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
Duke_Bit/ElfRefresh
56faf5431c1643ec5ae227dc854a31b391778b2c
library/src/main/ets/model/ElfTwoLevelHeader.ets
arkts
@author duke @description 自定义二级表头
export interface ElfTwoLevelHeader{ builderHeader:WrappedBuilder<[ElfRefreshHeader,ElfRefreshController]> }
AST#export_declaration#Left export AST#interface_declaration#Left interface ElfTwoLevelHeader AST#object_type#Left { AST#type_member#Left builderHeader : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left ElfRefreshHeader AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left ElfRefreshController AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ElfTwoLevelHeader{ builderHeader:WrappedBuilder<[ElfRefreshHeader,ElfRefreshController]> }
https://github.com/Duke_Bit/ElfRefresh/blob/56faf5431c1643ec5ae227dc854a31b391778b2c/library/src/main/ets/model/ElfTwoLevelHeader.ets#L8-L10
c842189f31241a067534e15108a2585a9ca9ff30
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
联系人排序字段枚举
export enum ContactSortField { NAME = 'name', BIRTHDAY = 'birthday', CREATED_AT = 'createdAt', UPDATED_AT = 'updatedAt', INTIMACY_LEVEL = 'intimacyLevel', DAYS_UNTIL_BIRTHDAY = 'daysUntilBirthday' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ContactSortField AST#enum_body#Left { AST#enum_member#Left NAME = AST#expression#Left 'name' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left BIRTHDAY = AST#expression#Left 'birthday' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CREATED_AT = AST#expression#Left 'createdAt' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left UPDATED_AT = AST#expression#Left 'updatedAt' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left INTIMACY_LEVEL = AST#expression#Left 'intimacyLevel' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DAYS_UNTIL_BIRTHDAY = AST#expression#Left 'daysUntilBirthday' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum ContactSortField { NAME = 'name', BIRTHDAY = 'birthday', CREATED_AT = 'createdAt', UPDATED_AT = 'updatedAt', INTIMACY_LEVEL = 'intimacyLevel', DAYS_UNTIL_BIRTHDAY = 'daysUntilBirthday' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L208-L215
4b040e29069fb42bfc220f43c5a15e23599285d3
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/utils/DateUtils.ets
arkts
获取本月的日期范围
export function getDateRangeOfThisMonth(date: Date | number) { // 获取本月的第一天和下个月的第一天 const beginDate = getFirstDateOfThisMonth(date) const nextMonth = new Date(beginDate.getTime()) nextMonth.setMonth(nextMonth.getMonth() + 1) // 返回日期范围对象 return { beginDate: beginDate.getTime(), endDate: nextMonth.getTime() - 1 }; }
AST#export_declaration#Left export AST#function_declaration#Left function getDateRangeOfThisMonth AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 获取本月的第一天和下个月的第一天 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left beginDate = AST#expression#Left AST#call_expression#Left AST#expression#Left getFirstDateOfThisMonth AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left nextMonth = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left beginDate AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left nextMonth AST#ERROR#Right . setMonth 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 nextMonth AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 返回日期范围对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left beginDate AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left beginDate AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left endDate AST#property_name#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 nextMonth 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 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getDateRangeOfThisMonth(date: Date | number) { const beginDate = getFirstDateOfThisMonth(date) const nextMonth = new Date(beginDate.getTime()) nextMonth.setMonth(nextMonth.getMonth() + 1) return { beginDate: beginDate.getTime(), endDate: nextMonth.getTime() - 1 }; }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/DateUtils.ets#L126-L133
1708f84743aaefa2eb9207d28f599d368e2e2049
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
requestEnableNotification
应用需要获取用户授权才能发送通知。在通知发布前调用该接口,可以拉起通知授权弹窗,让用户选择是否允许发送通知。使用Promise异步回调。 @param context @returns
static async requestEnableNotification(context: common.UIAbilityContext = AppUtil.getContext()):Promise<void> { return await notificationManager.requestEnableNotification(context) }
AST#method_declaration#Left static async requestEnableNotification 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#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#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#await_expression#Left await AST#expression#Left notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . requestEnableNotification AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async requestEnableNotification(context: common.UIAbilityContext = AppUtil.getContext()):Promise<void> { return await notificationManager.requestEnableNotification(context) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L75-L77
81d823bbd255ceebf8747d91cc15ad9bed82bd1e
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Native/DataConversionDemo/conversion/src/main/ets/common/constants/CommonContants.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 default class CommonConstants { /** * Height and width is 100%. * */ static readonly FULL_PARENT: string = '100%'; /** * Height and width is 80%. * */ static readonly EIGHTY_PARENT: string = '80%'; /** * Height and width is 90%. * */ static readonly NINETY_PARENT: string = '90%'; /** * Font weight 500. * */ static readonly FONT_WEIGHT: number = 500; /** * Space is 12. * */ static readonly SPACE: number = 12; /** * Max lines 1. */ static readonly MAX_LINES: number = 1; /** * Input max length 16. */ static readonly INPUT_MAX_LENGTH: number = 16; /** * Input max length 4. */ static readonly INPUT_MAX_LENGTH1: number = 4; /** * Layout weight 1. */ static readonly LAYOUT_WEIGHT: number = 1; /** * Bigger than 999999999 using scientific notation. */ static readonly MAX_RESULT: number = 999999999; /** * Exponential count 9. */ static readonly EXPONENTIAL_COUNT = 9; /** * Fixed count 2. */ static readonly FIXED_COUNT = 2; /** * Decimal format 10. */ static readonly DECIMAL_FORMAT = 10; /** * Buffer size 8. */ static readonly BUFFER_SIZE = 8; }
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Height and width is 100%. * */ AST#property_declaration#Left static readonly FULL_PARENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * Height and width is 80%. * */ AST#property_declaration#Left static readonly EIGHTY_PARENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '80%' AST#expression#Right ; AST#property_declaration#Right /** * Height and width is 90%. * */ AST#property_declaration#Left static readonly NINETY_PARENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '90%' AST#expression#Right ; AST#property_declaration#Right /** * Font weight 500. * */ AST#property_declaration#Left static readonly FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right /** * Space is 12. * */ AST#property_declaration#Left static readonly SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right /** * Max lines 1. */ AST#property_declaration#Left static readonly MAX_LINES : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * Input max length 16. */ AST#property_declaration#Left static readonly INPUT_MAX_LENGTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 16 AST#expression#Right ; AST#property_declaration#Right /** * Input max length 4. */ AST#property_declaration#Left static readonly INPUT_MAX_LENGTH1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4 AST#expression#Right ; AST#property_declaration#Right /** * Layout weight 1. */ AST#property_declaration#Left static readonly LAYOUT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * Bigger than 999999999 using scientific notation. */ AST#property_declaration#Left static readonly MAX_RESULT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 999999999 AST#expression#Right ; AST#property_declaration#Right /** * Exponential count 9. */ AST#property_declaration#Left static readonly EXPONENTIAL_COUNT = AST#expression#Left 9 AST#expression#Right ; AST#property_declaration#Right /** * Fixed count 2. */ AST#property_declaration#Left static readonly FIXED_COUNT = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /** * Decimal format 10. */ AST#property_declaration#Left static readonly DECIMAL_FORMAT = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right /** * Buffer size 8. */ AST#property_declaration#Left static readonly BUFFER_SIZE = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class CommonConstants { static readonly FULL_PARENT: string = '100%'; static readonly EIGHTY_PARENT: string = '80%'; static readonly NINETY_PARENT: string = '90%'; static readonly FONT_WEIGHT: number = 500; static readonly SPACE: number = 12; static readonly MAX_LINES: number = 1; static readonly INPUT_MAX_LENGTH: number = 16; static readonly INPUT_MAX_LENGTH1: number = 4; static readonly LAYOUT_WEIGHT: number = 1; static readonly MAX_RESULT: number = 999999999; static readonly EXPONENTIAL_COUNT = 9; static readonly FIXED_COUNT = 2; static readonly DECIMAL_FORMAT = 10; static readonly BUFFER_SIZE = 8; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Native/DataConversionDemo/conversion/src/main/ets/common/constants/CommonContants.ets#L16-L87
585b5faf389dfffc0d34995dbda00288ea203efc
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/GoodsRepository.ets
arkts
getGoodsCommentPage
分页查询商品评论 @param params 评论分页请求参数 @returns 评论分页数据
async getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { return this.networkDataSource.getGoodsCommentPage(params); }
AST#method_declaration#Left async getGoodsCommentPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsCommentPageRequest 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 AST#generic_type#Left NetworkPageData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Comment 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#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 . getGoodsCommentPage 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 getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { return this.networkDataSource.getGoodsCommentPage(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/GoodsRepository.ets#L91-L93
5e20cb7f93526ac7fb07cb03b7a5f2f375f340b4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
arkts
CustomAddressPicker
自定义地址选择组件CustomAddressPicker 功能描述: 1.提供省市区选择功能 2.支持传入有效的省市区名后,拉起地址选择弹窗时,显示对应的省市区 实现思路 1.使用getRawFileContentSync从rawfile目录下读取省市区json文件数据,使用util.TextDecoder进行解码。 2.使用bindSheet绑定地址选择半模态弹窗页面。 3.使用changeIndex控制省市区列表TabContent切换。 4.使用组件区域变化回调onAreaChange获取选择的省市区Text组件宽度,存入textInfos数组,用于后续计算选择省市区名后下方下滑线动画水平偏移量leftMargin。 5.在选择完区名后,使用JSON.parse(JSON.stringify(xxx))深拷贝选择的省市区数据,用于后续操作中需要加载上一次选择的完整省市区数据。 接口: CustomAddressPicker({ address: AddressInfo }) 参数: @param { AddressInfo } address - 地址信息类。必选项。 基本用法: // 不传入地址信息 @State noAddress: AddressInfo = new AddressInfo(); CustomAddressPicker({ address: this.noAddress }) // 传入有效的地址信息。拉起地址选择弹窗时就会根据传入的省市区名进行显示。 @State hasAddress: AddressInfo = new AddressInfo('浙江省', '杭州市', '余杭区'); CustomAddressPicker({ address: this.hasAddress })
@Component export struct CustomAddressPicker { // 底部导航条区域高度 @State bottomHeight: number = 0; // 选择的省市区 @State provinceCityRegion: string = '省、市、区'; // 地址选择半模态弹窗显隐标志位 @State @Watch('isShowChange') isShow: boolean = false; // 当前选择的省、市、区tab页签的index。0表示省,1表示市,2表示区 @State currentIndex: number = AddressType.Province; // 调用changeIndex切换TabContent动画时长 @State animationDuration: number = Constants.ANIMATION_DURATION; // 省List @State provinceList: CommonAddressList[] = []; // 市List @State cityList: CommonAddressList[] = []; // 区List @State regionList: CommonAddressList[] = []; // 记录上一次市List @State lastCityList: CommonAddressList[] = []; // 记录上一次区List @State lastRegionList: CommonAddressList[] = []; // 存放选择的省数据 @State province: Province = new Province('', '', []); // 记录当前省市区选择信息 @State currentSelectInfo: AddressInfo = new AddressInfo(); // 记录上一次省市区选择信息 @State lastSelectInfo: AddressInfo = new AddressInfo(); // 选择的省市区名下方的下滑线水平偏移量 @State leftMargin: number = 0; // 用于对外提供选择后的省市区信息或者传入地址信息 @Link address: AddressInfo; // 存放上一次选择的省市区名下方的下滑线水平偏移量 private lastLeftMargin: number = 0; // 存放选择的省市区名下方的下滑线位置信息 private textInfos: [number, number][] = []; // 存放从json读取的省市区数据 private data: Province[] = []; private controller: TabsController = new TabsController(); /** * 监听isShow值,自动化测试用例中使用 */ isShowChange() { emitter.emit({ eventId: 0, priority: 0 }, { data: { isShow: this.isShow } }) } aboutToAppear(): void { // 获取导航条高度,半模态弹窗内容进行避让 window.getLastWindow(getContext(), (err, data) => { const avoidAreaBottom = data.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); this.bottomHeight = avoidAreaBottom.bottomRect.height; }) // 从json文件读取省市区数据 const addressData: Array<Province> = JsonUtils.getAddressJson(Constants.JSON_FILE); for (let i = 0; i < addressData.length; i++) { // 保存读取到的数据 this.data.push(addressData[i]); this.provinceList.push(new CommonAddressList(addressData[i].code, addressData[i].name)); } // 首次加载AddressPickerComponent如果传入了有效的地址信息,拉起地址选择半模态页面时,会按传入的地址信息进行显示 this.initAddressSelect(); } /** * 首次加载AddressPickerComponent如果传入了有效的地址信息(如'浙江省', '杭州市', '余杭区')时,在拉起地址选择半模态页面时,会按传入的地址信息进行显示 */ initAddressSelect() { if (this.address.province !== '' && this.address.city !== '' && this.address.region !== '') { this.provinceCityRegion = this.address.province + this.address.city + this.address.region; this.currentSelectInfo.province = this.address.province; this.currentSelectInfo.city = this.address.city; this.currentSelectInfo.region = this.address.region; // 查找对应市,区地址数据 this.data.forEach(province => { if (province.name === this.address.province) { this.currentSelectInfo.provinceId = province.code; this.address.provinceId = province.code; // 遍历省份下的children(市级数据) province.children.forEach(city => { // 只提取市级的code和name this.cityList.push(new CommonAddressList(city.code, city.name)); if (city.name === this.address.city) { this.currentSelectInfo.cityId = city.code; this.address.cityId = city.code; city.children.forEach(region => { // 只提取区级的code和name this.regionList.push(new CommonAddressList(region.code, region.name)); if (region.name === this.address.region) { this.currentSelectInfo.regionId = region.code; this.address.regionId = region.code; // 深拷贝保存到相应的变量中 this.lastSelectInfo = JSON.parse(JSON.stringify(this.currentSelectInfo)) this.lastCityList = JSON.parse(JSON.stringify(this.cityList)); this.lastRegionList = JSON.parse(JSON.stringify(this.regionList)); this.animationDuration = 0; } }); } }); } }); } } /** * 选择的省市区名下方的下滑线动画 * @param duration 动画时长 * @param leftMargin 下划线动画偏移量 */ startAnimateTo(duration: number, leftMargin: number) { animateTo({ duration: duration, // 动画时长 curve: Curve.Linear, // 动画曲线 iterations: 1, // 播放次数 playMode: PlayMode.Normal // 动画模式 }, () => { this.leftMargin = leftMargin; }) } /** * 获取省、市、区名需要显示的字体颜色 * @param addressType 省/市/区类型 * @param item 省、市、区地址项 * @returns 需要显示的字体颜色 */ getFontColor(addressType: AddressType, item: CommonAddressList): Color | string | Resource { // 省/市/区名字体颜色 let isSelect: boolean = false; if (addressType === AddressType.Province) { isSelect = this.currentSelectInfo.province !== '' && item.name === this.currentSelectInfo.province; } else if (addressType === AddressType.City) { isSelect = this.currentSelectInfo.city !== '' && item.name === this.currentSelectInfo.city; } else if (addressType === AddressType.Region) { isSelect = this.currentSelectInfo.region !== '' && item.name === this.currentSelectInfo.region; } return isSelect ? $r('app.color.custom_address_picker_select_font_color') : Color.Black; } /** * 用于显示选择的省、市、区名 * @param params 传入要显示的省、市、区名 */ @Builder locationItem(params: Location) { Text(`${params.name === '' ? '请选择' : params.name}`) .height($r('app.string.custom_address_picker_full_size')) .fontSize($r('app.float.custom_address_picker_size_sixteen')) .fontWeight(this.currentIndex === params.index ? Constants.FONT_WEIGHT_FIVE_HUNDRED : Constants.FONT_WEIGHT_FOUR_HUNDRED) .fontColor(this.currentIndex === params.index ? $r('app.color.custom_address_picker_font_color_black') : $r('app.color.custom_address_picker_font_color_gray')) .constraintSize({ maxWidth: 'calc(33%)' }) .textOverflow({ overflow: TextOverflow.Ellipsis }) .maxLines(Constants.SIZE_ONE) .margin({ right: Constants.AREA_SPACE }) .onClick(() => { // TODO 知识点:使用changeIndex控制省市区列表TabContent切换 this.controller.changeIndex(params.index); }) .id(params.index.toString()) .onAreaChange((oldValue: Area, newValue: Area) => { // TODO 知识点:使用组件区域变化回调onAreaChange获取选择的省市区Text组件宽度,存入textInfos数组,用于后续计算选择省市区名后下方下滑线动画水平偏移量leftMargin // 组件区域变化时获取当前Text的宽度newValue.width和x轴相对位置newValue.position.x this.textInfos[params.index] = [newValue.position.x as number, newValue.width as number]; if (this.currentIndex === params.index && params.index === AddressType.Province) { // 计算选择的省市区名下方的下滑线偏移量 this.leftMargin = (this.textInfos[this.currentIndex][1] - Constants.DIVIDER_WIDTH) / 2; } }) } /** * 自定义TabBar */ @Builder customTabBar() { RelativeContainer() { Row() { // 选择的省名 this.locationItem({ index: AddressType.Province, name: this.currentSelectInfo.province }) // 选择的市名 this.locationItem({ index: AddressType.City, name: this.currentSelectInfo.city }) // 选择的区名 this.locationItem({ index: AddressType.Region, name: this.currentSelectInfo.region }) } .width($r('app.string.custom_address_picker_percent_eighty_five')) .height($r('app.string.custom_address_picker_percent_eighty')) .alignRules({ 'center': { 'anchor': '__container__', 'align': VerticalAlign.Center } }) .margin({ bottom: $r('app.float.custom_address_picker_size_ten') }) .padding({ top: $r('app.float.custom_address_picker_size_fifteen'), left: $r('app.float.custom_address_picker_size_twenty') }) Row() { // 选择的省市区名下方的下滑线 Divider() .width(Constants.DIVIDER_WIDTH) .strokeWidth(Constants.STROKE_WIDTH) .color($r('app.color.custom_address_picker_divider_color')) .margin({ left: this.leftMargin }) } .width($r('app.string.custom_address_picker_percent_eighty_five')) .height($r('app.string.custom_address_picker_percent_twenty')) .alignRules({ 'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom } }) .padding({ left: $r('app.float.custom_address_picker_size_twenty') }) Row() { Image($r('app.media.address_picker_close')) .objectFit(ImageFit.Contain)// 图片保持其原始的宽高比进行缩小或放大 .width($r('app.float.custom_address_picker_size_fourteen')) .height($r('app.float.custom_address_picker_size_fourteen')) .margin({ left: $r('app.float.custom_address_picker_size_twenty') }) } .onClick(() => { // 关闭半模态页面 this.isShow = false; }) .width($r('app.string.custom_address_picker_percent_fifteen')) .height($r('app.string.custom_address_picker_full_size')) .alignRules({ 'right': { 'anchor': '__container__', 'align': HorizontalAlign.End } }) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.float.custom_address_picker_size_forty_eight')) } /** * 自定义省/市/区名项 * @param addressType 省/市/区类型 * @param item 省、市、区地址项 */ @Builder areaNameItem(addressType: AddressType, item: CommonAddressList) { Column() { Text(item.name) .width($r('app.string.custom_address_picker_percent_ninety')) .height($r('app.float.custom_address_picker_size_forty_eight')) .fontSize($r('app.float.custom_address_picker_size_sixteen')) .fontColor(this.getFontColor(addressType, item)) Divider() .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) .width($r('app.string.custom_address_picker_percent_ninety')) } .width($r('app.string.custom_address_picker_full_size')) } /** * 自定义Tabs */ @Builder customTabs() { Tabs({ controller: this.controller }) { // 省列表 TabContent() { List() { ForEach(this.provinceList, (item: CommonAddressList) => { ListItem() { this.areaNameItem(AddressType.Province, item) }.onClick(() => { // TODO: 高性能知识点:如果当前点击选择的省与之前选择一样,跳过省、市数据获取,直接调用changeIndex(AddressType.City)切换到市列表,减少冗余查询以提升性能 if (this.currentSelectInfo.province === item.name) { this.controller.changeIndex(AddressType.City); return; } else { // 重置市和区数据 this.currentSelectInfo.cityId = ''; this.currentSelectInfo.city = ''; this.currentSelectInfo.regionId = ''; this.currentSelectInfo.region = ''; } this.cityList = []; this.regionList = []; // 点击省,获取该省所有市,存入cityList this.data.forEach(province => { if (province.name === item.name) { // 深拷贝一份省数据 this.province = JSON.parse(JSON.stringify(province)); // 遍历该省份下的children(市级数据) province.children.forEach(city => { // 只提取市级的code和name this.cityList.push(new CommonAddressList(city.code, city.name)); }); } }); this.currentSelectInfo.provinceId = item.code; this.currentSelectInfo.province = item.name; // 跳转市TabContent this.controller.changeIndex(AddressType.City); }) }, (item: CommonAddressList) => JSON.stringify(item)) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.string.custom_address_picker_full_size')) .scrollBar(BarState.Off) .friction($r('app.float.custom_address_picker_friction')) // 设置摩擦系数 .edgeEffect(EdgeEffect.Spring) // 边缘效果设置为Spring .listDirection(Axis.Vertical) // 排列方向 } // 市列表 TabContent() { List() { ForEach(this.cityList, (item: CommonAddressList) => { ListItem() { this.areaNameItem(AddressType.City, item) }.onClick(() => { // 如果点击的市和上一次点击的市一样,则不用刷新,减少冗余操作以提升性能 if (this.currentSelectInfo.city === item.name) { // TODO: 高性能知识点:如果当前点击选择的市与之前选择一样,跳过市、区数据获取,直接调用changeIndex(AddressType.Region)切换到区列表,减少冗余查询以提升性能 this.controller.changeIndex(AddressType.Region); return; } else { // 重置区数据 this.currentSelectInfo.regionId = ''; this.currentSelectInfo.region = ''; } this.regionList = []; // 点击市,获取该市所有区,存入regionList this.province.children.forEach(city => { if (city.name === item.name) { city.children.forEach(region => { // 只提取区级的code和name this.regionList.push(new CommonAddressList(region.code, region.name)); }); } }); this.currentSelectInfo.cityId = item.code; this.currentSelectInfo.city = item.name; this.controller.changeIndex(AddressType.Region); }) }, (item: CommonAddressList) => JSON.stringify(item)) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.string.custom_address_picker_full_size')) .scrollBar(BarState.Off) .friction($r('app.float.custom_address_picker_friction')) .edgeEffect(EdgeEffect.Spring) .listDirection(Axis.Vertical) } // 区列表 TabContent() { List() { ForEach(this.regionList, (item: CommonAddressList) => { ListItem() { this.areaNameItem(AddressType.Region, item) }.onClick(() => { // 记录选择的区信息 this.currentSelectInfo.regionId = item.code; this.currentSelectInfo.region = item.name; this.provinceCityRegion = this.currentSelectInfo.province + this.currentSelectInfo.city + this.currentSelectInfo.region; // 选择区后,退出地址选择半模态弹窗页面 this.isShow = false; // 将当前选中省市区信息保存到lastSelectInfo this.lastSelectInfo.provinceId = this.currentSelectInfo.provinceId; this.lastSelectInfo.province = this.currentSelectInfo.province; this.lastSelectInfo.cityId = this.currentSelectInfo.cityId; this.lastSelectInfo.city = this.currentSelectInfo.city; this.lastSelectInfo.regionId = this.currentSelectInfo.regionId; this.lastSelectInfo.region = this.currentSelectInfo.region; // TODO 知识点:在选择完区名后,使用JSON.parse(JSON.stringify(xxx))深拷贝选择的省市区数据,用于后续操作中需要加载上一次选择的完整省市区数据 // 深拷贝保存到相应的变量中 this.lastCityList = JSON.parse(JSON.stringify(this.cityList)); this.lastRegionList = JSON.parse(JSON.stringify(this.regionList)); this.address = JSON.parse(JSON.stringify(this.lastSelectInfo)); }) }, (item: CommonAddressList) => JSON.stringify(item)) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.string.custom_address_picker_full_size')) .scrollBar(BarState.Off) .friction($r('app.float.custom_address_picker_friction')) .edgeEffect(EdgeEffect.Spring) .listDirection(Axis.Vertical) } } .animationDuration(this.animationDuration) .onAppear(() => { if (this.lastSelectInfo.region !== '') { // 上一次选择如果选择到区,再次打开半模态弹窗页面时会显示到区的TabContent this.currentIndex = AddressType.Region; if (this.cityList.length === 0 && this.regionList.length === 0) { // 在已经选择过省市区后,再次打开地址选择半模态弹窗页面,但是没有选择到区就关闭了半模态页面,此时如果再次打开半模态页面,需要显示之前完整选择的省区市数据 this.currentSelectInfo.provinceId = this.lastSelectInfo.provinceId; this.currentSelectInfo.cityId = this.lastSelectInfo.cityId; this.currentSelectInfo.regionId = this.lastSelectInfo.regionId; this.currentSelectInfo.province = this.lastSelectInfo.province; this.currentSelectInfo.city = this.lastSelectInfo.city; this.currentSelectInfo.region = this.lastSelectInfo.region; this.cityList = JSON.parse(JSON.stringify(this.lastCityList)); this.regionList = JSON.parse(JSON.stringify(this.lastRegionList)); this.leftMargin = this.lastLeftMargin; } else { this.leftMargin = this.textInfos[0][1] + this.textInfos[1][1] + (this.textInfos[2][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE * 2; this.lastLeftMargin = this.leftMargin; } this.controller.changeIndex(AddressType.Region); } this.animationDuration = Constants.ANIMATION_DURATION; }) .onAnimationStart((index: number, targetIndex: number, event: TabsAnimationEvent) => { if (index === targetIndex) { return; } this.currentIndex = targetIndex; let leftMargin: number = 0; let isAnimating: boolean = false; if (index === AddressType.Province && targetIndex === AddressType.City) { // 从省切到市时,重新计算选择的省市区名下方的下滑线偏移量 leftMargin = this.textInfos[0][1] + (this.textInfos[1][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE; isAnimating = this.currentSelectInfo.city === '' ? false : true; } else if (index === AddressType.City && targetIndex === AddressType.Region) { // 从市切到区,重新计算选择的省市区名下方的下滑线偏移量 leftMargin = this.textInfos[0][1] + this.textInfos[1][1] + (this.textInfos[2][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE * 2; isAnimating = this.currentSelectInfo.region === '' ? false : true; } else if (index === AddressType.City && targetIndex === AddressType.Province) { // 从市切到省,重新计算选择的省市区名下方的下滑线偏移量 leftMargin = (this.textInfos[0][1] - Constants.DIVIDER_WIDTH) / 2; isAnimating = this.currentSelectInfo.city === '' ? false : true; } else if (index === AddressType.Region && targetIndex === AddressType.City) { // 从区切到市,重新计算选择的省市区名下方的下滑线偏移量 leftMargin = this.textInfos[0][1] + (this.textInfos[1][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE; isAnimating = this.currentSelectInfo.region === '' ? false : true; } else if (index === AddressType.Region && targetIndex === AddressType.Province) { // 点击自定义TabBar从区切到省,重新计算选择的省市区名下方的下滑线偏移量 leftMargin = (this.textInfos[0][1] - Constants.DIVIDER_WIDTH) / 2; isAnimating = this.currentSelectInfo.region === '' ? false : true; } else if (index === AddressType.Province && targetIndex === AddressType.Region) { // 点击自定义TabBar从省切到区,重新计算选择的省市区名下方的下滑线偏移量 leftMargin = this.textInfos[0][1] + this.textInfos[1][1] + (this.textInfos[2][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE * 2; isAnimating = this.currentSelectInfo.region === '' ? false : true; } // 只有在已经选择过的TabContent之间切换时,才会做下划线水平偏移动画 if (isAnimating) { this.startAnimateTo(this.animationDuration, leftMargin); } else { this.leftMargin = leftMargin; } }) .width($r('app.string.custom_address_picker_full_size')) .barHeight($r('app.float.custom_address_picker_size_zero')) .layoutWeight(Constants.SIZE_ONE) } /** * 地址选择半模态弹窗页面 */ @Builder addressSelectPage() { Column() { // 自定义TabBar this.customTabBar() Divider() .width($r('app.string.custom_address_picker_percent_ninety')) .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) // 自定义Tabs this.customTabs() } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.string.custom_address_picker_full_size')) .backgroundColor(Color.White) .padding({ bottom: this.bottomHeight + 'px' }) } build() { Column() { Divider() .height($r('app.float.custom_address_picker_size_one')) .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) Row() { Text($r('app.string.custom_address_picker_area')) .fontSize($r('app.float.custom_address_picker_size_sixteen')) .fontWeight(Constants.FONT_WEIGHT_FIVE_HUNDRED) .margin({ right: $r('app.float.custom_address_picker_size_twenty') }) Text(this.provinceCityRegion) .fontSize($r('app.float.custom_address_picker_size_fifteen')) .fontColor(this.provinceCityRegion === '省、市、区' ? $r('app.color.custom_address_picker_name_font_color') : Color.Black) .fontWeight(Constants.FONT_WEIGHT_THREE_HUNDRED) .constraintSize({ maxWidth: 'calc(68%)' }) .textOverflow({ overflow: TextOverflow.Ellipsis }) .maxLines(Constants.SIZE_ONE) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.float.custom_address_picker_size_forty_eight')) .onClick(() => { // 显示地址选择半模态弹窗页面 this.isShow = true; this.currentIndex = AddressType.Province; }) // TODO 知识点:使用bindSheet绑定地址选择半模态弹窗页面,isShow控制是否显示半模态页面 .bindSheet($$this.isShow, this.addressSelectPage(), { height: $r('app.string.custom_address_picker_percent_seventy'), // 半模态弹窗高度 showClose: false, // 设置不显示自带的关闭图标 dragBar: false, onDisappear: () => { // 退出地址选择半模态弹窗页面时,重置相关参数 this.animationDuration = 0; // 如果当前省市区没选全,则清空当前选择的地址信息 if (this.currentSelectInfo.region === '') { this.currentSelectInfo.provinceId = ''; this.currentSelectInfo.cityId = ''; this.currentSelectInfo.regionId = ''; this.currentSelectInfo.province = ''; this.currentSelectInfo.city = ''; this.currentSelectInfo.region = ''; this.cityList = []; this.regionList = []; } } }) Divider() .height($r('app.float.custom_address_picker_size_one')) .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.float.custom_address_picker_size_fifty_four')) .padding($r('app.float.custom_address_picker_size_two')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomAddressPicker AST#component_body#Left { // 底部导航条区域高度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right bottomHeight : 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 provinceCityRegion : 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 AST#decorator#Left @ Watch ( AST#expression#Left 'isShowChange' AST#expression#Right ) AST#decorator#Right isShow : 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 // 当前选择的省、市、区tab页签的index。0表示省,1表示市,2表示区 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : 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 AddressType AST#expression#Right . Province AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 调用changeIndex切换TabContent动画时长 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right animationDuration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . ANIMATION_DURATION AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 省List AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right provinceList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommonAddressList [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 市List AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right cityList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommonAddressList [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 区List AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right regionList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommonAddressList [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 记录上一次市List AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right lastCityList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommonAddressList [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 记录上一次区List AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right lastRegionList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommonAddressList [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 存放选择的省数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right province : AST#type_annotation#Left AST#primary_type#Left Province 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 Province 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#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 记录当前省市区选择信息 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentSelectInfo : AST#type_annotation#Left AST#primary_type#Left AddressInfo 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 AddressInfo AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 记录上一次省市区选择信息 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right lastSelectInfo : AST#type_annotation#Left AST#primary_type#Left AddressInfo 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 AddressInfo AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 选择的省市区名下方的下滑线水平偏移量 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right leftMargin : 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 @ Link AST#decorator#Right address : AST#type_annotation#Left AST#primary_type#Left AddressInfo AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 存放上一次选择的省市区名下方的下滑线水平偏移量 AST#property_declaration#Left private lastLeftMargin : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 存放选择的省市区名下方的下滑线位置信息 AST#property_declaration#Left private textInfos : AST#ERROR#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 存放从json读取的省市区数据 AST#property_declaration#Left private data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Province [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left TabsController AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TabsController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 监听isShow值,自动化测试用例中使用 */ AST#method_declaration#Left isShowChange 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 emitter AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left eventId AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left priority AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left isShow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShow 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 获取导航条高度,半模态弹窗内容进行避让 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left avoidAreaBottom = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . getWindowAvoidArea AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_NAVIGATION_INDICATOR AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottomHeight AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avoidAreaBottom AST#expression#Right . bottomRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 从json文件读取省市区数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left addressData : 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 Province AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JsonUtils AST#expression#Right . getAddressJson AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . JSON_FILE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 addressData AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { // 保存读取到的数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left addressData AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 . provinceList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CommonAddressList 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#subscript_expression#Left AST#expression#Left addressData AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left addressData AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . name 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#block_statement#Right AST#for_statement#Right AST#statement#Right // 首次加载AddressPickerComponent如果传入了有效的地址信息,拉起地址选择半模态页面时,会按传入的地址信息进行显示 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 . initAddressSelect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 首次加载AddressPickerComponent如果传入了有效的地址信息(如'浙江省', '杭州市', '余杭区')时,在拉起地址选择半模态页面时,会按传入的地址信息进行显示 */ AST#method_declaration#Left initAddressSelect AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . address AST#member_expression#Right AST#expression#Right . province AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . address AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . address AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceCityRegion AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . address AST#member_expression#Right AST#expression#Right . province AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . address AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . address AST#member_expression#Right AST#expression#Right . region 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . province 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 . address AST#member_expression#Right AST#expression#Right . province 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city 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 . address AST#member_expression#Right AST#expression#Right . city 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region 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 . address AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 查找对应市,区地址数据 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data 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 province => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . address AST#member_expression#Right AST#expression#Right . province 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . provinceId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . code 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 . address AST#member_expression#Right AST#expression#Right . provinceId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 遍历省份下的children(市级数据) 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 province AST#expression#Right . children 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 city => AST#block_statement#Left { // 只提取市级的code和name 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 . cityList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CommonAddressList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . address AST#member_expression#Right AST#expression#Right . city 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . cityId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . code 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 . address AST#member_expression#Right AST#expression#Right . cityId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . children 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 region => AST#block_statement#Left { // 只提取区级的code和name 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 . regionList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CommonAddressList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left region AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left region AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left region AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . address AST#member_expression#Right AST#expression#Right . region 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . regionId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left region AST#expression#Right . code 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 . address AST#member_expression#Right AST#expression#Right . regionId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left region AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 深拷贝保存到相应的变量中 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lastSelectInfo 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo 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#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 . lastCityList 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityList 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#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 . lastRegionList 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . regionList 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#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 . animationDuration 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#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#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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 选择的省市区名下方的下滑线动画 * @param duration 动画时长 * @param leftMargin 下划线动画偏移量 */ AST#method_declaration#Left startAnimateTo AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left leftMargin : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left animateTo ( AST#ERROR#Left AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left duration AST#expression#Right AST#component_parameter#Right , // 动画时长 AST#component_parameter#Left curve : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , // 动画曲线 AST#component_parameter#Left iterations : AST#expression#Left 1 AST#expression#Right AST#component_parameter#Right , // 播放次数 AST#component_parameter#Left playMode : AST#expression#Left AST#member_expression#Left AST#expression#Left PlayMode AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#component_parameter#Right // 动画模式 } AST#component_parameters#Right , AST#ERROR#Right AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftMargin AST#member_expression#Right = AST#expression#Left leftMargin AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 获取省、市、区名需要显示的字体颜色 * @param addressType 省/市/区类型 * @param item 省、市、区地址项 * @returns 需要显示的字体颜色 */ AST#method_declaration#Left getFontColor AST#parameter_list#Left ( AST#parameter#Left addressType : AST#type_annotation#Left AST#primary_type#Left AddressType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CommonAddressList 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 Color AST#primary_type#Right | 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#block_statement#Left { // 省/市/区名字体颜色 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isSelect : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left addressType AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Province 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 isSelect = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . province AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . province 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left addressType AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . City 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 isSelect = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left addressType AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Region 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 isSelect = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region 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#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left isSelect AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_select_font_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 . Black AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 用于显示选择的省、市、区名 * @param params 传入要显示的省、市、区名 */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right locationItem AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Location AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '请选择' AST#expression#Right : AST#expression#Left params AST#expression#Right AST#conditional_expression#Right AST#expression#Right . name 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 . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' 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.custom_address_picker_size_sixteen' 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 AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . FONT_WEIGHT_FIVE_HUNDRED AST#member_expression#Right AST#expression#Right : AST#expression#Left Constants AST#expression#Right AST#conditional_expression#Right AST#expression#Right . FONT_WEIGHT_FOUR_HUNDRED AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_font_color_black' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_font_color_gray' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . constraintSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left maxWidth AST#property_name#Right : AST#expression#Left 'calc(33%)' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SIZE_ONE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . AREA_SPACE 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 { // TODO 知识点:使用changeIndex控制省市区列表TabContent切换 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . changeIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . index 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 . id ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . index AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAreaChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left oldValue : AST#type_annotation#Left AST#primary_type#Left Area AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newValue : AST#type_annotation#Left AST#primary_type#Left Area AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // TODO 知识点:使用组件区域变化回调onAreaChange获取选择的省市区Text组件宽度,存入textInfos数组,用于后续计算选择省市区名后下方下滑线动画水平偏移量leftMargin // 组件区域变化时获取当前Text的宽度newValue.width和x轴相对位置newValue.position.x AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . index AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = AST#ERROR#Right [ AST#ERROR#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 newValue AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#ERROR#Right AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newValue AST#expression#Right . width AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right && AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Province 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 . leftMargin AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 /** * 自定义TabBar */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customTabBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) 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 . locationItem 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 index AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Province AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . province 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . locationItem 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 index AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . City AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . locationItem 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 index AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Region AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region 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#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.custom_address_picker_percent_eighty_five' 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.custom_address_picker_percent_eighty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left '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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_ten' 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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_fifteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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 Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . STROKE_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_divider_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 this AST#expression#Right . leftMargin 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#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_percent_eighty_five' 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.custom_address_picker_percent_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'bottom' AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'anchor' AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'align' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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.custom_address_picker_size_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.address_picker_close' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) // 图片保持其原始的宽高比进行缩小或放大 AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_fourteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_fourteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#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#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.custom_address_picker_percent_fifteen' 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.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'right' AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'anchor' AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'align' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_forty_eight' 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 /** * 自定义省/市/区名项 * @param addressType 省/市/区类型 * @param item 省、市、区地址项 */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right areaNameItem AST#parameter_list#Left ( AST#parameter#Left addressType : AST#type_annotation#Left AST#primary_type#Left AddressType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CommonAddressList AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_percent_ninety' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_forty_eight' 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.custom_address_picker_size_sixteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getFontColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left addressType AST#expression#Right , AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SIZE_ONE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_area_name_divider_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.custom_address_picker_percent_ninety' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' 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#builder_function_body#Right AST#method_declaration#Right /** * 自定义Tabs */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customTabs 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 Tabs ( AST#component_parameters#Left { AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller 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 TabContent ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceList 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 CommonAddressList AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . areaNameItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Province AST#member_expression#Right AST#expression#Right , AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // TODO: 高性能知识点:如果当前点击选择的省与之前选择一样,跳过省、市数据获取,直接调用changeIndex(AddressType.City)切换到市列表,减少冗余查询以提升性能 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . province AST#member_expression#Right AST#expression#Right === AST#expression#Left item AST#expression#Right AST#binary_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . changeIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . City 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 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . cityId AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . regionId AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityList 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 . regionList 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 // 点击省,获取该省所有市,存入cityList 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 . data 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 province => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left item AST#expression#Right AST#binary_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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . province 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 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 province AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 遍历该省份下的children(市级数据) 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 province AST#expression#Right . children 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 city => AST#block_statement#Left { // 只提取市级的code和name 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 . cityList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CommonAddressList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . name 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . provinceId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . province AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 跳转市TabContent AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . changeIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . City 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#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 CommonAddressList AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . friction ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_friction' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) // 设置摩擦系数 AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . Spring AST#member_expression#Right AST#expression#Right ) // 边缘效果设置为Spring AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 排列方向 } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 市列表 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TabContent ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityList 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 CommonAddressList AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . areaNameItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . City AST#member_expression#Right AST#expression#Right , AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 如果点击的市和上一次点击的市一样,则不用刷新,减少冗余操作以提升性能 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right AST#expression#Right === AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // TODO: 高性能知识点:如果当前点击选择的市与之前选择一样,跳过市、区数据获取,直接调用changeIndex(AddressType.Region)切换到区列表,减少冗余查询以提升性能 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . changeIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Region 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 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . regionId AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . regionList 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 // 点击市,获取该市所有区,存入regionList 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 . province AST#member_expression#Right AST#expression#Right . children 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 city => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left item AST#expression#Right AST#binary_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 AST#member_expression#Left AST#expression#Left city AST#expression#Right . children 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 region => AST#block_statement#Left { // 只提取区级的code和name 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 . regionList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CommonAddressList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left region AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left region AST#expression#Right . name 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . cityId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . changeIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Region 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#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 CommonAddressList AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . friction ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_friction' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . Spring AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 区列表 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TabContent ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . regionList 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 CommonAddressList AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . areaNameItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Region AST#member_expression#Right AST#expression#Right , AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . regionId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceCityRegion AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . province AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 选择区后,退出地址选择半模态弹窗页面 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . 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 // 将当前选中省市区信息保存到lastSelectInfo 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . provinceId 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . provinceId 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . province 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . province 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . cityId 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . cityId 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . city 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . city 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . regionId 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . regionId 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . region 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // TODO 知识点:在选择完区名后,使用JSON.parse(JSON.stringify(xxx))深拷贝选择的省市区数据,用于后续操作中需要加载上一次选择的完整省市区数据 // 深拷贝保存到相应的变量中 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lastCityList 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityList 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#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 . lastRegionList 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . regionList 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#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 . address 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lastSelectInfo 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#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#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 CommonAddressList AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . friction ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_friction' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . Spring AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . animationDuration ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationDuration 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#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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 上一次选择如果选择到区,再次打开半模态弹窗页面时会显示到区的TabContent AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Region 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . regionList 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . provinceId 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . provinceId 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . cityId 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . cityId 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . regionId 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . regionId 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . province 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . province 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . city 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . city 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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . region 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 . lastSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityList 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lastCityList 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#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 . regionList 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lastRegionList 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#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 . leftMargin AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lastLeftMargin AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftMargin AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . AREA_SPACE AST#member_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . lastLeftMargin AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftMargin AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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 . changeIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Region AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationDuration AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . ANIMATION_DURATION AST#member_expression#Right AST#expression#Right AST#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 . onAnimationStart ( 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#Left targetIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TabsAnimationEvent 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 index AST#expression#Right === AST#expression#Left targetIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#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 . currentIndex AST#member_expression#Right = AST#expression#Left targetIndex 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 leftMargin : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isAnimating : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Province AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . City 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 leftMargin = 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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . AREA_SPACE 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 isAnimating = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#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 index AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . City AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Region 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 leftMargin = 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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . AREA_SPACE AST#member_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left isAnimating = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#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 index AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . City AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Province 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 leftMargin = 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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#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 isAnimating = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#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 index AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Region AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . City 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 leftMargin = 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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . AREA_SPACE 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 isAnimating = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#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 index AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Region AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Province AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 点击自定义TabBar从区切到省,重新计算选择的省市区名下方的下滑线偏移量 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left leftMargin = 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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#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 isAnimating = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#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 index AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Province AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right === AST#expression#Left AddressType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Region AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 点击自定义TabBar从省切到区,重新计算选择的省市区名下方的下滑线偏移量 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left leftMargin = 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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInfos AST#member_expression#Right AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . AREA_SPACE AST#member_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left isAnimating = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right // 只有在已经选择过的TabContent之间切换时,才会做下划线水平偏移动画 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isAnimating 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 . startAnimateTo 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 . animationDuration AST#member_expression#Right AST#expression#Right , AST#expression#Left leftMargin AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftMargin AST#member_expression#Right = AST#expression#Left leftMargin AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . barHeight ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_zero' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SIZE_ONE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 地址选择半模态弹窗页面 */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right addressSelectPage 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 { // 自定义TabBar 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 . customTabBar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_percent_ninety' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SIZE_ONE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_area_name_divider_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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 自定义Tabs 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 . customTabs 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 . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottomHeight AST#member_expression#Right AST#expression#Right + AST#expression#Left 'px' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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#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 Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_one' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SIZE_ONE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_area_name_divider_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#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.custom_address_picker_area' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_sixteen' 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 Constants AST#expression#Right . FONT_WEIGHT_FIVE_HUNDRED AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceCityRegion AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_fifteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . provinceCityRegion AST#member_expression#Right AST#expression#Right === AST#expression#Left '省、市、区' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_name_font_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 . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . FONT_WEIGHT_THREE_HUNDRED AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . constraintSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left maxWidth AST#property_name#Right : AST#expression#Left 'calc(68%)' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SIZE_ONE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } 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.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_forty_eight' 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 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 . currentIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Province 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 ) // TODO 知识点:使用bindSheet绑定地址选择半模态弹窗页面,isShow控制是否显示半模态页面 AST#modifier_chain_expression#Left . bindSheet ( 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressSelectPage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_percent_seventy' 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 dragBar 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 onDisappear AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 退出地址选择半模态弹窗页面时,重置相关参数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationDuration AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 如果当前省市区没选全,则清空当前选择的地址信息 AST#statement#Left AST#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 . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . provinceId AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . cityId AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . regionId AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . province AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cityList 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 . regionList 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_one' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SIZE_ONE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_area_name_divider_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#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.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_fifty_four' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_two' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct CustomAddressPicker { @State bottomHeight: number = 0; @State provinceCityRegion: string = '省、市、区'; @State @Watch('isShowChange') isShow: boolean = false; @State currentIndex: number = AddressType.Province; @State animationDuration: number = Constants.ANIMATION_DURATION; @State provinceList: CommonAddressList[] = []; @State cityList: CommonAddressList[] = []; @State regionList: CommonAddressList[] = []; @State lastCityList: CommonAddressList[] = []; @State lastRegionList: CommonAddressList[] = []; @State province: Province = new Province('', '', []); @State currentSelectInfo: AddressInfo = new AddressInfo(); @State lastSelectInfo: AddressInfo = new AddressInfo(); 名下方的下滑线水平偏移量 @State leftMargin: number = 0; @Link address: AddressInfo; private lastLeftMargin: number = 0; private textInfos: [number, number][] = []; private data: Province[] = []; private controller: TabsController = new TabsController(); isShowChange() { emitter.emit({ eventId: 0, priority: 0 }, { data: { isShow: this.isShow } }) } aboutToAppear(): void { window.getLastWindow(getContext(), (err, data) => { const avoidAreaBottom = data.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); this.bottomHeight = avoidAreaBottom.bottomRect.height; }) const addressData: Array<Province> = JsonUtils.getAddressJson(Constants.JSON_FILE); for (let i = 0; i < addressData.length; i++) { this.data.push(addressData[i]); this.provinceList.push(new CommonAddressList(addressData[i].code, addressData[i].name)); } this.initAddressSelect(); } initAddressSelect() { if (this.address.province !== '' && this.address.city !== '' && this.address.region !== '') { this.provinceCityRegion = this.address.province + this.address.city + this.address.region; this.currentSelectInfo.province = this.address.province; this.currentSelectInfo.city = this.address.city; this.currentSelectInfo.region = this.address.region; this.data.forEach(province => { if (province.name === this.address.province) { this.currentSelectInfo.provinceId = province.code; this.address.provinceId = province.code; province.children.forEach(city => { this.cityList.push(new CommonAddressList(city.code, city.name)); if (city.name === this.address.city) { this.currentSelectInfo.cityId = city.code; this.address.cityId = city.code; city.children.forEach(region => { this.regionList.push(new CommonAddressList(region.code, region.name)); if (region.name === this.address.region) { this.currentSelectInfo.regionId = region.code; this.address.regionId = region.code; this.lastSelectInfo = JSON.parse(JSON.stringify(this.currentSelectInfo)) this.lastCityList = JSON.parse(JSON.stringify(this.cityList)); this.lastRegionList = JSON.parse(JSON.stringify(this.regionList)); this.animationDuration = 0; } }); } }); } }); } } startAnimateTo(duration: number, leftMargin: number) { animateTo({ duration: duration, curve: Curve.Linear, iterations: 1, playMode: PlayMode.Normal }, () => { this.leftMargin = leftMargin; }) } getFontColor(addressType: AddressType, item: CommonAddressList): Color | string | Resource { let isSelect: boolean = false; if (addressType === AddressType.Province) { isSelect = this.currentSelectInfo.province !== '' && item.name === this.currentSelectInfo.province; } else if (addressType === AddressType.City) { isSelect = this.currentSelectInfo.city !== '' && item.name === this.currentSelectInfo.city; } else if (addressType === AddressType.Region) { isSelect = this.currentSelectInfo.region !== '' && item.name === this.currentSelectInfo.region; } return isSelect ? $r('app.color.custom_address_picker_select_font_color') : Color.Black; } @Builder locationItem(params: Location) { Text(`${params.name === '' ? '请选择' : params.name}`) .height($r('app.string.custom_address_picker_full_size')) .fontSize($r('app.float.custom_address_picker_size_sixteen')) .fontWeight(this.currentIndex === params.index ? Constants.FONT_WEIGHT_FIVE_HUNDRED : Constants.FONT_WEIGHT_FOUR_HUNDRED) .fontColor(this.currentIndex === params.index ? $r('app.color.custom_address_picker_font_color_black') : $r('app.color.custom_address_picker_font_color_gray')) .constraintSize({ maxWidth: 'calc(33%)' }) .textOverflow({ overflow: TextOverflow.Ellipsis }) .maxLines(Constants.SIZE_ONE) .margin({ right: Constants.AREA_SPACE }) .onClick(() => { this.controller.changeIndex(params.index); }) .id(params.index.toString()) .onAreaChange((oldValue: Area, newValue: Area) => { this.textInfos[params.index] = [newValue.position.x as number, newValue.width as number]; if (this.currentIndex === params.index && params.index === AddressType.Province) { this.leftMargin = (this.textInfos[this.currentIndex][1] - Constants.DIVIDER_WIDTH) / 2; } }) } @Builder customTabBar() { RelativeContainer() { Row() { this.locationItem({ index: AddressType.Province, name: this.currentSelectInfo.province }) this.locationItem({ index: AddressType.City, name: this.currentSelectInfo.city }) this.locationItem({ index: AddressType.Region, name: this.currentSelectInfo.region }) } .width($r('app.string.custom_address_picker_percent_eighty_five')) .height($r('app.string.custom_address_picker_percent_eighty')) .alignRules({ 'center': { 'anchor': '__container__', 'align': VerticalAlign.Center } }) .margin({ bottom: $r('app.float.custom_address_picker_size_ten') }) .padding({ top: $r('app.float.custom_address_picker_size_fifteen'), left: $r('app.float.custom_address_picker_size_twenty') }) Row() { 名下方的下滑线 Divider() .width(Constants.DIVIDER_WIDTH) .strokeWidth(Constants.STROKE_WIDTH) .color($r('app.color.custom_address_picker_divider_color')) .margin({ left: this.leftMargin }) } .width($r('app.string.custom_address_picker_percent_eighty_five')) .height($r('app.string.custom_address_picker_percent_twenty')) .alignRules({ 'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom } }) .padding({ left: $r('app.float.custom_address_picker_size_twenty') }) Row() { Image($r('app.media.address_picker_close')) .objectFit(ImageFit.Contain) .width($r('app.float.custom_address_picker_size_fourteen')) .height($r('app.float.custom_address_picker_size_fourteen')) .margin({ left: $r('app.float.custom_address_picker_size_twenty') }) } .onClick(() => { this.isShow = false; }) .width($r('app.string.custom_address_picker_percent_fifteen')) .height($r('app.string.custom_address_picker_full_size')) .alignRules({ 'right': { 'anchor': '__container__', 'align': HorizontalAlign.End } }) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.float.custom_address_picker_size_forty_eight')) } @Builder areaNameItem(addressType: AddressType, item: CommonAddressList) { Column() { Text(item.name) .width($r('app.string.custom_address_picker_percent_ninety')) .height($r('app.float.custom_address_picker_size_forty_eight')) .fontSize($r('app.float.custom_address_picker_size_sixteen')) .fontColor(this.getFontColor(addressType, item)) Divider() .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) .width($r('app.string.custom_address_picker_percent_ninety')) } .width($r('app.string.custom_address_picker_full_size')) } @Builder customTabs() { Tabs({ controller: this.controller }) { TabContent() { List() { ForEach(this.provinceList, (item: CommonAddressList) => { ListItem() { this.areaNameItem(AddressType.Province, item) }.onClick(() => { if (this.currentSelectInfo.province === item.name) { this.controller.changeIndex(AddressType.City); return; } else { this.currentSelectInfo.cityId = ''; this.currentSelectInfo.city = ''; this.currentSelectInfo.regionId = ''; this.currentSelectInfo.region = ''; } this.cityList = []; this.regionList = []; this.data.forEach(province => { if (province.name === item.name) { this.province = JSON.parse(JSON.stringify(province)); province.children.forEach(city => { this.cityList.push(new CommonAddressList(city.code, city.name)); }); } }); this.currentSelectInfo.provinceId = item.code; this.currentSelectInfo.province = item.name; this.controller.changeIndex(AddressType.City); }) }, (item: CommonAddressList) => JSON.stringify(item)) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.string.custom_address_picker_full_size')) .scrollBar(BarState.Off) .friction($r('app.float.custom_address_picker_friction')) .edgeEffect(EdgeEffect.Spring) .listDirection(Axis.Vertical) } TabContent() { List() { ForEach(this.cityList, (item: CommonAddressList) => { ListItem() { this.areaNameItem(AddressType.City, item) }.onClick(() => { if (this.currentSelectInfo.city === item.name) { this.controller.changeIndex(AddressType.Region); return; } else { this.currentSelectInfo.regionId = ''; this.currentSelectInfo.region = ''; } this.regionList = []; this.province.children.forEach(city => { if (city.name === item.name) { city.children.forEach(region => { this.regionList.push(new CommonAddressList(region.code, region.name)); }); } }); this.currentSelectInfo.cityId = item.code; this.currentSelectInfo.city = item.name; this.controller.changeIndex(AddressType.Region); }) }, (item: CommonAddressList) => JSON.stringify(item)) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.string.custom_address_picker_full_size')) .scrollBar(BarState.Off) .friction($r('app.float.custom_address_picker_friction')) .edgeEffect(EdgeEffect.Spring) .listDirection(Axis.Vertical) } TabContent() { List() { ForEach(this.regionList, (item: CommonAddressList) => { ListItem() { this.areaNameItem(AddressType.Region, item) }.onClick(() => { this.currentSelectInfo.regionId = item.code; this.currentSelectInfo.region = item.name; this.provinceCityRegion = this.currentSelectInfo.province + this.currentSelectInfo.city + this.currentSelectInfo.region; this.isShow = false; this.lastSelectInfo.provinceId = this.currentSelectInfo.provinceId; this.lastSelectInfo.province = this.currentSelectInfo.province; this.lastSelectInfo.cityId = this.currentSelectInfo.cityId; this.lastSelectInfo.city = this.currentSelectInfo.city; this.lastSelectInfo.regionId = this.currentSelectInfo.regionId; this.lastSelectInfo.region = this.currentSelectInfo.region; this.lastCityList = JSON.parse(JSON.stringify(this.cityList)); this.lastRegionList = JSON.parse(JSON.stringify(this.regionList)); this.address = JSON.parse(JSON.stringify(this.lastSelectInfo)); }) }, (item: CommonAddressList) => JSON.stringify(item)) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.string.custom_address_picker_full_size')) .scrollBar(BarState.Off) .friction($r('app.float.custom_address_picker_friction')) .edgeEffect(EdgeEffect.Spring) .listDirection(Axis.Vertical) } } .animationDuration(this.animationDuration) .onAppear(() => { if (this.lastSelectInfo.region !== '') { this.currentIndex = AddressType.Region; if (this.cityList.length === 0 && this.regionList.length === 0) { this.currentSelectInfo.provinceId = this.lastSelectInfo.provinceId; this.currentSelectInfo.cityId = this.lastSelectInfo.cityId; this.currentSelectInfo.regionId = this.lastSelectInfo.regionId; this.currentSelectInfo.province = this.lastSelectInfo.province; this.currentSelectInfo.city = this.lastSelectInfo.city; this.currentSelectInfo.region = this.lastSelectInfo.region; this.cityList = JSON.parse(JSON.stringify(this.lastCityList)); this.regionList = JSON.parse(JSON.stringify(this.lastRegionList)); this.leftMargin = this.lastLeftMargin; } else { this.leftMargin = this.textInfos[0][1] + this.textInfos[1][1] + (this.textInfos[2][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE * 2; this.lastLeftMargin = this.leftMargin; } this.controller.changeIndex(AddressType.Region); } this.animationDuration = Constants.ANIMATION_DURATION; }) .onAnimationStart((index: number, targetIndex: number, event: TabsAnimationEvent) => { if (index === targetIndex) { return; } this.currentIndex = targetIndex; let leftMargin: number = 0; let isAnimating: boolean = false; if (index === AddressType.Province && targetIndex === AddressType.City) { leftMargin = this.textInfos[0][1] + (this.textInfos[1][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE; isAnimating = this.currentSelectInfo.city === '' ? false : true; } else if (index === AddressType.City && targetIndex === AddressType.Region) { leftMargin = this.textInfos[0][1] + this.textInfos[1][1] + (this.textInfos[2][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE * 2; isAnimating = this.currentSelectInfo.region === '' ? false : true; } else if (index === AddressType.City && targetIndex === AddressType.Province) { leftMargin = (this.textInfos[0][1] - Constants.DIVIDER_WIDTH) / 2; isAnimating = this.currentSelectInfo.city === '' ? false : true; } else if (index === AddressType.Region && targetIndex === AddressType.City) { leftMargin = this.textInfos[0][1] + (this.textInfos[1][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE; isAnimating = this.currentSelectInfo.region === '' ? false : true; } else if (index === AddressType.Region && targetIndex === AddressType.Province) { leftMargin = (this.textInfos[0][1] - Constants.DIVIDER_WIDTH) / 2; isAnimating = this.currentSelectInfo.region === '' ? false : true; } else if (index === AddressType.Province && targetIndex === AddressType.Region) { leftMargin = this.textInfos[0][1] + this.textInfos[1][1] + (this.textInfos[2][1] - Constants.DIVIDER_WIDTH) / 2 + Constants.AREA_SPACE * 2; isAnimating = this.currentSelectInfo.region === '' ? false : true; } if (isAnimating) { this.startAnimateTo(this.animationDuration, leftMargin); } else { this.leftMargin = leftMargin; } }) .width($r('app.string.custom_address_picker_full_size')) .barHeight($r('app.float.custom_address_picker_size_zero')) .layoutWeight(Constants.SIZE_ONE) } @Builder addressSelectPage() { Column() { this.customTabBar() Divider() .width($r('app.string.custom_address_picker_percent_ninety')) .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) this.customTabs() } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.string.custom_address_picker_full_size')) .backgroundColor(Color.White) .padding({ bottom: this.bottomHeight + 'px' }) } build() { Column() { Divider() .height($r('app.float.custom_address_picker_size_one')) .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) Row() { Text($r('app.string.custom_address_picker_area')) .fontSize($r('app.float.custom_address_picker_size_sixteen')) .fontWeight(Constants.FONT_WEIGHT_FIVE_HUNDRED) .margin({ right: $r('app.float.custom_address_picker_size_twenty') }) Text(this.provinceCityRegion) .fontSize($r('app.float.custom_address_picker_size_fifteen')) .fontColor(this.provinceCityRegion === '省、市、区' ? $r('app.color.custom_address_picker_name_font_color') : Color.Black) .fontWeight(Constants.FONT_WEIGHT_THREE_HUNDRED) .constraintSize({ maxWidth: 'calc(68%)' }) .textOverflow({ overflow: TextOverflow.Ellipsis }) .maxLines(Constants.SIZE_ONE) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.float.custom_address_picker_size_forty_eight')) .onClick(() => { this.isShow = true; this.currentIndex = AddressType.Province; }) .bindSheet($$this.isShow, this.addressSelectPage(), { height: $r('app.string.custom_address_picker_percent_seventy'), showClose: false, dragBar: false, onDisappear: () => { this.animationDuration = 0; if (this.currentSelectInfo.region === '') { this.currentSelectInfo.provinceId = ''; this.currentSelectInfo.cityId = ''; this.currentSelectInfo.regionId = ''; this.currentSelectInfo.province = ''; this.currentSelectInfo.city = ''; this.currentSelectInfo.region = ''; this.cityList = []; this.regionList = []; } } }) Divider() .height($r('app.float.custom_address_picker_size_one')) .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) } .width($r('app.string.custom_address_picker_full_size')) .height($r('app.float.custom_address_picker_size_fifty_four')) .padding($r('app.float.custom_address_picker_size_two')) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L50-L587
f8a233116b50634ee651dfbe98266c1506b12100
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
adaptDimension
Obtains the screen horizontal adaptation value. @return number
static adaptDimension(value: number): number { let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESIGN_HEIGHT * DESIGN_HEIGHT); let virtualDim = Math.sqrt(deviceDisplay.width * deviceDisplay.width + virtualHeight * virtualHeight); return virtualDim * value / designDim; // 放缩后长度 }
AST#method_declaration#Left static adaptDimension AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 deviceDisplay = 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 'globalDisplay' 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 display . Display 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#variable_declaration#Left let AST#variable_declarator#Left widthScale = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left deviceDisplay AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left DESIGN_WIDTH AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left virtualHeight = AST#expression#Left AST#binary_expression#Left AST#expression#Left widthScale AST#expression#Right * AST#expression#Left DESIGN_HEIGHT 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 designDim = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . sqrt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left DESIGN_WIDTH AST#expression#Right * AST#expression#Left DESIGN_WIDTH AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left DESIGN_HEIGHT AST#expression#Right * AST#expression#Left DESIGN_HEIGHT AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left virtualDim = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . sqrt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#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 deviceDisplay AST#expression#Right . width AST#member_expression#Right AST#expression#Right * AST#expression#Left deviceDisplay AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left virtualHeight AST#expression#Right * AST#expression#Left virtualHeight AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left virtualDim AST#expression#Right * AST#expression#Left value AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left designDim AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 放缩后长度 } AST#block_statement#Right AST#method_declaration#Right
static adaptDimension(value: number): number { let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESIGN_HEIGHT * DESIGN_HEIGHT); let virtualDim = Math.sqrt(deviceDisplay.width * deviceDisplay.width + virtualHeight * virtualHeight); return virtualDim * value / designDim; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets#L39-L46
6adb979c8ded276fa06b4d374ee3909a1730a110
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/components/common/src/main/ets/components/index.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 * from './ColorBlock';
AST#export_declaration#Left export * from './ColorBlock' ; AST#export_declaration#Right
export * from './ColorBlock';
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/components/common/src/main/ets/components/index.ets#L16-L16
702df22dc101415ac4cbe5242128eccf646e6e31
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
getLunarHolidays
获取农历节日 @param year 年份(公历) @returns 该年的农历节日列表
async getLunarHolidays(year: number): Promise<LunarHoliday[]> { try { const holidays: LunarHoliday[] = []; for (const holiday of LunarService.LUNAR_HOLIDAYS) { // 处理除夕特殊情况(腊月二十九或三十) let targetDay = holiday.day; if (holiday.name === '除夕') { // 检查腊月是大月还是小月 const monthDays = LunarUtils.getLunarMonthDays(year, 12, false); targetDay = monthDays; // 腊月的最后一天 } const solarDate = await this.lunarToSolar(year, holiday.month, targetDay); if (solarDate) { // 检查日期是否在指定年份内 const solarYear = new Date(solarDate).getFullYear(); if (solarYear === year) { holidays.push({ name: holiday.name, lunarDate: `${year}-${holiday.month.toString().padStart(2, '0')}-${targetDay.toString().padStart(2, '0')}`, solarDate, description: holiday.description, isTraditional: true }); } } } // 按公历日期排序 holidays.sort((a, b) => a.solarDate.localeCompare(b.solarDate)); return holidays; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get lunar holidays: ${error}`); return []; } }
AST#method_declaration#Left async getLunarHolidays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 LunarHoliday [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left holidays : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left LunarHoliday [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const holiday of AST#expression#Left AST#member_expression#Left AST#expression#Left LunarService AST#expression#Right . LUNAR_HOLIDAYS AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 处理除夕特殊情况(腊月二十九或三十) AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left targetDay = AST#expression#Left AST#member_expression#Left AST#expression#Left holiday AST#expression#Right . day AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left holiday AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left '除夕' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 检查腊月是大月还是小月 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left monthDays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LunarUtils AST#expression#Right . getLunarMonthDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left 12 AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left targetDay = AST#expression#Left monthDays 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 solarDate = 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 . lunarToSolar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left holiday AST#expression#Right . month AST#member_expression#Right AST#expression#Right , AST#expression#Left targetDay 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 solarDate AST#expression#Right ) AST#block_statement#Left { // 检查日期是否在指定年份内 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left solarYear = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left solarDate AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 solarYear AST#expression#Right === AST#expression#Left year 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 holidays 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#member_expression#Left AST#expression#Left holiday AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunarDate AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left year AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left holiday AST#expression#Right . month AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 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_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 targetDay AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 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#property_assignment#Right , AST#property_assignment#Left solarDate AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left holiday AST#expression#Right . description AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isTraditional 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#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#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 holidays AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . solarDate AST#member_expression#Right AST#expression#Right . localeCompare AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . solarDate 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#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 holidays AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to get lunar holidays: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getLunarHolidays(year: number): Promise<LunarHoliday[]> { try { const holidays: LunarHoliday[] = []; for (const holiday of LunarService.LUNAR_HOLIDAYS) { let targetDay = holiday.day; if (holiday.name === '除夕') { const monthDays = LunarUtils.getLunarMonthDays(year, 12, false); targetDay = monthDays; } const solarDate = await this.lunarToSolar(year, holiday.month, targetDay); if (solarDate) { const solarYear = new Date(solarDate).getFullYear(); if (solarYear === year) { holidays.push({ name: holiday.name, lunarDate: `${year}-${holiday.month.toString().padStart(2, '0')}-${targetDay.toString().padStart(2, '0')}`, solarDate, description: holiday.description, isTraditional: true }); } } } holidays.sort((a, b) => a.solarDate.localeCompare(b.solarDate)); return holidays; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get lunar holidays: ${error}`); return []; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L295-L332
633e318486b248162bb5e2fdb38d4f6e758b45c5
github
iamhyc/Aigis.git
585de9128882d868484438d32832ca9b9b50442d
entry/src/main/ets/entryability/EntryAbility.ets
arkts
requestSecret
------------------ Secret Manager ------------------//
private async requestSecret(otpType: OtpSchemaSupport, secret: SecretSchema, authToken?: Uint8Array): Promise<Uint8Array> { let encodedSecret = secret.secret; // case 1: secret needs decryption if (secret.encrypted) { // case 1.1: deprecated master key info if (this._decMasterKeyInfo?.version!==LATEST_KDF_VERSION) { AppStorage.set('StatusDecKeyRequired', true); return new Uint8Array(); } // encodedSecret = await this.decryptSecret(encodedSecret, secret.encrypted!, authToken); // case 1.2: decryption failed if (encodedSecret==='') { AppStorage.set('StatusDecKeyRequired', true); return new Uint8Array(); } } // case 2: (compatible with < v0.3.0) dec key missing else if (this.MasterKeyAvailable && this.decMasterKeyInfo?.keyAlias===undefined) { AppStorage.set('StatusDecKeyRequired', true); return new Uint8Array(); } // return decoded raw secret const b64Encoded: boolean = (otpType==='steam' && !isValidBase32String(encodedSecret)); const rawSecret: Uint8Array = b64Encoded? (new util.Base64Helper()).decodeSync(encodedSecret) : b32decode(encodedSecret); return rawSecret; }
AST#method_declaration#Left private async requestSecret AST#parameter_list#Left ( AST#parameter#Left otpType : AST#type_annotation#Left AST#primary_type#Left OtpSchemaSupport AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left secret : AST#type_annotation#Left AST#primary_type#Left SecretSchema AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left authToken ? : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left encodedSecret = AST#expression#Left AST#member_expression#Left AST#expression#Left secret AST#expression#Right . secret AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // case 1: secret needs decryption AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left secret AST#expression#Right . encrypted AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // case 1.1: deprecated master key info AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _decMasterKeyInfo AST#member_expression#Right AST#expression#Right ?. version AST#member_expression#Right AST#expression#Right !== AST#expression#Left LATEST_KDF_VERSION 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 AppStorage AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'StatusDecKeyRequired' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left encodedSecret = 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 . decryptSecret AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left encodedSecret AST#expression#Right , AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secret AST#expression#Right . encrypted AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left authToken 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 // case 1.2: decryption failed AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left encodedSecret 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'StatusDecKeyRequired' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#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 // case 2: (compatible with < v0.3.0) dec key missing 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . MasterKeyAvailable AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . decMasterKeyInfo AST#member_expression#Right AST#expression#Right ?. keyAlias 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 AppStorage AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'StatusDecKeyRequired' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#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 // return decoded raw secret AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left b64Encoded : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left otpType AST#expression#Right === AST#expression#Left 'steam' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isValidBase32String AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left encodedSecret AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rawSecret : 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#conditional_expression#Left AST#expression#Left b64Encoded AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . decodeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left encodedSecret AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left b32decode AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left encodedSecret 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 rawSecret AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async requestSecret(otpType: OtpSchemaSupport, secret: SecretSchema, authToken?: Uint8Array): Promise<Uint8Array> { let encodedSecret = secret.secret; if (secret.encrypted) { if (this._decMasterKeyInfo?.version!==LATEST_KDF_VERSION) { AppStorage.set('StatusDecKeyRequired', true); return new Uint8Array(); } encodedSecret = await this.decryptSecret(encodedSecret, secret.encrypted!, authToken); case 1.2: decryption failed if (encodedSecret==='') { AppStorage.set('StatusDecKeyRequired', true); return new Uint8Array(); } } case 2: (compatible with < v0.3.0) dec key missing else if (this.MasterKeyAvailable && this.decMasterKeyInfo?.keyAlias===undefined) { AppStorage.set('StatusDecKeyRequired', true); return new Uint8Array(); } return decoded raw secret const b64Encoded: boolean = (otpType==='steam' && !isValidBase32String(encodedSecret)); const rawSecret: Uint8Array = b64Encoded? (new util.Base64Helper()).decodeSync(encodedSecret) : b32decode(encodedSecret); return rawSecret; }
https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/entryability/EntryAbility.ets#L197-L223
f5ff11a87a9bc7f37ee113709737da48d9d24d29
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/PixelMapUtils.ets
arkts
createPixelMapFromBuffer
从内存数据创建PixelMap
static async createPixelMapFromBuffer( buffer: ArrayBuffer, options?: image.DecodingOptions ): Promise<image.PixelMap | null> { try { const imageSource = image.createImageSource(buffer); return await imageSource.createPixelMap(options); } catch (error) { console.error('从内存创建PixelMap失败:', error); return null; } }
AST#method_declaration#Left static async createPixelMapFromBuffer AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . DecodingOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imageSource = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left buffer AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left imageSource AST#expression#Right AST#await_expression#Right AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '从内存创建PixelMap失败:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async createPixelMapFromBuffer( buffer: ArrayBuffer, options?: image.DecodingOptions ): Promise<image.PixelMap | null> { try { const imageSource = image.createImageSource(buffer); return await imageSource.createPixelMap(options); } catch (error) { console.error('从内存创建PixelMap失败:', error); return null; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PixelMapUtils.ets#L39-L50
f9bbd95e1bf6cda331d9191a96b6edceff26d4f8
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_json/src/main/ets/json/JSONValue.ets
arkts
@Author csx @DateTime 2024/4/25 19:17:04 @TODO JSONValue 定义json值的类型 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_json
export type JSONValue = string | number | boolean | Date | Object | JSONObject | JSONArray | JSONArrayList | null;
AST#export_declaration#Left export AST#type_declaration#Left type JSONValue = AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left JSONObject AST#primary_type#Right | AST#primary_type#Left JSONArray AST#primary_type#Right | AST#primary_type#Left JSONArrayList AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
export type JSONValue = string | number | boolean | Date | Object | JSONObject | JSONArray | JSONArrayList | null;
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONValue.ets#L28-L28
94c0cf70dc379c4bbc59e025fa31e1ea82d8e1e2
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
generateCryptoKey
生成非对称密钥 @param symAlgName 秘钥规格 @returns 指定秘钥规格的非对称公私
static async generateCryptoKey(symAlgName: string): Promise<CryptoKey> { // 创建非对称密钥生成器 let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName); // 通过非对称密钥生成器,随机生成非对称密钥 let promiseKeyPair = await rsaGenerator.generateKeyPair(); // 转换成可以读懂的公私钥字符串 let pubKey = StrAndUintUtil.unitArray2String(promiseKeyPair.pubKey.getEncoded().data); let priKey = StrAndUintUtil.unitArray2String(promiseKeyPair.priKey.getEncoded().data); return new CryptoKey(pubKey, priKey); }
AST#method_declaration#Left static async generateCryptoKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CryptoKey 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 rsaGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symAlgName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 通过非对称密钥生成器,随机生成非对称密钥 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left promiseKeyPair = 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 rsaGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . generateKeyPair 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 pubKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2String AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promiseKeyPair 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#argument_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 priKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2String AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promiseKeyPair 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#argument_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 CryptoKey AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left priKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async generateCryptoKey(symAlgName: string): Promise<CryptoKey> { let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName); let promiseKeyPair = await rsaGenerator.generateKeyPair(); let pubKey = StrAndUintUtil.unitArray2String(promiseKeyPair.pubKey.getEncoded().data); let priKey = StrAndUintUtil.unitArray2String(promiseKeyPair.priKey.getEncoded().data); return new CryptoKey(pubKey, priKey); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L101-L110
25ebaba5ede6831d25020c39bf259f8665387702
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
parseNonStreamResponse
解析非流式响应
private parseNonStreamResponse(parsedResponse: Record<string, Object>, provider: string): string { let aiResponse: string = ''; if (provider === 'anthropic') { // Anthropic响应格式 if (parsedResponse.content && Array.isArray(parsedResponse.content) && parsedResponse.content.length > 0) { const content = parsedResponse.content[0] as Record<string, Object>; if (content.text && typeof content.text === 'string') { aiResponse = content.text; } else { throw new Error('Anthropic响应格式异常'); } } else { throw new Error('Anthropic响应格式异常'); } } else { // OpenAI、DeepSeek等标准格式 if (parsedResponse.choices && Array.isArray(parsedResponse.choices) && parsedResponse.choices.length > 0) { const choice = parsedResponse.choices[0] as Record<string, Object>; if (choice.message && typeof choice.message === 'object') { const message = choice.message as Record<string, Object>; if (message.content && typeof message.content === 'string') { aiResponse = message.content; } else { throw new Error('响应内容为空'); } } else { throw new Error('响应内容为空'); } } else { throw new Error('响应格式异常,未找到choices字段'); } } if (aiResponse.trim().length === 0) { throw new Error('AI响应内容为空'); } return aiResponse.trim(); }
AST#method_declaration#Left private parseNonStreamResponse AST#parameter_list#Left ( AST#parameter#Left parsedResponse : 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 Object 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 provider : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left aiResponse : 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left provider AST#expression#Right === AST#expression#Left 'anthropic' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // Anthropic响应格式 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left parsedResponse AST#expression#Right . content AST#member_expression#Right AST#expression#Right && AST#expression#Left Array AST#expression#Right AST#binary_expression#Right AST#expression#Right . isArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left parsedResponse AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left parsedResponse AST#expression#Right AST#binary_expression#Right AST#expression#Right . content 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#variable_declaration#Left const AST#variable_declarator#Left content = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left parsedResponse AST#expression#Right . content AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as 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 Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left content AST#expression#Right . text AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left content AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . text AST#member_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left aiResponse = AST#expression#Left AST#member_expression#Left AST#expression#Left content 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 else 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 'Anthropic响应格式异常' 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#block_statement#Right else 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 'Anthropic响应格式异常' 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#block_statement#Right else AST#block_statement#Left { // OpenAI、DeepSeek等标准格式 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left parsedResponse AST#expression#Right . choices AST#member_expression#Right AST#expression#Right && AST#expression#Left Array AST#expression#Right AST#binary_expression#Right AST#expression#Right . isArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left parsedResponse AST#expression#Right . choices AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left parsedResponse AST#expression#Right AST#binary_expression#Right AST#expression#Right . choices 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#variable_declaration#Left const AST#variable_declarator#Left choice = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left parsedResponse AST#expression#Right . choices AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as 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 Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left choice AST#expression#Right . message AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left choice AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right === AST#expression#Left 'object' 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 message = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left choice AST#expression#Right . message AST#member_expression#Right AST#expression#Right as 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 Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . content AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left message AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . content AST#member_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left aiResponse = AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . content 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#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '响应内容为空' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '响应内容为空' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else 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 '响应格式异常,未找到choices字段' 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left aiResponse 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#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 'AI响应内容为空' 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 aiResponse 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private parseNonStreamResponse(parsedResponse: Record<string, Object>, provider: string): string { let aiResponse: string = ''; if (provider === 'anthropic') { if (parsedResponse.content && Array.isArray(parsedResponse.content) && parsedResponse.content.length > 0) { const content = parsedResponse.content[0] as Record<string, Object>; if (content.text && typeof content.text === 'string') { aiResponse = content.text; } else { throw new Error('Anthropic响应格式异常'); } } else { throw new Error('Anthropic响应格式异常'); } } else { if (parsedResponse.choices && Array.isArray(parsedResponse.choices) && parsedResponse.choices.length > 0) { const choice = parsedResponse.choices[0] as Record<string, Object>; if (choice.message && typeof choice.message === 'object') { const message = choice.message as Record<string, Object>; if (message.content && typeof message.content === 'string') { aiResponse = message.content; } else { throw new Error('响应内容为空'); } } else { throw new Error('响应内容为空'); } } else { throw new Error('响应格式异常,未找到choices字段'); } } if (aiResponse.trim().length === 0) { throw new Error('AI响应内容为空'); } return aiResponse.trim(); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L547-L586
d49c0f6fedc604e4a56fccd3b170a002f2df2145
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
set
Called when setting. @since 10
static set<T>(propName: string, newValue: T): boolean { return StorageMap.shared.set(propName, newValue, false) }
AST#method_declaration#Left static set AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newValue : 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 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#member_expression#Left AST#expression#Left StorageMap AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left propName AST#expression#Right , AST#expression#Left newValue AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static set<T>(propName: string, newValue: T): boolean { return StorageMap.shared.set(propName, newValue, false) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L156-L158
0845b21ed9243a889c16fe1fb28b5edcce056bb6
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/IdUtil.ets
arkts
fastSimpleUUID
获取随机32位UUID,带-
static fastSimpleUUID(): string { const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); const uuid = new Array<string>(32); let rand = 0; let index = 0; for (let i = 0; i < 32; i++) { if (i === 8 || i === 12 || i === 16 || i === 20) { uuid[i] = '-'; } else { if (rand <= 0x02) { rand = 0x2000000 + (Math.random() * 0x1000000) | 0; } const r = rand & 0xf; rand = rand >> 4; uuid[i] = chars[(i === 12) ? (r & 0x3) | 0x8 : r]; } } return uuid.join(''); }
AST#method_declaration#Left static fastSimpleUUID AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left chars = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uuid = 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#expression#Left 32 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 rand = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 32 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( 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 i AST#expression#Right === AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right === AST#expression#Left 12 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 i 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#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right === AST#expression#Left 20 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left uuid AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left '-' AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left rand AST#expression#Right <= AST#expression#Left 0x02 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 rand = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 0x2000000 AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . random AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left 0x1000000 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 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left r = AST#expression#Left AST#binary_expression#Left AST#expression#Left rand AST#expression#Right & AST#expression#Left 0xf AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left rand = AST#expression#Left AST#binary_expression#Left AST#expression#Left rand AST#expression#Right >> AST#expression#Left 4 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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left uuid AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = chars AST#ERROR#Right [ AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right === AST#expression#Left 12 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 0x3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right | AST#expression#Left 0x8 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left r AST#expression#Right AST#conditional_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uuid AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static fastSimpleUUID(): string { const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); const uuid = new Array<string>(32); let rand = 0; let index = 0; for (let i = 0; i < 32; i++) { if (i === 8 || i === 12 || i === 16 || i === 20) { uuid[i] = '-'; } else { if (rand <= 0x02) { rand = 0x2000000 + (Math.random() * 0x1000000) | 0; } const r = rand & 0xf; rand = rand >> 4; uuid[i] = chars[(i === 12) ? (r & 0x3) | 0x8 : r]; } } return uuid.join(''); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdUtil.ets#L68-L88
68ec40c36363164fb598903a1647afd9832d131a
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/net/wanAPI/response/IWanCommonResponse.ets
arkts
玩安卓公共响应格式
export interface IWanCommonResponse<T> { data: T errorCode: number, errorMsg: string, }
AST#export_declaration#Left export AST#interface_declaration#Left interface IWanCommonResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left errorCode : 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 errorMsg : 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 IWanCommonResponse<T> { data: T errorCode: number, errorMsg: string, }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/net/wanAPI/response/IWanCommonResponse.ets#L6-L10
e76c213234f43ae27a6ea8da3b49c34d7ba3f835
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_016_F.ets
arkts
Introduction 库函数-string_trim
export function string_lib_func_016_F(taint_src : string) { let clean = "clean"; let t = clean.trim(); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_016_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left clean = AST#expression#Left "clean" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left t = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left clean AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left t AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function string_lib_func_016_F(taint_src : string) { let clean = "clean"; let t = clean.trim(); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_016_F.ets#L7-L11
d955b5eac299ae88e0e191412ef3eb98dda3bf1e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/Scroller.ets
arkts
customBuilder1
检测Web组件是否滚动到边界
@Builder customBuilder1() {}
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customBuilder1 AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
@Builder customBuilder1() {}
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/Scroller.ets#L43-L43
1abd7380ae008c5f543539d153afd5f17e99cb1e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/Index.ets
arkts
FunctionalScenes
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 { FunctionalScenes } from './src/main/ets/FunctionalScenes';
AST#export_declaration#Left export { FunctionalScenes } from './src/main/ets/FunctionalScenes' ; AST#export_declaration#Right
export { FunctionalScenes } from './src/main/ets/FunctionalScenes';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/Index.ets#L16-L16
12e5e55c49430839bb144d85fee040cf1647af57
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/transform/SketchTransformation.ets
arkts
SketchTransformation
图片变换:素描效果
@Sendable export class SketchTransformation extends PixelMapTransformation { constructor() { super(); } async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> { let imageInfo: image.ImageInfo = await toTransform.getImageInfo(); if (!imageInfo.size) { console.error('SketchTransformation The image size does not exist.'); return toTransform; } return await this.sketchGPU(toTransform, imageInfo.size.width, imageInfo.size.height); } private async sketchGPU(bitmap: PixelMap, targetWidth: number, targetHeight: number): Promise<PixelMap> { let bufferData = new ArrayBuffer(bitmap.getPixelBytesNumber()); await bitmap.readPixelsToBuffer(bufferData); let filter = new GPUImageSketchFilter(); filter.setImageData(bufferData, targetWidth, targetHeight); let buf = await filter.getPixelMapBuf(0, 0, targetWidth, targetHeight); await bitmap.writeBufferToPixels(buf); return bitmap; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class SketchTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left async transform AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toTransform : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PixelMap 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 imageInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageInfo 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 toTransform AST#expression#Right AST#await_expression#Right AST#expression#Right . getImageInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left imageInfo AST#expression#Right AST#unary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'SketchTransformation The image size does not exist.' AST#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 toTransform 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . sketchGPU AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toTransform AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private async sketchGPU AST#parameter_list#Left ( AST#parameter#Left bitmap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetHeight : 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 PixelMap 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 bufferData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ArrayBuffer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bitmap AST#expression#Right . getPixelBytesNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left bitmap AST#expression#Right AST#await_expression#Right AST#expression#Right . readPixelsToBuffer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bufferData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filter = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GPUImageSketchFilter AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left filter AST#expression#Right . setImageData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bufferData AST#expression#Right , AST#expression#Left targetWidth AST#expression#Right , AST#expression#Left targetHeight AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left buf = 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 filter AST#expression#Right AST#await_expression#Right AST#expression#Right . getPixelMapBuf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left targetWidth AST#expression#Right , AST#expression#Left targetHeight AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left bitmap AST#expression#Right AST#await_expression#Right AST#expression#Right . writeBufferToPixels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left buf AST#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 bitmap AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
@Sendable export class SketchTransformation extends PixelMapTransformation { constructor() { super(); } async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> { let imageInfo: image.ImageInfo = await toTransform.getImageInfo(); if (!imageInfo.size) { console.error('SketchTransformation The image size does not exist.'); return toTransform; } return await this.sketchGPU(toTransform, imageInfo.size.width, imageInfo.size.height); } private async sketchGPU(bitmap: PixelMap, targetWidth: number, targetHeight: number): Promise<PixelMap> { let bufferData = new ArrayBuffer(bitmap.getPixelBytesNumber()); await bitmap.readPixelsToBuffer(bufferData); let filter = new GPUImageSketchFilter(); filter.setImageData(bufferData, targetWidth, targetHeight); let buf = await filter.getPixelMapBuf(0, 0, targetWidth, targetHeight); await bitmap.writeBufferToPixels(buf); return bitmap; } }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/SketchTransformation.ets#L22-L46
5620a327cbe1b74f42bc64abd0a3075ee7920a7b
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets
arkts
MaxSelected @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare class MaxSelected { /** * data. support to set max_total_count, max_photo_count and max_video_count. * * @type { ?Map<MaxCountType, number> } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ data?: Map<MaxCountType, number>; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class MaxSelected AST#class_body#Left { /** * data. support to set max_total_count, max_photo_count and max_video_count. * * @type { ?Map<MaxCountType, number> } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#property_declaration#Left data ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left MaxCountType AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export declare class MaxSelected { data?: Map<MaxCountType, number>; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L488-L498
b925c267739004f0ffdac684d912c96a68ce7d47
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/buffer/AbstractBuffer.ets
arkts
size
Returns the size (length) of the buffer array. @return
public size(): number { return this.buffer.length; }
AST#method_declaration#Left public size AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public size(): number { return this.buffer.length; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/buffer/AbstractBuffer.ets#L68-L70
70c40bd3b37999ea5f8ffdf33fb1daf1e9cf8eaa
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/datasource/auth/AuthNetworkDataSource.ets
arkts
@file 认证相关网络数据源接口 定义认证模块所需的所有网络请求操作 @author Joker.X
export interface AuthNetworkDataSource { /** * 刷新 Token * @param {Record<string, string>} params - 刷新参数,包含 refresh_token * @returns {Promise<NetworkResponse<Auth>>} 刷新后的认证信息 */ refreshToken(params: Record<string, string>): Promise<NetworkResponse<Auth>>; /** * 密码登录 * @param params 登录参数,包含用户名、密码等 * @return 返回 Promise,包含认证结果 */ loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AuthNetworkDataSource AST#object_type#Left { /** * 刷新 Token * @param {Record<string, string>} params - 刷新参数,包含 refresh_token * @returns {Promise<NetworkResponse<Auth>>} 刷新后的认证信息 */ AST#type_member#Left refreshToken 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 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#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 密码登录 * @param params 登录参数,包含用户名、密码等 * @return 返回 Promise,包含认证结果 */ AST#type_member#Left loginByPassword AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PasswordLoginRequest 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 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#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface AuthNetworkDataSource { refreshToken(params: Record<string, string>): Promise<NetworkResponse<Auth>>; loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>>; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/datasource/auth/AuthNetworkDataSource.ets#L8-L22
014277b7be5efbdf3a937ac546a3955e001d9631
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/SettingsTypes.ets
arkts
备份位置枚举
export enum BackupLocation { LOCAL = 'local', CLOUD = 'cloud', EXTERNAL = 'external' }
AST#export_declaration#Left export AST#enum_declaration#Left enum BackupLocation AST#enum_body#Left { AST#enum_member#Left LOCAL = AST#expression#Left 'local' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CLOUD = AST#expression#Left 'cloud' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left EXTERNAL = AST#expression#Left 'external' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum BackupLocation { LOCAL = 'local', CLOUD = 'cloud', EXTERNAL = 'external' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L648-L652
f21970133d7d503abc07b3f62c70ca3e2e383fb1
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setCenterTextTypeface
sets the typeface for the center-text paint @param t
public setCenterTextTypeface(t: FontFamily): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintCenterText().setFontFamily(t); }
AST#method_declaration#Left public setCenterTextTypeface AST#parameter_list#Left ( AST#parameter#Left t : AST#type_annotation#Left AST#primary_type#Left FontFamily 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintCenterText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setFontFamily AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left t AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setCenterTextTypeface(t: FontFamily): void { ( this.mRenderer as PieChartRenderer).getPaintCenterText().setFontFamily(t); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L561-L564
ae0cc75a4cdd472ccba3e8bc74a28878ecfa8461
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets
arkts
connect2Server
连接服务端
connect2Server() { workerPort.postMessage({ type: 'connectServer', serverIp: this.serverIp, serverPort: this.serverPort, ca: this.ca, cert: this.cert, privateKey: this.privateKey }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsTwoWayMessage = e.data; if (response.type === 'connectSuccess') { this.msgHistory += 'Connect success\r\n'; this.canSend = true; } else if (response.type === 'connectFailure') { this.msgHistory += `Connect fail: ${response.message}\r\n`; } } }
AST#method_declaration#Left connect2Server 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 workerPort AST#expression#Right . postMessage 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 type AST#property_name#Right : AST#expression#Left 'connectServer' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serverIp AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . serverIp AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serverPort AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . serverPort AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left ca AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ca AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cert AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cert AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left privateKey AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . privateKey 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left workerPort AST#expression#Right . onmessage AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left MessageEvents 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 response : AST#type_annotation#Left AST#primary_type#Left TlsTwoWayMessage AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 'connectSuccess' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left 'Connect success\r\n' 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 . canSend 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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 'connectFailure' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` Connect fail: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right \r \n ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
connect2Server() { workerPort.postMessage({ type: 'connectServer', serverIp: this.serverIp, serverPort: this.serverPort, ca: this.ca, cert: this.cert, privateKey: this.privateKey }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsTwoWayMessage = e.data; if (response.type === 'connectSuccess') { this.msgHistory += 'Connect success\r\n'; this.canSend = true; } else if (response.type === 'connectFailure') { this.msgHistory += `Connect fail: ${response.message}\r\n`; } } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets#L332-L350
eab3a36dc7dec160fb93af095de9283a1781b0c5
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
unregisterAnim
取消注册路由转场动画 @param modifier
unregisterAnim(component: object) { const navId = this.navContextMap.get(this.getKey(component))?.pageId if (navId) { this.customTransitionMap.delete(navId); } this.navContextMap.delete(this.getKey(this)) }
AST#method_declaration#Left unregisterAnim AST#parameter_list#Left ( AST#parameter#Left component : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left navId = 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 . navContextMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left component 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 ?. pageId 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 navId 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 . customTransitionMap AST#member_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left navId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . navContextMap AST#member_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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
unregisterAnim(component: object) { const navId = this.navContextMap.get(this.getKey(component))?.pageId if (navId) { this.customTransitionMap.delete(navId); } this.navContextMap.delete(this.getKey(this)) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L357-L363
d5ffe2fb116f623315e8741218fa60e0228dedcb
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
trackEvent
记录使用事件
trackEvent(eventType: 'app_launch' | 'app_close' | 'contact_add' | 'contact_edit' | 'greeting_generate' | 'greeting_use' | 'feature_use', eventData?: EventData): void { const event: UsageEvent = { eventType, eventData, timestamp: new Date().toISOString(), sessionId: this.currentSessionId }; this.usageEvents.push(event); hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Event tracked: ${eventType}`); }
AST#method_declaration#Left trackEvent AST#parameter_list#Left ( AST#parameter#Left eventType AST#parameter#Right AST#ERROR#Left : 'app_launch' | 'app_close' | 'contact_add' | 'contact_edit' | 'greeting_generate' | 'greeting_use' | 'feature_use' AST#ERROR#Right , AST#parameter#Left eventData ? : AST#type_annotation#Left AST#primary_type#Left EventData 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 event : AST#type_annotation#Left AST#primary_type#Left UsageEvent AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left eventType AST#property_assignment#Right , AST#property_assignment#Left eventData AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timestamp AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sessionId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSessionId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . usageEvents AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 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 ` Event tracked: AST#template_substitution#Left $ { AST#expression#Left eventType 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#method_declaration#Right
trackEvent(eventType: 'app_launch' | 'app_close' | 'contact_add' | 'contact_edit' | 'greeting_generate' | 'greeting_use' | 'feature_use', eventData?: EventData): void { const event: UsageEvent = { eventType, eventData, timestamp: new Date().toISOString(), sessionId: this.currentSessionId }; this.usageEvents.push(event); hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Event tracked: ${eventType}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L327-L339
52129068ba9d1c9261d4ac5d47322ff3c4843793
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/widgets/pages/WidgetCard2x4.ets
arkts
getBirthdayTextColor
获取生日文本颜色
private getBirthdayTextColor(item: any): ResourceColor { if (item.isToday) { return '#FF5722'; } else if (item.isTomorrow) { return '#2196F3'; } return $r('app.color.text_secondary'); }
AST#method_declaration#Left private getBirthdayTextColor AST#parameter_list#Left ( AST#parameter#Left item : 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 ResourceColor 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 item AST#expression#Right . isToday AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '#FF5722' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . isTomorrow AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '#2196F3' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getBirthdayTextColor(item: any): ResourceColor { if (item.isToday) { return '#FF5722'; } else if (item.isTomorrow) { return '#2196F3'; } return $r('app.color.text_secondary'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L247-L254
b03159ff12b7e943dfc56dc2b500fb4eb2d1f619
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
decryptData
模拟使用HUKS生成的新密钥进行解密
async decryptData(resultCallback: Function): Promise<void> { let decryptOptions: HuksProperties[] = new Array(); getAesDecryptProperties(decryptOptions); let aesKeyAlias = 'test_aesKeyAlias'; let handle: number = 0; let options: huks.HuksOptions = { properties: decryptOptions, inData: cipherData }; let emptyOptions: huks.HuksOptions = { properties: [] }; await huks.initSession(aesKeyAlias, options).then((data) => { Logger.info(TAG, `decrypt initSession success, data: ${JSON.stringify(data)}`); handle = data.handle; }).catch((err: Error) => { Logger.error(TAG, `decrypt initSession failed, ${JSON.stringify(err)}: ${JSON.stringify(err.message)}`); }); await huks.finishSession(handle, options).then((data) => { Logger.info(TAG, `decrypt finishSession success, data: ${JSON.stringify(data)}`); resultCallback(uint8ArrayToString(data.outData as Uint8Array)); }).catch((err: Error) => { Logger.error(TAG, `decrypt finishSession failed, ${JSON.stringify(err)}: ${JSON.stringify(err.message)}`); promptAction.showToast({ message: `receive message failed, ${JSON.stringify(err)}: ${JSON.stringify(err.message)}`, duration: 6500, }); }); await huks.deleteKeyItem(aesKeyAlias, emptyOptions).then((data) => { Logger.info(TAG, `delete key success, data: ${JSON.stringify(data)}`); }).catch((err: Error)=>{ Logger.error(TAG, `delete key failed, ${JSON.stringify(err)}: ${JSON.stringify(err.message)}`); }); }
AST#method_declaration#Left async decryptData AST#parameter_list#Left ( AST#parameter#Left resultCallback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decryptOptions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HuksProperties [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getAesDecryptProperties AST#expression#Right AST#argument_list#Left ( AST#expression#Left decryptOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left aesKeyAlias = AST#expression#Left 'test_aesKeyAlias' 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 handle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left huks . HuksOptions 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 properties AST#property_name#Right : AST#expression#Left decryptOptions AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left inData AST#property_name#Right : AST#expression#Left cipherData AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left emptyOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left huks . HuksOptions 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 properties AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left huks AST#expression#Right AST#await_expression#Right AST#expression#Right . initSession AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left aesKeyAlias AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` decrypt initSession success, data: 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 data 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 handle = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . handle AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` decrypt initSession failed, AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left huks AST#expression#Right AST#await_expression#Right AST#expression#Right . finishSession AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left handle AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` decrypt finishSession success, data: 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 data 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 resultCallback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left uint8ArrayToString AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . outData AST#member_expression#Right 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#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 ` decrypt finishSession failed, AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#template_literal#Left ` receive message failed, AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 6500 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left huks AST#expression#Right AST#await_expression#Right AST#expression#Right . deleteKeyItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left aesKeyAlias AST#expression#Right , AST#expression#Left emptyOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` delete key success, data: 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 data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 ` delete key failed, AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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
async decryptData(resultCallback: Function): Promise<void> { let decryptOptions: HuksProperties[] = new Array(); getAesDecryptProperties(decryptOptions); let aesKeyAlias = 'test_aesKeyAlias'; let handle: number = 0; let options: huks.HuksOptions = { properties: decryptOptions, inData: cipherData }; let emptyOptions: huks.HuksOptions = { properties: [] }; await huks.initSession(aesKeyAlias, options).then((data) => { Logger.info(TAG, `decrypt initSession success, data: ${JSON.stringify(data)}`); handle = data.handle; }).catch((err: Error) => { Logger.error(TAG, `decrypt initSession failed, ${JSON.stringify(err)}: ${JSON.stringify(err.message)}`); }); await huks.finishSession(handle, options).then((data) => { Logger.info(TAG, `decrypt finishSession success, data: ${JSON.stringify(data)}`); resultCallback(uint8ArrayToString(data.outData as Uint8Array)); }).catch((err: Error) => { Logger.error(TAG, `decrypt finishSession failed, ${JSON.stringify(err)}: ${JSON.stringify(err.message)}`); promptAction.showToast({ message: `receive message failed, ${JSON.stringify(err)}: ${JSON.stringify(err.message)}`, duration: 6500, }); }); await huks.deleteKeyItem(aesKeyAlias, emptyOptions).then((data) => { Logger.info(TAG, `delete key success, data: ${JSON.stringify(data)}`); }).catch((err: Error)=>{ Logger.error(TAG, `delete key failed, ${JSON.stringify(err)}: ${JSON.stringify(err.message)}`); }); }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L339-L373
28cedce6ee0c2c62f41854f9214cabd8c58e94b5
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/casesfeature/swipercomponent/src/main/ets/components/mainpage/SwiperMainPage.ets
arkts
SwiperMainPage
功能说明: 通过Stack组件堆叠图片,实现多层级效果,配合手势滑动和显式动画实现切换的动画效果。同时通过改变数据中间值currentIndex来改变组件zIndex层级和高度来实现切换的效果。 推荐场景: 购物类、资讯类应用的首页轮播 核心组件: 1. SwiperSection: 自定义轮播图 实现步骤: 1. 数据准备。设置SwiperItemViewType(轮播图属性配置)以及初始化轮播图数据。其中SwiperItemViewType包含SwiperData(轮播项数据类)以及 contentBuilder(轮播项视图)两个属性。 @example class SwiperItemViewType { data: SwiperData; contentBuilder: WrappedBuilder<[SwiperData]>; constructor(data: SwiperData, contentBuilder: WrappedBuilder<[SwiperData]>) { this.data = data; this.contentBuilder = contentBuilder; } } SwiperData包含imageSrc(图片路径-必传)、name(标题名称)、appUri(功能模块地址)以及param(传递的参数)。 开发者可以使用以上默认的属性配置,也可以自行配置SwiperItemViewType和SwiperData的属性。 根据以上属性初始化数据。 @example aboutToAppear(): void { let swiperData: SwiperData[] = [ new SwiperData($r('app.media.swipercomponent_mp_chart'), $r('app.string.swipercomponent_swiper_data1'), 'barchart/BarChartPage'), new SwiperData($r('app.media.swipercomponent_lottie'), $r('app.string.swipercomponent_swiper_data2'), 'lottieview/LottieComponent'), new SwiperData($r('app.media.swipercomponent_component_tack'), $r('app.string.swipercomponent_swiper_data3'), 'componentstack/ComponentStack')]; swiperData.forEach((item: SwiperData) => { this.swiperListView.push(new SwiperItemViewType(item, wrapBuilder(SwiperItemView))) }) } 2. 构建indicatorBuilder(自定义导航点)。 @Builder indicatorBuilder() { ··· } 3. 构造自定义轮播视图。 @example SwiperSection({ swiperListView: this.swiperListView, currentIndex: this.currentIndex, swiperAnimationDuration: CommonConstants.SWIPER_ANIMATION_DURATION, swiperSwitchDuration: CommonConstants.SWIPER_SWITCH_DURATION, isLoop: CommonConstants.SWIPER_IS_LOOP, indicatorBuilder: () => { this.indicatorBuilder(); }, swiperItemHandle: (swiperItemData: SwiperData) => { TODO:点击swiper逻辑处理 点击轮播图Item时,根据点击的模块信息,将页面放入路由栈 this.dynamicsRouterPush(swiperItemData); } })
@Component export struct SwiperMainPage { // 轮播模块列表 swiperListView: SwiperItemViewType[] = []; dynamicsRouterPush:(swiperItemData:SwiperData) => void = (swiperItemData:SwiperData)=>{}; // 当前索引 @State currentIndex: number = 0; aboutToAppear(): void { let swiperData: SwiperData[] = [ new SwiperData($r('app.media.reward1'), $r('app.string.swipercomponent_swiper_data1'), 'barchart/BarChartPage'), new SwiperData($r('app.media.reward2'), $r('app.string.swipercomponent_swiper_data2'), 'lottieview/LottieComponent'), new SwiperData($r('app.media.reward3'), $r('app.string.swipercomponent_swiper_data3'), 'componentstack/ComponentStack'), ]; swiperData.forEach((item: SwiperData) => { // item单个轮播图数据,WrapBuilder单个轮播图视图。开发者可以自己配置轮播图数据和视图 this.swiperListView.push(new SwiperItemViewType(item, wrapBuilder(SwiperItemView))); }) } build() { Column() { /** * 轮播图视图 * @param swiperListView: 轮播图列表视图数据 * @param currentIndex: 当前索引值 * @param swiperAnimationDuration: 轮播图切换动画时间 * @param swiperSwitchDuration: 轮播图切换间隔时间 * @param isLoop: 轮播图是否自动循环播放 * @param indicatorBuilder: 导航点自定义视图 * @param swiperItemHandle: 点击轮播图处理逻辑 */ SwiperSection({ swiperListView: this.swiperListView, currentIndex: this.currentIndex, swiperAnimationDuration: CommonConstants.SWIPER_ANIMATION_DURATION, swiperSwitchDuration: CommonConstants.SWIPER_SWITCH_DURATION, isLoop: CommonConstants.SWIPER_IS_LOOP, indicatorBuilder: this.indicatorBuilder, swiperItemHandle: (swiperItemData: SwiperData) => { // TODO:点击swiper逻辑处理 // 点击轮播图Item时,根据点击的模块信息,将页面放入路由栈 this.dynamicsRouterPush(swiperItemData); } }) } } @Builder indicatorBuilder() { Row({ space: CommonConstants.INDICATOR_SPACE }) { ForEach(this.swiperListView, (item: SwiperData, index: number) => { Ellipse(index !== this.currentIndex ? { width: CommonConstants.INDICATOR_DEFAULT_WIDTH, height: CommonConstants.INDICATOR_HEIGHT } : { width: CommonConstants.INDICATOR_SELECTED_WIDTH, height: CommonConstants.INDICATOR_HEIGHT }) .fill(index !== this.currentIndex ? Color.Black : Color.Red) .fillOpacity(CommonConstants.INDICATOR_FILL_OPACITY) }) } .margin({ top: CommonConstants.INDICATOR_MARGIN_TOP }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SwiperMainPage AST#component_body#Left { // 轮播模块列表 AST#property_declaration#Left swiperListView : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SwiperItemViewType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left dynamicsRouterPush : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left swiperItemData : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left swiperItemData : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // 当前索引 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left swiperData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SwiperData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SwiperData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.reward1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_swiper_data1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'barchart/BarChartPage' 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 SwiperData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.reward2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_swiper_data2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'lottieview/LottieComponent' 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 SwiperData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.reward3' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_swiper_data3' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'componentstack/ComponentStack' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left swiperData AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // item单个轮播图数据,WrapBuilder单个轮播图视图。开发者可以自己配置轮播图数据和视图 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 . swiperListView AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SwiperItemViewType AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left SwiperItemView AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { /** * 轮播图视图 * @param swiperListView: 轮播图列表视图数据 * @param currentIndex: 当前索引值 * @param swiperAnimationDuration: 轮播图切换动画时间 * @param swiperSwitchDuration: 轮播图切换间隔时间 * @param isLoop: 轮播图是否自动循环播放 * @param indicatorBuilder: 导航点自定义视图 * @param swiperItemHandle: 点击轮播图处理逻辑 */ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SwiperSection ( AST#component_parameters#Left { AST#component_parameter#Left swiperListView : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperListView AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left currentIndex : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left swiperAnimationDuration : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_ANIMATION_DURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left swiperSwitchDuration : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_SWITCH_DURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isLoop : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_IS_LOOP AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left indicatorBuilder : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . indicatorBuilder AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left swiperItemHandle : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left swiperItemData : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // TODO:点击swiper逻辑处理 // 点击轮播图Item时,根据点击的模块信息,将页面放入路由栈 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 . dynamicsRouterPush AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left swiperItemData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#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#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right indicatorBuilder 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 AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_SPACE 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 this AST#expression#Right . swiperListView 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 SwiperData 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 Ellipse ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_DEFAULT_WIDTH AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_HEIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_SELECTED_WIDTH AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_HEIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fill ( 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 index AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fillOpacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_FILL_OPACITY 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#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 . 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 . INDICATOR_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#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 SwiperMainPage { swiperListView: SwiperItemViewType[] = []; dynamicsRouterPush:(swiperItemData:SwiperData) => void = (swiperItemData:SwiperData)=>{}; @State currentIndex: number = 0; aboutToAppear(): void { let swiperData: SwiperData[] = [ new SwiperData($r('app.media.reward1'), $r('app.string.swipercomponent_swiper_data1'), 'barchart/BarChartPage'), new SwiperData($r('app.media.reward2'), $r('app.string.swipercomponent_swiper_data2'), 'lottieview/LottieComponent'), new SwiperData($r('app.media.reward3'), $r('app.string.swipercomponent_swiper_data3'), 'componentstack/ComponentStack'), ]; swiperData.forEach((item: SwiperData) => { this.swiperListView.push(new SwiperItemViewType(item, wrapBuilder(SwiperItemView))); }) } build() { Column() { SwiperSection({ swiperListView: this.swiperListView, currentIndex: this.currentIndex, swiperAnimationDuration: CommonConstants.SWIPER_ANIMATION_DURATION, swiperSwitchDuration: CommonConstants.SWIPER_SWITCH_DURATION, isLoop: CommonConstants.SWIPER_IS_LOOP, indicatorBuilder: this.indicatorBuilder, swiperItemHandle: (swiperItemData: SwiperData) => { this.dynamicsRouterPush(swiperItemData); } }) } } @Builder indicatorBuilder() { Row({ space: CommonConstants.INDICATOR_SPACE }) { ForEach(this.swiperListView, (item: SwiperData, index: number) => { Ellipse(index !== this.currentIndex ? { width: CommonConstants.INDICATOR_DEFAULT_WIDTH, height: CommonConstants.INDICATOR_HEIGHT } : { width: CommonConstants.INDICATOR_SELECTED_WIDTH, height: CommonConstants.INDICATOR_HEIGHT }) .fill(index !== this.currentIndex ? Color.Black : Color.Red) .fillOpacity(CommonConstants.INDICATOR_FILL_OPACITY) }) } .margin({ top: CommonConstants.INDICATOR_MARGIN_TOP }) } }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/casesfeature/swipercomponent/src/main/ets/components/mainpage/SwiperMainPage.ets#L83-L147
be97ecad8258d57438ca5c05b6c6e20c878ddb95
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/entry/src/main/ets/pages/ScenariosExample.ets
arkts
transcodePixelMap
Use createPixelMap to replace pictures of ArrayBuffer type with PixelMap type @param data:Resources obtained from the network
transcodePixelMap(data: http.HttpResponse): void { if (http.ResponseCode.OK === data.responseCode) { const imageData: ArrayBuffer = data.result as ArrayBuffer; // Create a picture source instance through ArrayBuffer const imageSource: image.ImageSource = image.createImageSource(imageData); const options: image.InitializationOptions = { 'alphaType': 0, // Transparency 'editable': false, // Is it editable? 'pixelFormat': 3, // Pixel format 'scaleMode': 1, // Abbreviation 'size': { height: 100, width: 100 } }; // Create the size of the picture // Create PixelMap through attributes imageSource.createPixelMap(options).then((pixelMap: PixelMap) => { this.image = pixelMap; setTimeout(() => { if (this.imageBuffer !== undefined) { this.saveImage(this.imageBuffer); } }, 0) }); } }
AST#method_declaration#Left transcodePixelMap AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . ResponseCode AST#member_expression#Right AST#expression#Right . OK AST#member_expression#Right AST#expression#Right === AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imageData : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Create a picture source instance through ArrayBuffer AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imageSource : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left imageData 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 options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . InitializationOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'alphaType' AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // Transparency AST#property_assignment#Left AST#property_name#Left 'editable' AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , // Is it editable? AST#property_assignment#Left AST#property_name#Left 'pixelFormat' AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , // Pixel format AST#property_assignment#Left AST#property_name#Left 'scaleMode' AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // Abbreviation AST#property_assignment#Left AST#property_name#Left 'size' AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 100 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 100 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Create the size of the picture // Create PixelMap through attributes 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 imageSource AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 pixelMap 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 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageBuffer 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 this AST#expression#Right . saveImage 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 . imageBuffer 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#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
transcodePixelMap(data: http.HttpResponse): void { if (http.ResponseCode.OK === data.responseCode) { const imageData: ArrayBuffer = data.result as ArrayBuffer; const imageSource: image.ImageSource = image.createImageSource(imageData); const options: image.InitializationOptions = { 'alphaType': 0, 'editable': false, 'pixelFormat': 3, 'scaleMode': 1, 'size': { height: 100, width: 100 } }; imageSource.createPixelMap(options).then((pixelMap: PixelMap) => { this.image = pixelMap; setTimeout(() => { if (this.imageBuffer !== undefined) { this.saveImage(this.imageBuffer); } }, 0) }); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/pages/ScenariosExample.ets#L60-L83
dc150b3f3f62309b102b333666f9ae2b2c8ddccb
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets
arkts
resume
恢复倒计时
resume(): void { if (this.paused && !this.active) { this.paused = false; this.active = true; this.timerId = setInterval(() => { if (!this.active) return; this.remainMs = Math.max(0, this.remainMs - this.refreshFrequency); this.callback?.(this.remainMs); if (this.remainMs <= 0) { this.stop(); } }, this.refreshFrequency); } }
AST#method_declaration#Left resume AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paused AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . active 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 . paused AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . active 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . active 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 . remainMs AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . max AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#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 this AST#expression#Right . remainMs AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . refreshFrequency AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . callback 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 . remainMs 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . remainMs AST#member_expression#Right AST#expression#Right <= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . 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#block_statement#Right AST#if_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 this AST#expression#Right . refreshFrequency AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
resume(): void { if (this.paused && !this.active) { this.paused = false; this.active = true; this.timerId = setInterval(() => { if (!this.active) return; this.remainMs = Math.max(0, this.remainMs - this.refreshFrequency); this.callback?.(this.remainMs); if (this.remainMs <= 0) { this.stop(); } }, this.refreshFrequency); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L84-L100
d74cf2bf414d0292a6d693ff43ea2505ca0f19fc
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets
arkts
clearSound
清除铃声
clearSound(): void { SoundUtil.release(); }
AST#method_declaration#Left clearSound 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 SoundUtil AST#expression#Right . release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
clearSound(): void { SoundUtil.release(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets#L178-L180
dbc8c06be72c06d02833886877dce9b5a7d83b12
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets
arkts
getFilesInDir
获取目录中的文件名列表 @param path 文件绝对路径
static getFilesInDir(path: string) { const fileNames = fs.listFileSync(path); return fileNames; }
AST#method_declaration#Left static getFilesInDir 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fileNames = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . listFileSync 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 fileNames AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getFilesInDir(path: string) { const fileNames = fs.listFileSync(path); return fileNames; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets#L29-L32
134a85c964284b7200517693706458b3d5796483
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GlobalTypes.ets
arkts
分页响应接口
export interface PagedResponse<T> extends ApiResponse<T[]> { total: number; page: number; pageSize: number; hasMore: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PagedResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#extends_clause#Left extends AST#generic_type#Left ApiResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left total : 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 page : 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 pageSize : 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 hasMore : 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 PagedResponse<T> extends ApiResponse<T[]> { total: number; page: number; pageSize: number; hasMore: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L21-L26
556cf82ce2c81c392041a65a98466127ced01fbc
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/dialogv2/source/dialogv2.ets
arkts
getTitleAreaMinHeight
get title area min height @returns min height
private getTitleAreaMinHeight(): ResourceStr | number { if (this.secondaryTitle) { return $r('sys.float.alert_title_secondary_height'); } else if (this.primaryTitle) { return $r('sys.float.alert_title_primary_height'); } else { return 0; } }
AST#method_declaration#Left private getTitleAreaMinHeight AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left number 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#member_expression#Left AST#expression#Left this AST#expression#Right . secondaryTitle AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.alert_title_secondary_height' AST#expression#Right ) AST#resource_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#member_expression#Left AST#expression#Left this AST#expression#Right . primaryTitle AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.alert_title_primary_height' AST#expression#Right ) AST#resource_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 0 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#block_statement#Right AST#method_declaration#Right
private getTitleAreaMinHeight(): ResourceStr | number { if (this.secondaryTitle) { return $r('sys.float.alert_title_secondary_height'); } else if (this.primaryTitle) { return $r('sys.float.alert_title_primary_height'); } else { return 0; } }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1344-L1352
8885cfbe08dece5de8e164c73210d08760b525af
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_bookmarks.ets
arkts
move_bookmark
Moves a bookmark to another directory @param bookmark_path directory of bookmark to be moved @param to_path directory of destination @returns 0 if success @returns 1 if no bookmark selected @returns 2 if name crash
move_bookmark(bookmark_path: string, to_path: string) { if (bookmark_path == "") { console.log("[ERROR][Meow][bunch_of_bookmarks] Empty bookmark_path!") return 1; } // Get objects let item_bookmark = this.get_bookmark(bookmark_path); let target_folder: bookmark | undefined; if (to_path == "") { target_folder = this.root; } else { target_folder = this.get_folder(to_path); } // If Objects got if (item_bookmark && target_folder) { // Check name crash let check_path = ""; if (to_path == "") { check_path = item_bookmark.get_label() } else { check_path = to_path + "/" + item_bookmark.get_label() } if (this.get_bookmark(check_path)) { // name crash console.log("[ERROR][Meow][bunch_of_bookmarks] Duplicate bookmark name @ \"" + check_path + "\"!") return 2; } // All OK target_folder.add_content(item_bookmark); this.del_bookmark(bookmark_path); } this.last_accessed = Date.now(); return 0; }
AST#method_declaration#Left move_bookmark AST#parameter_list#Left ( AST#parameter#Left bookmark_path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to_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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left bookmark_path 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#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 "[ERROR][Meow][bunch_of_bookmarks] Empty bookmark_path!" AST#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 1 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // Get objects AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left item_bookmark = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . get_bookmark AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bookmark_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#variable_declaration#Left let AST#variable_declarator#Left target_folder : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left bookmark AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left to_path 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 target_folder = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . root 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 target_folder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . get_folder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left to_path 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 // If Objects got AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left item_bookmark AST#expression#Right && AST#expression#Left target_folder AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // Check name crash AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left check_path = AST#expression#Left "" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left to_path 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 check_path = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item_bookmark AST#expression#Right . get_label AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left check_path = 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 to_path AST#expression#Right + AST#expression#Left "/" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left item_bookmark AST#expression#Right AST#binary_expression#Right AST#expression#Right . get_label AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . get_bookmark AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left check_path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { // name crash 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#binary_expression#Left AST#expression#Left "[ERROR][Meow][bunch_of_bookmarks] Duplicate bookmark name @ \"" AST#expression#Right + AST#expression#Left check_path AST#expression#Right AST#binary_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#expression#Left 2 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // All OK AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target_folder AST#expression#Right . add_content AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item_bookmark AST#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 . del_bookmark AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bookmark_path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . last_accessed AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_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
move_bookmark(bookmark_path: string, to_path: string) { if (bookmark_path == "") { console.log("[ERROR][Meow][bunch_of_bookmarks] Empty bookmark_path!") return 1; } let item_bookmark = this.get_bookmark(bookmark_path); let target_folder: bookmark | undefined; if (to_path == "") { target_folder = this.root; } else { target_folder = this.get_folder(to_path); } if (item_bookmark && target_folder) { let check_path = ""; if (to_path == "") { check_path = item_bookmark.get_label() } else { check_path = to_path + "/" + item_bookmark.get_label() } if (this.get_bookmark(check_path)) { console.log("[ERROR][Meow][bunch_of_bookmarks] Duplicate bookmark name @ \"" + check_path + "\"!") return 2; } target_folder.add_content(item_bookmark); this.del_bookmark(bookmark_path); } this.last_accessed = Date.now(); return 0; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L262-L296
5bc7d0ead731fa1e94b70c88065911d6a462d027
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/navigation/LocalStorageNav.ets
arkts
LocalStorageNav
@file 本地存储示例页导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function LocalStorageNav(): void { LocalStoragePage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LocalStorageNav 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 LocalStoragePage ( ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function LocalStorageNav(): void { LocalStoragePage(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/navigation/LocalStorageNav.ets#L8-L11
b3ed0d75b2e3425a8468dfc7530ccf12713cfc13
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/utils/ColorPickerUtil.ets
arkts
setRgba
创建RGBA颜色字符串 @param red 红色分量 (0-255) @param green 绿色分量 (0-255) @param blue 蓝色分量 (0-255) @param opacity 透明度 (0.0-1.0) @returns 格式化的RGBA字符串
public static setRgba(red: number, green: number, blue: number, opacity: number): string { return `rgba(${red},${green},${blue},${opacity})`; }
AST#method_declaration#Left public static setRgba AST#parameter_list#Left ( AST#parameter#Left red : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left green : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left blue : 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 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 ` rgba( AST#template_substitution#Left $ { AST#expression#Left red AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left green AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left blue AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left opacity 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
public static setRgba(red: number, green: number, blue: number, opacity: number): string { return `rgba(${red},${green},${blue},${opacity})`; }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/utils/ColorPickerUtil.ets#L38-L40
0a05a5e2760d11425bb1fad9a45945b8f3a81f6b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
startContinuousTask
启动后台任务 @returns {void}
startContinuousTask(): void { // 避免重新启动后台任务 if (this.isBackgroundTaskRunning) { return; } // TODO:知识点:创建WantAgent实例,在后台任务时拉起应用 let wantAgentInfo: wantAgent.WantAgentInfo = { // 点击通知后,将要执行的动作列表 // 添加需要被拉起应用的bundleName和abilityName wants: [ { bundleName: "com.north.cases", abilityName: "com.north.cases.EntryAbility" } ], // 指定点击通知栏消息后的动作是拉起ability actionType: wantAgent.OperationType.START_ABILITY, // 使用者自定义的一个私有值 requestCode: 0, // 点击通知后,动作执行属性 actionFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] }; // 通过wantAgent模块下getWantAgent方法获取WantAgent对象 wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj: WantAgent) => { // TODO:知识点:设置后台任务类型,启动后台任务 backgroundTaskManager.startBackgroundRunning(this.bindContext!, backgroundTaskManager.BackgroundMode.AUDIO_PLAYBACK, wantAgentObj).then(() => { // 此处执行具体的长时任务逻辑,如放音等。 console.info(`Succeeded in operationing startBackgroundRunning.`); this.isBackgroundTaskRunning = true; }).catch((err: BusinessError) => { console.error(`Failed to operation startBackgroundRunning. Code is ${err.code}, message is ${err.message}`); }); }); }
AST#method_declaration#Left startContinuousTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 避免重新启动后台任务 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBackgroundTaskRunning AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // TODO:知识点:创建WantAgent实例,在后台任务时拉起应用 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left wantAgentInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left wantAgent . WantAgentInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { // 点击通知后,将要执行的动作列表 // 添加需要被拉起应用的bundleName和abilityName AST#property_assignment#Left AST#property_name#Left wants AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left "com.north.cases" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left "com.north.cases.EntryAbility" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , // 指定点击通知栏消息后的动作是拉起ability AST#property_assignment#Left AST#property_name#Left actionType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . OperationType AST#member_expression#Right AST#expression#Right . START_ABILITY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 使用者自定义的一个私有值 AST#property_assignment#Left AST#property_name#Left requestCode AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // 点击通知后,动作执行属性 AST#property_assignment#Left AST#property_name#Left actionFlags AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . WantAgentFlags AST#member_expression#Right AST#expression#Right . UPDATE_PRESENT_FLAG 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 通过wantAgent模块下getWantAgent方法获取WantAgent对象 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 wantAgent AST#expression#Right . getWantAgent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wantAgentInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left wantAgentObj : AST#type_annotation#Left AST#primary_type#Left WantAgent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // TODO:知识点:设置后台任务类型,启动后台任务 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left backgroundTaskManager AST#expression#Right . startBackgroundRunning AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bindContext AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left backgroundTaskManager AST#expression#Right . BackgroundMode AST#member_expression#Right AST#expression#Right . AUDIO_PLAYBACK AST#member_expression#Right AST#expression#Right , AST#expression#Left wantAgentObj AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 此处执行具体的长时任务逻辑,如放音等。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Succeeded in operationing startBackgroundRunning. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBackgroundTaskRunning AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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 ` Failed to operation startBackgroundRunning. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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
startContinuousTask(): void { if (this.isBackgroundTaskRunning) { return; } let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: "com.north.cases", abilityName: "com.north.cases.EntryAbility" } ], actionType: wantAgent.OperationType.START_ABILITY, requestCode: 0, actionFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] }; wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj: WantAgent) => { backgroundTaskManager.startBackgroundRunning(this.bindContext!, backgroundTaskManager.BackgroundMode.AUDIO_PLAYBACK, wantAgentObj).then(() => { console.info(`Succeeded in operationing startBackgroundRunning.`); this.isBackgroundTaskRunning = true; }).catch((err: BusinessError) => { console.error(`Failed to operation startBackgroundRunning. Code is ${err.code}, message is ${err.message}`); }); }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L279-L314
ca420195602bf9c6bebe9bf17d4f32e776fbbe7b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets
arkts
setAVPlayState
Setting the Playback Status of the Playback Control Center. @param state Status of the Playback Control Center.
public static setAVPlayState(state: avSession.PlaybackState) { if (state === undefined) { Logger.info(TAG, 'setAVPlayState fail,state is empty.'); return; } let currentSession = GlobalContext.getContext().getObject('currentSession') as avSession.AVSession; currentSession.setAVPlaybackState({ state: state }) .then(() => { Logger.info(TAG, 'setAVPlaybackState successfully'); }) .catch((err: Error) => { Logger.info(TAG, `setAVPlaybackState : ERROR : ${err}`); }); }
AST#method_declaration#Left public static setAVPlayState AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left avSession . PlaybackState AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left state 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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'setAVPlayState fail,state 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#variable_declaration#Left let AST#variable_declarator#Left currentSession = 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 'currentSession' 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 avSession . AVSession 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 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 currentSession AST#expression#Right . setAVPlaybackState 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 state AST#property_name#Right : AST#expression#Left state AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'setAVPlaybackState successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 ` setAVPlaybackState : ERROR : AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static setAVPlayState(state: avSession.PlaybackState) { if (state === undefined) { Logger.info(TAG, 'setAVPlayState fail,state is empty.'); return; } let currentSession = GlobalContext.getContext().getObject('currentSession') as avSession.AVSession; currentSession.setAVPlaybackState({ state: state }) .then(() => { Logger.info(TAG, 'setAVPlaybackState successfully'); }) .catch((err: Error) => { Logger.info(TAG, `setAVPlaybackState : ERROR : ${err}`); }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets#L77-L90
97b88f31797f2fa06540c3ca0e17b4a9add3e446
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ApplicationServices/OAID/entry/src/main/ets/common/CommonConstants.ets
arkts
Constants for components.
export class CommonConstants { /** * Text width percentage: 100%. */ static readonly TEXT_WIDTH: string = '100%'; /** * TextArea width percentage: 100%. */ static readonly TEXTAREA_WIDTH: string = '100%'; /** * Bottom width percentage: 85%. */ static readonly BOTTOM_WIDTH: string = '85%'; /** * Column height percentage: 100%. */ static readonly COLUMN_HEIGHT: string = '100%'; /** * DescStyle width percentage: 100%. */ static readonly DESC_STYLE_WIDTH: string = '100%'; /** * Windows bottom width percentage: 100%. */ static readonly WINDOWS_BOTTOM_WIDTH: string = '100%'; /** * Text opacity. */ static readonly TEXT_OPACITY: number = 0.6; /** * Divider opacity. */ static readonly DIVIDER_OPACITY: number = 0.4; }
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Text width percentage: 100%. */ AST#property_declaration#Left static readonly TEXT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * TextArea width percentage: 100%. */ AST#property_declaration#Left static readonly TEXTAREA_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * Bottom width percentage: 85%. */ AST#property_declaration#Left static readonly BOTTOM_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '85%' AST#expression#Right ; AST#property_declaration#Right /** * Column height percentage: 100%. */ AST#property_declaration#Left static readonly COLUMN_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * DescStyle width percentage: 100%. */ AST#property_declaration#Left static readonly DESC_STYLE_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * Windows bottom width percentage: 100%. */ AST#property_declaration#Left static readonly WINDOWS_BOTTOM_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * Text opacity. */ AST#property_declaration#Left static readonly TEXT_OPACITY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.6 AST#expression#Right ; AST#property_declaration#Right /** * Divider opacity. */ AST#property_declaration#Left static readonly DIVIDER_OPACITY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.4 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CommonConstants { static readonly TEXT_WIDTH: string = '100%'; static readonly TEXTAREA_WIDTH: string = '100%'; static readonly BOTTOM_WIDTH: string = '85%'; static readonly COLUMN_HEIGHT: string = '100%'; static readonly DESC_STYLE_WIDTH: string = '100%'; static readonly WINDOWS_BOTTOM_WIDTH: string = '100%'; static readonly TEXT_OPACITY: number = 0.6; static readonly DIVIDER_OPACITY: number = 0.4; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ApplicationServices/OAID/entry/src/main/ets/common/CommonConstants.ets#L19-L52
024c14a826c1909dd3998964512b626b6a48e1b4
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/NotificationUtil.ets
arkts
cancelNotice
取消通知 @param noticeId 通知id @param callBack 回调函数 @returns
static cancelNotice(noticeId: number, callBack?: () => void): void { notificationManager.cancel(noticeId, (err: Base.BusinessError) => { if (err) { ToastUtil.showToast('取消通知出错,原因为:' + err.message); } else { if (callBack) { callBack(); } } }); }
AST#method_declaration#Left static cancelNotice AST#parameter_list#Left ( AST#parameter#Left noticeId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callBack ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . cancel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left noticeId AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Base . BusinessError AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ToastUtil AST#expression#Right . showToast 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#expression#Right + AST#expression#Left err AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left callBack AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callBack AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static cancelNotice(noticeId: number, callBack?: () => void): void { notificationManager.cancel(noticeId, (err: Base.BusinessError) => { if (err) { ToastUtil.showToast('取消通知出错,原因为:' + err.message); } else { if (callBack) { callBack(); } } }); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/NotificationUtil.ets#L381-L391
e9ae63a244d92f04082a291d3b92c16609509a6e
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/model/userModel.ets
arkts
存储多个用户
constructor() { this.initializePreferences(); // 初始化时加载用户 }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initializePreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 初始化时加载用户 } AST#block_statement#Right AST#constructor_declaration#Right
constructor() { this.initializePreferences(); }
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/userModel.ets#L25-L27
05805cece660228763ddc8c3790b92595aff6340
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/Index.ets
arkts
buildQuickActions
构建快捷操作
@Builder buildQuickActions() { Column({ space: 16 }) { Text('快捷操作') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Row({ space: 16 }) { this.buildQuickActionItem('添加联系人', $r('app.media.ic_add'), () => { appRouter.goContactEdit(); }) this.buildQuickActionItem('导入联系人', $r('app.media.ic_import'), () => { appRouter.push(RoutePaths.CONTACT_IMPORT); }) this.buildQuickActionItem('统计分析', $r('app.media.ic_statistics'), () => { appRouter.goStatistics(); }) this.buildQuickActionItem('搜索', $r('app.media.ic_search'), () => { appRouter.goSearch(); }) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) } .width('100%') .padding(16) .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildQuickActions 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 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 '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildQuickActionItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '添加联系人' AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_add' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left appRouter AST#expression#Right . goContactEdit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildQuickActionItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '导入联系人' AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_import' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left appRouter AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RoutePaths AST#expression#Right . CONTACT_IMPORT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildQuickActionItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '统计分析' AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_statistics' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left appRouter AST#expression#Right . goStatistics AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildQuickActionItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '搜索' AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_search' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left appRouter AST#expression#Right . goSearch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.1)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildQuickActions() { Column({ space: 16 }) { Text('快捷操作') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Row({ space: 16 }) { this.buildQuickActionItem('添加联系人', $r('app.media.ic_add'), () => { appRouter.goContactEdit(); }) this.buildQuickActionItem('导入联系人', $r('app.media.ic_import'), () => { appRouter.push(RoutePaths.CONTACT_IMPORT); }) this.buildQuickActionItem('统计分析', $r('app.media.ic_statistics'), () => { appRouter.goStatistics(); }) this.buildQuickActionItem('搜索', $r('app.media.ic_search'), () => { appRouter.goSearch(); }) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) } .width('100%') .padding(16) .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L340-L379
e3471f81c9d959671e6d7a8640411c572ada4646
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets
arkts
useSocket
[End monitor_default_network_change] 原网络连接使用Socket模块建立连接
async function useSocket() { let tcpConnectOptions: socket.TCPConnectOptions = { address: netAddress, timeout: 6000 // 连接超时时间 }; /* 建立socket连接 */ sock.connect(tcpConnectOptions, (err: BusinessError) => { if (err) { Logger.error('connect fail'); promptAction.showToast({ message: 'Connect fail!', duration: 4000, // 提示消息持续时间 bottom: 300 // 提示消息与底部的距离 }); return; } Logger.info('connect success'); /* 通过socket发送数据 */ let tcpSendOptions: socket.TCPSendOptions = { data: 'Hello, server!' }; sock.send(tcpSendOptions).then(() => { Logger.info('send success'); promptAction.showToast({ message: 'Connect and Send successfully!', duration: 4000, // 提示消息持续时间 bottom: 300 // 提示消息与底部的距离 }); }).catch((err: BusinessError) => { Logger.error('send fail'); promptAction.showToast({ message: 'Send fail!', duration: 4000, // 提示消息持续时间 bottom: 300 // 提示消息与底部的距离 }); }); }); }
AST#function_declaration#Left async function useSocket AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tcpConnectOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . TCPConnectOptions 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 netAddress AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left 6000 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 /* 建立socket连接 */ AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sock AST#expression#Right . connect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tcpConnectOptions AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#Right ) AST#block_statement#Left { 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 'connect fail' AST#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 'Connect fail!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 4000 AST#expression#Right AST#property_assignment#Right , // 提示消息持续时间 AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right // 提示消息与底部的距离 } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'connect success' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right /* 通过socket发送数据 */ AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tcpSendOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . TCPSendOptions 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 'Hello, server!' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sock AST#expression#Right . send AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tcpSendOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'send success' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 'Connect and Send successfully!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 4000 AST#expression#Right AST#property_assignment#Right , // 提示消息持续时间 AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right // 提示消息与底部的距离 } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'send fail' AST#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 'Send fail!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 4000 AST#expression#Right AST#property_assignment#Right , // 提示消息持续时间 AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 300 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#function_declaration#Right
async function useSocket() { let tcpConnectOptions: socket.TCPConnectOptions = { address: netAddress, timeout: 6000 }; sock.connect(tcpConnectOptions, (err: BusinessError) => { if (err) { Logger.error('connect fail'); promptAction.showToast({ message: 'Connect fail!', duration: 4000, bottom: 300 }); return; } Logger.info('connect success'); let tcpSendOptions: socket.TCPSendOptions = { data: 'Hello, server!' }; sock.send(tcpSendOptions).then(() => { Logger.info('send success'); promptAction.showToast({ message: 'Connect and Send successfully!', duration: 4000, bottom: 300 }); }).catch((err: BusinessError) => { Logger.error('send fail'); promptAction.showToast({ message: 'Send fail!', duration: 4000, bottom: 300 }); }); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets#L49-L88
7b2fc546ce710a6b79c31f13eb497f92aa7125d8
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/HashTable.ets
arkts
hash
计算哈希值
private hash(key: K): number { const keyStr = String(key); let hash = 0; for (let i = 0; i < keyStr.length; i++) { hash = ((hash << 5) - hash) + keyStr.charCodeAt(i); hash = hash & hash; // Convert to 32bit integer } return Math.abs(hash) % this.capacity; }
AST#method_declaration#Left private hash AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left keyStr = AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hash = AST#expression#Left 0 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 keyStr AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hash = 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#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left hash AST#expression#Right << AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left hash AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left keyStr AST#expression#Right AST#binary_expression#Right AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hash = AST#expression#Left AST#binary_expression#Left AST#expression#Left hash AST#expression#Right & AST#expression#Left hash AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Convert to 32bit integer } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hash AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right % AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . capacity AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private hash(key: K): number { const keyStr = String(key); let hash = 0; for (let i = 0; i < keyStr.length; i++) { hash = ((hash << 5) - hash) + keyStr.charCodeAt(i); hash = hash & hash; } return Math.abs(hash) % this.capacity; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L34-L42
f3d992102b075c3458692a0e53bb7ed5d95f29b3
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
needsHighlight
Checks if the given index is set to be highlighted. @param index @return
public needsHighlight(index: number): boolean { // no highlight if (!this.valuesToHighlight()) return false; if (this.mIndicesToHighlight) { for (let i: number = 0; i < this.mIndicesToHighlight.length; i++) { // check if the xvalue for the given dataset needs highlight if ( /*(int)*/ Math.round(this.mIndicesToHighlight[i].getX()) == index) return true; } } return false; }
AST#method_declaration#Left public needsHighlight AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // no highlight AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . valuesToHighlight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#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#if_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 . mIndicesToHighlight AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mIndicesToHighlight AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { // check if the xvalue for the given dataset needs highlight AST#statement#Left AST#if_statement#Left if ( /*(int)*/ 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIndicesToHighlight AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . getX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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
public needsHighlight(index: number): boolean { if (!this.valuesToHighlight()) return false; if (this.mIndicesToHighlight) { for (let i: number = 0; i < this.mIndicesToHighlight.length; i++) { if ( Math.round(this.mIndicesToHighlight[i].getX()) == index) return true; } } return false; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L317-L333
7184be5cb3929bf0eb3756e9ba7659f78944874a
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/ArticleNode.ets
arkts
数据类型(开发者可以自行扩展数据属性) @param {number} type - 数据类型 @param {string} title - 数据标题 @param {string} url - 文章地址 @param {ArticleNode[]} children - 子数据列表
export class ArticleNode { public type: number = 0 public title: string = '' public url?: string = '' public children?:ArticleNode[] = [] }
AST#export_declaration#Left export AST#class_declaration#Left class ArticleNode AST#class_body#Left { AST#property_declaration#Left public type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left public title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left public url ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left public children ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ArticleNode [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ArticleNode { public type: number = 0 public title: string = '' public url?: string = '' public children?:ArticleNode[] = [] }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/ArticleNode.ets#L25-L30
337cae7044884737f8ab5ab4c9cbd2416bb07988
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/WindowUtil.ets
arkts
findWindow
查找name所对应的窗口。 @param name 窗口名字,即Configuration中的name。 @returns
static findWindow(name: string): window.Window { return window.findWindow(name); }
AST#method_declaration#Left static findWindow 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 AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . findWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name 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 findWindow(name: string): window.Window { return window.findWindow(name); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/WindowUtil.ets#L432-L434
ab556c03472c0af0b12a4c60b8ea6b461a9b7bca
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets
arkts
clear
只有退出和重启会调用
clear() { this._navigatorDelegateStack.clear(); this.globalPageRecordStack.clear(); }
AST#method_declaration#Left clear 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 . _navigatorDelegateStack AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . globalPageRecordStack AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
clear() { this._navigatorDelegateStack.clear(); this.globalPageRecordStack.clear(); }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets#L66-L69
768d257fa2dab7d97d29a41698d668d7cef2c382
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/guide/GuideService.ets
arkts
getGuideShowCount
获取引导显示次数
async getGuideShowCount(key: string): Promise<number> { try { const guideKey = `${this.GUIDE_PREFIX}${key}`; return await StorageManager.getNumber(`${guideKey}_count`, 0); } catch (error) { Logger.error('GuideService', `Failed to get guide show count: ${String(error)}`); return 0; } }
AST#method_declaration#Left async getGuideShowCount 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 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left guideKey = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . GUIDE_PREFIX AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left key 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left StorageManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getNumber 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 guideKey AST#expression#Right } AST#template_substitution#Right _count ` AST#template_literal#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'GuideService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to get guide show count: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left String 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#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getGuideShowCount(key: string): Promise<number> { try { const guideKey = `${this.GUIDE_PREFIX}${key}`; return await StorageManager.getNumber(`${guideKey}_count`, 0); } catch (error) { Logger.error('GuideService', `Failed to get guide show count: ${String(error)}`); return 0; } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/guide/GuideService.ets#L63-L71
8cd1f0e6678e4b53b104db4d8509c3297418a368
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/view/CardComponent.ets
arkts
CardComponent
CardComponent is a container with round corner.
@Component export default struct CardComponent { @BuilderParam children: () => void = () => {}; paddingValue: Padding | Length = { top: CardStyle.CARD_PADDING_VERTICAL, bottom: CardStyle.CARD_PADDING_VERTICAL, left: CardStyle.CARD_PADDING_HORIZONTAL, right: CardStyle.CARD_PADDING_HORIZONTAL }; marginValue: Margin | Length = { top: CardStyle.CARD_MARGIN_TOP, left: CardStyle.CARD_MARGIN_HORIZONTAL, right: CardStyle.CARD_MARGIN_HORIZONTAL }; colorValue: ResourceColor = $r('app.color.background1'); radiusValue: Length = CardStyle.CARD_RADIUS; build() { Column() { this.children() } .padding(this.paddingValue??{ top: CardStyle.CARD_PADDING_VERTICAL, bottom: CardStyle.CARD_PADDING_VERTICAL, left: CardStyle.CARD_PADDING_HORIZONTAL, right: CardStyle.CARD_PADDING_HORIZONTAL }) .margin(this.marginValue??{ top: CardStyle.CARD_MARGIN_TOP, left: CardStyle.CARD_MARGIN_HORIZONTAL, right: CardStyle.CARD_MARGIN_HORIZONTAL }) .backgroundColor(this.colorValue??$r('app.color.background1')) .borderRadius(this.radiusValue??CardStyle.CARD_RADIUS) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CardComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right children : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left paddingValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Padding AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = 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 CardStyle AST#expression#Right . CARD_PADDING_VERTICAL 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 CardStyle AST#expression#Right . CARD_PADDING_VERTICAL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CardStyle AST#expression#Right . CARD_PADDING_HORIZONTAL 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 CardStyle AST#expression#Right . CARD_PADDING_HORIZONTAL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left marginValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Margin AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = 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 CardStyle AST#expression#Right . CARD_MARGIN_TOP AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CardStyle AST#expression#Right . CARD_MARGIN_HORIZONTAL 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 CardStyle AST#expression#Right . CARD_MARGIN_HORIZONTAL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left colorValue : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.background1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left radiusValue : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CardStyle AST#expression#Right . CARD_RADIUS AST#member_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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . children 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 . padding ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right ?? 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 CardStyle AST#expression#Right . CARD_PADDING_VERTICAL 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 CardStyle AST#expression#Right . CARD_PADDING_VERTICAL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CardStyle AST#expression#Right . CARD_PADDING_HORIZONTAL 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 CardStyle AST#expression#Right . CARD_PADDING_HORIZONTAL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right ?? 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 CardStyle AST#expression#Right . CARD_MARGIN_TOP AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CardStyle AST#expression#Right . CARD_MARGIN_HORIZONTAL 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 CardStyle AST#expression#Right . CARD_MARGIN_HORIZONTAL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . colorValue AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.background1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( 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 . radiusValue AST#member_expression#Right AST#expression#Right ?? AST#expression#Left CardStyle AST#expression#Right AST#binary_expression#Right AST#expression#Right . CARD_RADIUS 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 } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export default struct CardComponent { @BuilderParam children: () => void = () => {}; paddingValue: Padding | Length = { top: CardStyle.CARD_PADDING_VERTICAL, bottom: CardStyle.CARD_PADDING_VERTICAL, left: CardStyle.CARD_PADDING_HORIZONTAL, right: CardStyle.CARD_PADDING_HORIZONTAL }; marginValue: Margin | Length = { top: CardStyle.CARD_MARGIN_TOP, left: CardStyle.CARD_MARGIN_HORIZONTAL, right: CardStyle.CARD_MARGIN_HORIZONTAL }; colorValue: ResourceColor = $r('app.color.background1'); radiusValue: Length = CardStyle.CARD_RADIUS; build() { Column() { this.children() } .padding(this.paddingValue??{ top: CardStyle.CARD_PADDING_VERTICAL, bottom: CardStyle.CARD_PADDING_VERTICAL, left: CardStyle.CARD_PADDING_HORIZONTAL, right: CardStyle.CARD_PADDING_HORIZONTAL }) .margin(this.marginValue??{ top: CardStyle.CARD_MARGIN_TOP, left: CardStyle.CARD_MARGIN_HORIZONTAL, right: CardStyle.CARD_MARGIN_HORIZONTAL }) .backgroundColor(this.colorValue??$r('app.color.background1')) .borderRadius(this.radiusValue??CardStyle.CARD_RADIUS) } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/view/CardComponent.ets#L21-L56
0e413dd730b54f474b6eba05d5ff9c914ba9ee64
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/field_sensitive/references_object/constructor_field_001_T.ets
arkts
Introduction 构造函数
export function constructor_field_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a.data); }
AST#export_declaration#Left export AST#function_declaration#Left function constructor_field_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left a = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left A AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . data 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#function_declaration#Right AST#export_declaration#Right
export function constructor_field_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/references_object/constructor_field_001_T.ets#L6-L9
cbef10d53f91dd909c4014c5ec1612a0493f81c8
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets
arkts
setListener
设置回调
private static setListener(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => { }) { // 创建回调对象 let setListener: speechRecognizer.RecognitionListener = { // 开始识别成功回调 onStart(sessionId: string, eventMessage: string) { }, // 事件回调 onEvent(sessionId: string, eventCode: number, eventMessage: string) { }, // 识别结果回调,包括中间结果和最终结果 onResult(sessionId: string, result: speechRecognizer.SpeechRecognitionResult) { SpeechRecognizerManager.speechResult = result callback && callback(result) }, // 识别完成回调 onComplete(sessionId: string, eventMessage: string) { }, // 错误回调,错误码通过本方法返回 // 如:返回错误码1002200006,识别引擎正忙,引擎正在识别中 // 更多错误码请参考错误码参考 onError(sessionId: string, errorCode: number, errorMessage: string) { }, } // 设置回调 SpeechRecognizerManager.asrEngine?.setListener(setListener); }
AST#method_declaration#Left private static setListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left srr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionResult 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#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#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 创建回调对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left setListener : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . RecognitionListener AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { // 开始识别成功回调 AST#property_assignment#Left AST#property_name#Left onStart AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventMessage : 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#block_statement#Right AST#property_assignment#Right , // 事件回调 AST#property_assignment#Left AST#property_name#Left onEvent AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventMessage : 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#block_statement#Right AST#property_assignment#Right , // 识别结果回调,包括中间结果和最终结果 AST#property_assignment#Left AST#property_name#Left onResult AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left SpeechRecognizerManager AST#expression#Right . speechResult 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#binary_expression#Left AST#expression#Left callback AST#expression#Right && AST#expression#Left callback AST#expression#Right AST#binary_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#property_assignment#Right , // 识别完成回调 AST#property_assignment#Left AST#property_name#Left onComplete AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventMessage : 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#block_statement#Right AST#property_assignment#Right , // 错误回调,错误码通过本方法返回 // 如:返回错误码1002200006,识别引擎正忙,引擎正在识别中 // 更多错误码请参考错误码参考 AST#property_assignment#Left AST#property_name#Left onError AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMessage : 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#block_statement#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right // 设置回调 AST#ERROR#Left SpeechRecognizerManager AST#ERROR#Right . asrEngine AST#member_expression#Right AST#expression#Right ?. setListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left setListener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private static setListener(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => { }) { let setListener: speechRecognizer.RecognitionListener = { onStart(sessionId: string, eventMessage: string) { }, onEvent(sessionId: string, eventCode: number, eventMessage: string) { }, onResult(sessionId: string, result: speechRecognizer.SpeechRecognitionResult) { SpeechRecognizerManager.speechResult = result callback && callback(result) }, onComplete(sessionId: string, eventMessage: string) { }, onError(sessionId: string, errorCode: number, errorMessage: string) { }, } SpeechRecognizerManager.asrEngine?.setListener(setListener); }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets#L46-L72
6dbbfa0307b5e64d6e7bc105146d25f1dbfbab1f
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/RadarChartRenderer.ets
arkts
drawDataSet
Draws the RadarDataSet @param c @param dataSet @param mostEntries the entry count of the dataset with the most entries
protected drawDataSet(c: CanvasRenderingContext2D, dataSet: IRadarDataSet, mostEntries: number): void { if (!this.mAnimator) { return; } let phaseX: number = this.mAnimator.getPhaseX(); let phaseY: number = this.mAnimator.getPhaseY(); let sliceangle: number = this.mChart.getSliceAngle(); // calculate the factor that is needed for transforming the value to // pixels let factor: number = this.mChart.getFactor(); let center: MPPointF | null = this.mChart.getCenterOffsets(); let pOut: MPPointF = MPPointF.getInstance(0, 0); let surface: Path2D = this.mDrawDataSetSurfacePathBuffer; surface = new Path2D(); let hasMovedToPoint: boolean = false; for (let j = 0; j < dataSet.getEntryCount(); j++) { this.mRenderPaint.setColor(dataSet.getColor(j)); let e: RadarEntry = dataSet.getEntryForIndex(j); if (center) { pOut = Utils.getPosition( center, (e.getY() - this.mChart.getYChartMin()) * factor * phaseY, sliceangle * j * phaseX + this.mChart.getRotationAngle(), pOut); } if (Number.isNaN(pOut.x)) continue; if (!hasMovedToPoint) { surface.moveTo(pOut.x, pOut.y); hasMovedToPoint = true; } else surface.lineTo(pOut.x, pOut.y); } if (dataSet.getEntryCount() > mostEntries && center) { // if this is not the largest set, draw a line to the center before closing surface.lineTo(center.x, center.y); } surface.closePath(); // surface.close(); if (dataSet.isDrawFilledEnabled()) { this.drawFilledPathWithAlpha(c, surface, dataSet.getFillColor(), dataSet.getFillAlpha()); } this.mRenderPaint.setStrokeWidth(dataSet.getLineWidth()); this.mRenderPaint.setStyle(Style.STROKE); // draw the line (only if filled is disabled or alpha is below 255) if (!dataSet.isDrawFilledEnabled() || dataSet.getFillAlpha() < 255) { Utils.resetContext2DWithoutFont(c, this.mRenderPaint); c.beginPath(); c.stroke(surface); c.closePath(); } if (center) { MPPointF.recycleInstance(center); } MPPointF.recycleInstance(pOut); }
AST#method_declaration#Left protected drawDataSet AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#Left IRadarDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mostEntries : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mAnimator AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left phaseX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAnimator AST#member_expression#Right AST#expression#Right . getPhaseX 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 phaseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAnimator AST#member_expression#Right AST#expression#Right . getPhaseY 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 sliceangle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getSliceAngle 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 // calculate the factor that is needed for transforming the value to // pixels AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left factor : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getFactor 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 center : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left MPPointF AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getCenterOffsets 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 pOut : AST#type_annotation#Left AST#primary_type#Left MPPointF 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 MPPointF AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left surface : AST#type_annotation#Left AST#primary_type#Left Path2D AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawDataSetSurfacePathBuffer 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#assignment_expression#Left surface = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Path2D 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#variable_declaration#Left let AST#variable_declarator#Left hasMovedToPoint : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left j = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right < AST#expression#Left dataSet AST#expression#Right AST#binary_expression#Right AST#expression#Right . getEntryCount 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#update_expression#Left AST#expression#Left j AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderPaint AST#member_expression#Right AST#expression#Right . setColor 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 dataSet AST#expression#Right . getColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left j AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#primary_type#Left RadarEntry 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 dataSet AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left j 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 center AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pOut = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . getPosition AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left center AST#expression#Right , 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#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 e AST#expression#Right . getY 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 . mChart AST#member_expression#Right AST#expression#Right . getYChartMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left factor AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left phaseY 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sliceangle AST#expression#Right * AST#expression#Left j AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left phaseX AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getRotationAngle 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 pOut 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#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 AST#member_expression#Left AST#expression#Left pOut AST#expression#Right . x AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left hasMovedToPoint AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left surface AST#expression#Right . moveTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pOut AST#expression#Right . x AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left pOut AST#expression#Right . y AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hasMovedToPoint = 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 else AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left surface AST#expression#Right . lineTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pOut AST#expression#Right . x AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left pOut AST#expression#Right . y 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . getEntryCount 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 mostEntries AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left center AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // if this is not the largest set, draw a line to the center before closing AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left surface AST#expression#Right . lineTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left center AST#expression#Right . x AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left center AST#expression#Right . y AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left surface AST#expression#Right . closePath 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 // surface.close(); 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 dataSet AST#expression#Right . isDrawFilledEnabled 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 . drawFilledPathWithAlpha AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left c AST#expression#Right , AST#expression#Left surface AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . getFillColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . getFillAlpha AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderPaint AST#member_expression#Right AST#expression#Right . setStrokeWidth 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 dataSet AST#expression#Right . getLineWidth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderPaint AST#member_expression#Right AST#expression#Right . setStyle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Style AST#expression#Right . STROKE 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 // draw the line (only if filled is disabled or alpha is below 255) AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left dataSet AST#expression#Right AST#unary_expression#Right AST#expression#Right . isDrawFilledEnabled 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 dataSet AST#expression#Right AST#binary_expression#Right AST#expression#Right . getFillAlpha 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 255 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 Utils AST#expression#Right . resetContext2DWithoutFont AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left c AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderPaint 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 c AST#expression#Right . beginPath 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 c AST#expression#Right . stroke AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left surface AST#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 c AST#expression#Right . closePath 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#statement#Left AST#if_statement#Left if ( AST#expression#Left center 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 MPPointF AST#expression#Right . recycleInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left center AST#expression#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 MPPointF AST#expression#Right . recycleInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pOut AST#expression#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
protected drawDataSet(c: CanvasRenderingContext2D, dataSet: IRadarDataSet, mostEntries: number): void { if (!this.mAnimator) { return; } let phaseX: number = this.mAnimator.getPhaseX(); let phaseY: number = this.mAnimator.getPhaseY(); let sliceangle: number = this.mChart.getSliceAngle(); let factor: number = this.mChart.getFactor(); let center: MPPointF | null = this.mChart.getCenterOffsets(); let pOut: MPPointF = MPPointF.getInstance(0, 0); let surface: Path2D = this.mDrawDataSetSurfacePathBuffer; surface = new Path2D(); let hasMovedToPoint: boolean = false; for (let j = 0; j < dataSet.getEntryCount(); j++) { this.mRenderPaint.setColor(dataSet.getColor(j)); let e: RadarEntry = dataSet.getEntryForIndex(j); if (center) { pOut = Utils.getPosition( center, (e.getY() - this.mChart.getYChartMin()) * factor * phaseY, sliceangle * j * phaseX + this.mChart.getRotationAngle(), pOut); } if (Number.isNaN(pOut.x)) continue; if (!hasMovedToPoint) { surface.moveTo(pOut.x, pOut.y); hasMovedToPoint = true; } else surface.lineTo(pOut.x, pOut.y); } if (dataSet.getEntryCount() > mostEntries && center) { surface.lineTo(center.x, center.y); } surface.closePath(); if (dataSet.isDrawFilledEnabled()) { this.drawFilledPathWithAlpha(c, surface, dataSet.getFillColor(), dataSet.getFillAlpha()); } this.mRenderPaint.setStrokeWidth(dataSet.getLineWidth()); this.mRenderPaint.setStyle(Style.STROKE); if (!dataSet.isDrawFilledEnabled() || dataSet.getFillAlpha() < 255) { Utils.resetContext2DWithoutFont(c, this.mRenderPaint); c.beginPath(); c.stroke(surface); c.closePath(); } if (center) { MPPointF.recycleInstance(center); } MPPointF.recycleInstance(pOut); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/RadarChartRenderer.ets#L93-L164
8b8ee561c2c85e860183e418626aaf772acaa3b6
gitee
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
体系分类 @param date @returns
export function systemCategory() { return axiosClient.get<SystemModel[]>({ url: `tree/json`, showLoading:true }) }
AST#export_declaration#Left export AST#function_declaration#Left function systemCategory AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axiosClient AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SystemModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` tree/json ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showLoading 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function systemCategory() { return axiosClient.get<SystemModel[]>({ url: `tree/json`, showLoading:true }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L193-L198
359ac77a7401de5a4553bf97f9458be9e7eebb85
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
pauseTask
暂停任务
async pauseTask(id: number): Promise<boolean> { return await this.updateTask(id, { status: 'pending' }); }
AST#method_declaration#Left async pauseTask 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . updateTask AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left status AST#property_name#Right : AST#expression#Left 'pending' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#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 pauseTask(id: number): Promise<boolean> { return await this.updateTask(id, { status: 'pending' }); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L347-L351
795a59e2415d5f7b15d42c39bc4cefc674f94ab3
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets
arkts
getChartPoint
Get chart point. @param {number} stepsValue Value of steps. @return {ChartPoint} chartPoint.
getChartPoint(stepsValue: number) { let chartPoint: ChartPoint = new ChartPoint(); // Value of a chart point. if the value exceeds 1000, only 1000 is displayed. chartPoint.value = Math.min(CommonConstants.TARGET_STEPS, stepsValue); chartPoint.description = stepsValue.toString(); // Display position of the chart point. set this parameter to above. chartPoint.textLocation = CommonConstants.TEXT_LOCATION; // Sets the color of the description font. chartPoint.textColor = CommonConstants.WHITE_COLOR; let pointStyle: PointStyle = new PointStyle(); pointStyle.size = CommonConstants.POINT_SIZE; pointStyle.fillColor = CommonConstants.WHITE_COLOR; pointStyle.strokeColor = CommonConstants.WHITE_COLOR; pointStyle.shape = CommonConstants.SHAPE_CIRCLE; chartPoint.pointStyle = pointStyle; return chartPoint; }
AST#method_declaration#Left getChartPoint AST#parameter_list#Left ( AST#parameter#Left stepsValue : 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 chartPoint : AST#type_annotation#Left AST#primary_type#Left ChartPoint 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 ChartPoint 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 // Value of a chart point. if the value exceeds 1000, only 1000 is displayed. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left chartPoint AST#expression#Right . value AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TARGET_STEPS AST#member_expression#Right AST#expression#Right , AST#expression#Left stepsValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left chartPoint AST#expression#Right . description AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stepsValue AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Display position of the chart point. set this parameter to above. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left chartPoint AST#expression#Right . textLocation AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TEXT_LOCATION AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Sets the color of the description font. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left chartPoint AST#expression#Right . textColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WHITE_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pointStyle : AST#type_annotation#Left AST#primary_type#Left PointStyle 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 PointStyle AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left pointStyle AST#expression#Right . size AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . POINT_SIZE 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 pointStyle AST#expression#Right . fillColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WHITE_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left pointStyle AST#expression#Right . strokeColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WHITE_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left pointStyle AST#expression#Right . shape AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SHAPE_CIRCLE 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 chartPoint AST#expression#Right . pointStyle AST#member_expression#Right = AST#expression#Left pointStyle 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 chartPoint AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getChartPoint(stepsValue: number) { let chartPoint: ChartPoint = new ChartPoint(); chartPoint.value = Math.min(CommonConstants.TARGET_STEPS, stepsValue); chartPoint.description = stepsValue.toString(); chartPoint.textLocation = CommonConstants.TEXT_LOCATION; chartPoint.textColor = CommonConstants.WHITE_COLOR; let pointStyle: PointStyle = new PointStyle(); pointStyle.size = CommonConstants.POINT_SIZE; pointStyle.fillColor = CommonConstants.WHITE_COLOR; pointStyle.strokeColor = CommonConstants.WHITE_COLOR; pointStyle.shape = CommonConstants.SHAPE_CIRCLE; chartPoint.pointStyle = pointStyle; return chartPoint; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets#L76-L92
004391a8cace6b6fc77258995cc47a616cbad95c
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/List_HDC/entry/src/main/ets/common/utils/Log.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export class Logger { private static isAppDebugMode: boolean = true; private static appIdentifier: string = 'List'; public static verbose(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().verbose(tag, msg); } } public static debug(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().debug(tag, msg); } } public static info(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().info(tag, msg); } } public static warn(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().warn(tag, msg); } } public static error(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().error(tag, msg); } } private static logger: Logger; private constructor() { } public static getInstance(): Logger { if (!Logger.logger) { Logger.logger = new Logger(); } return Logger.logger; } public verbose(tag: string, msg: string): void { console.log(`[${Logger.appIdentifier}] [verbose] tag:${tag} msg:${msg}`); } public debug(tag: string, msg: string): void { console.debug(`[${Logger.appIdentifier}] [debug] tag:${tag} msg:${msg}`); } public info(tag: string, msg: string): void { console.info(`[${Logger.appIdentifier}] [info] tag:${tag} msg:${msg}`); } public warn(tag: string, msg: string): void { console.warn(`[${Logger.appIdentifier}] [warn] tag:${tag} msg:${msg}`); } public error(tag: string, msg: string): void { console.error(`[${Logger.appIdentifier}] [error] tag:${tag} msg:${msg}`); } }
AST#export_declaration#Left export AST#class_declaration#Left class Logger AST#class_body#Left { AST#property_declaration#Left private static isAppDebugMode : 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 static appIdentifier : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'List' AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public static verbose AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#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 Logger AST#expression#Right . isAppDebugMode AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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 . verbose AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag AST#expression#Right , AST#expression#Left msg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public static debug AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#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 Logger AST#expression#Right . isAppDebugMode AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag AST#expression#Right , AST#expression#Left msg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public static info AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#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 Logger AST#expression#Right . isAppDebugMode AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag AST#expression#Right , AST#expression#Left msg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public static warn AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#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 Logger AST#expression#Right . isAppDebugMode AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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 . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag AST#expression#Right , AST#expression#Left msg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public static error AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#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 Logger AST#expression#Right . isAppDebugMode AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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 . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag AST#expression#Right , AST#expression#Left msg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#property_declaration#Left private static logger : AST#type_annotation#Left AST#primary_type#Left Logger AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Logger AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left Logger AST#expression#Right AST#unary_expression#Right AST#expression#Right . logger 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 Logger AST#expression#Right . logger AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Logger AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . logger AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public verbose AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . appIdentifier AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] [verbose] tag: AST#template_substitution#Left $ { AST#expression#Left tag AST#expression#Right } AST#template_substitution#Right msg: AST#template_substitution#Left $ { AST#expression#Left msg 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public debug AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . appIdentifier AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] [debug] tag: AST#template_substitution#Left $ { AST#expression#Left tag AST#expression#Right } AST#template_substitution#Right msg: AST#template_substitution#Left $ { AST#expression#Left msg 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public info AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . appIdentifier AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] [info] tag: AST#template_substitution#Left $ { AST#expression#Left tag AST#expression#Right } AST#template_substitution#Right msg: AST#template_substitution#Left $ { AST#expression#Left msg 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public warn AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . appIdentifier AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] [warn] tag: AST#template_substitution#Left $ { AST#expression#Left tag AST#expression#Right } AST#template_substitution#Right msg: AST#template_substitution#Left $ { AST#expression#Left msg 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public error AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . appIdentifier AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] [error] tag: AST#template_substitution#Left $ { AST#expression#Left tag AST#expression#Right } AST#template_substitution#Right msg: AST#template_substitution#Left $ { AST#expression#Left msg 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#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Logger { private static isAppDebugMode: boolean = true; private static appIdentifier: string = 'List'; public static verbose(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().verbose(tag, msg); } } public static debug(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().debug(tag, msg); } } public static info(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().info(tag, msg); } } public static warn(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().warn(tag, msg); } } public static error(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().error(tag, msg); } } private static logger: Logger; private constructor() { } public static getInstance(): Logger { if (!Logger.logger) { Logger.logger = new Logger(); } return Logger.logger; } public verbose(tag: string, msg: string): void { console.log(`[${Logger.appIdentifier}] [verbose] tag:${tag} msg:${msg}`); } public debug(tag: string, msg: string): void { console.debug(`[${Logger.appIdentifier}] [debug] tag:${tag} msg:${msg}`); } public info(tag: string, msg: string): void { console.info(`[${Logger.appIdentifier}] [info] tag:${tag} msg:${msg}`); } public warn(tag: string, msg: string): void { console.warn(`[${Logger.appIdentifier}] [warn] tag:${tag} msg:${msg}`); } public error(tag: string, msg: string): void { console.error(`[${Logger.appIdentifier}] [error] tag:${tag} msg:${msg}`); } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/utils/Log.ets#L16-L82
cafa8dea9a275535a1a639617a8423cf30c31f7f
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/components/feature/src/main/ets/pages/DialogBoxes/BindContentCoverBootcamp.ets
arkts
compEventTriggeredLog
compEvent
compEventTriggeredLog(value: string) { let time = formatDate(new Date(Date.now())) this.listEventTriggeredTagsTemp.push( new BlockTag(time, value) ) setTimeout(() => { if (AppStorage.get('Block')) { this.listEventTriggeredTags = this.listEventTriggeredTags.concat( this.listEventTriggeredTagsTemp ); this.listEventTriggeredTagsTemp = []; } else { if (this.listEventTriggeredTagsTemp) { this.listEventTriggeredTags = this.listEventTriggeredTags.concat( this.listEventTriggeredTagsTemp ); } if (this.listEventTriggeredTags) { this.listEventTriggeredTagsTemp = []; } } }, 200) }
AST#method_declaration#Left compEventTriggeredLog 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#variable_declaration#Left let AST#variable_declarator#Left time = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left formatDate 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . listEventTriggeredTagsTemp AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left BlockTag AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left time AST#expression#Right , AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left setTimeout AST#ERROR#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 AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Block' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listEventTriggeredTags AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listEventTriggeredTags AST#member_expression#Right AST#expression#Right . concat 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 . listEventTriggeredTagsTemp AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listEventTriggeredTagsTemp 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 else 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 . listEventTriggeredTagsTemp 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 . listEventTriggeredTags AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listEventTriggeredTags AST#member_expression#Right AST#expression#Right . concat 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 . listEventTriggeredTagsTemp AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listEventTriggeredTags 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 . listEventTriggeredTagsTemp 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#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#expression#Left 200 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
compEventTriggeredLog(value: string) { let time = formatDate(new Date(Date.now())) this.listEventTriggeredTagsTemp.push( new BlockTag(time, value) ) setTimeout(() => { if (AppStorage.get('Block')) { this.listEventTriggeredTags = this.listEventTriggeredTags.concat( this.listEventTriggeredTagsTemp ); this.listEventTriggeredTagsTemp = []; } else { if (this.listEventTriggeredTagsTemp) { this.listEventTriggeredTags = this.listEventTriggeredTags.concat( this.listEventTriggeredTagsTemp ); } if (this.listEventTriggeredTags) { this.listEventTriggeredTagsTemp = []; } } }, 200) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/components/feature/src/main/ets/pages/DialogBoxes/BindContentCoverBootcamp.ets#L78-L100
acca9680e44d354432fc20ea6c8b4f550defe67e
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
media/Image/photomodify/index.ets
arkts
logger
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { logger } from './src/main/ets/components/util/Logger'
AST#export_declaration#Left export { logger } from './src/main/ets/components/util/Logger' AST#export_declaration#Right
export { logger } from './src/main/ets/components/util/Logger'
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/media/Image/photomodify/index.ets#L16-L16
5ab8e21ac4640dbda2a3fedf6b56295081b111f9
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
openExtensionServiceManagementApplicationListener
listen extensionService application
openExtensionServiceManagementApplicationListener() { try { bundleMonitor.on('add', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Add bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor add, result: ${JSON.stringify(exception)}`); } try { bundleMonitor.on('update', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Update bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor update, result: ${JSON.stringify(exception)}`); } try { bundleMonitor.on('remove', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Remove bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor remove, result: ${JSON.stringify(exception)}`); } }
AST#method_declaration#Left openExtensionServiceManagementApplicationListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleMonitor AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'add' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left bundleChangeInfo AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right Add bundleName: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right userId: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . userId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setExtensionServiceManagementListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( exception ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right failed subscribe bundleMonitor add, result: 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 exception AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#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 bundleMonitor AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'update' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left bundleChangeInfo AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right Update bundleName: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right userId: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . userId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setExtensionServiceManagementListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( exception ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right failed subscribe bundleMonitor update, result: 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 exception AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#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 bundleMonitor AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'remove' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left bundleChangeInfo AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right Remove bundleName: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right userId: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . userId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setExtensionServiceManagementListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( exception ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right failed subscribe bundleMonitor remove, result: 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 exception AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
openExtensionServiceManagementApplicationListener() { try { bundleMonitor.on('add', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Add bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor add, result: ${JSON.stringify(exception)}`); } try { bundleMonitor.on('update', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Update bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor update, result: ${JSON.stringify(exception)}`); } try { bundleMonitor.on('remove', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Remove bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor remove, result: ${JSON.stringify(exception)}`); } }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L104-L129
e771ec4e7acc3f7041aa0e37fdfd7d2c482f9278
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
convertSM2PubKey
将服务器端生成的16进制的长度为130位的04开头的C1C3C2格式的SM2公钥转换为前端所需的ASN.1格式公钥字符串 @param pubKey 04开头的16进制的130位的公钥字符串 @returns 转换后的公钥字符串
static async convertSM2PubKey(pubKey: string): Promise<string> { if (pubKey.length != 130) { return '服务器端SM2公钥长度不正确~'; } //截取x参数 let px = pubKey.substring(2, 66); //截取y参数 let py = pubKey.substring(66); //转16进制放入对应的位置 04+x+y let pk: cryptoFramework.Point = { x: BigInt("0x" + px), y: BigInt("0x" + py) } //构建SM2公钥参数对象 let keyPair: cryptoFramework.ECCPubKeySpec = { params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'), pk: pk, algName: 'SM2', specType: cryptoFramework.AsyKeySpecType.PUBLIC_KEY_SPEC } //创建密钥生成器 let keyPairGenerator = await cryptoFramework.createAsyKeyGeneratorBySpec(keyPair); //生成uint8Array格式密钥 let unit8PubKey = await keyPairGenerator.generatePubKey(); //转换成鸿蒙所需公钥字符串 return StrAndUintUtil.unitArray2String(unit8PubKey.getEncoded().data); }
AST#method_declaration#Left static async convertSM2PubKey AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pubKey AST#expression#Right . length AST#member_expression#Right AST#expression#Right != AST#expression#Left 130 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '服务器端SM2公钥长度不正确~' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //截取x参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left px = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pubKey AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left 66 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 //截取y参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left py = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pubKey AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 66 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 //转16进制放入对应的位置 04+x+y AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pk : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . Point 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 x AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left px AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "0x" AST#expression#Right + AST#expression#Left py AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //构建SM2公钥参数对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyPair : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ECCPubKeySpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . ECCKeyUtil AST#member_expression#Right AST#expression#Right . genECCCommonParamsSpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NID_sm2' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pk AST#property_name#Right : AST#expression#Left pk AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left algName AST#property_name#Right : AST#expression#Left 'SM2' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left specType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . AsyKeySpecType AST#member_expression#Right AST#expression#Right . PUBLIC_KEY_SPEC AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //创建密钥生成器 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyPairGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cryptoFramework AST#expression#Right AST#await_expression#Right AST#expression#Right . createAsyKeyGeneratorBySpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyPair AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //生成uint8Array格式密钥 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left unit8PubKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left keyPairGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . generatePubKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换成鸿蒙所需公钥字符串 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2String AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left unit8PubKey AST#expression#Right . getEncoded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async convertSM2PubKey(pubKey: string): Promise<string> { if (pubKey.length != 130) { return '服务器端SM2公钥长度不正确~'; } let px = pubKey.substring(2, 66); let py = pubKey.substring(66); let pk: cryptoFramework.Point = { x: BigInt("0x" + px), y: BigInt("0x" + py) } let keyPair: cryptoFramework.ECCPubKeySpec = { params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'), pk: pk, algName: 'SM2', specType: cryptoFramework.AsyKeySpecType.PUBLIC_KEY_SPEC } let keyPairGenerator = await cryptoFramework.createAsyKeyGeneratorBySpec(keyPair); let unit8PubKey = await keyPairGenerator.generatePubKey(); return StrAndUintUtil.unitArray2String(unit8PubKey.getEncoded().data); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L80-L106
15b44c0378dbc3b2379f8dbf443b10af202272c3
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets
arkts
MARK: - PlanHelper
export class DBPlanHelper { private plan: DBPlan; constructor(plan: DBPlan) { this.plan = plan; } // MARK: - Private Helpers /** 获取此 DBPlan 的 DBPieces */ async dbPieces(): Promise<DBPiece[]> { if (this.plan.planId) { return await PlanDbAccess.shared.getPieces(this.plan.planId) ?? []; } return []; } /** 获取此 DBPlan 的 DBBoxes,可选过滤 pieceNo、num、distances */ async dbBoxes(pieceNo?: number, num?: number, distances?: Set<number>): Promise<DBBox[]> { if (!this.plan.planId) return []; let boxes = await PlanDbAccess.shared.getBoxs(this.plan.planId, pieceNo) ?? []; if (num != null) { boxes = boxes.filter(b => (b.num ?? -1) === num); } if (distances != null) { boxes = boxes.filter(b => distances.has(b.distance ?? -1)); } return boxes; } /** 获取此 DBPlan 的所有 wordIds(可指定 pieceNo) */ async wordIds(pieceNo?: number): Promise<number[]> { const pieces = await this.dbPieces(); if (pieceNo != null) { return pieces.filter(p => p.pieceNo === pieceNo).map(p => p.wordId ?? 0).filter(id => id > 0); } return pieces.map(p => p.wordId ?? 0).filter(id => id > 0); } /** 获取此 DBPlan 的 DBLearns */ async dbLearns(): Promise<DBLearn[]> { if (this.plan.planId) { return await PlanDbAccess.shared.getLearns(this.plan.planId) ?? []; } return []; } // MARK: - Utils for Plan /** 获取转换后的 Pieces */ async getPieces(): Promise<Piece[]> { const piecesSet = new Set<Piece>(); const dbPieces = await this.dbPieces(); dbPieces.forEach(dbPiece => { const pieceNo = dbPiece.pieceNo; const wordId = dbPiece.wordId; if (pieceNo != null && wordId) { const existed = Array.from(piecesSet).find(p => p.pieceNo === pieceNo); if (existed) { existed.appendMem(wordId); } else { piecesSet.add(new Piece(pieceNo, [wordId])); } } }); return Array.from(piecesSet).sort((a, b) => a.pieceNo - b.pieceNo); } /** 获取转换后的 Boxes */ async getBoxes(): Promise<Box[]> { const boxesSet = new Set<Box>(); const dbBoxes = await this.dbBoxes(); dbBoxes.forEach(dbBox => { const pieceNo = dbBox.pieceNo; const distance = dbBox.distance; if (pieceNo != null && distance != null) { boxesSet.add(new Box(distance, pieceNo)); // Set 自动去重 } }); return Array.from(boxesSet).sort((a, b) => a.pieceNo - b.pieceNo); } /** 获取转换后的 Learns */ async getLearns(): Promise<Learn[]> { // var learns = [Learn]() const learns = new Set<Learn>(); // 用Set更快 // 等待异步获取 dbLearns const dbLearnsArray: DBLearn[] = await this.dbLearns(); for (let i = 0; i < dbLearnsArray.length; i++) { const dbLearn = dbLearnsArray[i]; if (dbLearn.planId != null && dbLearn.bookId != null && dbLearn.num != null && dbLearn.distance != null && dbLearn.pieceNo != null && dbLearn.wordId != null && dbLearn.learnDate != null) { const learn = new Learn(); learn.planId = dbLearn.planId; learn.bookId = dbLearn.bookId; learn.num = dbLearn.num; learn.distance = dbLearn.distance; learn.pieceNo = dbLearn.pieceNo; learn.wordId = dbLearn.wordId; learn.learnDate = dbLearn.learnDate; //// 使用Set,无需判断Contains learns.add(learn); } } // 转数组并按 learnDate 升序排序 return Array.from(learns).sort((a, b) => (a.learnDate?.getTime() ?? 0) - (b.learnDate?.getTime() ?? 0)); } }
AST#export_declaration#Left export AST#class_declaration#Left class DBPlanHelper AST#class_body#Left { AST#property_declaration#Left private plan : AST#type_annotation#Left AST#primary_type#Left DBPlan AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left DBPlan 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 . plan AST#member_expression#Right = AST#expression#Left plan 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 // MARK: - Private Helpers /** 获取此 DBPlan 的 DBPieces */ AST#method_declaration#Left async dbPieces 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 DBPiece [ ] 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . plan AST#member_expression#Right AST#expression#Right . planId AST#member_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 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 PlanDbAccess AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . getPieces 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 . plan AST#member_expression#Right AST#expression#Right . planId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#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#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 获取此 DBPlan 的 DBBoxes,可选过滤 pieceNo、num、distances */ AST#method_declaration#Left async dbBoxes AST#parameter_list#Left ( AST#parameter#Left pieceNo ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#Left distances ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Set 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#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 DBBox [ ] 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#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 . plan AST#member_expression#Right AST#expression#Right . planId AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_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 let AST#variable_declarator#Left boxes = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PlanDbAccess AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . getBoxs 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 . plan AST#member_expression#Right AST#expression#Right . planId AST#member_expression#Right AST#expression#Right , AST#expression#Left pieceNo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#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 num 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#assignment_expression#Left boxes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left boxes AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left b => 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 b AST#expression#Right . num AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right 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#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 distances 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#assignment_expression#Left boxes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left boxes AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left b => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left distances AST#expression#Right . has 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 b AST#expression#Right . distance AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 boxes AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 获取此 DBPlan 的所有 wordIds(可指定 pieceNo) */ AST#method_declaration#Left async wordIds AST#parameter_list#Left ( AST#parameter#Left pieceNo ? : 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 number [ ] 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#variable_declaration#Left const AST#variable_declarator#Left pieces = 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 . dbPieces AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left pieceNo 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#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 pieces AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left p => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left p AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right === AST#expression#Left pieceNo AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left p => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left p AST#expression#Right . wordId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left id => AST#expression#Left AST#binary_expression#Left AST#expression#Left id AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pieces AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left p => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left p AST#expression#Right . wordId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left id => AST#expression#Left AST#binary_expression#Left AST#expression#Left id AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 获取此 DBPlan 的 DBLearns */ AST#method_declaration#Left async dbLearns 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 DBLearn [ ] 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . plan AST#member_expression#Right AST#expression#Right . planId AST#member_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 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 PlanDbAccess AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . getLearns 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 . plan AST#member_expression#Right AST#expression#Right . planId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#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#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - Utils for Plan /** 获取转换后的 Pieces */ AST#method_declaration#Left async getPieces 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 Piece [ ] 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#variable_declaration#Left const AST#variable_declarator#Left piecesSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Piece AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbPieces = 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 . dbPieces 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 dbPieces AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left dbPiece => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pieceNo = AST#expression#Left AST#member_expression#Left AST#expression#Left dbPiece AST#expression#Right . pieceNo 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 wordId = AST#expression#Left AST#member_expression#Left AST#expression#Left dbPiece AST#expression#Right . wordId AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left pieceNo 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 wordId 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 existed = 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 Array AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left piecesSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left p => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left p AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right === AST#expression#Left pieceNo AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left existed 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 existed AST#expression#Right . appendMem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wordId AST#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 piecesSet AST#expression#Right . add 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 Piece AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pieceNo AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left wordId AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 Array AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left piecesSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right - AST#expression#Left b AST#expression#Right AST#binary_expression#Right AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 获取转换后的 Boxes */ AST#method_declaration#Left async getBoxes 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 Box [ ] 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#variable_declaration#Left const AST#variable_declarator#Left boxesSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Box AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbBoxes = 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 . dbBoxes 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 dbBoxes AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left dbBox => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pieceNo = AST#expression#Left AST#member_expression#Left AST#expression#Left dbBox AST#expression#Right . pieceNo 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 distance = AST#expression#Left AST#member_expression#Left AST#expression#Left dbBox AST#expression#Right . distance AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left pieceNo 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 distance AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left boxesSet AST#expression#Right . add 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 Box AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left distance AST#expression#Right , AST#expression#Left pieceNo 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 // Set 自动去重 } 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#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 Array AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left boxesSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right - AST#expression#Left b AST#expression#Right AST#binary_expression#Right AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** 获取转换后的 Learns */ AST#method_declaration#Left async getLearns 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 Learn [ ] 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 { // var learns = [Learn]() AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left learns = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Learn AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 用Set更快 // 等待异步获取 dbLearns AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbLearnsArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DBLearn [ ] 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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbLearns 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 dbLearnsArray AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbLearn = AST#expression#Left AST#subscript_expression#Left AST#expression#Left dbLearnsArray AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dbLearn AST#expression#Right . planId 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 dbLearn AST#expression#Right AST#binary_expression#Right AST#expression#Right . bookId 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 dbLearn AST#expression#Right AST#binary_expression#Right AST#expression#Right . num 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 dbLearn AST#expression#Right AST#binary_expression#Right AST#expression#Right . distance 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 dbLearn AST#expression#Right AST#binary_expression#Right AST#expression#Right . pieceNo 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 dbLearn AST#expression#Right AST#binary_expression#Right AST#expression#Right . wordId 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 dbLearn AST#expression#Right AST#binary_expression#Right AST#expression#Right . learnDate 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left learn = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Learn AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left learn AST#expression#Right . planId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left dbLearn AST#expression#Right . planId 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 learn AST#expression#Right . bookId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left dbLearn AST#expression#Right . bookId 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 learn AST#expression#Right . num AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left dbLearn AST#expression#Right . num 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 learn AST#expression#Right . distance AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left dbLearn AST#expression#Right . distance 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 learn AST#expression#Right . pieceNo AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left dbLearn AST#expression#Right . pieceNo 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 learn AST#expression#Right . wordId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left dbLearn AST#expression#Right . wordId 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 learn AST#expression#Right . learnDate AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left dbLearn AST#expression#Right . learnDate AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //// 使用Set,无需判断Contains AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left learns AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left learn AST#expression#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 // 转数组并按 learnDate 升序排序 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 Array AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left learns AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . learnDate AST#member_expression#Right AST#expression#Right ?. getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . learnDate AST#member_expression#Right AST#expression#Right ?. getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class DBPlanHelper { private plan: DBPlan; constructor(plan: DBPlan) { this.plan = plan; } async dbPieces(): Promise<DBPiece[]> { if (this.plan.planId) { return await PlanDbAccess.shared.getPieces(this.plan.planId) ?? []; } return []; } async dbBoxes(pieceNo?: number, num?: number, distances?: Set<number>): Promise<DBBox[]> { if (!this.plan.planId) return []; let boxes = await PlanDbAccess.shared.getBoxs(this.plan.planId, pieceNo) ?? []; if (num != null) { boxes = boxes.filter(b => (b.num ?? -1) === num); } if (distances != null) { boxes = boxes.filter(b => distances.has(b.distance ?? -1)); } return boxes; } async wordIds(pieceNo?: number): Promise<number[]> { const pieces = await this.dbPieces(); if (pieceNo != null) { return pieces.filter(p => p.pieceNo === pieceNo).map(p => p.wordId ?? 0).filter(id => id > 0); } return pieces.map(p => p.wordId ?? 0).filter(id => id > 0); } async dbLearns(): Promise<DBLearn[]> { if (this.plan.planId) { return await PlanDbAccess.shared.getLearns(this.plan.planId) ?? []; } return []; } async getPieces(): Promise<Piece[]> { const piecesSet = new Set<Piece>(); const dbPieces = await this.dbPieces(); dbPieces.forEach(dbPiece => { const pieceNo = dbPiece.pieceNo; const wordId = dbPiece.wordId; if (pieceNo != null && wordId) { const existed = Array.from(piecesSet).find(p => p.pieceNo === pieceNo); if (existed) { existed.appendMem(wordId); } else { piecesSet.add(new Piece(pieceNo, [wordId])); } } }); return Array.from(piecesSet).sort((a, b) => a.pieceNo - b.pieceNo); } async getBoxes(): Promise<Box[]> { const boxesSet = new Set<Box>(); const dbBoxes = await this.dbBoxes(); dbBoxes.forEach(dbBox => { const pieceNo = dbBox.pieceNo; const distance = dbBox.distance; if (pieceNo != null && distance != null) { boxesSet.add(new Box(distance, pieceNo)); } }); return Array.from(boxesSet).sort((a, b) => a.pieceNo - b.pieceNo); } async getLearns(): Promise<Learn[]> { const learns = new Set<Learn>(); const dbLearnsArray: DBLearn[] = await this.dbLearns(); for (let i = 0; i < dbLearnsArray.length; i++) { const dbLearn = dbLearnsArray[i]; if (dbLearn.planId != null && dbLearn.bookId != null && dbLearn.num != null && dbLearn.distance != null && dbLearn.pieceNo != null && dbLearn.wordId != null && dbLearn.learnDate != null) { const learn = new Learn(); learn.planId = dbLearn.planId; learn.bookId = dbLearn.bookId; learn.num = dbLearn.num; learn.distance = dbLearn.distance; learn.pieceNo = dbLearn.pieceNo; learn.wordId = dbLearn.wordId; learn.learnDate = dbLearn.learnDate; learns.add(learn); } } return Array.from(learns).sort((a, b) => (a.learnDate?.getTime() ?? 0) - (b.learnDate?.getTime() ?? 0)); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets#L8-L135
4592c351c125c56039c6d41dfebd487b4c4cf72d
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/common/AppTheme.ets
arkts
主题管理器
export class ThemeManager { private static instance: ThemeManager; private currentTheme: AppTheme = lightTheme; private listeners: ((theme: AppTheme) => void)[] = []; private constructor() {} static getInstance(): ThemeManager { if (!ThemeManager.instance) { ThemeManager.instance = new ThemeManager(); } return ThemeManager.instance; } getCurrentTheme(): AppTheme { return this.currentTheme; } setTheme(theme: AppTheme): void { this.currentTheme = theme; this.notifyListeners(); } toggleTheme(): void { this.currentTheme = this.currentTheme.isDark ? lightTheme : darkTheme; this.notifyListeners(); } addThemeListener(listener: (theme: AppTheme) => void): void { this.listeners.push(listener); } removeThemeListener(listener: (theme: AppTheme) => void): void { const index = this.listeners.indexOf(listener); if (index > -1) { this.listeners.splice(index, 1); } } private notifyListeners(): void { this.listeners.forEach(listener => listener(this.currentTheme)); } }
AST#export_declaration#Left export AST#class_declaration#Left class ThemeManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left ThemeManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private currentTheme : AST#type_annotation#Left AST#primary_type#Left AppTheme AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left lightTheme AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private listeners : AST#ERROR#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left AppTheme AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ThemeManager AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left ThemeManager AST#expression#Right AST#unary_expression#Right AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ThemeManager AST#expression#Right . instance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ThemeManager AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ThemeManager AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left getCurrentTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppTheme AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTheme AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left setTheme AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left AppTheme 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 . currentTheme AST#member_expression#Right = AST#expression#Left theme AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyListeners AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left toggleTheme 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 . currentTheme 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 . currentTheme AST#member_expression#Right AST#expression#Right . isDark AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lightTheme AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left darkTheme AST#primary_type#Right AST#type_annotation#Right ; this AST#ERROR#Right . notifyListeners AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left addThemeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left AppTheme 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left removeThemeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left AppTheme 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#variable_declaration#Left const AST#variable_declarator#Left index = 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 index AST#expression#Right > AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#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 index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private notifyListeners AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#expression#Left AST#call_expression#Left AST#expression#Left listener AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTheme 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ThemeManager { private static instance: ThemeManager; private currentTheme: AppTheme = lightTheme; private listeners: ((theme: AppTheme) => void)[] = []; private constructor() {} static getInstance(): ThemeManager { if (!ThemeManager.instance) { ThemeManager.instance = new ThemeManager(); } return ThemeManager.instance; } getCurrentTheme(): AppTheme { return this.currentTheme; } setTheme(theme: AppTheme): void { this.currentTheme = theme; this.notifyListeners(); } toggleTheme(): void { this.currentTheme = this.currentTheme.isDark ? lightTheme : darkTheme; this.notifyListeners(); } addThemeListener(listener: (theme: AppTheme) => void): void { this.listeners.push(listener); } removeThemeListener(listener: (theme: AppTheme) => void): void { const index = this.listeners.indexOf(listener); if (index > -1) { this.listeners.splice(index, 1); } } private notifyListeners(): void { this.listeners.forEach(listener => listener(this.currentTheme)); } }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/common/AppTheme.ets#L68-L110
f135ab598b78f6a37745a317a2cd0e1e303d5bc9
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.inputMethodList.d.ets
arkts
@file @kit IMEKit Define pattern options of keyboard. @interface PatternOptions @syscap SystemCapability.MiscServices.InputMethodFramework @since 11
export interface PatternOptions { /** * The default selected pattern, The defaultSelected will default to 0 if left blank * * @type { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ defaultSelected?: number; /** * the patterns of input method. * * @type { Array<Pattern> } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ patterns: Array<Pattern>; /** * An action callback. When the pattern icon clicked, the callback will be invoked. * * @type { function } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ action: (index: number) => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PatternOptions AST#object_type#Left { /** * The default selected pattern, The defaultSelected will default to 0 if left blank * * @type { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ AST#type_member#Left defaultSelected ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * the patterns of input method. * * @type { Array<Pattern> } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ AST#type_member#Left patterns : 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 Pattern 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_member#Right ; /** * An action callback. When the pattern icon clicked, the callback will be invoked. * * @type { function } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ AST#type_member#Left action : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface PatternOptions { defaultSelected?: number; patterns: Array<Pattern>; action: (index: number) => void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.inputMethodList.d.ets#L26-L51
ccb7726d25a40051d3d6bb01fe86861d0d268817
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/lineCharts/LineChartNotAxisConfigPage.ets
arkts
menuCallback
标题栏菜单回调
@Monitor("titleModel.index") menuCallback() { if (this.titleModel === null || this.titleModel === undefined) { return } let index: number = this.titleModel.getIndex() if (index === undefined || index === null || index === -1) { return } if (this.model === null || this.model === undefined) { return } let data = this.model.getData(); let sets: JArrayList<ILineDataSet> | null = null; if (data) { sets = data.getDataSets(); } const animateFun = (s: string) => { this.titleSelectString = s this.animate() } const toggleDrawIcon = (sets: JArrayList<ILineDataSet> | null) => { if (sets) { for (let i = 0; i < sets.size(); i++) { let set = sets.get(i) as LineDataSet; set.setDrawIcons(!this.isDrawIcons) } this.isDrawIcons = !this.isDrawIcons this.model?.invalidate(); } } switch (this.menuItemArr[index]) { case 'Animate X': animateFun('X') break; case 'Animate Y': animateFun('Y') break;
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left "titleModel.index" AST#expression#Right ) AST#decorator#Right menuCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleModel AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . titleModel AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left return AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleModel AST#member_expression#Right AST#expression#Right . getIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left return AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . model AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left return AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . getData 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 sets : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ILineDataSet AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right 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 sets = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . getDataSets 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 const AST#variable_declarator#Left animateFun = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left s : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleSelectString AST#member_expression#Right = AST#expression#Left s 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 . animate 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toggleDrawIcon = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left sets : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ILineDataSet AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left sets AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left sets AST#expression#Right AST#binary_expression#Right AST#expression#Right . size 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#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left set = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sets AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left LineDataSet 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 set AST#expression#Right . setDrawIcons AST#member_expression#Right AST#expression#Right AST#argument_list#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 . isDrawIcons AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isDrawIcons 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 . isDrawIcons AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right ?. invalidate 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#ERROR#Left switch AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . menuItemArr AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Right AST#property_assignment#Left AST#property_name#Left 'Animate X' AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left animateFun AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'X' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'Animate Y' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left animateFun AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'Y' ) break AST#ERROR#Right ; AST#method_declaration#Right
@Monitor("titleModel.index") menuCallback() { if (this.titleModel === null || this.titleModel === undefined) { return } let index: number = this.titleModel.getIndex() if (index === undefined || index === null || index === -1) { return } if (this.model === null || this.model === undefined) { return } let data = this.model.getData(); let sets: JArrayList<ILineDataSet> | null = null; if (data) { sets = data.getDataSets(); } const animateFun = (s: string) => { this.titleSelectString = s this.animate() } const toggleDrawIcon = (sets: JArrayList<ILineDataSet> | null) => { if (sets) { for (let i = 0; i < sets.size(); i++) { let set = sets.get(i) as LineDataSet; set.setDrawIcons(!this.isDrawIcons) } this.isDrawIcons = !this.isDrawIcons this.model?.invalidate(); } } switch (this.menuItemArr[index]) { case 'Animate X': animateFun('X') break; case 'Animate Y': animateFun('Y') break;
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/lineCharts/LineChartNotAxisConfigPage.ets#L46-L89
ecce945e55890daa883cf2decd99ad55f23eac7f
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/IconListViewModel.ets
arkts
Icon status.
export interface IconStatus { normal: Resource, chosen: Resource }
AST#export_declaration#Left export AST#interface_declaration#Left interface IconStatus AST#object_type#Left { AST#type_member#Left normal : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left chosen : AST#type_annotation#Left AST#primary_type#Left Resource 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 IconStatus { normal: Resource, chosen: Resource }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/IconListViewModel.ets#L19-L22
3b29ee485033a865ae7ed38ab95733858a9fbf05
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Rdb/RdbUtils.ets
arkts
isCreateTable
确认创建
isCreateTable(tableName: string, columns: Array<ColumnInfo>): Promise<boolean> { return this.createTable(tableName, columns).then(() => { return true; }).catch((error: Error) => { return false; }); }
AST#method_declaration#Left isCreateTable AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left columns : 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 ColumnInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 this AST#expression#Right . createTable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tableName AST#expression#Right , AST#expression#Left columns 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#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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
isCreateTable(tableName: string, columns: Array<ColumnInfo>): Promise<boolean> { return this.createTable(tableName, columns).then(() => { return true; }).catch((error: Error) => { return false; }); }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbUtils.ets#L55-L61
8a05b6e8dbeb9fb85563cef4cdda374bded46905
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets
arkts
detachWeb
卸载Webview
detachWeb() : void { this.rootNode = null; }
AST#method_declaration#Left detachWeb 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 . rootNode 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#builder_function_body#Right AST#method_declaration#Right
detachWeb() : void { this.rootNode = null; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets#L80-L82
e5136a558b9f6eab3081f2410bae6d07892c808b
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/Memo.ets
arkts
Memo insert/update data
export interface MemoData { content: string; created_at: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface MemoData AST#object_type#Left { AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left created_at : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface MemoData { content: string; created_at: number; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/Memo.ets#L18-L21
ccf5e08cd432e319d865d7a5882b939816c2b478
github
AIxiaoHanBao/ArkTs-Study.git
31abbb6f91dd2333c8b7650d8f6010f39be846b9
entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * The index page message. */ static readonly INDEX_MESSAGE: string = 'Index Page'; /** * The src msg. */ static readonly SECOND_SRC_MSG: string = 'Index页面传来的数据'; /** * The second page url. */ static readonly SECOND_URL: string = 'pages/Test2'; /** * The second page message. */ static readonly SECOND_MESSAGE: string = 'Second Page'; /** * The src param. */ static readonly SECOND_SRC_PARAM: string = 'src'; /** * Full the width. */ static readonly FULL_WIDTH: string = '100%'; /** * Full the height. */ static readonly FULL_HEIGHT: string = '100%'; /** * The hello world font size. */ static readonly FONT_SIZE: string = '38fp'; /** * The param font size. */ static readonly PARAMS_FONT_SIZE: string = '20fp'; /** * The button font size. */ static readonly BUTTON_FONT_SIZE: string = '16fp'; /** * The button width. */ static readonly BUTTON_WIDTH: string = '296vp'; /** * The button height. */ static readonly BUTTON_HEIGHT: string = '40vp'; /** * The layout height. */ static readonly LAYOUT_HEIGHT: string = '140vp'; /** * The param opacity. */ static readonly PARAMS_OPACITY: number = 0.6; }
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The index page message. */ AST#property_declaration#Left static readonly INDEX_MESSAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Index Page' AST#expression#Right ; AST#property_declaration#Right /** * The src msg. */ AST#property_declaration#Left static readonly SECOND_SRC_MSG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Index页面传来的数据' AST#expression#Right ; AST#property_declaration#Right /** * The second page url. */ AST#property_declaration#Left static readonly SECOND_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/Test2' AST#expression#Right ; AST#property_declaration#Right /** * The second page message. */ AST#property_declaration#Left static readonly SECOND_MESSAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Second Page' AST#expression#Right ; AST#property_declaration#Right /** * The src param. */ AST#property_declaration#Left static readonly SECOND_SRC_PARAM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'src' AST#expression#Right ; AST#property_declaration#Right /** * Full the width. */ AST#property_declaration#Left static readonly FULL_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * Full the height. */ AST#property_declaration#Left static readonly FULL_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * The hello world font size. */ AST#property_declaration#Left static readonly FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '38fp' AST#expression#Right ; AST#property_declaration#Right /** * The param font size. */ AST#property_declaration#Left static readonly PARAMS_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '20fp' AST#expression#Right ; AST#property_declaration#Right /** * The button font size. */ AST#property_declaration#Left static readonly BUTTON_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '16fp' AST#expression#Right ; AST#property_declaration#Right /** * The button width. */ AST#property_declaration#Left static readonly BUTTON_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '296vp' AST#expression#Right ; AST#property_declaration#Right /** * The button height. */ AST#property_declaration#Left static readonly BUTTON_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '40vp' AST#expression#Right ; AST#property_declaration#Right /** * The layout height. */ AST#property_declaration#Left static readonly LAYOUT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '140vp' AST#expression#Right ; AST#property_declaration#Right /** * The param opacity. */ AST#property_declaration#Left static readonly PARAMS_OPACITY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.6 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class CommonConstants { static readonly INDEX_MESSAGE: string = 'Index Page'; static readonly SECOND_SRC_MSG: string = 'Index页面传来的数据'; static readonly SECOND_URL: string = 'pages/Test2'; static readonly SECOND_MESSAGE: string = 'Second Page'; static readonly SECOND_SRC_PARAM: string = 'src'; static readonly FULL_WIDTH: string = '100%'; static readonly FULL_HEIGHT: string = '100%'; static readonly FONT_SIZE: string = '38fp'; static readonly PARAMS_FONT_SIZE: string = '20fp'; static readonly BUTTON_FONT_SIZE: string = '16fp'; static readonly BUTTON_WIDTH: string = '296vp'; static readonly BUTTON_HEIGHT: string = '40vp'; static readonly LAYOUT_HEIGHT: string = '140vp'; static readonly PARAMS_OPACITY: number = 0.6; }
https://github.com/AIxiaoHanBao/ArkTs-Study.git/blob/31abbb6f91dd2333c8b7650d8f6010f39be846b9/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L89
86754871a105e3d97502212440c37df1157032b1
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/view/Home.ets
arkts
Home
"首页"内容
@Component export default struct Home { private swiperController: SwiperController = new SwiperController(); build() { Scroll() { Column({ space: CommonConstants.COMMON_SPACE }) { Column() { Text($r('app.string.mainPage_tabTitles_home')) .fontWeight(FontWeight.Medium) .fontSize($r('app.float.page_title_text_size')) .margin({ top: $r('app.float.mainPage_tabTitles_margin') }) .padding({ left: $r('app.float.mainPage_tabTitles_padding') }) } .width(CommonConstants.FULL_PARENT) .alignItems(HorizontalAlign.Start) Swiper(this.swiperController) { ForEach(mainViewModel.getSwiperImages(), (img: Resource) => { Image(img).borderRadius($r('app.float.home_swiper_borderRadius')) }, (img: Resource) => JSON.stringify(img.id)) } .margin({ top: $r('app.float.home_swiper_margin') }) .autoPlay(true) Grid() { ForEach(mainViewModel.getFirstGridData(), (item: ItemData) => { GridItem() { Column() { Image(item.image) .width($r('app.float.home_homeCell_size')) .height($r('app.float.home_homeCell_size')) Text(item.title) .fontSize($r('app.float.little_text_size')) .margin({ top: $r('app.float.home_homeCell_margin') }) } } }, (item: ItemData) => JSON.stringify(item)) } .columnsTemplate('1fr 1fr 1fr 1fr') .rowsTemplate('1fr 1fr') .columnsGap($r('app.float.home_grid_columnsGap')) .rowsGap($r('app.float.home_grid_rowGap')) .padding({ top: $r('app.float.home_grid_padding'), bottom: $r('app.float.home_grid_padding') }) .height($r('app.float.home_grid_height')) .backgroundColor(Color.White) .borderRadius($r('app.float.home_grid_borderRadius')) Text($r('app.string.home_list')) .fontSize($r('app.float.normal_text_size')) .fontWeight(FontWeight.Medium) .width(CommonConstants.FULL_PARENT) .margin({ top: $r('app.float.home_text_margin') }) Grid() { ForEach(mainViewModel.getSecondGridData(), (secondItem: ItemData) => { GridItem() { Column() { Text(secondItem.title) .fontSize($r('app.float.normal_text_size')) .fontWeight(FontWeight.Medium) Text(secondItem.others) .margin({ top: $r('app.float.home_list_margin') }) .fontSize($r('app.float.little_text_size')) .fontColor($r('app.color.home_grid_fontColor')) } .alignItems(HorizontalAlign.Start) } .padding({ top: $r('app.float.home_list_padding'), left: $r('app.float.home_list_padding') }) .borderRadius($r('app.float.home_backgroundImage_borderRadius')) .align(Alignment.TopStart) .backgroundImage(secondItem.image) .backgroundImageSize(ImageSize.Cover) .width(CommonConstants.FULL_PARENT) .height(CommonConstants.FULL_PARENT) }, (secondItem: ItemData) => JSON.stringify(secondItem)) } .width(CommonConstants.FULL_PARENT) .height($r('app.float.home_secondGrid_height')) .columnsTemplate('1fr 1fr') .rowsTemplate('1fr 1fr') .columnsGap($r('app.float.home_grid_columnsGap')) .rowsGap($r('app.float.home_grid_rowGap')) .margin({ bottom: $r('app.float.setting_button_bottom') }) } } .scrollBar(BarState.Off) .height(CommonConstants.FULL_PARENT) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct Home AST#component_body#Left { AST#property_declaration#Left private swiperController : AST#type_annotation#Left AST#primary_type#Left SwiperController 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 SwiperController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . COMMON_SPACE 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 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.mainPage_tabTitles_home' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.page_title_text_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.mainPage_tabTitles_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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.mainPage_tabTitles_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#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_PARENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Swiper ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperController AST#member_expression#Right AST#expression#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 mainViewModel AST#expression#Right . getSwiperImages 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 img : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left img AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_swiper_borderRadius' 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#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 img : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left img 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#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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_swiper_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . autoPlay ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_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 Grid ( ) 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 mainViewModel AST#expression#Right . getFirstGridData 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 item : AST#type_annotation#Left AST#primary_type#Left ItemData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . image AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_homeCell_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_homeCell_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.little_text_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_homeCell_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ItemData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . columnsTemplate ( AST#expression#Left '1fr 1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . rowsTemplate ( AST#expression#Left '1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_grid_columnsGap' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_grid_rowGap' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_grid_padding' 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.float.home_grid_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 . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_grid_height' 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 . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_grid_borderRadius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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.home_list' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.normal_text_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PARENT 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#resource_expression#Left $r ( AST#expression#Left 'app.float.home_text_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Grid ( ) AST#container_content_body#Left { 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 mainViewModel AST#expression#Right . getSecondGridData 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 secondItem : AST#type_annotation#Left AST#primary_type#Left ItemData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 secondItem AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.normal_text_size' 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left secondItem AST#expression#Right . others AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_list_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.little_text_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.home_grid_fontColor' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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#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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_list_padding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_list_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 . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_backgroundImage_borderRadius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . TopStart AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundImage ( AST#expression#Left AST#member_expression#Left AST#expression#Left secondItem AST#expression#Right . image AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundImageSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageSize AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PARENT 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 . FULL_PARENT 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#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 secondItem : AST#type_annotation#Left AST#primary_type#Left ItemData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left secondItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PARENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_secondGrid_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . columnsTemplate ( AST#expression#Left '1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . rowsTemplate ( AST#expression#Left '1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_grid_columnsGap' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.home_grid_rowGap' 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 bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.setting_button_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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PARENT 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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export default struct Home { private swiperController: SwiperController = new SwiperController(); build() { Scroll() { Column({ space: CommonConstants.COMMON_SPACE }) { Column() { Text($r('app.string.mainPage_tabTitles_home')) .fontWeight(FontWeight.Medium) .fontSize($r('app.float.page_title_text_size')) .margin({ top: $r('app.float.mainPage_tabTitles_margin') }) .padding({ left: $r('app.float.mainPage_tabTitles_padding') }) } .width(CommonConstants.FULL_PARENT) .alignItems(HorizontalAlign.Start) Swiper(this.swiperController) { ForEach(mainViewModel.getSwiperImages(), (img: Resource) => { Image(img).borderRadius($r('app.float.home_swiper_borderRadius')) }, (img: Resource) => JSON.stringify(img.id)) } .margin({ top: $r('app.float.home_swiper_margin') }) .autoPlay(true) Grid() { ForEach(mainViewModel.getFirstGridData(), (item: ItemData) => { GridItem() { Column() { Image(item.image) .width($r('app.float.home_homeCell_size')) .height($r('app.float.home_homeCell_size')) Text(item.title) .fontSize($r('app.float.little_text_size')) .margin({ top: $r('app.float.home_homeCell_margin') }) } } }, (item: ItemData) => JSON.stringify(item)) } .columnsTemplate('1fr 1fr 1fr 1fr') .rowsTemplate('1fr 1fr') .columnsGap($r('app.float.home_grid_columnsGap')) .rowsGap($r('app.float.home_grid_rowGap')) .padding({ top: $r('app.float.home_grid_padding'), bottom: $r('app.float.home_grid_padding') }) .height($r('app.float.home_grid_height')) .backgroundColor(Color.White) .borderRadius($r('app.float.home_grid_borderRadius')) Text($r('app.string.home_list')) .fontSize($r('app.float.normal_text_size')) .fontWeight(FontWeight.Medium) .width(CommonConstants.FULL_PARENT) .margin({ top: $r('app.float.home_text_margin') }) Grid() { ForEach(mainViewModel.getSecondGridData(), (secondItem: ItemData) => { GridItem() { Column() { Text(secondItem.title) .fontSize($r('app.float.normal_text_size')) .fontWeight(FontWeight.Medium) Text(secondItem.others) .margin({ top: $r('app.float.home_list_margin') }) .fontSize($r('app.float.little_text_size')) .fontColor($r('app.color.home_grid_fontColor')) } .alignItems(HorizontalAlign.Start) } .padding({ top: $r('app.float.home_list_padding'), left: $r('app.float.home_list_padding') }) .borderRadius($r('app.float.home_backgroundImage_borderRadius')) .align(Alignment.TopStart) .backgroundImage(secondItem.image) .backgroundImageSize(ImageSize.Cover) .width(CommonConstants.FULL_PARENT) .height(CommonConstants.FULL_PARENT) }, (secondItem: ItemData) => JSON.stringify(secondItem)) } .width(CommonConstants.FULL_PARENT) .height($r('app.float.home_secondGrid_height')) .columnsTemplate('1fr 1fr') .rowsTemplate('1fr 1fr') .columnsGap($r('app.float.home_grid_columnsGap')) .rowsGap($r('app.float.home_grid_rowGap')) .margin({ bottom: $r('app.float.setting_button_bottom') }) } } .scrollBar(BarState.Off) .height(CommonConstants.FULL_PARENT) } }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/view/Home.ets#L8-L97
895cb85d583e2594025a536684ab7064cf3e1ed4
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
loadQueue
加载待听队列
async loadQueue() { try { this.queueEpisodes = await this.dbService.getQueueEpisodes(); console.info(`[MainPage] Loaded ${this.queueEpisodes.length} queue items`); } catch (error) { console.error('[MainPage] Failed to load queue:', error); } }
AST#method_declaration#Left async loadQueue AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . queueEpisodes AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbService AST#member_expression#Right AST#expression#Right . getQueueEpisodes 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainPage] Loaded 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 . queueEpisodes AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right queue items ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[MainPage] Failed to load queue:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async loadQueue() { try { this.queueEpisodes = await this.dbService.getQueueEpisodes(); console.info(`[MainPage] Loaded ${this.queueEpisodes.length} queue items`); } catch (error) { console.error('[MainPage] Failed to load queue:', error); } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L294-L301
5740e250e37c8158753da6e84630beffe49a4853
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/RequestUserAuthorization/entry/src/main/ets/secondability/SecondAbility.ets
arkts
onCreate
[StartExclude request_permission_in_UIAbility]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AbilityConstant . LaunchParam AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#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 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 onCreate' 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
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/RequestUserAuthorization/entry/src/main/ets/secondability/SecondAbility.ets#L59-L61
f4f9475d2f409916b34e077ddea3097512929119
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/GoodsCommentSubmitRequest.ets
arkts
@param {GoodsCommentSubmitRequest} init - 初始化数据
constructor(init: GoodsCommentSubmitRequest) { this.orderId = init.orderId; this.data = new Comment(init.data); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init : AST#type_annotation#Left AST#primary_type#Left GoodsCommentSubmitRequest 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 . orderId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . orderId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Comment AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
constructor(init: GoodsCommentSubmitRequest) { this.orderId = init.orderId; this.data = new Comment(init.data); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/GoodsCommentSubmitRequest.ets#L20-L23
4e29a70f79a3c745c0c7ed0bff4437b89a6dcded
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
createWindow
创建子窗口或者系统窗口,使用Promise异步回调。 @param config 创建窗口时的参数。 需要权限: 当创建窗口类型为window.WindowType.TYPE_FLOAT时,需要ohos.permission.SYSTEM_FLOAT_WINDOW权限 @returns
static async createWindow(config: window.Configuration): Promise<window.Window> { return window.createWindow(config); }
AST#method_declaration#Left static async createWindow AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Configuration AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . createWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left config AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async createWindow(config: window.Configuration): Promise<window.Window> { return window.createWindow(config); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L505-L507
96194bd47612f2fce2852b05e87122b613cd0f1d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets
arkts
AccountLogout
帐号登出
async AccountLogout() { Logger.info('AccountLogout start'); let accountInfo = await accountAbility.getOsAccountDistributedInfo(); let info: UserInfo = { name: '', id: '1234', event: 'Ohos.account.event.LOGIN', nickname: 'nickname', avatar: 'avatar' } if (accountInfo.name === 'ohosAnonymousName') { return } info.name = accountInfo.name info.event = 'Ohos.account.event.LOGOUT' await accountAbility.setOsAccountDistributedInfo(info); Logger.info('AccountLogout end'); }
AST#method_declaration#Left async AccountLogout AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AccountLogout start' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left accountInfo = 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 accountAbility AST#expression#Right AST#await_expression#Right AST#expression#Right . getOsAccountDistributedInfo 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 info : AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '1234' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left 'Ohos.account.event.LOGIN' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left nickname AST#property_name#Right : AST#expression#Left 'nickname' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left avatar AST#property_name#Right : AST#expression#Left 'avatar' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left accountInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left 'ohosAnonymousName' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left return AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left info AST#expression#Right . name AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left accountInfo AST#expression#Right . name 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 info AST#expression#Right . event AST#member_expression#Right = AST#expression#Left 'Ohos.account.event.LOGOUT' 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 accountAbility AST#expression#Right AST#await_expression#Right AST#expression#Right . setOsAccountDistributedInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left info AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AccountLogout end' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async AccountLogout() { Logger.info('AccountLogout start'); let accountInfo = await accountAbility.getOsAccountDistributedInfo(); let info: UserInfo = { name: '', id: '1234', event: 'Ohos.account.event.LOGIN', nickname: 'nickname', avatar: 'avatar' } if (accountInfo.name === 'ohosAnonymousName') { return } info.name = accountInfo.name info.event = 'Ohos.account.event.LOGOUT' await accountAbility.setOsAccountDistributedInfo(info); Logger.info('AccountLogout end'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets#L135-L152
f0d0b782f56553b31b36713e0d2183fd7760eae4
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/AES.ets
arkts
decryptGCM
解密(GCM模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|GCM|PKCS7、AES192|GCM|PKCS7、AES128|GCM|PKCS7)。 @returns
static async decryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7'): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher(transformation); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams); let decryptUpdate = await decoder.update(data); //GCM模式解密doFinal时传入空,验证init时传入的tag数据,如果验证失败会抛出异常。 await decoder.doFinal(null) return decryptUpdate; }
AST#method_declaration#Left static async decryptGCM AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left gcmParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . GcmParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'AES256|GCM|PKCS7' 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#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . DECRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left gcmParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decryptUpdate = 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 decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . update 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //GCM模式解密doFinal时传入空,验证init时传入的tag数据,如果验证失败会抛出异常。 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 decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left decryptUpdate AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async decryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7'): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher(transformation); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams); let decryptUpdate = await decoder.update(data); await decoder.doFinal(null) return decryptUpdate; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L73-L81
3acbf7cf3154fea14554a32af4c589300c21adf1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/groupavatar/src/main/ets/model/SnapShotModel.ets
arkts
setComponentId
设置id @param {string} componentId - 组件id
setComponentId(componentId: string) { this.componentId = componentId; }
AST#method_declaration#Left setComponentId AST#parameter_list#Left ( AST#parameter#Left componentId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . componentId AST#member_expression#Right = AST#expression#Left componentId AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
setComponentId(componentId: string) { this.componentId = componentId; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/model/SnapShotModel.ets#L37-L39
75bd34fbe3679efbbe044e964db85102bf58ec7a
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets
arkts
getLayoutInfoCache
getLayoutInfoCache
getLayoutInfoCache() { return this.layoutInfo; }
AST#method_declaration#Left getLayoutInfoCache AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . layoutInfo AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getLayoutInfoCache() { return this.layoutInfo; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L204-L206
7d897d30bda798f4808af689b7bd17ca703798c1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraServiceUint.ets
arkts
sessionFlowFn
会话流
async sessionFlowFn(cameraManager: camera.CameraManager, cameraInput: camera.CameraInput, previewOutput: camera.PreviewOutput | undefined): Promise<void> { try { // 创建CaptureSession实例 this.session = cameraManager.createSession(camera.SceneMode.NORMAL_PHOTO) as camera.PhotoSession; this.session.beginConfig(); this.session.addInput(cameraInput); this.session.addOutput(previewOutput); this.getPreviewRotation(); await this.session.commitConfig(); await this.session.start(); logger.info(TAG, 'sessionFlowFn success'); } catch (error) { logger.error(TAG, `sessionFlowFn fail : ${JSON.stringify(error)}`); } }
AST#method_declaration#Left async sessionFlowFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cameraInput : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraInput AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left previewOutput : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left camera . PreviewOutput AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 创建CaptureSession实例 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session 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 cameraManager AST#expression#Right . createSession AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left camera AST#expression#Right . SceneMode AST#member_expression#Right AST#expression#Right . NORMAL_PHOTO AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . PhotoSession AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . session AST#member_expression#Right AST#expression#Right . beginConfig AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right . addInput AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cameraInput AST#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 . session AST#member_expression#Right AST#expression#Right . addOutput AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left previewOutput AST#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 . getPreviewRotation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . session AST#member_expression#Right AST#expression#Right . commitConfig AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . session AST#member_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 'sessionFlowFn success' AST#expression#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 ` sessionFlowFn fail : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async sessionFlowFn(cameraManager: camera.CameraManager, cameraInput: camera.CameraInput, previewOutput: camera.PreviewOutput | undefined): Promise<void> { try { this.session = cameraManager.createSession(camera.SceneMode.NORMAL_PHOTO) as camera.PhotoSession; this.session.beginConfig(); this.session.addInput(cameraInput); this.session.addOutput(previewOutput); this.getPreviewRotation(); await this.session.commitConfig(); await this.session.start(); logger.info(TAG, 'sessionFlowFn success'); } catch (error) { logger.error(TAG, `sessionFlowFn fail : ${JSON.stringify(error)}`); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraServiceUint.ets#L221-L236
ffd667db837d56f53b0c145170551e7c9ec754d8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
importData
导入数据
private async importData(): Promise<void> { try { console.log('[Settings] Starting data import...'); promptAction.showDialog({ title: '导入数据', message: '导入数据将覆盖当前所有联系人,是否继续?', buttons: [ { text: '取消', color: '#999999' }, { text: '继续导入', color: '#FF6B6B' } ] }).then((result) => { if (result.index === 1) { // 在实际应用中,这里可以调用文件选择器API promptAction.showToast({ message: '请选择要导入的备份文件', duration: 2000 }); } }); } catch (error) { console.error('[Settings] Import failed:', error); promptAction.showToast({ message: '导入数据失败', duration: 2000 }); } }
AST#method_declaration#Left private async importData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[Settings] Starting data import...' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 promptAction AST#expression#Right . showDialog 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 '导入数据' AST#expression#Right AST#property_assignment#Right , 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 buttons AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left '取消' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#999999' 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 text AST#property_name#Right : AST#expression#Left '继续导入' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#FF6B6B' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . index AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 在实际应用中,这里可以调用文件选择器API 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 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[Settings] Import failed:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 2000 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 importData(): Promise<void> { try { console.log('[Settings] Starting data import...'); promptAction.showDialog({ title: '导入数据', message: '导入数据将覆盖当前所有联系人,是否继续?', buttons: [ { text: '取消', color: '#999999' }, { text: '继续导入', color: '#FF6B6B' } ] }).then((result) => { if (result.index === 1) { promptAction.showToast({ message: '请选择要导入的备份文件', duration: 2000 }); } }); } catch (error) { console.error('[Settings] Import failed:', error); promptAction.showToast({ message: '导入数据失败', duration: 2000 }); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L1322-L1356
dc8a3e2884f25defd064072f3ceac2ded5ff984b
github
yanweiguo198-commits/Harmony-Calendar-App.git
9ebdfbe588dfc230231af619a6eeb89b3c7fc39f
entry/src/main/ets/pages/Index.ets
arkts
handleSaveEvent
--- 2. 保存/更新逻辑 ---
async handleSaveEvent(event: CalendarEvent) { // 提醒逻辑 if (event.isReminded && event.startTime > new Date().getTime()) { // 简单处理:先取消旧提醒(如果有),再加新提醒 if (event.reminderId !== -1) { await ReminderService.cancelReminder(event.reminderId); } let targetDate = new Date(event.startTime); event.reminderId = await ReminderService.addReminder(event.title, targetDate); } // 查找是否存在同 ID 的事件 const index = this.eventList.findIndex(e => e.id === event.id); if (index !== -1) { // 存在 -> 更新 (编辑模式) this.eventList[index] = event; // 强制刷新:ArkTS 数组元素替换有时需要触发通知 this.eventList = [...this.eventList]; console.info(`更新日程: ${event.title}`); } else { // 不存在 -> 新增 this.eventList.push(event); console.info(`新增日程: ${event.title}`); } }
AST#method_declaration#Left async handleSaveEvent AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left CalendarEvent 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#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . isReminded AST#member_expression#Right AST#expression#Right && AST#expression#Left event AST#expression#Right AST#binary_expression#Right AST#expression#Right . startTime AST#member_expression#Right AST#expression#Right > AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { // 简单处理:先取消旧提醒(如果有),再加新提醒 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . reminderId AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left ReminderService AST#expression#Right AST#await_expression#Right AST#expression#Right . cancelReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . reminderId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#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 targetDate = 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 event AST#expression#Right . startTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . reminderId AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left ReminderService AST#expression#Right AST#await_expression#Right AST#expression#Right . addReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . title AST#member_expression#Right AST#expression#Right , AST#expression#Left targetDate AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 查找是否存在同 ID 的事件 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 index = 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 . eventList AST#member_expression#Right AST#expression#Right . findIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left e => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left event AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 index AST#expression#Right !== AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // 存在 -> 更新 (编辑模式) AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . eventList AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = event AST#ERROR#Right ; AST#expression_statement#Right // 强制刷新:ArkTS 数组元素替换有时需要触发通知 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . eventList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . eventList 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 更新日程: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { // 不存在 -> 新增 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . eventList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 新增日程: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
async handleSaveEvent(event: CalendarEvent) { if (event.isReminded && event.startTime > new Date().getTime()) { if (event.reminderId !== -1) { await ReminderService.cancelReminder(event.reminderId); } let targetDate = new Date(event.startTime); event.reminderId = await ReminderService.addReminder(event.title, targetDate); } const index = this.eventList.findIndex(e => e.id === event.id); if (index !== -1) { this.eventList[index] = event; this.eventList = [...this.eventList]; console.info(`更新日程: ${event.title}`); } else { this.eventList.push(event); console.info(`新增日程: ${event.title}`); } }
https://github.com/yanweiguo198-commits/Harmony-Calendar-App.git/blob/9ebdfbe588dfc230231af619a6eeb89b3c7fc39f/entry/src/main/ets/pages/Index.ets#L44-L69
65ee7fee43a4537b08347a0efeab57a0acf75d2d
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/data/RegionData.ets
arkts
getRegionOptions
获取地区级联选项 @returns {IBestCascaderOption[]} 地区选项
static getRegionOptions(): IBestCascaderOption[] { return REGION_OPTIONS; }
AST#method_declaration#Left static getRegionOptions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IBestCascaderOption [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left REGION_OPTIONS AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getRegionOptions(): IBestCascaderOption[] { return REGION_OPTIONS; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/data/RegionData.ets#L1354-L1356
773b38efb7a546520694808df852497f2430c652
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets
arkts
PhotoBrowserRange. include ALL and SELECTED_ONLY @enum { number } PhotoBrowserRange @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare enum PhotoBrowserRange { /** * ALL. all photos or vedios * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ ALL = 0, /** * SELECTED_ONLY. only selected photos or vedios * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ SELECTED_ONLY = 1 }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PhotoBrowserRange AST#enum_body#Left { /** * ALL. all photos or vedios * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#enum_member#Left ALL = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , /** * SELECTED_ONLY. only selected photos or vedios * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#enum_member#Left SELECTED_ONLY = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export declare enum PhotoBrowserRange { ALL = 0, SELECTED_ONLY = 1 }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L739-L756
23381892f6e106d77093b9ac58f790f96c9ce494
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SyncTypes.ets
arkts
数据同步相关类型定义 包含云端同步、冲突解决、备份恢复等功能的类型定义 用户认证相关
export interface UserCredentials { email?: string; phone?: string; password: string; authCode?: string; // 验证码 }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserCredentials AST#object_type#Left { AST#type_member#Left email ? : 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 phone ? : 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 password : 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 authCode ? : 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 UserCredentials { email?: string; phone?: string; password: string; authCode?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L9-L14
ff9ef070bac05d3d474f431b17c2c582c1c68f37
github
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/05.输入框与按钮和组件间隔.ets
arkts
@State message: string = 'Hello World123';
build() { // build里面只能有一个容器组件 // 使用space控制组件间的距离 Column({ space: 20 }) { TextInput({ placeholder: '请输入用户名' }) TextInput({ placeholder: '请输入密码' }) .type(InputType.Password) Button('登录') .width(200) } .padding(10) }
AST#build_method#Left build ( ) AST#build_body#Left { // build里面只能有一个容器组件 // 使用space控制组件间的距离 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 20 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#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#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 . Password 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 Button ( AST#expression#Left '登录' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 200 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 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Column({ space: 20 }) { TextInput({ placeholder: '请输入用户名' }) TextInput({ placeholder: '请输入密码' }) .type(InputType.Password) Button('登录') .width(200) } .padding(10) }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/05.输入框与按钮和组件间隔.ets#L8-L23
85432dd5eeadbba8d3d77e5eb5f33a0fecc35c9e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
getSmartSuggestions
获取智能建议
getSmartSuggestions(): SmartSuggestion[] { return this.smartSuggestions.filter(s => !s.read); }
AST#method_declaration#Left getSmartSuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SmartSuggestion [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . smartSuggestions 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 s => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left s AST#expression#Right AST#unary_expression#Right AST#expression#Right . read AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getSmartSuggestions(): SmartSuggestion[] { return this.smartSuggestions.filter(s => !s.read); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L546-L548
d0bbfa90945654a024c435269510519f12c62ae3
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/context/ContextUtil.ets
arkts
init
在 UIAbility 的 onCreate 方法中获取 UIAbilityContext
static init(context: common.UIAbilityContext) { ContextUtil.context = context; }
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ContextUtil AST#expression#Right . context AST#member_expression#Right = AST#expression#Left context AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static init(context: common.UIAbilityContext) { ContextUtil.context = context; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/context/ContextUtil.ets#L33-L35
5addbf7bd4052e941e6fcb08ee4eb7539473b8a6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets
arkts
action
聊天页面传来的相应动作
action(): void { Logger.info(TAG, `action_sendMsg:${this.sendMsg}`); if (this.sendMsg === 'closeSocket') { this.socketController?.closeSocket(); } else if (this.sendMsg === 'clear') { } else { // 转发消息 包括事件 this.sendData(this.sendMsg); } }
AST#method_declaration#Left action AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` action_sendMsg: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sendMsg 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#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 . sendMsg AST#member_expression#Right AST#expression#Right === AST#expression#Left 'closeSocket' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . socketController AST#member_expression#Right AST#expression#Right ?. closeSocket AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else AST#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 . sendMsg AST#member_expression#Right AST#expression#Right === AST#expression#Left 'clear' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { } else { // 转发消息 包括事件 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sendData 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 . sendMsg AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
action(): void { Logger.info(TAG, `action_sendMsg:${this.sendMsg}`); if (this.sendMsg === 'closeSocket') { this.socketController?.closeSocket(); } else if (this.sendMsg === 'clear') { } else { this.sendData(this.sendMsg); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L82-L92
fab29f3098792c0fa78a698d7a44c36090448e20
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineDataSet.ets
arkts
setCircleRadius
Sets the radius of the drawn circles. Default radius = 4f, Min = 1f @param radius
public setCircleRadius(radius: number): void { if (radius >= 1) { // this.mCircleRadius = Utils.convertDpToPixel(radius); this.mCircleRadius = radius; } else { LogUtil.log("LineDataSet", "Circle radius cannot be < 1") } }
AST#method_declaration#Left public setCircleRadius AST#parameter_list#Left ( AST#parameter#Left radius : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left radius AST#expression#Right >= AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // this.mCircleRadius = Utils.convertDpToPixel(radius); AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCircleRadius AST#member_expression#Right = AST#expression#Left radius AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "LineDataSet" AST#expression#Right , AST#expression#Left "Circle radius cannot be < 1" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setCircleRadius(radius: number): void { if (radius >= 1) { this.mCircleRadius = radius; } else { LogUtil.log("LineDataSet", "Circle radius cannot be < 1") } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L155-L163
c073959c3fbf0c6ad3388ec6071d49ddfc18d417
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/product/default/src/main/ets/feature/SunCanvasFeature.ets
arkts
initMoon
月出月落图 @param context @param img @param iconMoon
function initMoon(context: CanvasRenderingContext2D, img: ImageBitmap, iconMoon: ImageBitmap) { /* * 根据月出月落时间点绘制 * 获取两个时间点 * 分割成一个半圆 * 角度换算刻度 * 绘制 */ try { let begin = resourceManager!.getStringSync($r('app.string.moonrise_begin').id); let final = resourceManager!.getStringSync($r('app.string.moonset_final').id); let now = new Date(); let time: number = now.getHours(); let flag = true; // 月亮是否绘制 let index: number = time >= 17 ? time - 17 : time + 7; let scale = Math.floor(index * 18 / 13); if (now.getHours() >= 6 && now.getHours() < 17) { flag = false; scale = 0; } let width = context.width, height = context.height; // 文字 context.font = '20px'; context.fillStyle = "#99FFFFFF"; context.textAlign = 'center'; context.textBaseline = 'middle'; context.fillText(begin, width / 6, height - 20); context.font = '20px'; context.fillStyle = "#99FFFFFF"; context.textAlign = 'center'; context.textBaseline = 'middle'; context.fillText(resourceManager!.getStringSync($r('app.string.first_quarter').id), width / 2, height - 20); context.font = '20px'; context.fillStyle = "#99FFFFFF"; context.textAlign = 'center'; context.textBaseline = 'middle'; context.fillText(final, width / 6 * 5, height - 20); context.drawImage(iconMoon, 0, 0, 16, 16, width / 2 - 5, height - 45, 24, 24); // 渐变色 let color = context.createLinearGradient(0, 0, width, height); color.addColorStop(0, '#FFAF38'); color.addColorStop(scale / 18, '#DDFAD961'); color.addColorStop(1, '#11FFFFFF'); context.save(); context.beginPath(); context.lineWidth = 1; if (flag) { context.strokeStyle = color; } else { context.strokeStyle = '#33C0C0C0'; } context.arc(width / 2, height - 25, width * 0.3, Math.PI / 180 * 197, Math.PI * 2 / 180 * 171, false); context.setLineDash([8]); context.stroke(); context.restore(); if (flag) { // x为刻度线 context.save(); // 弧度*π/180 得到弧度 let deg = Math.PI / 180 * (197 + scale * 9); let offsetX = -(Math.cos(deg) * width * 0.3); let offsetY = -(Math.sin(deg) * width * 0.3); context.drawImage(img, 0, 0, 120, 120, width / 2 - offsetX - 12, height - 37 - offsetY, 24, 24); } } catch (error) { hilog.error(DOMAIN, 'testTag', '%{public}s', `getStringSync failed, error code: ${error.code}, message: ${error.message}.`); } }
AST#function_declaration#Left function initMoon AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left img : AST#type_annotation#Left AST#primary_type#Left ImageBitmap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left iconMoon : AST#type_annotation#Left AST#primary_type#Left ImageBitmap 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 let AST#variable_declarator#Left begin = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left resourceManager AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.moonrise_begin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left final = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left resourceManager AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.moonset_final' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getHours 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 flag = AST#expression#Left AST#boolean_literal#Left true AST#boolean_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 index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left time AST#expression#Right >= AST#expression#Left 17 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left time AST#expression#Right - AST#expression#Left 17 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left time AST#expression#Right + AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left scale = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right * AST#expression#Left 18 AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left 13 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right >= AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left now AST#expression#Right AST#binary_expression#Right AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right < AST#expression#Left 17 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 flag = 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 scale = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left width = AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right , AST#variable_declarator#Left height = AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 文字 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . font AST#member_expression#Right = AST#expression#Left '20px' 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 context AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left "#99FFFFFF" 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 context AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left 'center' 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 context AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'middle' 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 context AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left begin AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right / AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right - AST#expression#Left 20 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . font AST#member_expression#Right = AST#expression#Left '20px' 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 context AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left "#99FFFFFF" 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 context AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left 'center' 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 context AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'middle' 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 context AST#expression#Right . fillText 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#non_null_assertion_expression#Left AST#expression#Left resourceManager AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.first_quarter' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right - AST#expression#Left 20 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . font AST#member_expression#Right = AST#expression#Left '20px' 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 context AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left "#99FFFFFF" 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 context AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left 'center' 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 context AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'middle' 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 context AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left final AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right / AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right - AST#expression#Left 20 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 context AST#expression#Right . drawImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left iconMoon AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 16 AST#expression#Right , AST#expression#Left 16 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right - AST#expression#Left 45 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left 24 AST#expression#Right , AST#expression#Left 24 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 渐变色 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left color = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . createLinearGradient AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left width AST#expression#Right , AST#expression#Left height 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 color AST#expression#Right . addColorStop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left '#FFAF38' AST#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 color AST#expression#Right . addColorStop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left scale AST#expression#Right / AST#expression#Left 18 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '#DDFAD961' AST#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 color AST#expression#Right . addColorStop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left '#11FFFFFF' AST#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 context AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . beginPath 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 context AST#expression#Right . lineWidth AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left flag 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 context AST#expression#Right . strokeStyle AST#member_expression#Right = AST#expression#Left color AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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 context AST#expression#Right . strokeStyle AST#member_expression#Right = AST#expression#Left '#33C0C0C0' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . arc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right - AST#expression#Left 25 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right * AST#expression#Left 0.3 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . PI AST#member_expression#Right AST#expression#Right / AST#expression#Left 180 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 197 AST#expression#Right AST#binary_expression#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#member_expression#Left AST#expression#Left Math AST#expression#Right . PI AST#member_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left 180 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 171 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . setLineDash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 8 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . stroke 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 context AST#expression#Right . restore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left flag AST#expression#Right ) AST#block_statement#Left { // x为刻度线 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 弧度*π/180 得到弧度 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left deg = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . PI AST#member_expression#Right AST#expression#Right / AST#expression#Left 180 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 197 AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left scale AST#expression#Right * AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offsetX = AST#expression#Left AST#unary_expression#Left - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . cos AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left deg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left width AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 0.3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_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 offsetY = AST#expression#Left AST#unary_expression#Left - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . sin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left deg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left width AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 0.3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_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 context AST#expression#Right . drawImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left img AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 120 AST#expression#Right , AST#expression#Left 120 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 width AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left offsetX AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 12 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right - AST#expression#Left 37 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left offsetY AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left 24 AST#expression#Right , AST#expression#Left 24 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( 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 DOMAIN AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` getStringSync 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#function_declaration#Right
function initMoon(context: CanvasRenderingContext2D, img: ImageBitmap, iconMoon: ImageBitmap) { try { let begin = resourceManager!.getStringSync($r('app.string.moonrise_begin').id); let final = resourceManager!.getStringSync($r('app.string.moonset_final').id); let now = new Date(); let time: number = now.getHours(); let flag = true; let index: number = time >= 17 ? time - 17 : time + 7; let scale = Math.floor(index * 18 / 13); if (now.getHours() >= 6 && now.getHours() < 17) { flag = false; scale = 0; } let width = context.width, height = context.height; context.font = '20px'; context.fillStyle = "#99FFFFFF"; context.textAlign = 'center'; context.textBaseline = 'middle'; context.fillText(begin, width / 6, height - 20); context.font = '20px'; context.fillStyle = "#99FFFFFF"; context.textAlign = 'center'; context.textBaseline = 'middle'; context.fillText(resourceManager!.getStringSync($r('app.string.first_quarter').id), width / 2, height - 20); context.font = '20px'; context.fillStyle = "#99FFFFFF"; context.textAlign = 'center'; context.textBaseline = 'middle'; context.fillText(final, width / 6 * 5, height - 20); context.drawImage(iconMoon, 0, 0, 16, 16, width / 2 - 5, height - 45, 24, 24); let color = context.createLinearGradient(0, 0, width, height); color.addColorStop(0, '#FFAF38'); color.addColorStop(scale / 18, '#DDFAD961'); color.addColorStop(1, '#11FFFFFF'); context.save(); context.beginPath(); context.lineWidth = 1; if (flag) { context.strokeStyle = color; } else { context.strokeStyle = '#33C0C0C0'; } context.arc(width / 2, height - 25, width * 0.3, Math.PI / 180 * 197, Math.PI * 2 / 180 * 171, false); context.setLineDash([8]); context.stroke(); context.restore(); if (flag) { context.save(); let deg = Math.PI / 180 * (197 + scale * 9); let offsetX = -(Math.cos(deg) * width * 0.3); let offsetY = -(Math.sin(deg) * width * 0.3); context.drawImage(img, 0, 0, 120, 120, width / 2 - offsetX - 12, height - 37 - offsetY, 24, 24); } } catch (error) { hilog.error(DOMAIN, 'testTag', '%{public}s', `getStringSync failed, error code: ${error.code}, message: ${error.message}.`); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/product/default/src/main/ets/feature/SunCanvasFeature.ets#L111-L188
ebbeb162afae9f75ff97b28f3325d11eb8fca2e6
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/model/database/PreferencesHandler.ets
arkts
clear
清除用户首选项中的数据。
public clear() { if (this.preferences != null) { this.preferences.clear(); } }
AST#method_declaration#Left public clear 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 . preferences AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
public clear() { if (this.preferences != null) { this.preferences.clear(); } }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/database/PreferencesHandler.ets#L63-L67
ad7b2210efe73b0b4a8f010bd87b257082e2293d
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Manager/CDbPath.ets
arkts
构造函数
constructor(pureName: string) { this.baseName = pureName; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left pureName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . baseName AST#member_expression#Right = AST#expression#Left pureName 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(pureName: string) { this.baseName = pureName; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CDbPath.ets#L15-L17
89525ed99d9121cb8c12bcfa120c7c2ecca3a215
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
src/main/ets/pages/EnvironmentMonitoringPage.ets
arkts
checkTemperatureStatus
温度状态判断
function checkTemperatureStatus(value: number): string { if (value > TEMPERATURE.WARNING_HIGH) { return EnvironmentStatusType.HIGH } else if (value < TEMPERATURE.WARNING_LOW) { return EnvironmentStatusType.LOW } return EnvironmentStatusType.NORMAL }
AST#function_declaration#Left function checkTemperatureStatus AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right > AST#expression#Left TEMPERATURE AST#expression#Right AST#binary_expression#Right AST#expression#Right . WARNING_HIGH AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left EnvironmentStatusType AST#expression#Right . HIGH AST#member_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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right < AST#expression#Left TEMPERATURE AST#expression#Right AST#binary_expression#Right AST#expression#Right . WARNING_LOW AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left EnvironmentStatusType AST#expression#Right . LOW AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left EnvironmentStatusType AST#expression#Right . NORMAL AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function checkTemperatureStatus(value: number): string { if (value > TEMPERATURE.WARNING_HIGH) { return EnvironmentStatusType.HIGH } else if (value < TEMPERATURE.WARNING_LOW) { return EnvironmentStatusType.LOW } return EnvironmentStatusType.NORMAL }
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/EnvironmentMonitoringPage.ets#L50-L57
87a6ca8aa08b94e05ab2538452825f09f1c19974
github