nwo
stringclasses 304
values | sha
stringclasses 304
values | path
stringlengths 9
214
| language
stringclasses 1
value | identifier
stringlengths 0
49
| docstring
stringlengths 1
34.2k
| function
stringlengths 8
59.4k
| ast_function
stringlengths 71
497k
| obf_function
stringlengths 8
39.4k
| url
stringlengths 102
324
| function_sha
stringlengths 40
40
| source
stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/communication_wifi
|
387ba7fa8f98578629a6148635a4d630b2b99aa1
|
wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/model/BaseModel.ets
|
arkts
|
Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 BaseModel {
constructor() {
}
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class BaseModel AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class BaseModel {
constructor() {
}
}
|
https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/model/BaseModel.ets#L16-L19
|
f0cc18e203b64f6af2d9304cea3ab2c2b3508611
|
gitee
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_search_engines.ets
|
arkts
|
import_string
|
Import search engines in a specific plain text format.
In default overwrites whatever was in this list_of_search_engines.
@param imp The string in the correct format:
@example 'Bing\nhttps://www.cn.bing.com/search?q=%s\nGoogle\nhttps://www.google.com/search?q=%s'
|
static import_string(imp: string) {
// Clear
bunch_of_search_engines.list_of_search_engines = [];
if (imp == "") {
return;
}
// Import
let import_list: string[] = imp.split("\n");
for (let index = 0; index < import_list.length; index += 2) {
if (import_list[index] != "") {
bunch_of_search_engines.add_search_engine(new search_engine(import_list[index], import_list[index+1]));
}
}
}
|
AST#method_declaration#Left static import_string AST#parameter_list#Left ( AST#parameter#Left imp : 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 { // Clear AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left bunch_of_search_engines AST#expression#Right . list_of_search_engines 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left imp AST#expression#Right == AST#expression#Left "" 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 // Import AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left import_list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imp AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "\n" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left import_list AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left index += AST#expression#Left 2 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left import_list AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_search_engines AST#expression#Right . add_search_engine 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 search_engine AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left import_list AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left import_list AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static import_string(imp: string) {
bunch_of_search_engines.list_of_search_engines = [];
if (imp == "") {
return;
}
let import_list: string[] = imp.split("\n");
for (let index = 0; index < import_list.length; index += 2) {
if (import_list[index] != "") {
bunch_of_search_engines.add_search_engine(new search_engine(import_list[index], import_list[index+1]));
}
}
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L74-L87
|
a37b633bc18c10b546b2b8f190d04751e93976c5
|
gitee
|
Vinson0709/arkdemo.git
|
793491fe04b387f55dadfef86b30e28d0535d994
|
entry/src/main/ets/pages/Buttons.ets
|
arkts
|
buttonStyle
|
自定义样式:button
|
@Styles buttonStyle(){
.width(180)
.height(40)
.margin({ bottom: 10})
}
|
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right buttonStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 180 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#method_declaration#Right
|
@Styles buttonStyle(){
.width(180)
.height(40)
.margin({ bottom: 10})
}
|
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Buttons.ets#L33-L37
|
5ba0d2ab66b1a39e5d4c6ad04417ebc6c896c78f
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets
|
arkts
|
年、月、周视图切换场景的相关设置
|
export interface CalendarSwitch {
controller?: CalendarController; // 自定义日历控制器,用于视图切换后的数据刷新。
currentSelectDay?: DayInfo; // 记录月、周视图中点击选中的日期信息。
isYearMonthHidden?: boolean; // 是否隐藏自定义日历年、月、周视图中自带的年月信息标题。
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface CalendarSwitch AST#object_type#Left { AST#type_member#Left controller ? : AST#type_annotation#Left AST#primary_type#Left CalendarController AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 自定义日历控制器,用于视图切换后的数据刷新。 AST#type_member#Left currentSelectDay ? : AST#type_annotation#Left AST#primary_type#Left DayInfo AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 记录月、周视图中点击选中的日期信息。 AST#type_member#Left isYearMonthHidden ? : 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 CalendarSwitch {
controller?: CalendarController;
currentSelectDay?: DayInfo;
isYearMonthHidden?: boolean;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets#L51-L55
|
ab66818782429908dd378b3a87a79f1cf67f5ab0
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
|
arkts
|
单例模型私有化构造函数,使用getInstance静态方法获得单例
|
private constructor() {
// 初始化窗口管理model
const windowStage: window.WindowStage | undefined = AppStorage.get('windowStage');
if (windowStage) {
this.windowModel.setWindowStage(windowStage);
}
// 初始化相机流尺寸
this.updateCameraCompSize();
}
|
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 初始化窗口管理model AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left windowStage : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage 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#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 'windowStage' 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 windowStage 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 . windowModel AST#member_expression#Right AST#expression#Right . setWindowStage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left windowStage AST#expression#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 this AST#expression#Right . updateCameraCompSize 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
|
private constructor() {
const windowStage: window.WindowStage | undefined = AppStorage.get('windowStage');
if (windowStage) {
this.windowModel.setWindowStage(windowStage);
}
this.updateCameraCompSize();
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L32-L41
|
bd5b753f1a35d8d87681b49634e2d179b2e7c19d
|
gitee
|
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets
|
arkts
|
getCircleColors
|
ALL CODE BELOW RELATED TO CIRCLE-COLORS
returns all colors specified for the circles
@return
|
public getCircleColors(): JArrayList<Number> {
return this.mCircleColors;
}
|
AST#method_declaration#Left public getCircleColors AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCircleColors AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getCircleColors(): JArrayList<Number> {
return this.mCircleColors;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets#L256-L258
|
3dfb17d4c7cf3d68f695eb8f90768d8ef89e8939
|
gitee
|
DompetApp/Dompet.harmony.git
|
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
|
entry/src/main/ets/globals/event.ets
|
arkts
|
recentUser
|
User
|
public async recentUser() {
logger.info('AppEvent.recentUser is called')
return AppDatabaser.recentUser()
}
|
AST#method_declaration#Left public async recentUser 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 'AppEvent.recentUser is called' AST#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 AppDatabaser AST#expression#Right . recentUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public async recentUser() {
logger.info('AppEvent.recentUser is called')
return AppDatabaser.recentUser()
}
|
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/globals/event.ets#L55-L58
|
ab2ce10714653a489eb4dcbd7432b8f839beff79
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets
|
arkts
|
将 HSL 颜色模型转换为 HEX 颜色模型
@param {number} hue - 色相 (Hue),范围为 0 到 360
@param {number} saturation - 饱和度 (Saturation),范围为 0 到 100
@param {number} lightness - 亮度 (Lightness),范围为 0 到 100
@returns {string} - 返回 HEX 颜色值,格式为 '#RRGGBB'
|
export function hslToHex(hue: number, saturation: number, lightness: number): string {
// 将 HSL 转换为 RGB
const rgb: RgbType = hslToRgb(hue, saturation, lightness);
// 返回 HEX 颜色值
return rgbToHex(rgb.red, rgb.green, rgb.blue);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function hslToHex AST#parameter_list#Left ( AST#parameter#Left hue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left saturation : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left lightness : 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 { // 将 HSL 转换为 RGB AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rgb : AST#type_annotation#Left AST#primary_type#Left RgbType AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left hslToRgb AST#expression#Right AST#argument_list#Left ( AST#expression#Left hue AST#expression#Right , AST#expression#Left saturation AST#expression#Right , AST#expression#Left lightness 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 // 返回 HEX 颜色值 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left rgbToHex AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left rgb AST#expression#Right . red AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left rgb AST#expression#Right . green AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left rgb AST#expression#Right . blue AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function hslToHex(hue: number, saturation: number, lightness: number): string {
const rgb: RgbType = hslToRgb(hue, saturation, lightness);
return rgbToHex(rgb.red, rgb.green, rgb.blue);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets#L26-L31
|
5796cd9ddd926e937dd321230075ee6efec56194
|
gitee
|
|
Tianpei-Shi/MusicDash.git
|
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
|
src/model/MusicItem.ets
|
arkts
|
音乐文件地址
|
constructor(id: number, title: string, artist: string, cover: string, duration: number, url?: string) {
this.id = id;
this.title = title;
this.artist = artist;
this.cover = cover;
this.duration = duration;
this.url = url;
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left artist : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cover : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left url ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right = AST#expression#Left title AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . artist AST#member_expression#Right = AST#expression#Left artist 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 . cover AST#member_expression#Right = AST#expression#Left cover AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . duration AST#member_expression#Right = AST#expression#Left duration AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . url AST#member_expression#Right = AST#expression#Left url AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor(id: number, title: string, artist: string, cover: string, duration: number, url?: string) {
this.id = id;
this.title = title;
this.artist = artist;
this.cover = cover;
this.duration = duration;
this.url = url;
}
|
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/MusicItem.ets#L12-L19
|
e124286bbad048e7c821c3b7c82c10c084d09278
|
github
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_history.ets
|
arkts
|
save_month_to_disk
|
Saves the current opened file to disk
|
save_month_to_disk() {
sandbox_save(this.current_opened_file_path, this.export_string());
}
|
AST#method_declaration#Left save_month_to_disk AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left sandbox_save ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . current_opened_file_path 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 . export_string AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
save_month_to_disk() {
sandbox_save(this.current_opened_file_path, this.export_string());
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L465-L467
|
0752ca0b797b9e0269510cb27d8d69f252b88bcb
|
gitee
|
devaige/HarmonyOSOfficialDemo.git
|
8b939116592cbc4e1c1b2e4f0b8fc4a57fde0f8c
|
ToDoListArkTS/entry/src/main/ets/common/constant/CommonConstant.ets
|
arkts
|
Style constants that can be used by all modules
|
export default class CommonConstants {
/**
* Full width or height.
*/
static readonly FULL_LENGTH: string = '100%';
/**
* Title height.
*/
static readonly TITLE_WIDTH: string = '80%';
/**
* List default width.
*/
static readonly LIST_DEFAULT_WIDTH: string = '93.3%';
/**
* Opacity of default.
*/
static readonly OPACITY_DEFAULT: number = 1;
/**
* Opacity of default.
*/
static readonly OPACITY_COMPLETED: number = 0.4;
/**
* BorderRadius of list item.
*/
static readonly BORDER_RADIUS: number = 24;
/**
* Font weight 500.
*/
static readonly FONT_WEIGHT: number = 500;
/**
* Space of column.
*/
static readonly COLUMN_SPACE: number = 16;
/**
* agents data.
*/
static readonly TODO_DATA: Array<string> = [
"早起晨练",
"准备早餐",
"阅读名著",
"学习ArkTS",
"看剧放松"
];
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Full width or height.
*/ AST#property_declaration#Left static readonly FULL_LENGTH : 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 /**
* Title height.
*/ AST#property_declaration#Left static readonly TITLE_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '80%' AST#expression#Right ; AST#property_declaration#Right /**
* List default width.
*/ AST#property_declaration#Left static readonly LIST_DEFAULT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '93.3%' AST#expression#Right ; AST#property_declaration#Right /**
* Opacity of default.
*/ AST#property_declaration#Left static readonly OPACITY_DEFAULT : 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 /**
* Opacity of default.
*/ AST#property_declaration#Left static readonly OPACITY_COMPLETED : 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 /**
* BorderRadius of list item.
*/ AST#property_declaration#Left static readonly BORDER_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right /**
* 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 of column.
*/ AST#property_declaration#Left static readonly COLUMN_SPACE : 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 /**
* agents data.
*/ AST#property_declaration#Left static readonly TODO_DATA : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left "早起晨练" AST#expression#Right , AST#expression#Left "准备早餐" AST#expression#Right , AST#expression#Left "阅读名著" AST#expression#Right , AST#expression#Left "学习ArkTS" AST#expression#Right , AST#expression#Left "看剧放松" AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class CommonConstants {
static readonly FULL_LENGTH: string = '100%';
static readonly TITLE_WIDTH: string = '80%';
static readonly LIST_DEFAULT_WIDTH: string = '93.3%';
static readonly OPACITY_DEFAULT: number = 1;
static readonly OPACITY_COMPLETED: number = 0.4;
static readonly BORDER_RADIUS: number = 24;
static readonly FONT_WEIGHT: number = 500;
static readonly COLUMN_SPACE: number = 16;
static readonly TODO_DATA: Array<string> = [
"早起晨练",
"准备早餐",
"阅读名著",
"学习ArkTS",
"看剧放松"
];
}
|
https://github.com/devaige/HarmonyOSOfficialDemo.git/blob/8b939116592cbc4e1c1b2e4f0b8fc4a57fde0f8c/ToDoListArkTS/entry/src/main/ets/common/constant/CommonConstant.ets#L19-L70
|
197311107baa58cf129706e12672dec4a0633e1e
|
github
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/datas/myData/WordUser.ets
|
arkts
|
incrementLearnTimes
|
增加学习次数(类似Swift的mutating方法)
|
incrementLearnTimes(): void {
this.learnTimes++;
}
|
AST#method_declaration#Left incrementLearnTimes 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#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . learnTimes AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
incrementLearnTimes(): void {
this.learnTimes++;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUser.ets#L73-L75
|
41dec68307c67af2de896abef02ed15952ceae82
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/bigdata/src/main/ets/pages/Index.ets
|
arkts
|
taskFunc
|
在并发函数中模拟数据处理
|
@Concurrent
async function taskFunc(obj: Test) {
console.info('test task res1 is: ' + obj.data1.name + ' res2 is: ' + obj.data2.name);
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function taskFunc AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left Test AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info 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 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 'test task res1 is: ' AST#expression#Right + AST#expression#Left obj AST#expression#Right AST#binary_expression#Right AST#expression#Right . data1 AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right + AST#expression#Left ' res2 is: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left obj AST#expression#Right AST#binary_expression#Right AST#expression#Right . data2 AST#member_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#expression_statement#Right } AST#builder_function_body#Right AST#decorated_function_declaration#Right
|
@Concurrent
async function taskFunc(obj: Test) {
console.info('test task res1 is: ' + obj.data1.name + ' res2 is: ' + obj.data2.name);
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/bigdata/src/main/ets/pages/Index.ets#L22-L25
|
21761eba42678174cd09d580efab672bd607af97
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Temperature.ets
|
arkts
|
initCurveData
|
初始化数据
@param count 曲线图点的个数
@param range y轴范围
|
private initCurveData(): LineData {
let values = new JArrayList<EntryOhos>();
for (let index: number = 0; index < this.gpData.length; index++) {
const gpDataCur = this.gpData[index];
if (gpDataCur.systemHTemp == '') {
continue
}
values.add(new EntryOhos(Number(index).valueOf(), Number(gpDataCur.systemHTemp).valueOf() / 1000));
}
let gradientFillColor = [];
gradientFillColor.push([0x0C0099CC, 0.2])
gradientFillColor.push([0x7F0099CC, 0.4])
gradientFillColor.push([0x0099CC, 1.0])
let dataSet = new JArrayList<ILineDataSet>();
let set1 = new LineDataSet(values, 'SystemHTemp(℃)');
set1.setDrawFilled(false);
set1.setMode(Mode.CUBIC_BEZIER);
set1.setGradientFillColor(gradientFillColor)
set1.setColorByColor(Color.Green);
set1.setLineWidth(3)
set1.setDrawValues(false);
set1.setDrawCircles(false);
set1.setCircleColor(Color.Blue);
set1.setCircleRadius(8);
set1.setCircleHoleRadius(4)
set1.setCircleHoleColor(Color.Green)
set1.setDrawCircleHole(false)
dataSet.add(set1);
return new LineData(dataSet)
}
|
AST#method_declaration#Left private initCurveData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LineData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left values = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos 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#for_statement#Left for ( 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 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 index AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . gpData 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 index 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 gpDataCur = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . gpData AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right 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 gpDataCur AST#expression#Right . systemHTemp AST#member_expression#Right AST#expression#Right == AST#expression#Left '' 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 continue 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left values 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 EntryOhos 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 AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left gpDataCur AST#expression#Right . systemHTemp AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left gradientFillColor = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left gradientFillColor AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x0C0099CC AST#expression#Right , AST#expression#Left 0.2 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 gradientFillColor AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x7F0099CC AST#expression#Right , AST#expression#Left 0.4 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 gradientFillColor AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x0099CC AST#expression#Right , AST#expression#Left 1.0 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#variable_declaration#Left let AST#variable_declarator#Left dataSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right 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#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 set1 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LineDataSet AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left values AST#expression#Right , AST#expression#Left 'SystemHTemp(℃)' 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 set1 AST#expression#Right . setDrawFilled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Mode AST#expression#Right . CUBIC_BEZIER 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 set1 AST#expression#Right . setGradientFillColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left gradientFillColor AST#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 set1 AST#expression#Right . setColorByColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green 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 set1 AST#expression#Right . setLineWidth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 3 AST#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 set1 AST#expression#Right . setDrawValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setDrawCircles AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set1 AST#expression#Right . setCircleColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue 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 set1 AST#expression#Right . setCircleRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 8 AST#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 set1 AST#expression#Right . setCircleHoleRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 set1 AST#expression#Right . setCircleHoleColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green 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 set1 AST#expression#Right . setDrawCircleHole AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left set1 AST#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 LineData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataSet 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
|
private initCurveData(): LineData {
let values = new JArrayList<EntryOhos>();
for (let index: number = 0; index < this.gpData.length; index++) {
const gpDataCur = this.gpData[index];
if (gpDataCur.systemHTemp == '') {
continue
}
values.add(new EntryOhos(Number(index).valueOf(), Number(gpDataCur.systemHTemp).valueOf() / 1000));
}
let gradientFillColor = [];
gradientFillColor.push([0x0C0099CC, 0.2])
gradientFillColor.push([0x7F0099CC, 0.4])
gradientFillColor.push([0x0099CC, 1.0])
let dataSet = new JArrayList<ILineDataSet>();
let set1 = new LineDataSet(values, 'SystemHTemp(℃)');
set1.setDrawFilled(false);
set1.setMode(Mode.CUBIC_BEZIER);
set1.setGradientFillColor(gradientFillColor)
set1.setColorByColor(Color.Green);
set1.setLineWidth(3)
set1.setDrawValues(false);
set1.setDrawCircles(false);
set1.setCircleColor(Color.Blue);
set1.setCircleRadius(8);
set1.setCircleHoleRadius(4)
set1.setCircleHoleColor(Color.Green)
set1.setDrawCircleHole(false)
dataSet.add(set1);
return new LineData(dataSet)
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Temperature.ets#L437-L471
|
7859cefb790a6462ac11c7ae1a80ebeef53706a9
|
gitee
|
yongoe1024/RdbPlus.git
|
4a3fc04ba5903bc1c1b194efbc557017976909dc
|
rdbplus/src/main/ets/core/Connection.ets
|
arkts
|
数据库工具
|
export class Connection {
private id: string
private store: relationalStore.RdbStore
private static context?: Context = undefined
private static logger?: Logger = undefined
set version(v: number) {
this.store.version = v
}
|
AST#export_declaration#Left export AST#class_declaration#Left class Connection AST#class_body#Left { AST#property_declaration#Left private id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left private store : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbStore AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left private static context ? : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right AST#property_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#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left undefined AST#expression#Right AST#ERROR#Left set version ( AST#ERROR#Left v : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ) AST#ERROR#Right { AST#property_name#Left this AST#property_name#Right AST#ERROR#Right . store AST#member_expression#Right AST#expression#Right . version AST#member_expression#Right = AST#expression#Left v AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class Connection {
private id: string
private store: relationalStore.RdbStore
private static context?: Context = undefined
private static logger?: Logger = undefined
set version(v: number) {
this.store.version = v
}
|
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/core/Connection.ets#L8-L16
|
3f5876aa3f549deb5b4c83f29b9ede7c208d92db
|
github
|
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/expression/special_expression/nullish_coalescing_001_T.ets
|
arkts
|
Introduction 空合并运算符
|
export function nullish_coalescing_001_T(taint_src : string) {
let t = null ?? taint_src;
taint.Sink(t);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function nullish_coalescing_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 t = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ?? AST#expression#Left taint_src AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 nullish_coalescing_001_T(taint_src : string) {
let t = null ?? taint_src;
taint.Sink(t);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/nullish_coalescing_001_T.ets#L6-L9
|
85da407f4abc449efdb03564ed68383d92a2cb67
|
github
|
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/model/style/ICustomButtonStyle.ets
|
arkts
|
自定义按钮样式
|
export interface ICustomButtonStyle {
/**
* 自定义预设样式Id,用来区分样式 ID
*/
customStyleId: string
/**
* 按钮背景颜色(可选)
*/
background?: ResourceColor;
/**
* 按钮背景颜色 渐变(可选)
*/
linearGradient?: ILinearGradient;
/**
* 按钮边框样式(可选)
*/
border?: BorderOptions;
/**
* 按钮文本颜色(可选)
*/
fontColor?: ResourceColor;
/**
* 按钮字体大小(可选)
*/
fontSize?: Length;
/**
* 按钮字体粗细(可选)
*/
fontWeight?: FontWeight;
/**
* 按钮圆角半径(可选)
*/
borderRadius?: Length | BorderRadiuses;
/**
* 按钮高度(可选)
*/
height?: Length;
/**
* 按钮宽度(可选)
*/
width?: Length;
/**
* 按钮权重(可选)
*/
layoutWeight?: number | string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ICustomButtonStyle AST#object_type#Left { /**
* 自定义预设样式Id,用来区分样式 ID
*/ AST#type_member#Left customStyleId : 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 background ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 按钮背景颜色 渐变(可选)
*/ AST#type_member#Left linearGradient ? : AST#type_annotation#Left AST#primary_type#Left ILinearGradient AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 按钮边框样式(可选)
*/ AST#type_member#Left border ? : AST#type_annotation#Left AST#primary_type#Left BorderOptions AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 按钮文本颜色(可选)
*/ AST#type_member#Left fontColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 按钮字体大小(可选)
*/ AST#type_member#Left fontSize ? : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 按钮字体粗细(可选)
*/ AST#type_member#Left fontWeight ? : AST#type_annotation#Left AST#primary_type#Left FontWeight AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 按钮圆角半径(可选)
*/ AST#type_member#Left borderRadius ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left BorderRadiuses AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 按钮高度(可选)
*/ AST#type_member#Left height ? : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 按钮宽度(可选)
*/ AST#type_member#Left width ? : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 按钮权重(可选)
*/ AST#type_member#Left layoutWeight ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ICustomButtonStyle {
customStyleId: string
background?: ResourceColor;
linearGradient?: ILinearGradient;
border?: BorderOptions;
fontColor?: ResourceColor;
fontSize?: Length;
fontWeight?: FontWeight;
borderRadius?: Length | BorderRadiuses;
height?: Length;
width?: Length;
layoutWeight?: number | string;
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/style/ICustomButtonStyle.ets#L6-L59
|
f1f4724f848be77f5031c7a41e5ae6017f22c1f4
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets
|
arkts
|
module list
|
export const LIST: string[] = ['最近播放', '为你推荐'];
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left LIST : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '最近播放' AST#expression#Right , AST#expression#Left '为你推荐' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const LIST: string[] = ['最近播放', '为你推荐'];
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L89-L89
|
c03b5daac5023b312625497c99126de7d392ab1b
|
gitee
|
|
XiangRui_FuZi/harmony-oscourse
|
da885f9a777a1eace7a07e1cd81137746687974b
|
class1/entry/src/main/ets/pages/inform.ets
|
arkts
|
markAsRead
|
标记单个为已读
|
private markAsRead(id: number) {
this.notifications = this.notifications.map(item => {
if (item.id === id) {
item.read = true;
}
return item;
});
this.unreadCount = this.calculateUnreadCount();
CommonVariable.unreadCount=this.unreadCount;
}
|
AST#method_declaration#Left private markAsRead 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#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 . notifications 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 . notifications AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . read AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left item AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . unreadCount AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateUnreadCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left CommonVariable AST#expression#Right . unreadCount AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . unreadCount AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private markAsRead(id: number) {
this.notifications = this.notifications.map(item => {
if (item.id === id) {
item.read = true;
}
return item;
});
this.unreadCount = this.calculateUnreadCount();
CommonVariable.unreadCount=this.unreadCount;
}
|
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/inform.ets#L175-L184
|
8d1218bde159b377165f74c6604865301e081ad9
|
gitee
|
Rayawa/dashboard.git
|
9107efe7fb69a58d799a378b79ea8ffa4041cec8
|
entry/src/main/ets/common/url.ets
|
arkts
|
_buildComponents
|
==================== 构建组件 ====================
|
private _buildComponents(): void {
// 构建URL字符串
let url = "";
// 协议
if (this._scheme) {
url += this._scheme + ":";
}
// 授权部分
if (this._hostname) {
url += "//";
// 用户信息
if (this._username || this._password) {
url += this._encodeUserInfo(this._username);
if (this._password) {
url += ":" + this._encodeUserInfo(this._password);
}
url += "@";
}
// 主机
url += this._hostname;
// 端口
if (this._port) {
url += ":" + this._port;
}
}
// 路径
url += this._encodePath(this._pathname);
// 查询
if (this._search) {
url += "?" + this._search;
}
// 哈希
if (this._hash) {
url += "#" + this._hash;
}
this._url = url;
// 构建origin
if (this._scheme && this._hostname) {
let port = "";
if (this._port && URL.SPECIAL_SCHEMES.has(this._scheme)) {
const defaultPort = URL.DEFAULT_PORTS.get(this._scheme);
if (defaultPort !== undefined && this._port !== defaultPort) {
port = ":" + this._port;
}
}
this._origin = this._scheme + "://" + this._hostname + port;
} else if (this._scheme === "file") {
this._origin = "null";
} else {
this._origin = "";
}
}
|
AST#method_declaration#Left private _buildComponents 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 { // 构建URL字符串 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left url = 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#member_expression#Left AST#expression#Left this AST#expression#Right . _scheme 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 url += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _scheme AST#member_expression#Right AST#expression#Right + AST#expression#Left ":" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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 . _hostname 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 url += AST#expression#Left "//" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 用户信息 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _username AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . _password 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 url += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _encodeUserInfo 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 . _username AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _password 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 url += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ":" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . _encodeUserInfo 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 . _password AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left url += 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 url += AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _hostname AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 端口 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _port 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 url += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ":" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . _port AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 路径 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left url += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _encodePath 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 . _pathname AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 查询 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _search 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 url += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "?" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . _search 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _hash 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 url += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "#" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . _hash AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _url AST#member_expression#Right = AST#expression#Left url AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 构建origin AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _scheme AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . _hostname AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left port = 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _port AST#member_expression#Right AST#expression#Right && AST#expression#Left URL AST#expression#Right AST#binary_expression#Right AST#expression#Right . SPECIAL_SCHEMES AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _scheme AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultPort = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left URL AST#expression#Right . DEFAULT_PORTS AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _scheme AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 defaultPort AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . _port AST#member_expression#Right AST#expression#Right !== AST#expression#Left defaultPort 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 port = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ":" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . _port AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _origin 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#member_expression#Left AST#expression#Left this AST#expression#Right . _scheme 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 . _hostname AST#member_expression#Right AST#expression#Right + AST#expression#Left port AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#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 . _scheme AST#member_expression#Right AST#expression#Right === AST#expression#Left "file" 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 . _origin AST#member_expression#Right = AST#expression#Left "null" 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 . _origin 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private _buildComponents(): void {
let url = "";
if (this._scheme) {
url += this._scheme + ":";
}
if (this._hostname) {
url += "//";
if (this._username || this._password) {
url += this._encodeUserInfo(this._username);
if (this._password) {
url += ":" + this._encodeUserInfo(this._password);
}
url += "@";
}
url += this._hostname;
if (this._port) {
url += ":" + this._port;
}
}
url += this._encodePath(this._pathname);
if (this._search) {
url += "?" + this._search;
}
if (this._hash) {
url += "#" + this._hash;
}
this._url = url;
if (this._scheme && this._hostname) {
let port = "";
if (this._port && URL.SPECIAL_SCHEMES.has(this._scheme)) {
const defaultPort = URL.DEFAULT_PORTS.get(this._scheme);
if (defaultPort !== undefined && this._port !== defaultPort) {
port = ":" + this._port;
}
}
this._origin = this._scheme + "://" + this._hostname + port;
} else if (this._scheme === "file") {
this._origin = "null";
} else {
this._origin = "";
}
}
|
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/url.ets#L509-L570
|
d5f1569feec8afe7a9fb299bd53a67ea3cee79fb
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/CopyUtils.ets
|
arkts
|
copyText
|
实现文本复制功能
@param text 要复制的文本
|
public static copyText(text: string): void {
// 创建剪贴板条目
const pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
const systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.setData(pasteboardData); // Put data into clipboard
}
|
AST#method_declaration#Left public static copyText AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 pasteboardData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . createData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_PLAIN AST#member_expression#Right AST#expression#Right , AST#expression#Left text 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 systemPasteboard = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . getSystemPasteboard 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 systemPasteboard AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pasteboardData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Put data into clipboard } AST#block_statement#Right AST#method_declaration#Right
|
public static copyText(text: string): void {
const pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
const systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.setData(pasteboardData);
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/CopyUtils.ets#L11-L16
|
04008079e0863ca620bb5104c8adbcd04c085d8c
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/gesturejudge/GestureJudge.ets
|
arkts
|
GestureJudge
|
[Start gesture_judge] [Start set_gesture_judge]
|
@Entry
@Component
export struct GestureJudge {
scroller: Scroller = new Scroller();
// [StartExclude set_gesture_judge]
scroller2: Scroller = new Scroller();
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
private childRecognizer: GestureRecognizer = new GestureRecognizer();
private currentRecognizer: GestureRecognizer = new GestureRecognizer();
private lastOffset: number = 0;
// [EndExclude set_gesture_judge]
build() {
NavDestination() {
Column({ space: 12 }) {
Text($r('app.string.gesture_GestureJudge_text'))
.fontSize(14)
.fontColor('#666')
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) { // 外部滚动容器
Column() {
Text('Scroll Area')
.width('90%')
.height(150)
.backgroundColor(0xFFFFFF)
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
Scroll(this.scroller2) { // 内部滚动容器
Column() {
Text('Scroll Area2')
.width('90%')
.height(150)
.backgroundColor(0xFFFFFF)
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
Column() {
ForEach(this.arr, (item: number) => {
Text(item.toString())
.width('90%')
.height(150)
.backgroundColor(0xFFFFFF)
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
}, (item: string) => item)
}.width('100%')
}
}
.id('inner')
.width('100%')
.height(800)
}.width('100%')
}
.id('outer')
.height(600)
.scrollable(ScrollDirection.Vertical) // 滚动方向纵向
.scrollBar(BarState.On) // 滚动条常驻显示
.scrollBarColor(Color.Gray) // 滚动条颜色
.scrollBarWidth(10) // 滚动条宽度
.edgeEffect(EdgeEffect.None)
.shouldBuiltInRecognizerParallelWith((current: GestureRecognizer, others: Array<GestureRecognizer>) => {
for (let i = 0; i < others.length; i++) {
let target = others[i].getEventTargetInfo();
if (target.getId() == 'inner' && others[i].isBuiltIn() &&
others[i].getType() == GestureControl.GestureType.PAN_GESTURE) { // 找到将要组成并行手势的识别器
this.currentRecognizer = current; // 保存当前组件的识别器
this.childRecognizer = others[i]; // 保存将要组成并行手势的识别器
return others[i]; // 返回和当前手势将要组成并行手势的识别器
}
}
return undefined;
})
.onGestureRecognizerJudgeBegin((event: BaseGestureEvent, current: GestureRecognizer,
others: Array<GestureRecognizer>) => { // 在识别器即将要成功时,根据当前组件状态,设置识别器使能状态
let target = current.getEventTargetInfo();
if (target.getId() == 'outer' && current.isBuiltIn() &&
current.getType() == GestureControl.GestureType.PAN_GESTURE) {
for (let i = 0; i < others.length; i++) {
let target = others[i].getEventTargetInfo() as ScrollableTargetInfo;
if (target instanceof ScrollableTargetInfo && target.getId() == 'inner') { // 找到响应链上对应并行的识别器
let panEvent = event as PanGestureEvent;
this.childRecognizer.setEnabled(true);
this.currentRecognizer.setEnabled(false);
if (target.isEnd()) { // 根据当前组件状态以及移动方向动态控制识别器使能状态
if (panEvent && panEvent.offsetY < 0) {
this.childRecognizer.setEnabled(false);
this.currentRecognizer.setEnabled(true);
}
} else if (target.isBegin()) {
if (panEvent.offsetY > 0) {
this.childRecognizer.setEnabled(false);
this.currentRecognizer.setEnabled(true);
}
}
}
}
}
return GestureJudgeResult.CONTINUE;
})
// [StartExclude set_gesture_judge]
.parallelGesture( // 绑定一个Pan手势作为动态控制器
PanGesture()
.onActionUpdate((event: GestureEvent) => {
if (this.childRecognizer.getState() != GestureRecognizerState.SUCCESSFUL ||
this.currentRecognizer.getState() != GestureRecognizerState.SUCCESSFUL) {
// 如果识别器状态不是SUCCESSFUL,则不做控制
return;
}
let target = this.childRecognizer.getEventTargetInfo() as ScrollableTargetInfo;
let currentTarget = this.currentRecognizer.getEventTargetInfo() as ScrollableTargetInfo;
if (target instanceof ScrollableTargetInfo && currentTarget instanceof ScrollableTargetInfo) {
this.childRecognizer.setEnabled(true);
this.currentRecognizer.setEnabled(false);
if (target.isEnd()) { // 在移动过程中实时根据当前组件状态,控制识别器的开闭状态
if ((event.offsetY - this.lastOffset) < 0) {
this.childRecognizer.setEnabled(false);
if (currentTarget.isEnd()) {
this.currentRecognizer.setEnabled(false);
} else {
this.currentRecognizer.setEnabled(true);
}
}
} else if (target.isBegin()) {
if ((event.offsetY - this.lastOffset) > 0) {
this.childRecognizer.setEnabled(false);
if (currentTarget.isBegin()) {
this.currentRecognizer.setEnabled(false);
} else {
this.currentRecognizer.setEnabled(true);
}
}
}
}
this.lastOffset = event.offsetY;
})
)
// [EndExclude set_gesture_judge]
}.width('100%').height('90%').backgroundColor(0xDCDCDC)
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.gesture_GestureJudge_title'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct GestureJudge AST#component_body#Left { AST#property_declaration#Left scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // [StartExclude set_gesture_judge] AST#property_declaration#Left scroller2 : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left 3 AST#expression#Right , AST#expression#Left 4 AST#expression#Right , AST#expression#Left 5 AST#expression#Right , AST#expression#Left 6 AST#expression#Right , AST#expression#Left 7 AST#expression#Right , AST#expression#Left 8 AST#expression#Right , AST#expression#Left 9 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private childRecognizer : AST#type_annotation#Left AST#primary_type#Left GestureRecognizer 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 GestureRecognizer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private currentRecognizer : AST#type_annotation#Left AST#primary_type#Left GestureRecognizer 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 GestureRecognizer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private lastOffset : 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 // [EndExclude set_gesture_judge] AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.gesture_GestureJudge_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . TopStart AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { // 外部滚动容器 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'Scroll Area' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 150 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xFFFFFF AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller2 AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { // 内部滚动容器 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'Scroll Area2' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 150 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xFFFFFF AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . arr AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 150 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xFFFFFF AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left item AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'inner' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 800 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'outer' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 600 AST#expression#Right ) AST#modifier_chain_expression#Left . scrollable ( AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollDirection AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) // 滚动方向纵向 AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . On AST#member_expression#Right AST#expression#Right ) // 滚动条常驻显示 AST#modifier_chain_expression#Left . scrollBarColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) // 滚动条颜色 AST#modifier_chain_expression#Left . scrollBarWidth ( AST#expression#Left 10 AST#expression#Right ) // 滚动条宽度 AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shouldBuiltInRecognizerParallelWith ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left GestureRecognizer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left others : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GestureRecognizer AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left others AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left target = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . getEventTargetInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . getId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left 'inner' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . isBuiltIn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . getType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left GestureControl AST#expression#Right AST#binary_expression#Right AST#expression#Right . GestureType AST#member_expression#Right AST#expression#Right . PAN_GESTURE AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 找到将要组成并行手势的识别器 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right = AST#expression#Left current AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 保存当前组件的识别器 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 保存将要组成并行手势的识别器 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 返回和当前手势将要组成并行手势的识别器 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onGestureRecognizerJudgeBegin ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left BaseGestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left GestureRecognizer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left others : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GestureRecognizer AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 在识别器即将要成功时,根据当前组件状态,设置识别器使能状态 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left target = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . getEventTargetInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . getId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left 'outer' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left current AST#expression#Right AST#binary_expression#Right AST#expression#Right . isBuiltIn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left current AST#expression#Right AST#binary_expression#Right AST#expression#Right . getType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left GestureControl AST#expression#Right AST#binary_expression#Right AST#expression#Right . GestureType AST#member_expression#Right AST#expression#Right . PAN_GESTURE AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left others AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left target = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . getEventTargetInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ScrollableTargetInfo AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left target AST#expression#Right instanceof AST#expression#Left ScrollableTargetInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left target AST#expression#Right AST#binary_expression#Right AST#expression#Right . getId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left 'inner' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 找到响应链上对应并行的识别器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left panEvent = AST#expression#Left AST#as_expression#Left AST#expression#Left event AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PanGestureEvent AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . isEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { // 根据当前组件状态以及移动方向动态控制识别器使能状态 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left panEvent AST#expression#Right && AST#expression#Left panEvent AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . isBegin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left panEvent AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left GestureJudgeResult AST#expression#Right . CONTINUE AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) // [StartExclude set_gesture_judge] AST#modifier_chain_expression#Left . parallelGesture ( // 绑定一个Pan手势作为动态控制器 AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left PanGesture AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionUpdate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . getState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right != AST#expression#Left GestureRecognizerState AST#expression#Right AST#binary_expression#Right AST#expression#Right . SUCCESSFUL AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . getState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right != AST#expression#Left GestureRecognizerState AST#expression#Right AST#binary_expression#Right AST#expression#Right . SUCCESSFUL AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 如果识别器状态不是SUCCESSFUL,则不做控制 AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left target = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . getEventTargetInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ScrollableTargetInfo AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left currentTarget = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . getEventTargetInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ScrollableTargetInfo AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left target AST#expression#Right instanceof AST#expression#Left ScrollableTargetInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left currentTarget AST#expression#Right instanceof AST#expression#Left ScrollableTargetInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . isEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { // 在移动过程中实时根据当前组件状态,控制识别器的开闭状态 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lastOffset AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentTarget AST#expression#Right . isEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . isBegin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lastOffset AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentTarget AST#expression#Right . isBegin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lastOffset AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [EndExclude set_gesture_judge] } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xDCDCDC AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.gesture_GestureJudge_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Entry
@Component
export struct GestureJudge {
scroller: Scroller = new Scroller();
scroller2: Scroller = new Scroller();
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
private childRecognizer: GestureRecognizer = new GestureRecognizer();
private currentRecognizer: GestureRecognizer = new GestureRecognizer();
private lastOffset: number = 0;
build() {
NavDestination() {
Column({ space: 12 }) {
Text($r('app.string.gesture_GestureJudge_text'))
.fontSize(14)
.fontColor('#666')
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
Column() {
Text('Scroll Area')
.width('90%')
.height(150)
.backgroundColor(0xFFFFFF)
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
Scroll(this.scroller2) {
Column() {
Text('Scroll Area2')
.width('90%')
.height(150)
.backgroundColor(0xFFFFFF)
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
Column() {
ForEach(this.arr, (item: number) => {
Text(item.toString())
.width('90%')
.height(150)
.backgroundColor(0xFFFFFF)
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
}, (item: string) => item)
}.width('100%')
}
}
.id('inner')
.width('100%')
.height(800)
}.width('100%')
}
.id('outer')
.height(600)
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.On)
.scrollBarColor(Color.Gray)
.scrollBarWidth(10)
.edgeEffect(EdgeEffect.None)
.shouldBuiltInRecognizerParallelWith((current: GestureRecognizer, others: Array<GestureRecognizer>) => {
for (let i = 0; i < others.length; i++) {
let target = others[i].getEventTargetInfo();
if (target.getId() == 'inner' && others[i].isBuiltIn() &&
others[i].getType() == GestureControl.GestureType.PAN_GESTURE) {
this.currentRecognizer = current;
this.childRecognizer = others[i];
return others[i];
}
}
return undefined;
})
.onGestureRecognizerJudgeBegin((event: BaseGestureEvent, current: GestureRecognizer,
others: Array<GestureRecognizer>) => {
let target = current.getEventTargetInfo();
if (target.getId() == 'outer' && current.isBuiltIn() &&
current.getType() == GestureControl.GestureType.PAN_GESTURE) {
for (let i = 0; i < others.length; i++) {
let target = others[i].getEventTargetInfo() as ScrollableTargetInfo;
if (target instanceof ScrollableTargetInfo && target.getId() == 'inner') {
let panEvent = event as PanGestureEvent;
this.childRecognizer.setEnabled(true);
this.currentRecognizer.setEnabled(false);
if (target.isEnd()) {
if (panEvent && panEvent.offsetY < 0) {
this.childRecognizer.setEnabled(false);
this.currentRecognizer.setEnabled(true);
}
} else if (target.isBegin()) {
if (panEvent.offsetY > 0) {
this.childRecognizer.setEnabled(false);
this.currentRecognizer.setEnabled(true);
}
}
}
}
}
return GestureJudgeResult.CONTINUE;
})
.parallelGesture(
PanGesture()
.onActionUpdate((event: GestureEvent) => {
if (this.childRecognizer.getState() != GestureRecognizerState.SUCCESSFUL ||
this.currentRecognizer.getState() != GestureRecognizerState.SUCCESSFUL) {
return;
}
let target = this.childRecognizer.getEventTargetInfo() as ScrollableTargetInfo;
let currentTarget = this.currentRecognizer.getEventTargetInfo() as ScrollableTargetInfo;
if (target instanceof ScrollableTargetInfo && currentTarget instanceof ScrollableTargetInfo) {
this.childRecognizer.setEnabled(true);
this.currentRecognizer.setEnabled(false);
if (target.isEnd()) {
if ((event.offsetY - this.lastOffset) < 0) {
this.childRecognizer.setEnabled(false);
if (currentTarget.isEnd()) {
this.currentRecognizer.setEnabled(false);
} else {
this.currentRecognizer.setEnabled(true);
}
}
} else if (target.isBegin()) {
if ((event.offsetY - this.lastOffset) > 0) {
this.childRecognizer.setEnabled(false);
if (currentTarget.isBegin()) {
this.currentRecognizer.setEnabled(false);
} else {
this.currentRecognizer.setEnabled(true);
}
}
}
}
this.lastOffset = event.offsetY;
})
)
}.width('100%').height('90%').backgroundColor(0xDCDCDC)
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.gesture_GestureJudge_title'))
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/gesturejudge/GestureJudge.ets#L18-L169
|
a4bb76a3b5ec7db304944ce855c78be9f439fade
|
gitee
|
Vinson0709/arkdemo.git
|
793491fe04b387f55dadfef86b30e28d0535d994
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
页面渲染 builder
|
build() {
Column() {
// 自定义builder渲染
this.listBuilder()
}
.width('100%')
.height('100%')
.backgroundColor($r('app.color.page_background'))
}
|
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 { // 自定义builder渲染 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 . listBuilder 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 '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.page_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column() {
this.listBuilder()
}
.width('100%')
.height('100%')
.backgroundColor($r('app.color.page_background'))
}
|
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Index.ets#L75-L83
|
ad37ee6d7b99c21ec893f22688e448e2356ea3e2
|
github
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/goods/src/main/ets/component/CommentItem.ets
|
arkts
|
构建评论 Item
@returns {void} 无返回值
|
build(): void {
RowStartTop({
widthValue: P100,
paddingValue: $r("app.float.space_padding_medium"),
onTap: this.onTap ? (_: ClickEvent): void => this.handleTap() : undefined
}) {
Avatar({
src: this.comment.avatarUrl ?? "",
avatarSize: 32
});
SpaceHorizontalMedium();
Column() {
Text(this.comment.nickName ?? $r("app.string.anonymous_user"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_primary"));
SpaceVerticalXSmall();
IBestRate({
value: this.comment.starCount,
count: 5,
iconSize: 14,
readOnly: true
});
if (this.comment.content) {
SpaceVerticalXSmall();
Text(this.comment.content)
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_secondary"))
.width(P100);
}
}
.layoutWeight(1)
.attributeModifier(columnStart());
if (this.comment.pics && this.comment.pics.length > 0) {
SpaceHorizontalMedium();
this.CommentImagePreview(this.comment.pics);
}
}
}
|
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RowStartTop ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left _ : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleTap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right : AST#expression#Left undefined AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left Avatar ( AST#component_parameters#Left { AST#component_parameter#Left src : 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 . comment AST#member_expression#Right AST#expression#Right . avatarUrl AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left avatarSize : AST#expression#Left 32 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left SpaceHorizontalMedium ( ) ; AST#ui_custom_component_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . comment AST#member_expression#Right AST#expression#Right . nickName AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.anonymous_user" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#binary_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.body_medium" 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.text_primary" 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#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalXSmall ( ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left IBestRate ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . comment AST#member_expression#Right AST#expression#Right . starCount AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left count : AST#expression#Left 5 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left iconSize : AST#expression#Left 14 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left readOnly : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . comment AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SpaceVerticalXSmall ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . comment AST#member_expression#Right AST#expression#Right . content 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.body_medium" 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.text_secondary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left P100 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . attributeModifier ( AST#expression#Left AST#call_expression#Left AST#expression#Left columnStart AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . comment AST#member_expression#Right AST#expression#Right . pics AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . comment AST#member_expression#Right AST#expression#Right . pics AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SpaceHorizontalMedium ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . CommentImagePreview 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 . comment AST#member_expression#Right AST#expression#Right . pics 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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build(): void {
RowStartTop({
widthValue: P100,
paddingValue: $r("app.float.space_padding_medium"),
onTap: this.onTap ? (_: ClickEvent): void => this.handleTap() : undefined
}) {
Avatar({
src: this.comment.avatarUrl ?? "",
avatarSize: 32
});
SpaceHorizontalMedium();
Column() {
Text(this.comment.nickName ?? $r("app.string.anonymous_user"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_primary"));
SpaceVerticalXSmall();
IBestRate({
value: this.comment.starCount,
count: 5,
iconSize: 14,
readOnly: true
});
if (this.comment.content) {
SpaceVerticalXSmall();
Text(this.comment.content)
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_secondary"))
.width(P100);
}
}
.layoutWeight(1)
.attributeModifier(columnStart());
if (this.comment.pics && this.comment.pics.length > 0) {
SpaceHorizontalMedium();
this.CommentImagePreview(this.comment.pics);
}
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/CommentItem.ets#L27-L70
|
0c0324c9da207bae5266371d8850913d88708a73
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/SettingsTypes.ets
|
arkts
|
设置重置选项接口
|
export interface SettingsResetOptions {
resetTheme: boolean;
resetNotifications: boolean;
resetDisplay: boolean;
resetPrivacy: boolean;
resetAI: boolean;
resetData: boolean;
resetAdvanced: boolean;
keepUserData: boolean;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface SettingsResetOptions AST#object_type#Left { AST#type_member#Left resetTheme : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left resetNotifications : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left resetDisplay : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left resetPrivacy : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left resetAI : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left resetData : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left resetAdvanced : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left keepUserData : 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 SettingsResetOptions {
resetTheme: boolean;
resetNotifications: boolean;
resetDisplay: boolean;
resetPrivacy: boolean;
resetAI: boolean;
resetData: boolean;
resetAdvanced: boolean;
keepUserData: boolean;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L489-L498
|
a5718668c7b161fb4eb08c91240f0cd79317efb6
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets
|
arkts
|
changeOpacityImage
|
修改图片透明度为0.5
|
private changeOpacityImage() {
if (this.pixelMap != undefined) {
// [Start pixelmap_change_opacity_image]
// 透明度0.5
this.pixelMap.opacity(0.5).then(() => {
this.updateImageInfo();
})
// [End pixelmap_change_opacity_image]
}
}
|
AST#method_declaration#Left private changeOpacityImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // [Start pixelmap_change_opacity_image] // 透明度0.5 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right . opacity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0.5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateImageInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // [End pixelmap_change_opacity_image] } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private changeOpacityImage() {
if (this.pixelMap != undefined) {
this.pixelMap.opacity(0.5).then(() => {
this.updateImageInfo();
})
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets#L310-L319
|
bb482424e31f5844b85841bf0cd9c9a8cc6c2a5f
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_ui/src/main/ets/ui/web/WebViewUtil.ets
|
arkts
|
WebViewUtil
|
@Author csx
@DateTime 2024/9/3 23:24
@TODO WebViewUtil
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui
|
@Component
export struct WebViewUtil {
controller: webview.WebviewController = new webview.WebviewController();
aboutToAppear(): void {
try {
webview.WebviewController.setWebDebuggingAccess(true);
} catch (error) {
console.error(`ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
}
}
build() {
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WebViewUtil AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left webview AST#expression#Right AST#new_expression#Right AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . setWebDebuggingAccess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` ErrorCode: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , Message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct WebViewUtil {
controller: webview.WebviewController = new webview.WebviewController();
aboutToAppear(): void {
try {
webview.WebviewController.setWebDebuggingAccess(true);
} catch (error) {
console.error(`ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
}
}
build() {
}
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/web/WebViewUtil.ets#L25-L40
|
b35460fd698fc32855ded697b137255203344f0b
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_speech/src/main/ets/TextReaderHelper.ets
|
arkts
|
setListener
|
设置监听事件
@param listener
|
static setListener(listener: TextReaderListener) {
if (listener?.onStateChange) {
TextReaderHelper.on('stateChange', listener.onStateChange);
}
if (listener?.onStop) {
TextReaderHelper.on('stop', listener.onStop);
}
if (listener?.onRelease) {
TextReaderHelper.on('release', listener.onRelease);
}
if (listener?.onShowPanel) {
TextReaderHelper.on('showPanel', listener.onShowPanel);
}
if (listener?.onHidePanel) {
TextReaderHelper.on('hidePanel', listener.onHidePanel);
}
if (listener?.onSetArticle) {
TextReaderHelper.on('setArticle', listener.onSetArticle);
}
if (listener?.onClickArticle) {
TextReaderHelper.on('clickArticle', listener.onClickArticle);
}
if (listener?.onClickAuthor) {
TextReaderHelper.on('clickAuthor', listener.onClickAuthor);
}
if (listener?.onClickNotification) {
TextReaderHelper.on('clickNotification', listener.onClickNotification);
}
if (listener?.onRequestMore) {
TextReaderHelper.on('requestMore', listener.onRequestMore);
}
if (listener?.onEventPanel) {
TextReaderHelper.on('eventPanel', listener.onEventPanel);
}
if (listener?.onEventNotification) {
TextReaderHelper.on('eventNotification', listener.onEventNotification);
}
if (listener?.onEventReadList) {
TextReaderHelper.on('eventReadList', listener.onEventReadList);
}
}
|
AST#method_declaration#Left static setListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left TextReaderListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onStateChange 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stateChange' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onStateChange 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onStop 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stop' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onStop 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onRelease 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'release' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onRelease 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onShowPanel 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showPanel' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onShowPanel 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onHidePanel 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'hidePanel' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onHidePanel 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onSetArticle 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'setArticle' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onSetArticle 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onClickArticle 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'clickArticle' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onClickArticle 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onClickAuthor 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'clickAuthor' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onClickAuthor 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onClickNotification 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'clickNotification' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onClickNotification 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onRequestMore 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'requestMore' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onRequestMore 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onEventPanel 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'eventPanel' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onEventPanel 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onEventNotification 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'eventNotification' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onEventNotification 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right ?. onEventReadList 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 TextReaderHelper AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'eventReadList' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onEventReadList 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#builder_function_body#Right AST#method_declaration#Right
|
static setListener(listener: TextReaderListener) {
if (listener?.onStateChange) {
TextReaderHelper.on('stateChange', listener.onStateChange);
}
if (listener?.onStop) {
TextReaderHelper.on('stop', listener.onStop);
}
if (listener?.onRelease) {
TextReaderHelper.on('release', listener.onRelease);
}
if (listener?.onShowPanel) {
TextReaderHelper.on('showPanel', listener.onShowPanel);
}
if (listener?.onHidePanel) {
TextReaderHelper.on('hidePanel', listener.onHidePanel);
}
if (listener?.onSetArticle) {
TextReaderHelper.on('setArticle', listener.onSetArticle);
}
if (listener?.onClickArticle) {
TextReaderHelper.on('clickArticle', listener.onClickArticle);
}
if (listener?.onClickAuthor) {
TextReaderHelper.on('clickAuthor', listener.onClickAuthor);
}
if (listener?.onClickNotification) {
TextReaderHelper.on('clickNotification', listener.onClickNotification);
}
if (listener?.onRequestMore) {
TextReaderHelper.on('requestMore', listener.onRequestMore);
}
if (listener?.onEventPanel) {
TextReaderHelper.on('eventPanel', listener.onEventPanel);
}
if (listener?.onEventNotification) {
TextReaderHelper.on('eventNotification', listener.onEventNotification);
}
if (listener?.onEventReadList) {
TextReaderHelper.on('eventReadList', listener.onEventReadList);
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L242-L282
|
0d3b2832e20926ddf0b7ecd061df51a6b0c65d76
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/marquee/src/main/ets/model/DataType.ets
|
arkts
|
行程信息类型
@param id
@param trainNumber 列车号
@param wholeCourse 全程
@param startingTime 起始时间
@param endingTime 终止时间
@param timeDifference 距出发时间
@param origin 起始位置
@param destination 目的地
@param ticketEntrance 检票口
@param vehicleModel 车型
|
export interface TripDataType {
id: number;
trainNumber: string;
wholeCourse: ResourceStr;
startingTime: string;
endingTime: string;
timeDifference: ResourceStr;
origin: ResourceStr;
destination: ResourceStr;
ticketEntrance: ResourceStr;
vehicleModel: ResourceStr;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface TripDataType AST#object_type#Left { AST#type_member#Left id : 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 trainNumber : 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 wholeCourse : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left startingTime : 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 endingTime : 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 timeDifference : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left origin : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left destination : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left ticketEntrance : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left vehicleModel : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface TripDataType {
id: number;
trainNumber: string;
wholeCourse: ResourceStr;
startingTime: string;
endingTime: string;
timeDifference: ResourceStr;
origin: ResourceStr;
destination: ResourceStr;
ticketEntrance: ResourceStr;
vehicleModel: ResourceStr;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/model/DataType.ets#L32-L43
|
b7cbeb09f40e3333dd8488ac546490a1318c744e
|
gitee
|
|
huang7855196/ArkTs-iLearn.git
|
08590adaca7a58d5284416ba5cfc09117122af84
|
HomeModule/src/main/ets/components/QuestionDetailComp.ets
|
arkts
|
QuestionDetailComp
|
@desc:问题详情页
@author:hxy
@time:2024/3/19
|
@Component
export struct QuestionDetailComp {
@State
item: QuestionDetail = {} as QuestionDetail
@State
list: QuestionDetail[] = []
@State
index: number = 0
mViewModel: HomeViewModel = new HomeViewModel()
controller: webview.WebviewController = new webview.WebviewController()
aboutToAppear() {
const params = router.getParams() as DetailParams
if (params) {
this.item = params.item as QuestionDetail
this.list = params.list as QuestionDetail[]
this.index = this.list.findIndex(item => item.id === this.item.id)
this.getData()
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct QuestionDetailComp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right item : AST#type_annotation#Left AST#primary_type#Left QuestionDetail AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left QuestionDetail AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left QuestionDetail [ ] 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#ERROR#Left AST#decorator#Left @ State AST#decorator#Right index AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right mViewModel : AST#type_annotation#Left AST#primary_type#Left HomeViewModel 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 HomeViewModel 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 controller AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left webview AST#expression#Right AST#new_expression#Right AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left aboutToAppear AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right { AST#property_name#Left const AST#property_name#Right params AST#ERROR#Right = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . getParams AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left DetailParams AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#ERROR#Left if AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . item AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . item AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left QuestionDetail AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . list AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . list AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left QuestionDetail [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . index 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 . list 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 item => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . item AST#member_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#ERROR#Left this AST#ERROR#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#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right } AST#ERROR#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct QuestionDetailComp {
@State
item: QuestionDetail = {} as QuestionDetail
@State
list: QuestionDetail[] = []
@State
index: number = 0
mViewModel: HomeViewModel = new HomeViewModel()
controller: webview.WebviewController = new webview.WebviewController()
aboutToAppear() {
const params = router.getParams() as DetailParams
if (params) {
this.item = params.item as QuestionDetail
this.list = params.list as QuestionDetail[]
this.index = this.list.findIndex(item => item.id === this.item.id)
this.getData()
}
}
|
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/HomeModule/src/main/ets/components/QuestionDetailComp.ets#L14-L33
|
f6480110110424b7ff0cd4176578c0830e1a4ba2
|
github
|
RicardoWesleyli/ArkUI-Animations.git
|
a85f94156d3fde1439bfb68a2108dbc3eb4a1dca
|
BuyButtonAnimation/entry/src/main/ets/pages/Index.ets
|
arkts
|
aboutToAppear
|
生命周期方法:页面加载时执行
|
aboutToAppear() {
this.startSpinAnimation()
this.startIconAnimation()
}
|
AST#method_declaration#Left aboutToAppear 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 this AST#expression#Right . startSpinAnimation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startIconAnimation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
aboutToAppear() {
this.startSpinAnimation()
this.startIconAnimation()
}
|
https://github.com/RicardoWesleyli/ArkUI-Animations.git/blob/a85f94156d3fde1439bfb68a2108dbc3eb4a1dca/BuyButtonAnimation/entry/src/main/ets/pages/Index.ets#L92-L95
|
7588ca9e017529f51cf838947ecf68c313c693b7
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/UI/ImageViewer/entry/src/main/ets/view/PicturePreview.ets
|
arkts
|
getListMaxLength
|
获取图片数量和设置懒加载图片数据
|
getListMaxLength() {
this.listMaxLength = this.imageList.length;
this.lazyImageList.clearAndPushAll(this.imageList);
}
|
AST#method_declaration#Left getListMaxLength AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listMaxLength 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 . imageList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . lazyImageList AST#member_expression#Right AST#expression#Right . clearAndPushAll 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 . imageList AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
getListMaxLength() {
this.listMaxLength = this.imageList.length;
this.lazyImageList.clearAndPushAll(this.imageList);
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/view/PicturePreview.ets#L65-L68
|
9de71784e5b59a48b8f8561d60d65f5a71046b33
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets
|
arkts
|
getFullFps
|
方法描述 计算满帧
@param maxFps maxFps
@return java.lang.Integer get full fps
|
static getFullFps(maxFps: number): number {
/*关于满帧判定,把所有帧率做一次遍历:
* 1、只要有>=100帧,则判断为120帧
* 2、否则只要有>=70 且所有帧都小于100,则判断为90帧
* 1、否则只要有>=44 并且 所有帧都小于70的情况,就按照满帧60帧
* 2、只要有>=34,且所有帧率均小于44的,就按照满帧40帧
* 3、如果所有帧率均小于34帧的,就按照满帧30
*/
if (maxFps >= 100) {
return 120;
} else if (maxFps >= 70) {
return 90;
} else if (maxFps >= 44) {
return 60;
} else if (maxFps >= 34) {
return 40;
}
return 30;
}
|
AST#method_declaration#Left static getFullFps AST#parameter_list#Left ( AST#parameter#Left maxFps : 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 { /*关于满帧判定,把所有帧率做一次遍历:
* 1、只要有>=100帧,则判断为120帧
* 2、否则只要有>=70 且所有帧都小于100,则判断为90帧
* 1、否则只要有>=44 并且 所有帧都小于70的情况,就按照满帧60帧
* 2、只要有>=34,且所有帧率均小于44的,就按照满帧40帧
* 3、如果所有帧率均小于34帧的,就按照满帧30
*/ AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left maxFps AST#expression#Right >= AST#expression#Left 100 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 120 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left maxFps AST#expression#Right >= AST#expression#Left 70 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 90 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left maxFps AST#expression#Right >= AST#expression#Left 44 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 60 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left maxFps AST#expression#Right >= AST#expression#Left 34 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 40 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 30 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getFullFps(maxFps: number): number {
if (maxFps >= 100) {
return 120;
} else if (maxFps >= 70) {
return 90;
} else if (maxFps >= 44) {
return 60;
} else if (maxFps >= 34) {
return 40;
}
return 30;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets#L48-L67
|
06e76307001433a89f42f50d76cb5a6bf332d53b
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/ColumnInfo.ets
|
arkts
|
Copyright (C), 2024-06-22
@author LinXun
@date 2024-06-22 10:08
@version 1.0
@description: 数据库列接口
|
export interface ColumnInfo{
// 实体属性名
name: string
// 数据库列名
columnName: string
// 列类型
type: ColumnType
defaultValue?: string | number
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ColumnInfo AST#object_type#Left { // 实体属性名 AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 数据库列名 AST#type_member#Left columnName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 列类型 AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left ColumnType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left defaultValue ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ColumnInfo{
name: string
columnName: string
type: ColumnType
defaultValue?: string | number
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/ColumnInfo.ets#L8-L16
|
6f52238660c24875bda3509672b920e3d16872f7
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/calendar/LunarCalendar.ets
|
arkts
|
getLunarMonthDays
|
获取农历月的天数
|
private getLunarMonthDays(year: number, month: number): number {
if (year < 1900 || year > 2100 || month < 1 || month > 12) return 30;
const yearInfo = this.lunarInfo[year - 1900];
return (yearInfo & (0x10000 >> month)) ? 30 : 29;
}
|
AST#method_declaration#Left private getLunarMonthDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#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 year AST#expression#Right < AST#expression#Left 1900 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left year AST#expression#Right > AST#expression#Left 2100 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left month AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left month 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#statement#Left AST#return_statement#Left return AST#expression#Left 30 AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left yearInfo = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lunarInfo AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left year AST#expression#Right - AST#expression#Left 1900 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left yearInfo AST#expression#Right & AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 0x10000 AST#expression#Right >> AST#expression#Left month 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#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 30 AST#expression#Right : AST#expression#Left 29 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private getLunarMonthDays(year: number, month: number): number {
if (year < 1900 || year > 2100 || month < 1 || month > 12) return 30;
const yearInfo = this.lunarInfo[year - 1900];
return (yearInfo & (0x10000 >> month)) ? 30 : 29;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarCalendar.ets#L183-L188
|
7caca4072291f4680ce0f8d602e3bf3d645fdb81
|
github
|
kaina404/HarmonyStock.git
|
99233a46fb0dfb21e02294c730fd80e2fb404f9b
|
entry/src/main/ets/pages/component/PanKouComponent.ets
|
arkts
|
_drawUI
|
绘制UI
|
_drawUI() {
this._clearCanvas()
this._drawNewPrice()
this._drawPanKouDetail()
// this.panKouDetail.strokeRect(this.context, "#e2233e")
}
|
AST#method_declaration#Left _drawUI 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 this AST#expression#Right . _clearCanvas AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _drawNewPrice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _drawPanKouDetail 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 // this.panKouDetail.strokeRect(this.context, "#e2233e") } AST#builder_function_body#Right AST#method_declaration#Right
|
_drawUI() {
this._clearCanvas()
this._drawNewPrice()
this._drawPanKouDetail()
}
|
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/PanKouComponent.ets#L47-L52
|
48562f99f7b33fa9ebcab834b52391faf53ebbbf
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/DES.ets
|
arkts
|
generateSymKeySync
|
生成对称密钥SymKey,同步
@param symAlgName 待生成对称密钥生成器的算法名称(3DES192)
@returns
|
static generateSymKeySync(): cryptoFramework.SymKey {
return CryptoUtil.generateSymKeySync('3DES192');
}
|
AST#method_declaration#Left static generateSymKeySync AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#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 CryptoUtil AST#expression#Right . generateSymKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '3DES192' 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 generateSymKeySync(): cryptoFramework.SymKey {
return CryptoUtil.generateSymKeySync('3DES192');
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L200-L202
|
a7c8f2bc7c2f361cafd5370bb30d089afdc201da
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/lunar/OnlineLunarService.ets
|
arkts
|
农历年份详细信息
|
export interface OnlineLunarYear {
year: number;
zodiac: string;
ganzhi: string;
leapMonth: number;
isLeapYear: boolean;
leapMonthDays?: number;
solarTerms: SolarTermInfo[];
festivals: LunarFestival[];
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface OnlineLunarYear AST#object_type#Left { AST#type_member#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left zodiac : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left ganzhi : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left leapMonth : 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 isLeapYear : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left leapMonthDays ? : 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 solarTerms : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SolarTermInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left festivals : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left LunarFestival [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface OnlineLunarYear {
year: number;
zodiac: string;
ganzhi: string;
leapMonth: number;
isLeapYear: boolean;
leapMonthDays?: number;
solarTerms: SolarTermInfo[];
festivals: LunarFestival[];
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/OnlineLunarService.ets#L36-L45
|
26722763c3e428d32d20422eb00ebc83547e84db
|
github
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/utils/DateHelper.ets
|
arkts
|
isSameMinute
|
是否是同一分
|
static isSameMinute(selectDate: Date, date: Date): boolean {
return DateHelper.isSameHour(selectDate, date) && selectDate.getMinutes() == date.getMinutes();
}
|
AST#method_declaration#Left static isSameMinute AST#parameter_list#Left ( AST#parameter#Left selectDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateHelper AST#expression#Right . isSameHour AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left selectDate AST#expression#Right , AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left selectDate AST#expression#Right AST#binary_expression#Right AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left date AST#expression#Right AST#binary_expression#Right AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static isSameMinute(selectDate: Date, date: Date): boolean {
return DateHelper.isSameHour(selectDate, date) && selectDate.getMinutes() == date.getMinutes();
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L144-L146
|
ed096cc2e04489ff4ae43cdeafd44463dc5c04e0
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets
|
arkts
|
getCredential
|
/** * 获取固定密钥 仅在测试时使用 public static constCredential: CredentialCallBack = (request)=>{ return new Promise((resolve, reject) => { let credential : QCloudCredential= new QCloudCredential(); // 用户的 SecretId,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140 credential.secretID = "SECRETID"; // 用户的 SecretKey,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140 credential.secretKey = "SECRETKEY"; resolve(credential); }) } /获取密钥
|
getCredential(): QCloudCredential {
let credential : QCloudCredential= new QCloudCredential();
// 用户的 SecretId
credential.secretID = StringEncoder.decodeAfterRemoveSalt(CosConfig.secretId)!! //"SECRETID";
// 用户的 SecretKey
credential.secretKey = StringEncoder.decodeAfterRemoveSalt(CosConfig.secretKey)!! //"SECRETKEY";
//TODO: 获取临时密钥
//Credential.sessionCredential
return credential
}
|
AST#method_declaration#Left getCredential AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left QCloudCredential AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left credential : AST#type_annotation#Left AST#primary_type#Left QCloudCredential 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 QCloudCredential 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 // 用户的 SecretId AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left credential AST#expression#Right . secretID AST#member_expression#Right = AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringEncoder AST#expression#Right . decodeAfterRemoveSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CosConfig AST#expression#Right . secretId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right //"SECRETID"; // 用户的 SecretKey AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left credential AST#expression#Right . secretKey AST#member_expression#Right = AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringEncoder AST#expression#Right . decodeAfterRemoveSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CosConfig AST#expression#Right . secretKey AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right //"SECRETKEY"; //TODO: 获取临时密钥 //Credential.sessionCredential AST#statement#Left AST#return_statement#Left return AST#expression#Left credential AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getCredential(): QCloudCredential {
let credential : QCloudCredential= new QCloudCredential();
credential.secretID = StringEncoder.decodeAfterRemoveSalt(CosConfig.secretId)!!
credential.secretKey = StringEncoder.decodeAfterRemoveSalt(CosConfig.secretKey)!!
return credential
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets#L79-L92
|
6f6371fc3197b7485955db75ef7afe4bae2e7383
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/utils/Helper.ets
|
arkts
|
isLargeScreen
|
是否是大屏,大于手机屏幕宽度500vp
|
static isLargeScreen(): boolean {
return Helper.getDisplayWidth() > 500;
}
|
AST#method_declaration#Left static isLargeScreen AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . getDisplayWidth 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 500 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 isLargeScreen(): boolean {
return Helper.getDisplayWidth() > 500;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L202-L204
|
dd1fe3508eb9cb0cc6725d2da5422188a9e23146
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/data/CandleDataSet.ets
|
arkts
|
DataSet for the CandleStickChart.
|
export default class CandleDataSet extends LineScatterCandleRadarDataSet<CandleEntry> implements ICandleDataSet {
/**
* the width of the shadow of the candle
*/
private mShadowWidth: number = 3;
/**
* should the candle bars show?
* when false, only "ticks" will show
* <p/>
* - default: true
*/
private mShowCandleBar: boolean = true;
/**
* the space between the candle entries, default 0.1f (10%)
*/
private mBarSpace: number = 0.1;
/**
* use candle color for the shadow
*/
private mShadowColorSameAsCandle: boolean = false;
/**
* paint style when open < close
* increasing candlesticks are traditionally hollow
*/
protected mIncreasingPaintStyle: Style = Style.STROKE;
/**
* paint style when open > close
* decreasing candlesticks are traditionally filled
*/
protected mDecreasingPaintStyle: Style = Style.FILL;
/**
* color for open == close
*/
protected mNeutralColor: number = ColorTemplate.COLOR_SKIP;
/**
* color for open < close
*/
protected mIncreasingColor: number = ColorTemplate.COLOR_SKIP;
/**
* color for open > close
*/
protected mDecreasingColor: number = ColorTemplate.COLOR_SKIP;
/**
* shadow line color, set -1 for backward compatibility and uses default
* color
*/
protected mShadowColor: number = ColorTemplate.COLOR_SKIP;
constructor(yVals: JArrayList<CandleEntry>, label: string) {
super(yVals, label);
}
public copy(): DataSet<CandleEntry> {
let entries = new JArrayList<CandleEntry>();
if (this.mEntries != null) {
for (let i = 0; i < this.mEntries.size(); i++) {
entries.add(this.mEntries.get(i).copy());
}
}
let copied = new CandleDataSet(entries, this.getLabel());
this.copyTo(copied);
return copied;
}
protected copyTo(candleDataSet: CandleDataSet): void {
super.copyTo(candleDataSet);
candleDataSet.mShadowWidth = this.mShadowWidth;
candleDataSet.mShowCandleBar = this.mShowCandleBar;
candleDataSet.mBarSpace = this.mBarSpace;
candleDataSet.mShadowColorSameAsCandle = this.mShadowColorSameAsCandle;
candleDataSet.mHighLightColor = this.mHighLightColor;
candleDataSet.mIncreasingPaintStyle = this.mIncreasingPaintStyle;
candleDataSet.mDecreasingPaintStyle = this.mDecreasingPaintStyle;
candleDataSet.mNeutralColor = this.mNeutralColor;
candleDataSet.mIncreasingColor = this.mIncreasingColor;
candleDataSet.mDecreasingColor = this.mDecreasingColor;
candleDataSet.mShadowColor = this.mShadowColor;
}
public myCalcMinMax(e: CandleEntry): void {
if (e.getLow() < this.mYMin)
this.mYMin = e.getLow();
if (e.getHigh() > this.mYMax)
this.mYMax = e.getHigh();
this.calcMinMaxX(e);
}
protected myCalcMinMaxY(e: CandleEntry): void {
if (e.getHigh() < this.mYMin)
this.mYMin = e.getHigh();
if (e.getHigh() > this.mYMax)
this.mYMax = e.getHigh();
if (e.getLow() < this.mYMin)
this.mYMin = e.getLow();
if (e.getLow() > this.mYMax)
this.mYMax = e.getLow();
}
/**
* Sets the space that is left out on the left and right side of each
* candle, default 0.1f (10%), max 0.45f, min 0f
*
* @param space
*/
public setBarSpace(space: number): void {
if (space < 0)
space = 0;
if (space > 0.45)
space = 0.45;
this.mBarSpace = space;
}
public getBarSpace(): number {
return this.mBarSpace;
}
/**
* Sets the width of the candle-shadow-line in pixels. Default 3f.
*
* @param width
*/
public setShadowWidth(width: number): void {
this.mShadowWidth = Utils.handleDataValues(width);
// this.mShadowWidth = width;
}
public getShadowWidth(): number {
return this.mShadowWidth;
}
/**
* Sets whether the candle bars should show?
*
* @param showCandleBar
*/
public setShowCandleBar(showCandleBar: boolean): void {
this.mShowCandleBar = showCandleBar;
}
public getShowCandleBar(): boolean {
return this.mShowCandleBar;
}
/**
* It is necessary to implement ColorsList class that will encapsulate
* colors list functionality, because It's wrong to copy paste setColor,
* addColor, ... resetColors for each time when we want to add a coloring
* options for one of objects
*
* @author Mesrop
*/
/** BELOW THIS COLOR HANDLING */
/**
* Sets the one and ONLY color that should be used for this DataSet when
* open == close.
*
* @param color
*/
public setNeutralColor(color: number): void {
this.mNeutralColor = color;
}
public getNeutralColor(): number {
return this.mNeutralColor;
}
/**
* Sets the one and ONLY color that should be used for this DataSet when
* open <= close.
*
* @param color
*/
public setIncreasingColor(color: number): void {
this.mIncreasingColor = color;
}
public getIncreasingColor(): number {
return this.mIncreasingColor;
}
/**
* Sets the one and ONLY color that should be used for this DataSet when
* open > close.
*
* @param color
*/
public setDecreasingColor(color: number): void {
this.mDecreasingColor = color;
}
public getDecreasingColor(): number {
return this.mDecreasingColor;
}
public getIncreasingPaintStyle(): Style {
return this.mIncreasingPaintStyle;
}
/**
* Sets paint style when open < close
*
* @param paintStyle
*/
public setIncreasingPaintStyle(paintStyle: Style): void {
this.mIncreasingPaintStyle = paintStyle;
}
public getDecreasingPaintStyle(): Style {
return this.mDecreasingPaintStyle;
}
/**
* Sets paint style when open > close
*
* @param decreasingPaintStyle
*/
public setDecreasingPaintStyle(decreasingPaintStyle: Style): void {
this.mDecreasingPaintStyle = decreasingPaintStyle;
}
public getShadowColor(): number {
return this.mShadowColor;
}
/**
* Sets shadow color for all entries
*
* @param shadowColor
*/
public setShadowColor(shadowColor: number): void {
this.mShadowColor = shadowColor;
}
public getShadowColorSameAsCandle(): boolean {
return this.mShadowColorSameAsCandle;
}
/**
* Sets shadow color to be the same color as the candle color
*
* @param shadowColorSameAsCandle
*/
public setShadowColorSameAsCandle(shadowColorSameAsCandle: boolean): void {
this.mShadowColorSameAsCandle = shadowColorSameAsCandle;
}
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class CandleDataSet extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left LineScatterCandleRadarDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CandleEntry 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#implements_clause#Left implements ICandleDataSet AST#implements_clause#Right AST#class_body#Left { /**
* the width of the shadow of the candle
*/ AST#property_declaration#Left private mShadowWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right /**
* should the candle bars show?
* when false, only "ticks" will show
* <p/>
* - default: true
*/ AST#property_declaration#Left private mShowCandleBar : 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 /**
* the space between the candle entries, default 0.1f (10%)
*/ AST#property_declaration#Left private mBarSpace : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.1 AST#expression#Right ; AST#property_declaration#Right /**
* use candle color for the shadow
*/ AST#property_declaration#Left private mShadowColorSameAsCandle : 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 /**
* paint style when open < close
* increasing candlesticks are traditionally hollow
*/ AST#property_declaration#Left protected mIncreasingPaintStyle : AST#type_annotation#Left AST#primary_type#Left Style AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Style AST#expression#Right . STROKE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* paint style when open > close
* decreasing candlesticks are traditionally filled
*/ AST#property_declaration#Left protected mDecreasingPaintStyle : AST#type_annotation#Left AST#primary_type#Left Style AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Style AST#expression#Right . FILL AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* color for open == close
*/ AST#property_declaration#Left protected mNeutralColor : 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 ColorTemplate AST#expression#Right . COLOR_SKIP AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* color for open < close
*/ AST#property_declaration#Left protected mIncreasingColor : 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 ColorTemplate AST#expression#Right . COLOR_SKIP AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* color for open > close
*/ AST#property_declaration#Left protected mDecreasingColor : 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 ColorTemplate AST#expression#Right . COLOR_SKIP AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* shadow line color, set -1 for backward compatibility and uses default
* color
*/ AST#property_declaration#Left protected mShadowColor : 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 ColorTemplate AST#expression#Right . COLOR_SKIP AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left yVals : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CandleEntry 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 label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( AST#expression#Left yVals AST#expression#Right , AST#expression#Left label AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left public copy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left DataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CandleEntry 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 entries = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CandleEntry 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#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 . mEntries 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#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#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 . mEntries AST#member_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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left entries 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#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 . mEntries AST#member_expression#Right 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 . copy 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#for_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 copied = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CandleDataSet AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left entries AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getLabel 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 this AST#expression#Right . copyTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left copied AST#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 copied AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left protected copyTo AST#parameter_list#Left ( AST#parameter#Left candleDataSet : AST#type_annotation#Left AST#primary_type#Left CandleDataSet 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 super AST#expression#Right . copyTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left candleDataSet 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 candleDataSet AST#expression#Right . mShadowWidth AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShadowWidth 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 candleDataSet AST#expression#Right . mShowCandleBar AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShowCandleBar 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 candleDataSet AST#expression#Right . mBarSpace AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mBarSpace 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 candleDataSet AST#expression#Right . mShadowColorSameAsCandle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShadowColorSameAsCandle 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 candleDataSet AST#expression#Right . mHighLightColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mHighLightColor 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 candleDataSet AST#expression#Right . mIncreasingPaintStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIncreasingPaintStyle 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 candleDataSet AST#expression#Right . mDecreasingPaintStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDecreasingPaintStyle 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 candleDataSet AST#expression#Right . mNeutralColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mNeutralColor 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 candleDataSet AST#expression#Right . mIncreasingColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIncreasingColor 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 candleDataSet AST#expression#Right . mDecreasingColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDecreasingColor 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 candleDataSet AST#expression#Right . mShadowColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShadowColor AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public myCalcMinMax AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left CandleEntry 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getLow 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 . mYMin AST#member_expression#Right AST#expression#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 . mYMin AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getLow 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#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getHigh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mYMax AST#member_expression#Right AST#expression#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 . mYMax AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getHigh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calcMinMaxX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left protected myCalcMinMaxY AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left CandleEntry 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getHigh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mYMin AST#member_expression#Right AST#expression#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 . mYMin AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getHigh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 . getHigh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mYMax AST#member_expression#Right AST#expression#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 . mYMax AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getHigh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 . getLow 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 . mYMin AST#member_expression#Right AST#expression#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 . mYMin AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getLow 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#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getLow 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 . mYMax AST#member_expression#Right AST#expression#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 . mYMax AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . getLow 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets the space that is left out on the left and right side of each
* candle, default 0.1f (10%), max 0.45f, min 0f
*
* @param space
*/ AST#method_declaration#Left public setBarSpace AST#parameter_list#Left ( AST#parameter#Left space : 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#binary_expression#Left AST#expression#Left space AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left space = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left space AST#expression#Right > AST#expression#Left 0.45 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left space = AST#expression#Left 0.45 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mBarSpace AST#member_expression#Right = AST#expression#Left space AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public getBarSpace 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 this AST#expression#Right . mBarSpace AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets the width of the candle-shadow-line in pixels. Default 3f.
*
* @param width
*/ AST#method_declaration#Left public setShadowWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 . mShadowWidth AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . handleDataValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left width 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 // this.mShadowWidth = width; } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getShadowWidth 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 this AST#expression#Right . mShadowWidth AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets whether the candle bars should show?
*
* @param showCandleBar
*/ AST#method_declaration#Left public setShowCandleBar AST#parameter_list#Left ( AST#parameter#Left showCandleBar : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShowCandleBar AST#member_expression#Right = AST#expression#Left showCandleBar AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getShowCandleBar AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShowCandleBar AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* It is necessary to implement ColorsList class that will encapsulate
* colors list functionality, because It's wrong to copy paste setColor,
* addColor, ... resetColors for each time when we want to add a coloring
* options for one of objects
*
* @author Mesrop
*/ /** BELOW THIS COLOR HANDLING */ /**
* Sets the one and ONLY color that should be used for this DataSet when
* open == close.
*
* @param color
*/ AST#method_declaration#Left public setNeutralColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mNeutralColor AST#member_expression#Right = AST#expression#Left color AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getNeutralColor 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 this AST#expression#Right . mNeutralColor AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets the one and ONLY color that should be used for this DataSet when
* open <= close.
*
* @param color
*/ AST#method_declaration#Left public setIncreasingColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIncreasingColor AST#member_expression#Right = AST#expression#Left color AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getIncreasingColor 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 this AST#expression#Right . mIncreasingColor AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets the one and ONLY color that should be used for this DataSet when
* open > close.
*
* @param color
*/ AST#method_declaration#Left public setDecreasingColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDecreasingColor AST#member_expression#Right = AST#expression#Left color AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getDecreasingColor 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 this AST#expression#Right . mDecreasingColor 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 public getIncreasingPaintStyle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Style 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 . mIncreasingPaintStyle AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets paint style when open < close
*
* @param paintStyle
*/ AST#method_declaration#Left public setIncreasingPaintStyle AST#parameter_list#Left ( AST#parameter#Left paintStyle : AST#type_annotation#Left AST#primary_type#Left Style 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 . mIncreasingPaintStyle AST#member_expression#Right = AST#expression#Left paintStyle AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getDecreasingPaintStyle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Style 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 . mDecreasingPaintStyle AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets paint style when open > close
*
* @param decreasingPaintStyle
*/ AST#method_declaration#Left public setDecreasingPaintStyle AST#parameter_list#Left ( AST#parameter#Left decreasingPaintStyle : AST#type_annotation#Left AST#primary_type#Left Style 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 . mDecreasingPaintStyle AST#member_expression#Right = AST#expression#Left decreasingPaintStyle AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getShadowColor 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 this AST#expression#Right . mShadowColor AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets shadow color for all entries
*
* @param shadowColor
*/ AST#method_declaration#Left public setShadowColor AST#parameter_list#Left ( AST#parameter#Left shadowColor : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShadowColor AST#member_expression#Right = AST#expression#Left shadowColor AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getShadowColorSameAsCandle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShadowColorSameAsCandle AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets shadow color to be the same color as the candle color
*
* @param shadowColorSameAsCandle
*/ AST#method_declaration#Left public setShadowColorSameAsCandle AST#parameter_list#Left ( AST#parameter#Left shadowColorSameAsCandle : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShadowColorSameAsCandle AST#member_expression#Right = AST#expression#Left shadowColorSameAsCandle AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class CandleDataSet extends LineScatterCandleRadarDataSet<CandleEntry> implements ICandleDataSet {
private mShadowWidth: number = 3;
private mShowCandleBar: boolean = true;
private mBarSpace: number = 0.1;
private mShadowColorSameAsCandle: boolean = false;
protected mIncreasingPaintStyle: Style = Style.STROKE;
protected mDecreasingPaintStyle: Style = Style.FILL;
protected mNeutralColor: number = ColorTemplate.COLOR_SKIP;
protected mIncreasingColor: number = ColorTemplate.COLOR_SKIP;
protected mDecreasingColor: number = ColorTemplate.COLOR_SKIP;
protected mShadowColor: number = ColorTemplate.COLOR_SKIP;
constructor(yVals: JArrayList<CandleEntry>, label: string) {
super(yVals, label);
}
public copy(): DataSet<CandleEntry> {
let entries = new JArrayList<CandleEntry>();
if (this.mEntries != null) {
for (let i = 0; i < this.mEntries.size(); i++) {
entries.add(this.mEntries.get(i).copy());
}
}
let copied = new CandleDataSet(entries, this.getLabel());
this.copyTo(copied);
return copied;
}
protected copyTo(candleDataSet: CandleDataSet): void {
super.copyTo(candleDataSet);
candleDataSet.mShadowWidth = this.mShadowWidth;
candleDataSet.mShowCandleBar = this.mShowCandleBar;
candleDataSet.mBarSpace = this.mBarSpace;
candleDataSet.mShadowColorSameAsCandle = this.mShadowColorSameAsCandle;
candleDataSet.mHighLightColor = this.mHighLightColor;
candleDataSet.mIncreasingPaintStyle = this.mIncreasingPaintStyle;
candleDataSet.mDecreasingPaintStyle = this.mDecreasingPaintStyle;
candleDataSet.mNeutralColor = this.mNeutralColor;
candleDataSet.mIncreasingColor = this.mIncreasingColor;
candleDataSet.mDecreasingColor = this.mDecreasingColor;
candleDataSet.mShadowColor = this.mShadowColor;
}
public myCalcMinMax(e: CandleEntry): void {
if (e.getLow() < this.mYMin)
this.mYMin = e.getLow();
if (e.getHigh() > this.mYMax)
this.mYMax = e.getHigh();
this.calcMinMaxX(e);
}
protected myCalcMinMaxY(e: CandleEntry): void {
if (e.getHigh() < this.mYMin)
this.mYMin = e.getHigh();
if (e.getHigh() > this.mYMax)
this.mYMax = e.getHigh();
if (e.getLow() < this.mYMin)
this.mYMin = e.getLow();
if (e.getLow() > this.mYMax)
this.mYMax = e.getLow();
}
public setBarSpace(space: number): void {
if (space < 0)
space = 0;
if (space > 0.45)
space = 0.45;
this.mBarSpace = space;
}
public getBarSpace(): number {
return this.mBarSpace;
}
public setShadowWidth(width: number): void {
this.mShadowWidth = Utils.handleDataValues(width);
}
public getShadowWidth(): number {
return this.mShadowWidth;
}
public setShowCandleBar(showCandleBar: boolean): void {
this.mShowCandleBar = showCandleBar;
}
public getShowCandleBar(): boolean {
return this.mShowCandleBar;
}
public setNeutralColor(color: number): void {
this.mNeutralColor = color;
}
public getNeutralColor(): number {
return this.mNeutralColor;
}
public setIncreasingColor(color: number): void {
this.mIncreasingColor = color;
}
public getIncreasingColor(): number {
return this.mIncreasingColor;
}
public setDecreasingColor(color: number): void {
this.mDecreasingColor = color;
}
public getDecreasingColor(): number {
return this.mDecreasingColor;
}
public getIncreasingPaintStyle(): Style {
return this.mIncreasingPaintStyle;
}
public setIncreasingPaintStyle(paintStyle: Style): void {
this.mIncreasingPaintStyle = paintStyle;
}
public getDecreasingPaintStyle(): Style {
return this.mDecreasingPaintStyle;
}
public setDecreasingPaintStyle(decreasingPaintStyle: Style): void {
this.mDecreasingPaintStyle = decreasingPaintStyle;
}
public getShadowColor(): number {
return this.mShadowColor;
}
public setShadowColor(shadowColor: number): void {
this.mShadowColor = shadowColor;
}
public getShadowColorSameAsCandle(): boolean {
return this.mShadowColorSameAsCandle;
}
public setShadowColorSameAsCandle(shadowColorSameAsCandle: boolean): void {
this.mShadowColorSameAsCandle = shadowColorSameAsCandle;
}
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CandleDataSet.ets#L29-L285
|
795d6bf48958ae08bf044fbf06379f5de65fefd6
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/perfermance/customreusablepool/Index.ets
|
arkts
|
BuilderNodePoolDemoComponent
|
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 { BuilderNodePoolDemoComponent } from './src/main/ets/pages/BuilderNodePoolDemo';
|
AST#export_declaration#Left export { BuilderNodePoolDemoComponent } from './src/main/ets/pages/BuilderNodePoolDemo' ; AST#export_declaration#Right
|
export { BuilderNodePoolDemoComponent } from './src/main/ets/pages/BuilderNodePoolDemo';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/Index.ets#L16-L16
|
8ad7312b4b5089cd001ce0027d90fb2e63582b8c
|
gitee
|
hefengbao/jingmo-for-HarmonyOS.git
|
a208f3fdc95c0914749072e811301b9dfd6678d6
|
commons/constants/src/main/ets/DbConst.ets
|
arkts
|
为了保证平稳升级,所有的修改、删除操作都通过 SQL 语句完成,即不更改以前版本的 SQL 语句
|
export class DbMigrationConst {
// Version 1
static readonly CREATE_CHINA_WORLDCULTUREHERITAGE_TABLE: string =
'create table if not exists ' + DbTableConst.CHINA_WORLDCULTUREHERITAGE_TABLE +
' (id integer primary key autoincrement not null, type text not null, name text not null, year text not null, ' +
'year2 text, level text not null, address text not null, image text not null, content text not null)';
static readonly CREATE_CLASSICALLITERATURE_CLASSICPOEM_TABLE: string =
'create table if not exists ' + DbTableConst.CLASSICALLITERATURE_CLASSICPOEM_TABLE +
' (id integer primary key autoincrement not null, dynasty text not null, writer text not null,' +
' writer_introduction text, title text not null, subtitle text, preface text, content text not null,' +
' annotation text, translation text, creative_background text, explain text, comment text, collection text,' +
' category text )';
static readonly CREATE_CLASSICALLITERATURE_SENTENCE_TABLE: string =
'create table if not exists ' + DbTableConst.CLASSICALLITERATURE_SENTENCE_TABLE +
' (id integer primary key autoincrement not null, content text not null, from_txt text not null, poem_id integer)';
static readonly CREATE_CHINESE_ANTITHETICALCOUPLET_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_ANTITHETICALCOUPLET_TABLE +
' (id integer primary key autoincrement not null, body text not null, description text, image text)';
static readonly CREATE_CHINESE_CHARACTER_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_CHARACTER_TABLE +
' (id integer primary key autoincrement not null, character text not null, character2 text, pinyin text not null, ' +
'radical text, stroke integer, wubi text, explanations text, explanations2 text)';
static readonly CREATE_CHINESE_EXPRESSION_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_EXPRESSION_TABLE +
' (id integer not null primary key autoincrement, word text not null, pinyin text not null, explanation text, ' +
'example text, source text, quote text, similar text, opposite text, usage text, story text, notice text, ' +
'spelling text)';
static readonly CREATE_CHINESE_IDIOM_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_IDIOM_TABLE +
' (id integer not null primary key autoincrement, word text not null, pinyin text not null, abbr text not null, ' +
'explanation text, example text, source text, quote text, similar text, opposite text, usage text, story text, ' +
'notice text, spelling text)';
static readonly CREATE_CHINESE_KNOWLEDGE_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_KNOWLEDGE_TABLE +
' (id integer primary key autoincrement not null, content text not null, label text not null, url text)';
static readonly CREATE_CHINESE_MODERNPOETRY_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_MODERNPOETRY_TABLE +
' (id integer primary key autoincrement not null, title text not null, author text not null, ' +
'content text not null, zhu text, yi text, shang text, author_info text)';
static readonly CREATE_CHINESE_QUOTE_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_QUOTE_TABLE +
' (id integer primary key autoincrement not null, content text not null, author text, from_txt text not null)';
static readonly CREATE_BOOKMARKS_TABLE: string =
'create table if not exists ' + DbTableConst.BOOKMARKS_TABLE +
' (id integer primary key autoincrement not null, bookmarkable_id integer, bookmarkable_model text)';
// Version 2
static readonly CREATE_CHINESE_LYRIC_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_LYRIC_TABLE +
' (id integer primary key autoincrement not null, title text not null, writer text, ' +
'singer text, content text not null)';
static readonly CREATE_CHINESE_LYRIC_FTS_TABLE =
'CREATE VIRTUAL TABLE IF NOT EXISTS ' + DbTableConst.CHINESE_LYRIC_FTS_TABLE +
' USING fts4(id, title, content, tokenize=icu zh_CN)';
static readonly CREATE_CHINESE_MODERNPOETRY_FTS_TABLE: string =
'CREATE VIRTUAL TABLE IF NOT EXISTS ' + DbTableConst.CHINESE_MODERNPOETRY_FTS_TABLE +
' USING fts4(id, author, title, content, tokenize=icu zh_CN)';
static readonly CREATE_CHINESE_PROVERB_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_PROVERB_TABLE +
' (id integer primary key autoincrement not null, content text not null, tags text)';
static readonly CREATE_CHINESE_RIDDLE_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_RIDDLE_TABLE +
' (id integer primary key autoincrement not null, puzzle text, answer text)';
static readonly CREATE_CHINESE_TONGUETWISTER_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_TONGUETWISTER_TABLE +
' (id integer primary key autoincrement not null, title text not null, content text not null, content2 text)';
static readonly CREATE_CHINESE_WISECRACK_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_WISECRACK_TABLE +
' (id integer primary key autoincrement not null, riddle text not null, answer text not null, ' +
'first_letter text, first_word text)';
static readonly CREATE_CLASSICALLITERATURE_CLASSICPOEM_FTS_TABLE =
'CREATE VIRTUAL TABLE IF NOT EXISTS ' + DbTableConst.CLASSICALLITERATURE_CLASSICPOEM_FTS_TABLE +
' USING fts4(id, writer, title, content, tokenize=icu zh_CN)';
static readonly CREATE_CLASSICALLITERATURE_PEOPLE_TABLE: string =
'create table if not exists ' + DbTableConst.CLASSICALLITERATURE_PEOPLE_TABLE +
' (id integer primary key autoincrement not null, name text not null, birth_year text, ' +
'birthday text, death_year text, deathday text, dynasty text, aliases text, titles text, ' +
'hometown text, details text)';
static readonly CREATE_CLASSICALLITERATURE_WRITING_TABLE =
'create table if not exists ' + DbTableConst.CLASSICALLITERATURE_WRITING_TABLE + '' +
' (id integer primary key autoincrement not null, group_index integer, classes text, froms text, ' +
'allusions text, pictures text, dynasty text, author text, author_id integer, author_date text, ' +
'author_years text, author_place text, type text, type_detail text, rhyme text, rank integer, ' +
'first_clause_rhyme text, title text, subtitle text, tune_id text, preface text, ' +
'clauses text not null, note text, comments text)';
static readonly CREATE_CLASSICALLITERATURE_WRITING_FTS_TABLE =
'CREATE VIRTUAL TABLE IF NOT EXISTS ' + DbTableConst.CLASSICALLITERATURE_WRITING_FTS_TABLE +
' USING fts4(id, author, title, content, tokenize=icu zh_CN)';
// Version3
static readonly CREATE_FORM_INFO_TABLE =
'create table if not exists ' + DbTableConst.FORM_INFO_TABLE +
' (id text primary key not null, name text not null, dimension text not null, ability text)';
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DbMigrationConst AST#class_body#Left { // Version 1 AST#property_declaration#Left static readonly CREATE_CHINA_WORLDCULTUREHERITAGE_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINA_WORLDCULTUREHERITAGE_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, type text not null, name text not null, year text not null, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'year2 text, level text not null, address text not null, image text not null, content text not null)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CLASSICALLITERATURE_CLASSICPOEM_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 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 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CLASSICALLITERATURE_CLASSICPOEM_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, dynasty text not null, writer text not null,' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ' writer_introduction text, title text not null, subtitle text, preface text, content text not null,' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ' annotation text, translation text, creative_background text, explain text, comment text, collection text,' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ' category text )' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CLASSICALLITERATURE_SENTENCE_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CLASSICALLITERATURE_SENTENCE_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, content text not null, from_txt text not null, poem_id integer)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_ANTITHETICALCOUPLET_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_ANTITHETICALCOUPLET_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, body text not null, description text, image text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_CHARACTER_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_CHARACTER_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, character text not null, character2 text, pinyin text not null, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'radical text, stroke integer, wubi text, explanations text, explanations2 text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_EXPRESSION_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_EXPRESSION_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer not null primary key autoincrement, word text not null, pinyin text not null, explanation text, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'example text, source text, quote text, similar text, opposite text, usage text, story text, notice text, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'spelling text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_IDIOM_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_IDIOM_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer not null primary key autoincrement, word text not null, pinyin text not null, abbr text not null, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'explanation text, example text, source text, quote text, similar text, opposite text, usage text, story text, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'notice text, spelling text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_KNOWLEDGE_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_KNOWLEDGE_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, content text not null, label text not null, url text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_MODERNPOETRY_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_MODERNPOETRY_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, title text not null, author text not null, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'content text not null, zhu text, yi text, shang text, author_info text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_QUOTE_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_QUOTE_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, content text not null, author text, from_txt text not null)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_BOOKMARKS_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . BOOKMARKS_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, bookmarkable_id integer, bookmarkable_model text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right // Version 2 AST#property_declaration#Left static readonly CREATE_CHINESE_LYRIC_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_LYRIC_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, title text not null, writer text, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'singer text, content text not null)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_LYRIC_FTS_TABLE = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'CREATE VIRTUAL TABLE IF NOT EXISTS ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_LYRIC_FTS_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' USING fts4(id, title, content, tokenize=icu zh_CN)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_MODERNPOETRY_FTS_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'CREATE VIRTUAL TABLE IF NOT EXISTS ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_MODERNPOETRY_FTS_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' USING fts4(id, author, title, content, tokenize=icu zh_CN)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_PROVERB_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_PROVERB_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, content text not null, tags text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_RIDDLE_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_RIDDLE_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, puzzle text, answer text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_TONGUETWISTER_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_TONGUETWISTER_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, title text not null, content text not null, content2 text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CHINESE_WISECRACK_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHINESE_WISECRACK_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, riddle text not null, answer text not null, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'first_letter text, first_word text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CLASSICALLITERATURE_CLASSICPOEM_FTS_TABLE = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'CREATE VIRTUAL TABLE IF NOT EXISTS ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CLASSICALLITERATURE_CLASSICPOEM_FTS_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' USING fts4(id, writer, title, content, tokenize=icu zh_CN)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CLASSICALLITERATURE_PEOPLE_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CLASSICALLITERATURE_PEOPLE_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, name text not null, birth_year text, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'birthday text, death_year text, deathday text, dynasty text, aliases text, titles text, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'hometown text, details text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CLASSICALLITERATURE_WRITING_TABLE = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CLASSICALLITERATURE_WRITING_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ' (id integer primary key autoincrement not null, group_index integer, classes text, froms text, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'allusions text, pictures text, dynasty text, author text, author_id integer, author_date text, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'author_years text, author_place text, type text, type_detail text, rhyme text, rank integer, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'first_clause_rhyme text, title text, subtitle text, tune_id text, preface text, ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'clauses text not null, note text, comments text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CREATE_CLASSICALLITERATURE_WRITING_FTS_TABLE = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'CREATE VIRTUAL TABLE IF NOT EXISTS ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . CLASSICALLITERATURE_WRITING_FTS_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' USING fts4(id, author, title, content, tokenize=icu zh_CN)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right // Version3 AST#property_declaration#Left static readonly CREATE_FORM_INFO_TABLE = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'create table if not exists ' AST#expression#Right + AST#expression#Left DbTableConst AST#expression#Right AST#binary_expression#Right AST#expression#Right . FORM_INFO_TABLE AST#member_expression#Right AST#expression#Right + AST#expression#Left ' (id text primary key not null, name text not null, dimension text not null, ability text)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DbMigrationConst {
static readonly CREATE_CHINA_WORLDCULTUREHERITAGE_TABLE: string =
'create table if not exists ' + DbTableConst.CHINA_WORLDCULTUREHERITAGE_TABLE +
' (id integer primary key autoincrement not null, type text not null, name text not null, year text not null, ' +
'year2 text, level text not null, address text not null, image text not null, content text not null)';
static readonly CREATE_CLASSICALLITERATURE_CLASSICPOEM_TABLE: string =
'create table if not exists ' + DbTableConst.CLASSICALLITERATURE_CLASSICPOEM_TABLE +
' (id integer primary key autoincrement not null, dynasty text not null, writer text not null,' +
' writer_introduction text, title text not null, subtitle text, preface text, content text not null,' +
' annotation text, translation text, creative_background text, explain text, comment text, collection text,' +
' category text )';
static readonly CREATE_CLASSICALLITERATURE_SENTENCE_TABLE: string =
'create table if not exists ' + DbTableConst.CLASSICALLITERATURE_SENTENCE_TABLE +
' (id integer primary key autoincrement not null, content text not null, from_txt text not null, poem_id integer)';
static readonly CREATE_CHINESE_ANTITHETICALCOUPLET_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_ANTITHETICALCOUPLET_TABLE +
' (id integer primary key autoincrement not null, body text not null, description text, image text)';
static readonly CREATE_CHINESE_CHARACTER_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_CHARACTER_TABLE +
' (id integer primary key autoincrement not null, character text not null, character2 text, pinyin text not null, ' +
'radical text, stroke integer, wubi text, explanations text, explanations2 text)';
static readonly CREATE_CHINESE_EXPRESSION_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_EXPRESSION_TABLE +
' (id integer not null primary key autoincrement, word text not null, pinyin text not null, explanation text, ' +
'example text, source text, quote text, similar text, opposite text, usage text, story text, notice text, ' +
'spelling text)';
static readonly CREATE_CHINESE_IDIOM_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_IDIOM_TABLE +
' (id integer not null primary key autoincrement, word text not null, pinyin text not null, abbr text not null, ' +
'explanation text, example text, source text, quote text, similar text, opposite text, usage text, story text, ' +
'notice text, spelling text)';
static readonly CREATE_CHINESE_KNOWLEDGE_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_KNOWLEDGE_TABLE +
' (id integer primary key autoincrement not null, content text not null, label text not null, url text)';
static readonly CREATE_CHINESE_MODERNPOETRY_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_MODERNPOETRY_TABLE +
' (id integer primary key autoincrement not null, title text not null, author text not null, ' +
'content text not null, zhu text, yi text, shang text, author_info text)';
static readonly CREATE_CHINESE_QUOTE_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_QUOTE_TABLE +
' (id integer primary key autoincrement not null, content text not null, author text, from_txt text not null)';
static readonly CREATE_BOOKMARKS_TABLE: string =
'create table if not exists ' + DbTableConst.BOOKMARKS_TABLE +
' (id integer primary key autoincrement not null, bookmarkable_id integer, bookmarkable_model text)';
static readonly CREATE_CHINESE_LYRIC_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_LYRIC_TABLE +
' (id integer primary key autoincrement not null, title text not null, writer text, ' +
'singer text, content text not null)';
static readonly CREATE_CHINESE_LYRIC_FTS_TABLE =
'CREATE VIRTUAL TABLE IF NOT EXISTS ' + DbTableConst.CHINESE_LYRIC_FTS_TABLE +
' USING fts4(id, title, content, tokenize=icu zh_CN)';
static readonly CREATE_CHINESE_MODERNPOETRY_FTS_TABLE: string =
'CREATE VIRTUAL TABLE IF NOT EXISTS ' + DbTableConst.CHINESE_MODERNPOETRY_FTS_TABLE +
' USING fts4(id, author, title, content, tokenize=icu zh_CN)';
static readonly CREATE_CHINESE_PROVERB_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_PROVERB_TABLE +
' (id integer primary key autoincrement not null, content text not null, tags text)';
static readonly CREATE_CHINESE_RIDDLE_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_RIDDLE_TABLE +
' (id integer primary key autoincrement not null, puzzle text, answer text)';
static readonly CREATE_CHINESE_TONGUETWISTER_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_TONGUETWISTER_TABLE +
' (id integer primary key autoincrement not null, title text not null, content text not null, content2 text)';
static readonly CREATE_CHINESE_WISECRACK_TABLE: string =
'create table if not exists ' + DbTableConst.CHINESE_WISECRACK_TABLE +
' (id integer primary key autoincrement not null, riddle text not null, answer text not null, ' +
'first_letter text, first_word text)';
static readonly CREATE_CLASSICALLITERATURE_CLASSICPOEM_FTS_TABLE =
'CREATE VIRTUAL TABLE IF NOT EXISTS ' + DbTableConst.CLASSICALLITERATURE_CLASSICPOEM_FTS_TABLE +
' USING fts4(id, writer, title, content, tokenize=icu zh_CN)';
static readonly CREATE_CLASSICALLITERATURE_PEOPLE_TABLE: string =
'create table if not exists ' + DbTableConst.CLASSICALLITERATURE_PEOPLE_TABLE +
' (id integer primary key autoincrement not null, name text not null, birth_year text, ' +
'birthday text, death_year text, deathday text, dynasty text, aliases text, titles text, ' +
'hometown text, details text)';
static readonly CREATE_CLASSICALLITERATURE_WRITING_TABLE =
'create table if not exists ' + DbTableConst.CLASSICALLITERATURE_WRITING_TABLE + '' +
' (id integer primary key autoincrement not null, group_index integer, classes text, froms text, ' +
'allusions text, pictures text, dynasty text, author text, author_id integer, author_date text, ' +
'author_years text, author_place text, type text, type_detail text, rhyme text, rank integer, ' +
'first_clause_rhyme text, title text, subtitle text, tune_id text, preface text, ' +
'clauses text not null, note text, comments text)';
static readonly CREATE_CLASSICALLITERATURE_WRITING_FTS_TABLE =
'CREATE VIRTUAL TABLE IF NOT EXISTS ' + DbTableConst.CLASSICALLITERATURE_WRITING_FTS_TABLE +
' USING fts4(id, author, title, content, tokenize=icu zh_CN)';
static readonly CREATE_FORM_INFO_TABLE =
'create table if not exists ' + DbTableConst.FORM_INFO_TABLE +
' (id text primary key not null, name text not null, dimension text not null, ability text)';
}
|
https://github.com/hefengbao/jingmo-for-HarmonyOS.git/blob/a208f3fdc95c0914749072e811301b9dfd6678d6/commons/constants/src/main/ets/DbConst.ets#L42-L133
|
2c0f1d776fab97500a13ed54ad0ebbadb64619b1
|
github
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
AppAspectProgrammingDesign/entry/src/main/ets/components/someThirdParty.ets
|
arkts
|
[Start webhandler] someThirdParty.ets
|
export class WebHandler {
getWebAddrHttps(): string {
let ret = 'http';
// ...
return ret;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class WebHandler AST#class_body#Left { AST#method_declaration#Left getWebAddrHttps 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 let AST#variable_declarator#Left ret = AST#expression#Left 'http' 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 ret 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 WebHandler {
getWebAddrHttps(): string {
let ret = 'http';
return ret;
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppAspectProgrammingDesign/entry/src/main/ets/components/someThirdParty.ets#L22-L28
|
0c2b199512b5b15b01fd08a5845bf8da209a00fc
|
gitee
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets
|
arkts
|
drawPan
|
绘制表盘
|
private drawPan(): void{
this.renderContext.beginPath();
let secondImg = new ImageBitmap(MainConstant.CLOCK_PAN_IMAGE_URL);
let imgWidth = this.clockRadius * 2;
this.renderContext.drawImage(secondImg, -this.clockRadius, -this.clockRadius, imgWidth, imgWidth);
this.renderContext.restore();
}
|
AST#method_declaration#Left private drawPan 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . renderContext AST#member_expression#Right 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#variable_declaration#Left let AST#variable_declarator#Left secondImg = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImageBitmap AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left MainConstant AST#expression#Right . CLOCK_PAN_IMAGE_URL 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 imgWidth = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clockRadius AST#member_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 . renderContext AST#member_expression#Right AST#expression#Right . drawImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left secondImg AST#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 . clockRadius AST#member_expression#Right AST#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 . clockRadius AST#member_expression#Right AST#expression#Right , AST#expression#Left imgWidth AST#expression#Right , AST#expression#Left imgWidth AST#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 . renderContext AST#member_expression#Right AST#expression#Right . restore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private drawPan(): void{
this.renderContext.beginPath();
let secondImg = new ImageBitmap(MainConstant.CLOCK_PAN_IMAGE_URL);
let imgWidth = this.clockRadius * 2;
this.renderContext.drawImage(secondImg, -this.clockRadius, -this.clockRadius, imgWidth, imgWidth);
this.renderContext.restore();
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets#L94-L100
|
604c90fb8c97c3763ff577e678c5a9ed085facdf
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
完整农历系统设计.ets
|
arkts
|
getLunarYearCn
|
获取农历年份中文表示
|
private static getLunarYearCn(lunarYear: number): string {
const yearStr = lunarYear.toString();
const cnNumbers = ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
let result = "";
for (let i = 0; i < yearStr.length; i++) {
result += cnNumbers[parseInt(yearStr[i])];
}
return result + "年";
}
|
AST#method_declaration#Left private static getLunarYearCn AST#parameter_list#Left ( AST#parameter#Left lunarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left yearStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lunarYear AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cnNumbers = AST#expression#Left AST#array_literal#Left [ AST#expression#Left "〇" AST#expression#Right , AST#expression#Left "一" AST#expression#Right , AST#expression#Left "二" AST#expression#Right , AST#expression#Left "三" AST#expression#Right , AST#expression#Left "四" AST#expression#Right , AST#expression#Left "五" AST#expression#Right , AST#expression#Left "六" AST#expression#Right , AST#expression#Left "七" AST#expression#Right , AST#expression#Left "八" AST#expression#Right , AST#expression#Left "九" AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left "" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left yearStr AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result += AST#expression#Left AST#subscript_expression#Left AST#expression#Left cnNumbers AST#expression#Right [ AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left yearStr 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#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left result AST#expression#Right + AST#expression#Left "年" AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static getLunarYearCn(lunarYear: number): string {
const yearStr = lunarYear.toString();
const cnNumbers = ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
let result = "";
for (let i = 0; i < yearStr.length; i++) {
result += cnNumbers[parseInt(yearStr[i])];
}
return result + "年";
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L399-L409
|
d78c4885f10122c0460c231de987fbd5050f1941
|
github
|
jianguo888/nut-weather
|
d37553c8d4c994c5e69134e7591318c4790a8245
|
entry/src/main/ets/MainAbility/common/RealtimeWeather.ets
|
arkts
|
RealtimeWeather
|
@ts-nocheck
该组件为实时天气预报组件
powered by 坚果
2022/7/20
|
@Entry
@Component
export struct RealtimeWeather{
@State temp: string = "9"
@State text: string = "坚果"
@State isRequestSucceed: boolean = true
build(){
Column() {
Text($r("app.string.city"))
.fontSize(30)
Row() {
Text(this.temp)
.fontSize(100)
Text('℃')
.fontSize(30)
.margin({ top: 10 })
}
.alignItems(VerticalAlign.Top)
.margin({ top: 5 })
Text(this.text)
.fontSize(36)
.margin({ top: 5 })
}.margin({ top: 50 })
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct RealtimeWeather AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right temp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "9" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right text : 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 isRequestSucceed : 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#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.city" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . temp AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '℃' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top 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 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 . text AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 36 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 50 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Entry
@Component
export struct RealtimeWeather{
@State temp: string = "9"
@State text: string = "坚果"
@State isRequestSucceed: boolean = true
build(){
Column() {
Text($r("app.string.city"))
.fontSize(30)
Row() {
Text(this.temp)
.fontSize(100)
Text('℃')
.fontSize(30)
.margin({ top: 10 })
}
.alignItems(VerticalAlign.Top)
.margin({ top: 5 })
Text(this.text)
.fontSize(36)
.margin({ top: 5 })
}.margin({ top: 50 })
}
}
|
https://github.com/jianguo888/nut-weather/blob/d37553c8d4c994c5e69134e7591318c4790a8245/entry/src/main/ets/MainAbility/common/RealtimeWeather.ets#L23-L57
|
a861e400014ba0fb927a87114d73914efe9140fc
|
gitee
|
weiwei0928/Eyepetizer-harmony.git
|
fd5947c6f616c22d42256f36ba752093b782a910
|
entry/src/main/ets/common/utils/windowManager.ets
|
arkts
|
disableFullScreen
|
关闭沉浸式模式
|
static async disableFullScreen() {
const win = await window.getLastWindow(getContext()) //使用window这个API的getLastWindow方法获取页面
win.setWindowLayoutFullScreen(false) //使用setWindowLayoutFullScreen设置false关闭沉浸式模式
AppStorage.setOrCreate('topHeight', 0) //将高度重置为零
}
|
AST#method_declaration#Left static async disableFullScreen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left win = 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#binary_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 window AST#expression#Right AST#await_expression#Right 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#argument_list#Right AST#call_expression#Right AST#expression#Right //使用window这个API的getLastWindow方法获取页面 AST#ERROR#Left w AST#ERROR#Right in AST#expression#Left AST#expression#Right AST#binary_expression#Right AST#expression#Right . setWindowLayoutFullScreen AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right //使用setWindowLayoutFullScreen设置false关闭沉浸式模式 AST#ERROR#Left AppStorage AST#ERROR#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'topHeight' 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#block_statement#Right AST#method_declaration#Right
|
static async disableFullScreen() {
const win = await window.getLastWindow(getContext())
win.setWindowLayoutFullScreen(false)
AppStorage.setOrCreate('topHeight', 0)
}
|
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/utils/windowManager.ets#L14-L18
|
af50ef2e757e7e9b8e9f91eee24c349c158833f6
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/i18n/LanguageDetector.ets
|
arkts
|
detectBestLanguage
|
检测最佳语言
|
async detectBestLanguage(): Promise<LanguageDetectionResult> {
try {
// 1. 检测系统语言
const systemResult = await this.detectSystemLanguage();
// 2. 检测地区偏好
const regionResult = await this.detectRegionLanguage();
// 3. 综合分析
const finalResult = this.combineDetectionResults([systemResult, regionResult]);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Detected language: ${finalResult.detectedLanguage} (confidence: ${finalResult.confidence})`);
return finalResult;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to detect best language: ${error}`);
// 返回默认结果
return {
detectedLanguage: SupportedLanguage.ZH_CN,
confidence: 0.1,
source: DetectionSource.FALLBACK,
alternatives: [SupportedLanguage.EN_US]
};
}
}
|
AST#method_declaration#Left async detectBestLanguage 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 LanguageDetectionResult 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 { // 1. 检测系统语言 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left systemResult = 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 . detectSystemLanguage 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 // 2. 检测地区偏好 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left regionResult = 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 . detectRegionLanguage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 3. 综合分析 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left finalResult = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . combineDetectionResults AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left systemResult AST#expression#Right , AST#expression#Left regionResult AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Detected language: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left finalResult AST#expression#Right . detectedLanguage AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right (confidence: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left finalResult AST#expression#Right . confidence AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ) ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left finalResult 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 detect best language: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 返回默认结果 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left detectedLanguage AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left SupportedLanguage AST#expression#Right . ZH_CN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left confidence AST#property_name#Right : AST#expression#Left 0.1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left source AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DetectionSource AST#expression#Right . FALLBACK AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alternatives AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SupportedLanguage AST#expression#Right . EN_US 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#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 detectBestLanguage(): Promise<LanguageDetectionResult> {
try {
const systemResult = await this.detectSystemLanguage();
const regionResult = await this.detectRegionLanguage();
const finalResult = this.combineDetectionResults([systemResult, regionResult]);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Detected language: ${finalResult.detectedLanguage} (confidence: ${finalResult.confidence})`);
return finalResult;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to detect best language: ${error}`);
return {
detectedLanguage: SupportedLanguage.ZH_CN,
confidence: 0.1,
source: DetectionSource.FALLBACK,
alternatives: [SupportedLanguage.EN_US]
};
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L186-L213
|
ef3e1f6dbc53683e3f6252ade6a7c05148bf8284
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/SimpleBirthdayApp.ets
|
arkts
|
buildTabBarItem
|
构建Tab栏项
|
@Builder
buildTabBarItem(title: string, icon: string, index: number) {
Column({ space: 4 }) {
Text(icon)
.fontSize(20)
.opacity(this.currentTabIndex === index ? 1 : 0.6)
Text(title)
.fontSize(10)
.fontColor(this.currentTabIndex === index ? '#4ECDC4' : '#999999')
.fontWeight(this.currentTabIndex === index ? FontWeight.Bold : FontWeight.Normal)
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabBarItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 4 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left icon AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0.6 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left title AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#4ECDC4' AST#expression#Right : AST#expression#Left '#999999' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right : AST#expression#Left FontWeight AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildTabBarItem(title: string, icon: string, index: number) {
Column({ space: 4 }) {
Text(icon)
.fontSize(20)
.opacity(this.currentTabIndex === index ? 1 : 0.6)
Text(title)
.fontSize(10)
.fontColor(this.currentTabIndex === index ? '#4ECDC4' : '#999999')
.fontWeight(this.currentTabIndex === index ? FontWeight.Bold : FontWeight.Normal)
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L1639-L1654
|
068a5b3b805d167b7e82bb61c9b203b34b4ee471
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets
|
arkts
|
XComponent's Y方向的偏移量
|
constructor() {
this.width = 1080;
this.height = 720;
this.offsetX = 0;
this.offsetY = 0;
}
|
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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . width AST#member_expression#Right = AST#expression#Left 1080 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 . height AST#member_expression#Right = AST#expression#Left 720 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 . offsetX AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetY 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#constructor_declaration#Right
|
constructor() {
this.width = 1080;
this.height = 720;
this.offsetX = 0;
this.offsetY = 0;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets#L29-L34
|
7d367a731e3617f1d5eaeb0b38cd391815dbe201
|
gitee
|
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/entry/src/main/ets/pages/practice/CaloriePage.ets
|
arkts
|
OneWeekTrainTime
|
************************************统计图处理*********************************************
|
@Builder
OneWeekTrainTime(workoutdata:WorkoutData,day:number){
Column(){
Row(){
Text(this.Month.toString()+'月'+day.toString()+'日-'+this.Month.toString()+'月'+(day+6).toString()+'日')
.fontSize(20)
.fontColor('#222B45')
.fontWeight('500')
Row(){
Text(workoutdata.allCalories.toString())
.fontSize(26)
.fontWeight(600)
.fontColor('#6249E3')
Text('千卡')
.fontSize(20)
.fontColor('#8F9BB3')
}
.width('30%')
.justifyContent(FlexAlign.End)
.margin({right:15})
}
.width('100%')
.height(40)
.padding(15)
.justifyContent(FlexAlign.SpaceBetween)
// 柱状图部分
Row() {
// 遍历 dailyData 数组,为每一天创建一个柱子
ForEach(workoutdata.weekInfo, (item:DailyWorkout, index: number) => {
Column() {
Progress({value:(200-item.calorie),total:200,type:ProgressType.Capsule})
.width(10)
.height(100)
.style({strokeWidth:1})
.backgroundColor('#6C55E3')
.color('#E5E5E5')
// 星期标识
Text(this.weekName[getWeekDayName(this.firstDayOfWeek, index)])
.fontSize(14)
.fontColor('#333333')
.margin({ top: 8 });
}
.width('100%')
.height(150)
.layoutWeight(1); // 让每个柱子在Row中平均分配空间
});
}
.margin({top:15})
.width('100%')
.justifyContent(FlexAlign.SpaceAround); // 柱子之间平均分配间距
}
.width('100%')
.height(220)
.margin({top:10})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right OneWeekTrainTime AST#parameter_list#Left ( AST#parameter#Left workoutdata : AST#type_annotation#Left AST#primary_type#Left WorkoutData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this 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 + AST#expression#Left '月' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left day AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#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 . 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 + AST#expression#Left '月' 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 day AST#expression#Right + AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left '日' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#222B45' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left '500' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left workoutdata AST#expression#Right . allCalories 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#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 26 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 600 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#6249E3' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '千卡' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#8F9BB3' 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 '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 { // 遍历 dailyData 数组,为每一天创建一个柱子 AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left workoutdata AST#expression#Right . weekInfo 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 DailyWorkout 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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Progress ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 200 AST#expression#Right - AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . calorie AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left total : AST#expression#Left 200 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ProgressType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Left . style ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#6C55E3' AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#E5E5E5' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 星期标识 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weekName AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#call_expression#Left AST#expression#Left getWeekDayName AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . firstDayOfWeek AST#member_expression#Right AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' 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 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 150 AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right // 让每个柱子在Row中平均分配空间 } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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 . SpaceAround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right // 柱子之间平均分配间距 } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 220 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
OneWeekTrainTime(workoutdata:WorkoutData,day:number){
Column(){
Row(){
Text(this.Month.toString()+'月'+day.toString()+'日-'+this.Month.toString()+'月'+(day+6).toString()+'日')
.fontSize(20)
.fontColor('#222B45')
.fontWeight('500')
Row(){
Text(workoutdata.allCalories.toString())
.fontSize(26)
.fontWeight(600)
.fontColor('#6249E3')
Text('千卡')
.fontSize(20)
.fontColor('#8F9BB3')
}
.width('30%')
.justifyContent(FlexAlign.End)
.margin({right:15})
}
.width('100%')
.height(40)
.padding(15)
.justifyContent(FlexAlign.SpaceBetween)
Row() {
ForEach(workoutdata.weekInfo, (item:DailyWorkout, index: number) => {
Column() {
Progress({value:(200-item.calorie),total:200,type:ProgressType.Capsule})
.width(10)
.height(100)
.style({strokeWidth:1})
.backgroundColor('#6C55E3')
.color('#E5E5E5')
Text(this.weekName[getWeekDayName(this.firstDayOfWeek, index)])
.fontSize(14)
.fontColor('#333333')
.margin({ top: 8 });
}
.width('100%')
.height(150)
.layoutWeight(1);
});
}
.margin({top:15})
.width('100%')
.justifyContent(FlexAlign.SpaceAround);
}
.width('100%')
.height(220)
.margin({top:10})
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/CaloriePage.ets#L82-L141
|
330c4b8de96215d1b97090704c9a3a449ddbfc4b
|
github
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatBotItemUI.ets
|
arkts
|
typewriterFun
|
打印机字体显示效果函数
@param msg
|
typewriterFun(msg:string) {
let id = 0;
let timer = setInterval(() => {
if (id < msg.length) {
this.textMsg += msg[id++];
} else {
clearInterval(timer);
}
}, 100);
}
|
AST#method_declaration#Left typewriterFun AST#parameter_list#Left ( 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left id = 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 timer = 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#binary_expression#Left AST#expression#Left id AST#expression#Right < AST#expression#Left msg AST#expression#Right AST#binary_expression#Right AST#expression#Right . length 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 . textMsg AST#member_expression#Right += AST#expression#Left AST#subscript_expression#Left AST#expression#Left msg AST#expression#Right [ AST#expression#Left AST#update_expression#Left AST#expression#Left id AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left timer AST#expression#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 100 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
|
typewriterFun(msg:string) {
let id = 0;
let timer = setInterval(() => {
if (id < msg.length) {
this.textMsg += msg[id++];
} else {
clearInterval(timer);
}
}, 100);
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatBotItemUI.ets#L47-L56
|
7c240e70cf2522521d85415ed2470bbc0246384d
|
gitee
|
openharmony/arkcompiler_ets_frontend
|
ddf0cc059556d046c2896e7a27e23ac9eefda70c
|
ets2panda/linter/homecheck/resources/thirdPartyModules/@ohos/gif-drawable/index.ets
|
arkts
|
default
|
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 { default as GIFComponentV2 } from './src/main/ets/components/gif/display/GIFComponentV2';
|
AST#export_declaration#Left export { default as GIFComponentV2 } from './src/main/ets/components/gif/display/GIFComponentV2' ; AST#export_declaration#Right
|
export { default as GIFComponentV2 } from './src/main/ets/components/gif/display/GIFComponentV2';
|
https://github.com/openharmony/arkcompiler_ets_frontend/blob/ddf0cc059556d046c2896e7a27e23ac9eefda70c/ets2panda/linter/homecheck/resources/thirdPartyModules/@ohos/gif-drawable/index.ets#L15-L15
|
2bde2b311f08b26ea328a81c6bd6ee6cd6f150d4
|
gitee
|
pangpang20/wavecast.git
|
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
|
entry/src/main/ets/service/DatabaseService.ets
|
arkts
|
getDatabaseVersion
|
获取数据库版本
|
private async getDatabaseVersion(): Promise<number> {
if (!this.rdbStore) return 0;
try {
// 使用 PRAGMA user_version 存储版本号
const resultSet = await this.rdbStore.querySql('PRAGMA user_version');
let version = 0;
if (resultSet.goToFirstRow()) {
version = resultSet.getLong(0);
}
resultSet.close();
return version;
} catch (error) {
console.error('[DatabaseService] Failed to get database version:', error);
return 0;
}
}
|
AST#method_declaration#Left private async getDatabaseVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 . rdbStore AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 使用 PRAGMA user_version 存储版本号 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resultSet = 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 . rdbStore AST#member_expression#Right AST#expression#Right . querySql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'PRAGMA user_version' 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 version = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToFirstRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left version = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getLong AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 resultSet AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left version 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 '[DatabaseService] Failed to get database version:' 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 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
|
private async getDatabaseVersion(): Promise<number> {
if (!this.rdbStore) return 0;
try {
const resultSet = await this.rdbStore.querySql('PRAGMA user_version');
let version = 0;
if (resultSet.goToFirstRow()) {
version = resultSet.getLong(0);
}
resultSet.close();
return version;
} catch (error) {
console.error('[DatabaseService] Failed to get database version:', error);
return 0;
}
}
|
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DatabaseService.ets#L103-L119
|
e474d6ee3c7518a085185ad5efa4b1c2c519e954
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/ets/entryability/EntryAbility.ets
|
arkts
|
[Start register_init_scheme]
|
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 注册三方协议的配置。
testNapi.registerCustomSchemes();
// 初始化Web组件内核,该操作会初始化Browser进程以及创建BrowserContext。
webview.WebviewController.initializeWebEngine();
// 设置SchemeHandler。
testNapi.setSchemeHandler();
}
// [StartExclude register_init_scheme]
onDestroy(): void {
}
onWindowStageCreate(windowStage: window.WindowStage): void {
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
return;
}
});
}
onWindowStageDestroy(): void {
}
onForeground(): void {
}
onBackground(): void {
}
// [EndExclude register_init_scheme]
};
|
AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { 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 testNapi AST#expression#Right . registerCustomSchemes 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 // 初始化Web组件内核,该操作会初始化Browser进程以及创建BrowserContext。 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . initializeWebEngine 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 // 设置SchemeHandler。 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left testNapi AST#expression#Right . setSchemeHandler 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 // [StartExclude register_init_scheme] AST#method_declaration#Left onDestroy 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowStage AST#expression#Right . loadContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pages/Index' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left onWindowStageDestroy 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left onForeground AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left onBackground 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#builder_function_body#Right AST#method_declaration#Right // [EndExclude register_init_scheme] } AST#class_body#Right AST#class_declaration#Right ; AST#export_declaration#Right
|
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
testNapi.registerCustomSchemes();
webview.WebviewController.initializeWebEngine();
testNapi.setSchemeHandler();
}
onDestroy(): void {
}
onWindowStageCreate(windowStage: window.WindowStage): void {
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
return;
}
});
}
onWindowStageDestroy(): void {
}
onForeground(): void {
}
onBackground(): void {
}
};
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/ets/entryability/EntryAbility.ets#L24-L59
|
90f3cf6bae16e2c0c5159a819146a2d1879aef87
|
gitee
|
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_axios/src/main/ets/axios/EfClientApi.ets
|
arkts
|
getByParams
|
get请求 - json格式
@param efClientParams get请求入参实体
@returns
|
async getByParams<E>(efClientParams: efClientParams<null>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> {
try {
//如果当前请求efClientParams.loadingTxt传入参数 则 更改当前的loading文本
if (efClientParams.loadingTxt) {
efAxiosParams.loadingTxt = efClientParams.loadingTxt;
}
let response: AxiosResponse<E> = await efAxios.get<E, AxiosResponse<E>, null>(efClientParams.url, {
params: efClientParams.params,
headers: EfClientApi.appendHeader(efClientParams.headers),
baseURL: EfClientApi.appendBaseURL(efClientParams.baseUrl)
});
//如果当前请求更改过loading文字的话 - 更改默认值
if (efClientParams.loadingTxt) {
efAxiosParams.loadingTxt = EfAxiosConst.loadingTxt;
}
//需要转换类型解决状态变量监听的问题
if (cls) {
return plainToClass(cls, response.data);
}
//返回response的数据
return response.data;
} catch (error) {
//如果当前请求更改过loading文字的话 - 更改默认值
if (efClientParams.loadingTxt) {
efAxiosParams.loadingTxt = EfAxiosConst.loadingTxt;
}
let e: AxiosError = error as AxiosError;
//将异常抛出
return new EfAxiosError(Number(e.code), e.name, e.message, e.stack);
}
}
|
AST#method_declaration#Left async getByParams AST#type_parameters#Left < AST#type_parameter#Left E AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left efClientParams : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left efClientParams AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left null 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 cls ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ClassConstructor AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E 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#union_type#Left AST#primary_type#Left E AST#primary_type#Right | AST#primary_type#Left EfAxiosError 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 { //如果当前请求efClientParams.loadingTxt传入参数 则 更改当前的loading文本 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . loadingTxt 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 efAxiosParams AST#expression#Right . loadingTxt AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . loadingTxt 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#variable_declaration#Left let AST#variable_declarator#Left response : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left efAxios AST#expression#Right AST#await_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left E 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_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . url AST#member_expression#Right AST#expression#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#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . params AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EfClientApi AST#expression#Right . appendHeader AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . headers AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left baseURL AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EfClientApi AST#expression#Right . appendBaseURL AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . baseUrl AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //如果当前请求更改过loading文字的话 - 更改默认值 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . loadingTxt 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 efAxiosParams AST#expression#Right . loadingTxt AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left EfAxiosConst AST#expression#Right . loadingTxt 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#if_statement#Left if ( AST#expression#Left cls 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 plainToClass AST#expression#Right AST#argument_list#Left ( AST#expression#Left cls AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //返回response的数据 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { //如果当前请求更改过loading文字的话 - 更改默认值 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left efClientParams AST#expression#Right . loadingTxt 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 efAxiosParams AST#expression#Right . loadingTxt AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left EfAxiosConst AST#expression#Right . loadingTxt 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#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#primary_type#Left AxiosError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AxiosError 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left EfAxiosError AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . stack 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getByParams<E>(efClientParams: efClientParams<null>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> {
try {
if (efClientParams.loadingTxt) {
efAxiosParams.loadingTxt = efClientParams.loadingTxt;
}
let response: AxiosResponse<E> = await efAxios.get<E, AxiosResponse<E>, null>(efClientParams.url, {
params: efClientParams.params,
headers: EfClientApi.appendHeader(efClientParams.headers),
baseURL: EfClientApi.appendBaseURL(efClientParams.baseUrl)
});
if (efClientParams.loadingTxt) {
efAxiosParams.loadingTxt = EfAxiosConst.loadingTxt;
}
if (cls) {
return plainToClass(cls, response.data);
}
return response.data;
} catch (error) {
if (efClientParams.loadingTxt) {
efAxiosParams.loadingTxt = EfAxiosConst.loadingTxt;
}
let e: AxiosError = error as AxiosError;
return new EfAxiosError(Number(e.code), e.name, e.message, e.stack);
}
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L192-L222
|
d7f5d4144a0a2917fbe106ea7bb1d470cb55a2d4
|
gitee
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets
|
arkts
|
encryptGCM
|
加密(GCM模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@returns
|
static async encryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let encryptUpdate = await cipher.update(data);
//GCM模式加密doFinal时传入空,获得tag数据,并更新至gcmParams对象中。
gcmParams.authTag = await cipher.doFinal(null);
return encryptUpdate;
}
|
AST#method_declaration#Left static async encryptGCM 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_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 cipher = 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 'SM4_128|GCM|PKCS7' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 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 . ENCRYPT_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 encryptUpdate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . 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时传入空,获得tag数据,并更新至gcmParams对象中。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left gcmParams AST#expression#Right . authTag 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 cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left encryptUpdate AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async encryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let encryptUpdate = await cipher.update(data);
gcmParams.authTag = await cipher.doFinal(null);
return encryptUpdate;
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L35-L43
|
1f068d3aa29a384ae99c1163699730e3ecdd91e6
|
github
|
dloong49/wallpaper-app.git
|
ef84f33ba56fbe333c50c0de59ae56d28f556c0b
|
entry/src/main/ets/component/ToLoad.ets
|
arkts
|
到底了
|
build() {
Text("到底了~").fontSize(13).lineHeight(50).textAlign(TextAlign.Center)
}
|
AST#build_method#Left build ( ) AST#build_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 13 AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Text("到底了~").fontSize(13).lineHeight(50).textAlign(TextAlign.Center)
}
|
https://github.com/dloong49/wallpaper-app.git/blob/ef84f33ba56fbe333c50c0de59ae56d28f556c0b/entry/src/main/ets/component/ToLoad.ets#L36-L38
|
3bcff3ba1f6746360c8e3fb367561b004a260f3c
|
github
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/processes/web_actions.ets
|
arkts
|
Web General
Initialization of a window's web environment.
|
export function init_web(storage: LocalStorage) {
// Init download delegate
(AppStorage.get('bunch_of_downloads') as bunch_of_downloads).init_delegate(storage);
// Enable third party cookies
webview.WebCookieManager.putAcceptThirdPartyCookieEnabled(AppStorage.get('enable_third_party_cookies') as boolean);
// webview.WebviewController.enablePrivateNetworkAccess(false);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function init_web AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // Init download delegate AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left 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 'bunch_of_downloads' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left bunch_of_downloads AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . init_delegate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left storage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Enable third party cookies 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 webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . putAcceptThirdPartyCookieEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 'enable_third_party_cookies' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // webview.WebviewController.enablePrivateNetworkAccess(false); } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function init_web(storage: LocalStorage) {
(AppStorage.get('bunch_of_downloads') as bunch_of_downloads).init_delegate(storage);
webview.WebCookieManager.putAcceptThirdPartyCookieEnabled(AppStorage.get('enable_third_party_cookies') as boolean);
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L57-L63
|
e86c489193d87a9fe5d483f97748d8cd0ed9c68c
|
gitee
|
|
lime-zz/Ark-ui_RubbishRecycleApp.git
|
c2a9bff8fbb5bc46d922934afad0327cc1696969
|
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
|
arkts
|
calculateTotalPrice
|
计算选中商品的总价
|
calculateTotalPrice(): string {
const selectedItems: Type1[] = this.datas.filter((item: Type1): boolean => item.selected);
const total: number = selectedItems.reduce((sum: number, item: Type1): number => {
// 从avalue中提取价格数字
const price: number = parseInt(item.avalue.replace('币', ''));
return sum + (isNaN(price) ? 0 : price);
}, 0);
return `${total}币`;
}
|
AST#method_declaration#Left calculateTotalPrice 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 selectedItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Type1 [ ] 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#member_expression#Left AST#expression#Left this AST#expression#Right . datas AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Type1 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#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . selected AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left total : 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 selectedItems AST#expression#Right . reduce AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left sum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Type1 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 { // 从avalue中提取价格数字 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left price : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . avalue AST#member_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '币' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 sum AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left isNaN AST#expression#Right AST#argument_list#Left ( AST#expression#Left price AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left price AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left total 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
|
calculateTotalPrice(): string {
const selectedItems: Type1[] = this.datas.filter((item: Type1): boolean => item.selected);
const total: number = selectedItems.reduce((sum: number, item: Type1): number => {
const price: number = parseInt(item.avalue.replace('币', ''));
return sum + (isNaN(price) ? 0 : price);
}, 0);
return `${total}币`;
}
|
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L249-L257
|
e42cc20f7d4887e0bb91c1d73f4dacbf8952f374
|
github
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/common/utils/StorageUtils.ets
|
arkts
|
putNumber
|
存储数值数据
@param key 存储键
@param value 存储值
|
static async putNumber(key: string, value: number): Promise<void> {
const dataPreferences = StorageUtils.dataPreferences;
if (!dataPreferences) {
console.error('Preferences not initialized');
return;
}
try {
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error(`Failed to put number for key ${key}:`, error);
}
}
|
AST#method_declaration#Left static async putNumber AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dataPreferences = AST#expression#Left AST#member_expression#Left AST#expression#Left StorageUtils AST#expression#Right . dataPreferences 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#unary_expression#Left ! AST#expression#Left dataPreferences 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Preferences not initialized' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#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 dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . flush AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#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 put number for key AST#template_substitution#Left $ { AST#expression#Left key AST#expression#Right } AST#template_substitution#Right : ` AST#template_literal#Right 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
|
static async putNumber(key: string, value: number): Promise<void> {
const dataPreferences = StorageUtils.dataPreferences;
if (!dataPreferences) {
console.error('Preferences not initialized');
return;
}
try {
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error(`Failed to put number for key ${key}:`, error);
}
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L66-L79
|
93bc7f66ce370723ee39a307a1c6276518647274
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteItemModel.ets
|
arkts
|
套餐信息,包括时间、套餐名称、套餐价格、套餐类型
|
export declare class TimeList {
time: string; // 套餐时间
name?: ResourceStr; // 套餐名称
price?: ResourceStr; // 套餐价格
type: string; // 套餐类型
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TimeList AST#class_body#Left { AST#property_declaration#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 套餐时间 AST#property_declaration#Left name ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 套餐名称 AST#property_declaration#Left price ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 套餐价格 AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 套餐类型 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class TimeList {
time: string;
name?: ResourceStr;
price?: ResourceStr;
type: string;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteItemModel.ets#L19-L24
|
b46e22aa9801078b959e4544eeabc6e559ffb448
|
gitee
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/SM4.ets
|
arkts
|
decryptCBC
|
解密(CBC模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|CBC|PKCS7、SM4_128|CBC|PKCS5、等)
@returns
|
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> {
return SM4.decrypt(data, symKey, ivParams, transformation);
}
|
AST#method_declaration#Left static async decryptCBC 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 ivParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . IvParamsSpec 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 'SM4_128|CBC|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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SM4 AST#expression#Right . decrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left ivParams AST#expression#Right , AST#expression#Left transformation 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 decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> {
return SM4.decrypt(data, symKey, ivParams, transformation);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L137-L140
|
45fbbce6e7e9181268d2b1d18d8424b7f81b6a1a
|
gitee
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/services/NotificationService.ets
|
arkts
|
setVoiceReminderEnabled
|
设置语音提醒开关
@param enabled - 是否启用语音提醒
|
setVoiceReminderEnabled(enabled: boolean): void {
this.voiceReminderEnabled = enabled;
console.info(`[NotificationService] 语音提醒${enabled ? '已启用' : '已禁用'}`);
}
|
AST#method_declaration#Left setVoiceReminderEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . voiceReminderEnabled AST#member_expression#Right = AST#expression#Left enabled 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 ` [NotificationService] 语音提醒 AST#template_substitution#Left $ { AST#expression#Left AST#conditional_expression#Left AST#expression#Left enabled AST#expression#Right ? AST#expression#Left '已启用' AST#expression#Right : AST#expression#Left '已禁用' AST#expression#Right AST#conditional_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#builder_function_body#Right AST#method_declaration#Right
|
setVoiceReminderEnabled(enabled: boolean): void {
this.voiceReminderEnabled = enabled;
console.info(`[NotificationService] 语音提醒${enabled ? '已启用' : '已禁用'}`);
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/NotificationService.ets#L227-L230
|
b6f5f99f56a484252ec7d18ba2759862d9134fcb
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/DisplayUtils.ets
|
arkts
|
getDefaultDisplay
|
获取默认屏幕信息
|
public static getDefaultDisplay(): display.Display {
return DisplayUtils._defaultDisplay;
}
|
AST#method_declaration#Left public static getDefaultDisplay AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left DisplayUtils AST#expression#Right . _defaultDisplay AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static getDefaultDisplay(): display.Display {
return DisplayUtils._defaultDisplay;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DisplayUtils.ets#L13-L15
|
2a8813b650738307c597af138451d8c984a940d8
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/CrashUtil.ets
|
arkts
|
writeStr
|
将数据写入文件,并关闭文件。
|
private static writeStr(path: string, str: string): number {
const file = FileUtil.openSync(path);
let offset = FileUtil.statSync(file.fd).size;
if (offset === 0) {
str = `[${str}]`;
} else {
offset = offset - 1;
str = `,${str}]`;
}
const options: WriteOptions = { offset: offset, encoding: 'utf-8' };
let result = FileUtil.writeSync(file.fd, str, options);
FileUtil.closeSync(file.fd); //关闭文件
return result;
}
|
AST#method_declaration#Left private static writeStr AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 file = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtil AST#expression#Right . openSync 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#variable_declaration#Left let AST#variable_declarator#Left offset = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtil AST#expression#Right . statSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . size 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 offset AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left str = AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left str AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left offset = AST#expression#Left AST#binary_expression#Left AST#expression#Left offset AST#expression#Right - AST#expression#Left 1 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 str = AST#expression#Left AST#template_literal#Left ` , AST#template_substitution#Left $ { AST#expression#Left str AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left WriteOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left offset AST#property_name#Right : AST#expression#Left offset AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left encoding AST#property_name#Right : AST#expression#Left 'utf-8' 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtil AST#expression#Right . writeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left str AST#expression#Right , AST#expression#Left options 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 FileUtil AST#expression#Right . closeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //关闭文件 AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static writeStr(path: string, str: string): number {
const file = FileUtil.openSync(path);
let offset = FileUtil.statSync(file.fd).size;
if (offset === 0) {
str = `[${str}]`;
} else {
offset = offset - 1;
str = `,${str}]`;
}
const options: WriteOptions = { offset: offset, encoding: 'utf-8' };
let result = FileUtil.writeSync(file.fd, str, options);
FileUtil.closeSync(file.fd);
return result;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L212-L225
|
007df6388af7d4f6ea385e9cb031a947d8f3a64e
|
gitee
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets
|
arkts
|
添加任务进度记录
@param progress 进度记录对象
@returns 创建的进度记录
|
export function addTaskProgress(progress: Progress): Promise<Progress> {
try {
// 创建符合接口的数据结构
const queryParams: QueryParams = {};
const requestData: RequestData = {
taskId: progress.taskId,
dreamId: progress.dreamId,
userId: progress.userId,
description: progress.description,
// 由于RequestData不支持images字段,将其放在URL参数中
};
// 如果有图片,添加到URL参数中
if (progress.images) {
queryParams['images'] = progress.images;
}
return request<Progress>(
RequestMethod.POST,
`/progress`, // 使用后端真实的API路径
queryParams,
requestData
);
} catch (error) {
console.error(`添加任务进度记录失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`添加任务进度记录失败: ${error instanceof Error ? error.message : String(error)}`);
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function addTaskProgress AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_type#Left Progress 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 Progress 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 queryParams : AST#type_annotation#Left AST#primary_type#Left QueryParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left requestData : AST#type_annotation#Left AST#primary_type#Left RequestData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left taskId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left progress AST#expression#Right . taskId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dreamId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left progress AST#expression#Right . dreamId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left userId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left progress AST#expression#Right . userId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left progress AST#expression#Right . description AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 由于RequestData不支持images字段,将其放在URL参数中 } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 如果有图片,添加到URL参数中 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left progress AST#expression#Right . images AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left queryParams AST#expression#Right [ AST#expression#Left 'images' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = progress AST#ERROR#Right . images AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Progress AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . POST AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` /progress ` AST#template_literal#Right AST#expression#Right , // 使用后端真实的API路径 AST#expression#Left queryParams AST#expression#Right , AST#expression#Left requestData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 添加任务进度记录失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 添加任务进度记录失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function addTaskProgress(progress: Progress): Promise<Progress> {
try {
const queryParams: QueryParams = {};
const requestData: RequestData = {
taskId: progress.taskId,
dreamId: progress.dreamId,
userId: progress.userId,
description: progress.description,
};
if (progress.images) {
queryParams['images'] = progress.images;
}
return request<Progress>(
RequestMethod.POST,
`/progress`,
queryParams,
requestData
);
} catch (error) {
console.error(`添加任务进度记录失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`添加任务进度记录失败: ${error instanceof Error ? error.message : String(error)}`);
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L138-L165
|
02d544f99838520940e3a82ab3c31339396d802a
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/common/ErrorHandler.ets
|
arkts
|
logError
|
记录错误日志
|
private logError(errorInfo: ErrorInfo): void {
const logMessage = `[${errorInfo.type.toUpperCase()}] ${errorInfo.message}`;
if (errorInfo.originalError) {
hilog.error(
LogConstants.DOMAIN_APP,
LogConstants.TAG_APP,
`${logMessage} | Original: ${errorInfo.originalError.message}`
);
} else {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, logMessage);
}
// 如果有上下文信息,也记录下来
if (errorInfo.context) {
hilog.debug(
LogConstants.DOMAIN_APP,
LogConstants.TAG_APP,
`Error context: ${JSON.stringify(errorInfo.context)}`
);
}
}
|
AST#method_declaration#Left private logError AST#parameter_list#Left ( AST#parameter#Left errorInfo : AST#type_annotation#Left AST#primary_type#Left ErrorInfo 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 logMessage = AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left errorInfo AST#expression#Right . type AST#member_expression#Right AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ] AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left errorInfo AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left errorInfo AST#expression#Right . originalError AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 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 ` AST#template_substitution#Left $ { AST#expression#Left logMessage AST#expression#Right } AST#template_substitution#Right | Original: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left errorInfo AST#expression#Right . originalError AST#member_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 logMessage AST#expression#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left errorInfo AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . 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 ` Error context: 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 errorInfo AST#expression#Right . context 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private logError(errorInfo: ErrorInfo): void {
const logMessage = `[${errorInfo.type.toUpperCase()}] ${errorInfo.message}`;
if (errorInfo.originalError) {
hilog.error(
LogConstants.DOMAIN_APP,
LogConstants.TAG_APP,
`${logMessage} | Original: ${errorInfo.originalError.message}`
);
} else {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, logMessage);
}
if (errorInfo.context) {
hilog.debug(
LogConstants.DOMAIN_APP,
LogConstants.TAG_APP,
`Error context: ${JSON.stringify(errorInfo.context)}`
);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/ErrorHandler.ets#L83-L104
|
7986ae60e63207c89eddb391336771f3a101ef25
|
github
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/viewmodel/SimpleStatsManager.ets
|
arkts
|
日统计数据
|
export interface SimpleDailyStats {
tasksCompleted: number;
tasksTotal: number;
focusTime: number;
pomodoroSessions: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface SimpleDailyStats AST#object_type#Left { AST#type_member#Left tasksCompleted : 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 tasksTotal : 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 focusTime : 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 pomodoroSessions : 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 SimpleDailyStats {
tasksCompleted: number;
tasksTotal: number;
focusTime: number;
pomodoroSessions: number;
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleStatsManager.ets#L8-L13
|
5e4f764456fba738c9cb9037ff5957ca8517c673
|
github
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets
|
arkts
|
delete
|
删除数据
@param predicates 条件
@returns
|
delete(predicates: relationalStore.RdbPredicates): Promise<number> {
return new Promise((resolve, reject) => {
this.rdbStore?.delete(predicates, (err, rows) => {
if (err) {
Logger.error(`[${CommonConstants.RDB_TAG}]`,'删除失败!,', JSON.stringify(err));
reject(err);
} else {
Logger.debug(`[${CommonConstants.RDB_TAG}]`,'删除成功!删除行数:', rows.toString());
resolve(rows);
}
})
});
}
|
AST#method_declaration#Left delete AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right , AST#parameter#Left reject AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ?. delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left rows 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 AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . RDB_TAG AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right , AST#expression#Left '删除失败!,' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . 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 CommonConstants AST#expression#Right . RDB_TAG AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right , AST#expression#Left '删除成功!删除行数:' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rows AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left rows AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
delete(predicates: relationalStore.RdbPredicates): Promise<number> {
return new Promise((resolve, reject) => {
this.rdbStore?.delete(predicates, (err, rows) => {
if (err) {
Logger.error(`[${CommonConstants.RDB_TAG}]`,'删除失败!,', JSON.stringify(err));
reject(err);
} else {
Logger.debug(`[${CommonConstants.RDB_TAG}]`,'删除成功!删除行数:', rows.toString());
resolve(rows);
}
})
});
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L149-L161
|
81d4815fd6719745eebda2855ea216e9059a838f
|
github
|
xinkai-hu/MyDay.git
|
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
|
entry/src/main/ets/model/WeatherResult.ets
|
arkts
|
天气请求结果数据类型。与高德地图天气 API 请求结果向对应。
|
export default interface
|
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
|
export default interface
|
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/model/WeatherResult.ets#L6-L6
|
3846a74ac829a298fcf83a20b844d01f7beae5ba
|
github
|
|
zhonghaojie/ArkTSComponentPractice.git
|
73f56243f10439a872d0990320bb3f8df17d0001
|
entry/src/main/ets/pages/Login.ets
|
arkts
|
blueTextStyle
|
蓝字样式
|
@Extend(Text) function blueTextStyle () {
.fontColor($r('app.color.login_blue_text_color'))
.fontSize($r("app.float.small_text_size"))
.fontWeight(FontWeight.Medium)
.padding({ top: $r('app.float.forgot_margin_top'), bottom: $r('app.float.forgot_margin_top') })
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function blueTextStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.login_blue_text_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.small_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 . 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.forgot_margin_top' 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.forgot_margin_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#decorated_function_declaration#Right
|
@Extend(Text) function blueTextStyle () {
.fontColor($r('app.color.login_blue_text_color'))
.fontSize($r("app.float.small_text_size"))
.fontWeight(FontWeight.Medium)
.padding({ top: $r('app.float.forgot_margin_top'), bottom: $r('app.float.forgot_margin_top') })
}
|
https://github.com/zhonghaojie/ArkTSComponentPractice.git/blob/73f56243f10439a872d0990320bb3f8df17d0001/entry/src/main/ets/pages/Login.ets#L30-L35
|
2abc17d65908a7641cd580bd136ce821e1da19f0
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets
|
arkts
|
WeekViewItem
|
时间计算工具类
周视图子组件
|
@Component
export struct WeekViewItem {
// 周视图日期数据
@State @Watch('getFirstDayData') weekDays: Day[][] = [];
// 当前选中的日期
@State currentSelectDay: DayInfo =
new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0); // 当前选中的日期
// 当前选中的日期,格式'year-month-date'
@Link @Watch('OnChangeSelectDate') currentSelectDate: string;
// 表示周视图第几周
@Prop @Watch('updateWeekData') weekNum: number;
private month: number = Constants.TODAY_MONTH;
// 自定义日历样式
calendarStyle: CalendarStyle = {};
// 周视图数据切换回调,返回一周中第一天的数据
onWeekSwitch: (item: CalendarData) => void = () => {
};
// 日期点击回调
onDateClick: (year: number, month: number, date: number) => void = () => {
};
// 日历控制器。这里用于控制添加日程后月视图数据刷新
controller?: CalendarController;
/**
* 日期选择监听
*/
OnChangeSelectDate() {
const PARTS: string[] = this.currentSelectDate.split('-');
this.currentSelectDay.year = Number(PARTS[0]);
this.currentSelectDay.month = Number(PARTS[1]);
this.currentSelectDay.date = Number(PARTS[2]);
}
/**
* 周视图切换时,将当前周数据的第一天(周日)日期数据传出去
*/
getFirstDayData() {
if (this.weekDays && this.weekDays[0][0].dayInfo) {
this.onWeekSwitch({
date: this.weekDays[0][0].dayInfo.date,
month: this.weekDays[0][0].dayInfo.month,
year: this.weekDays[0][0].dayInfo.year
})
}
}
/**
* 更新周数据
*/
updateWeekData() {
this.getWeekViewData(this.weekNum);
}
/**
* 获取指定周数据
*/
getWeekViewData(weekNum: number) {
this.weekDays = [...TimeUtils.getWeekDays(weekNum)];
}
aboutToAppear() {
if (this.controller) {
this.controller.schedulePointRefresh = this.schedulePointRefresh;
}
this.getWeekViewData(this.weekNum);
}
/**
* 刷新日程点数据
*/
private schedulePointRefresh = () => {
this.updateWeekData();
}
/**
* 周视图一天的子组件
* @param day 日期
*/
@Builder
weekDayBuilder(day: Day) {
Column() {
Text(day.dayNum + '')
.fontColor(StyleUtils.getColor(day, this.month, this.currentSelectDay, CalendarViewType.WEEK,
this.calendarStyle))
.fontSize(Constants.DAY_FONT_SIZE *
(this.calendarStyle.textScaling ? this.calendarStyle.textScaling : Constants.FONT_MULTIPLIER))
.fontWeight(FontWeight.Medium)
Text(day.lunarDay)
.fontColor(StyleUtils.getLunarDayColor(day, this.month, this.currentSelectDay, CalendarViewType.WEEK,
this.calendarStyle))
.fontSize(Constants.LUNAR_DAY_FONT_SIZE *
(this.calendarStyle.textScaling ? this.calendarStyle.textScaling : Constants.FONT_MULTIPLIER))
}
.width($r('app.integer.calendar_switch_size_forty'))
.height($r('app.integer.calendar_switch_size_forty'))
.borderRadius($r('app.integer.calendar_switch_size_forty'))
.borderColor($r('app.color.calendar_switch_border_color'))
.borderWidth(StyleUtils.getBorderWidth(day, this.month, this.currentSelectDay, CalendarViewType.WEEK))
.backgroundColor(StyleUtils.getBackgroundColor(day, this.currentSelectDay, this.calendarStyle))
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
.onClick(() => {
// 获取年月日信息
this.onDateClick(day.dayInfo.year, day.dayInfo.month, day.dayInfo.date);
this.currentSelectDate = day.dayInfo.year + '-' + day.dayInfo.month + '-' + day.dayInfo.date;
this.currentSelectDay.year = day.dayInfo.year;
this.currentSelectDay.month = day.dayInfo.month;
this.currentSelectDay.date = day.dayInfo.date;
})
}
build() {
Column() {
ForEach(this.weekDays, (items: Day[]) => {
Row() {
ForEach(items, (item: Day) => {
Column() {
this.weekDayBuilder(item)
if (item.isShowSchedulePoint) {
// 日程点
Circle({ width: Constants.SCHEDULE_POINT_DIAMETER, height: Constants.SCHEDULE_POINT_DIAMETER })
.fill($r('app.color.calendar_switch_schedule_point_color'))
.margin({ top: $r('app.integer.calendar_switch_size_one') })
}
}
.height($r('app.integer.calendar_switch_size_forty_six'))
}, (item: Day, index: number) => {
return item.dayNum + '' + index + item.isShowSchedulePoint;
})
}
.width($r('app.string.calendar_switch_full_size'))
.justifyContent(FlexAlign.SpaceBetween)
}, (item: Day[], index: number) => {
return item.reduce((item1, item2) => {
return item1 + item2.dayInfo.year + item2.dayInfo.month + item2.dayInfo.date + item2.isShowSchedulePoint
}, '') + index;
})
}.width($r('app.string.calendar_switch_full_size'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WeekViewItem AST#component_body#Left { // 周视图日期数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'getFirstDayData' AST#expression#Right ) AST#decorator#Right weekDays : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Day [ ] [ ] 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 currentSelectDay : AST#type_annotation#Left AST#primary_type#Left DayInfo 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 DayInfo 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 AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 当前选中的日期 // 当前选中的日期,格式'year-month-date' AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'OnChangeSelectDate' AST#expression#Right ) AST#decorator#Right currentSelectDate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 表示周视图第几周 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updateWeekData' AST#expression#Right ) AST#decorator#Right weekNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . TODAY_MONTH AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 自定义日历样式 AST#property_declaration#Left calendarStyle : AST#type_annotation#Left AST#primary_type#Left CalendarStyle AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right // 周视图数据切换回调,返回一周中第一天的数据 AST#property_declaration#Left onWeekSwitch : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CalendarData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // 日期点击回调 AST#property_declaration#Left onDateClick : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left 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 controller ? : AST#type_annotation#Left AST#primary_type#Left CalendarController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 日期选择监听
*/ AST#method_declaration#Left OnChangeSelectDate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left PARTS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDate AST#member_expression#Right AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDay AST#member_expression#Right AST#expression#Right . year AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left PARTS AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . currentSelectDay AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left PARTS AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . currentSelectDay AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left PARTS AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 周视图切换时,将当前周数据的第一天(周日)日期数据传出去
*/ AST#method_declaration#Left getFirstDayData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left 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#member_expression#Left AST#expression#Left this AST#expression#Right . weekDays AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . weekDays AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onWeekSwitch 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 date AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_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 . weekDays AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left month AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_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 . weekDays AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left year AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_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 . weekDays AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . year 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 更新周数据
*/ AST#method_declaration#Left updateWeekData 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 this AST#expression#Right . getWeekViewData 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 . weekNum AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取指定周数据
*/ AST#method_declaration#Left getWeekViewData AST#parameter_list#Left ( AST#parameter#Left weekNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weekDays AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . getWeekDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left weekNum AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . schedulePointRefresh AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . schedulePointRefresh AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right 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 . getWeekViewData 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 . weekNum AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 刷新日程点数据
*/ AST#property_declaration#Left private schedulePointRefresh = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateWeekData 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 /**
* 周视图一天的子组件
* @param day 日期
*/ AST#property_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right weekDayBuilder AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left Day 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . dayNum AST#member_expression#Right AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StyleUtils AST#expression#Right . getColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left day AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . month AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDay AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CalendarViewType AST#expression#Right . WEEK AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calendarStyle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DAY_FONT_SIZE AST#member_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calendarStyle AST#member_expression#Right AST#expression#Right . textScaling AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calendarStyle AST#member_expression#Right AST#expression#Right . textScaling AST#member_expression#Right AST#expression#Right : AST#expression#Left Constants AST#expression#Right AST#conditional_expression#Right AST#expression#Right . FONT_MULTIPLIER AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 day AST#expression#Right . lunarDay AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StyleUtils AST#expression#Right . getLunarDayColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left day AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . month AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDay AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CalendarViewType AST#expression#Right . WEEK AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calendarStyle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . LUNAR_DAY_FONT_SIZE AST#member_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calendarStyle AST#member_expression#Right AST#expression#Right . textScaling AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calendarStyle AST#member_expression#Right AST#expression#Right . textScaling AST#member_expression#Right AST#expression#Right : AST#expression#Left Constants AST#expression#Right AST#conditional_expression#Right AST#expression#Right . FONT_MULTIPLIER AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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.integer.calendar_switch_size_forty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_forty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_forty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.calendar_switch_border_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderWidth ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StyleUtils AST#expression#Right . getBorderWidth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left day AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . month AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDay AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CalendarViewType AST#expression#Right . WEEK AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StyleUtils AST#expression#Right . getBackgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left day AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDay AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calendarStyle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 获取年月日信息 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onDateClick 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 day AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . year AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDate 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#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 day AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . year AST#member_expression#Right AST#expression#Right + AST#expression#Left '-' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left day AST#expression#Right AST#binary_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right AST#expression#Right + AST#expression#Left '-' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left day AST#expression#Right AST#binary_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . date 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 . currentSelectDay AST#member_expression#Right AST#expression#Right . year AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . year 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 . currentSelectDay AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . month 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 . currentSelectDay AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weekDays AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Day [ ] AST#array_type#Right 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 Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left items 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 Day AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#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 . weekDayBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . isShowSchedulePoint AST#member_expression#Right AST#expression#Right ) { // 日程点 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Circle ( AST#component_parameters#Left { AST#component_parameter#Left width : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SCHEDULE_POINT_DIAMETER AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left height : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SCHEDULE_POINT_DIAMETER AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fill ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.calendar_switch_schedule_point_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_one' 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_forty_six' 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 item : AST#type_annotation#Left AST#primary_type#Left Day 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#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . dayNum AST#member_expression#Right AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . isShowSchedulePoint AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#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.calendar_switch_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . 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#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 AST#array_type#Left Day [ ] AST#array_type#Right 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#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 item AST#expression#Right . reduce AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item1 AST#parameter#Right , AST#parameter#Left item2 AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 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 item1 AST#expression#Right + AST#expression#Left item2 AST#expression#Right AST#binary_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . year AST#member_expression#Right AST#expression#Right + AST#expression#Left item2 AST#expression#Right AST#binary_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right AST#expression#Right + AST#expression#Left item2 AST#expression#Right AST#binary_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right + AST#expression#Left item2 AST#expression#Right AST#binary_expression#Right AST#expression#Right . isShowSchedulePoint AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left '' 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#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.calendar_switch_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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct WeekViewItem {
@State @Watch('getFirstDayData') weekDays: Day[][] = [];
@State currentSelectDay: DayInfo =
new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0);
,格式'year-month-date'
@Link @Watch('OnChangeSelectDate') currentSelectDate: string;
@Prop @Watch('updateWeekData') weekNum: number;
private month: number = Constants.TODAY_MONTH;
calendarStyle: CalendarStyle = {};
onWeekSwitch: (item: CalendarData) => void = () => {
};
onDateClick: (year: number, month: number, date: number) => void = () => {
};
controller?: CalendarController;
OnChangeSelectDate() {
const PARTS: string[] = this.currentSelectDate.split('-');
this.currentSelectDay.year = Number(PARTS[0]);
this.currentSelectDay.month = Number(PARTS[1]);
this.currentSelectDay.date = Number(PARTS[2]);
}
getFirstDayData() {
if (this.weekDays && this.weekDays[0][0].dayInfo) {
this.onWeekSwitch({
date: this.weekDays[0][0].dayInfo.date,
month: this.weekDays[0][0].dayInfo.month,
year: this.weekDays[0][0].dayInfo.year
})
}
}
updateWeekData() {
this.getWeekViewData(this.weekNum);
}
getWeekViewData(weekNum: number) {
this.weekDays = [...TimeUtils.getWeekDays(weekNum)];
}
aboutToAppear() {
if (this.controller) {
this.controller.schedulePointRefresh = this.schedulePointRefresh;
}
this.getWeekViewData(this.weekNum);
}
private schedulePointRefresh = () => {
this.updateWeekData();
}
@Builder
weekDayBuilder(day: Day) {
Column() {
Text(day.dayNum + '')
.fontColor(StyleUtils.getColor(day, this.month, this.currentSelectDay, CalendarViewType.WEEK,
this.calendarStyle))
.fontSize(Constants.DAY_FONT_SIZE *
(this.calendarStyle.textScaling ? this.calendarStyle.textScaling : Constants.FONT_MULTIPLIER))
.fontWeight(FontWeight.Medium)
Text(day.lunarDay)
.fontColor(StyleUtils.getLunarDayColor(day, this.month, this.currentSelectDay, CalendarViewType.WEEK,
this.calendarStyle))
.fontSize(Constants.LUNAR_DAY_FONT_SIZE *
(this.calendarStyle.textScaling ? this.calendarStyle.textScaling : Constants.FONT_MULTIPLIER))
}
.width($r('app.integer.calendar_switch_size_forty'))
.height($r('app.integer.calendar_switch_size_forty'))
.borderRadius($r('app.integer.calendar_switch_size_forty'))
.borderColor($r('app.color.calendar_switch_border_color'))
.borderWidth(StyleUtils.getBorderWidth(day, this.month, this.currentSelectDay, CalendarViewType.WEEK))
.backgroundColor(StyleUtils.getBackgroundColor(day, this.currentSelectDay, this.calendarStyle))
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
.onClick(() => {
this.onDateClick(day.dayInfo.year, day.dayInfo.month, day.dayInfo.date);
this.currentSelectDate = day.dayInfo.year + '-' + day.dayInfo.month + '-' + day.dayInfo.date;
this.currentSelectDay.year = day.dayInfo.year;
this.currentSelectDay.month = day.dayInfo.month;
this.currentSelectDay.date = day.dayInfo.date;
})
}
build() {
Column() {
ForEach(this.weekDays, (items: Day[]) => {
Row() {
ForEach(items, (item: Day) => {
Column() {
this.weekDayBuilder(item)
if (item.isShowSchedulePoint) {
Circle({ width: Constants.SCHEDULE_POINT_DIAMETER, height: Constants.SCHEDULE_POINT_DIAMETER })
.fill($r('app.color.calendar_switch_schedule_point_color'))
.margin({ top: $r('app.integer.calendar_switch_size_one') })
}
}
.height($r('app.integer.calendar_switch_size_forty_six'))
}, (item: Day, index: number) => {
return item.dayNum + '' + index + item.isShowSchedulePoint;
})
}
.width($r('app.string.calendar_switch_full_size'))
.justifyContent(FlexAlign.SpaceBetween)
}, (item: Day[], index: number) => {
return item.reduce((item1, item2) => {
return item1 + item2.dayInfo.year + item2.dayInfo.month + item2.dayInfo.date + item2.isShowSchedulePoint
}, '') + index;
})
}.width($r('app.string.calendar_switch_full_size'))
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets#L25-L164
|
6ba5ec9a4976d0d65f86d6f09c973965c5dd3c41
|
gitee
|
zhongte/TaoYao
|
80850f3800dd6037216d3f7c58a2bf34a881c93f
|
taoyao/src/main/ets/shijing/taoyao/TaoYao.ets
|
arkts
|
requestLocationGlobalSwitch
|
拉起全局开关弹窗,通过异步的方式告知是否打开了定位开关
@param context
@returns true 打开了定位开关
|
static requestLocationGlobalSwitch(context: Context): Promise<boolean> {
const locationGlobalSwitch = new LocationGlobalSwitch()
return locationGlobalSwitch.requestGlobalSwitch(context)
}
|
AST#method_declaration#Left static requestLocationGlobalSwitch AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left locationGlobalSwitch = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LocationGlobalSwitch 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left locationGlobalSwitch AST#expression#Right . requestGlobalSwitch 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 requestLocationGlobalSwitch(context: Context): Promise<boolean> {
const locationGlobalSwitch = new LocationGlobalSwitch()
return locationGlobalSwitch.requestGlobalSwitch(context)
}
|
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/TaoYao.ets#L115-L118
|
9a516d024021cb574bfb681305a30c1795e4d0d2
|
gitee
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets
|
arkts
|
ExceptionPrompt
|
Declare struct ExceptionPrompt higher-order component.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Declare struct ExceptionPrompt higher-order component.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12
|
@Component
export declare struct ExceptionPrompt {
/**
* Configuration information of ExceptionPrompt.
* @type { PromptOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Configuration information of ExceptionPrompt.
* @type { PromptOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
@Prop
options: PromptOptions;
/**
* Callback when clicking the text on the left.
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Callback when clicking the text on the left.
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
onTipClick?: () => void;
/**
* Callback when click the icon button.
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Callback when click the icon button.
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
onActionTextClick?: () => void;
/**
* The build function is a member function that must return an ArkTS component type (Element) to represent the component to be rendered as a user interface.
* @type { function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* The build function is a member function that must return an ArkTS component type (Element) to represent the component to be rendered as a user interface.
* @type { function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
build(): void;
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ExceptionPrompt AST#component_body#Left { /**
* Configuration information of ExceptionPrompt.
* @type { PromptOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* Configuration information of ExceptionPrompt.
* @type { PromptOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right options : AST#type_annotation#Left AST#primary_type#Left PromptOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Callback when clicking the text on the left.
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* Callback when clicking the text on the left.
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left onTipClick ? : 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#property_declaration#Right /**
* Callback when click the icon button.
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* Callback when click the icon button.
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left onActionTextClick ? : 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#property_declaration#Right /**
* The build function is a member function that must return an ArkTS component type (Element) to represent the component to be rendered as a user interface.
* @type { function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* The build function is a member function that must return an ArkTS component type (Element) to represent the component to be rendered as a user interface.
* @type { function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#ERROR#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#ERROR#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export declare struct ExceptionPrompt {
@Prop
options: PromptOptions;
onTipClick?: () => void;
onActionTextClick?: () => void;
build(): void;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets#L190-L257
|
a30395e4d6850af8dd2662a349d951930b28fdec
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/FormatUtil.ets
|
arkts
|
getParamsUrl
|
将参数拼接在url上,返回新的url。
@param url 拼接的url
@param params 拼接的参数
@param append true-直接拼接(可能会出现相同key),false-拼接值,并删除重复值
@returns
|
static getParamsUrl(url: string, params: Map<string, Any> | Record<string, Any>, append: boolean = false): string {
const urlObj = OsUrl.URL.parseURL(url);
const paramsObj = urlObj.params;
if (params instanceof Map) {
params.forEach((value: Any, key: string) => {
if (key && value != undefined) {
if (append) {
paramsObj.append(key, value.toString());
} else {
paramsObj.set(key, value.toString());
}
}
});
} else {
Object.keys(params).forEach(key => {
let value = params[key];
if (key && value != undefined) {
if (append) {
paramsObj.append(key, value.toString());
} else {
paramsObj.set(key, value.toString());
}
}
});
}
return urlObj.toString();
}
|
AST#method_declaration#Left static getParamsUrl AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | 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 Any AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left append : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 urlObj = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OsUrl AST#expression#Right . URL AST#member_expression#Right AST#expression#Right . parseURL AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left paramsObj = AST#expression#Left AST#member_expression#Left AST#expression#Left urlObj AST#expression#Right . params 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 params AST#expression#Right instanceof AST#expression#Left Map 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 params AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left key AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left append 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 paramsObj AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } 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 paramsObj AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left key => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left value = AST#expression#Left AST#subscript_expression#Left AST#expression#Left params AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left key AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left append 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 paramsObj AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } 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 paramsObj AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 urlObj AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getParamsUrl(url: string, params: Map<string, Any> | Record<string, Any>, append: boolean = false): string {
const urlObj = OsUrl.URL.parseURL(url);
const paramsObj = urlObj.params;
if (params instanceof Map) {
params.forEach((value: Any, key: string) => {
if (key && value != undefined) {
if (append) {
paramsObj.append(key, value.toString());
} else {
paramsObj.set(key, value.toString());
}
}
});
} else {
Object.keys(params).forEach(key => {
let value = params[key];
if (key && value != undefined) {
if (append) {
paramsObj.append(key, value.toString());
} else {
paramsObj.set(key, value.toString());
}
}
});
}
return urlObj.toString();
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L172-L198
|
2ea5213d9927f1c2333ccf86042451979f0c4316
|
gitee
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets
|
arkts
|
isToday
|
检查日期是否为今天
@param date 需要检查的日期
@returns 是否为今天
|
static isToday(date: Date): boolean {
const today = new Date();
return date.getDate() === today.getDate() &&
date.getMonth() === today.getMonth() &&
date.getFullYear() === today.getFullYear();
}
|
AST#method_declaration#Left static isToday AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left today = 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#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 date AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left today AST#expression#Right AST#binary_expression#Right AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left date AST#expression#Right AST#binary_expression#Right AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left today AST#expression#Right AST#binary_expression#Right AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left date AST#expression#Right AST#binary_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#expression#Left today AST#expression#Right AST#binary_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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static isToday(date: Date): boolean {
const today = new Date();
return date.getDate() === today.getDate() &&
date.getMonth() === today.getMonth() &&
date.getFullYear() === today.getFullYear();
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets#L206-L211
|
3bd399dd610c694540045b7fdef06691a0d6b67b
|
github
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/main/src/main/ets/viewmodel/CoreViewModel.ets
|
arkts
|
@file 核心页面 ViewModel
@author Joker.X
|
@ObservedV2
export default class CoreViewModel extends BaseViewModel {
/**
* 核心模块卡片数据
*/
@Trace
readonly cards: CoreCardItem[] = [
{
title: $r("app.string.main_core_network_demo_title"),
description: $r("app.string.main_core_network_demo_desc"),
onClick: () => DemoNavigator.toNetworkDemo()
},
{
title: $r("app.string.main_core_network_list_demo_title"),
description: $r("app.string.main_core_network_list_demo_desc"),
onClick: () => DemoNavigator.toNetworkListDemo()
},
{
title: $r("app.string.main_core_database_title"),
description: $r("app.string.main_core_database_desc"),
onClick: () => DemoNavigator.toDatabase()
},
{
title: $r("app.string.main_core_local_storage_title"),
description: $r("app.string.main_core_local_storage_desc"),
onClick: () => DemoNavigator.toLocalStorage()
},
{
title: $r("app.string.main_core_state_management_title"),
description: $r("app.string.main_core_state_management_desc"),
onClick: () => DemoNavigator.toStateManagement()
},
{
title: $r("app.string.main_core_network_request_title"),
description: $r("app.string.main_core_network_request_desc"),
onClick: () => DemoNavigator.toNetworkRequest()
}
];
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class CoreViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 核心模块卡片数据
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right readonly cards : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CoreCardItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_network_demo_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_network_demo_desc" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onClick AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DemoNavigator AST#expression#Right . toNetworkDemo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_network_list_demo_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_network_list_demo_desc" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onClick AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DemoNavigator AST#expression#Right . toNetworkListDemo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_database_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_database_desc" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onClick AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DemoNavigator AST#expression#Right . toDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_local_storage_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_local_storage_desc" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onClick AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DemoNavigator AST#expression#Right . toLocalStorage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_state_management_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_state_management_desc" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onClick AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DemoNavigator AST#expression#Right . toStateManagement AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_network_request_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_network_request_desc" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onClick AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DemoNavigator AST#expression#Right . toNetworkRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#decorated_export_declaration#Right
|
@ObservedV2
export default class CoreViewModel extends BaseViewModel {
@Trace
readonly cards: CoreCardItem[] = [
{
title: $r("app.string.main_core_network_demo_title"),
description: $r("app.string.main_core_network_demo_desc"),
onClick: () => DemoNavigator.toNetworkDemo()
},
{
title: $r("app.string.main_core_network_list_demo_title"),
description: $r("app.string.main_core_network_list_demo_desc"),
onClick: () => DemoNavigator.toNetworkListDemo()
},
{
title: $r("app.string.main_core_database_title"),
description: $r("app.string.main_core_database_desc"),
onClick: () => DemoNavigator.toDatabase()
},
{
title: $r("app.string.main_core_local_storage_title"),
description: $r("app.string.main_core_local_storage_desc"),
onClick: () => DemoNavigator.toLocalStorage()
},
{
title: $r("app.string.main_core_state_management_title"),
description: $r("app.string.main_core_state_management_desc"),
onClick: () => DemoNavigator.toStateManagement()
},
{
title: $r("app.string.main_core_network_request_title"),
description: $r("app.string.main_core_network_request_desc"),
onClick: () => DemoNavigator.toNetworkRequest()
}
];
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/CoreViewModel.ets#L9-L47
|
abfe0c904cfe7caf6852c7883f4e2a22d540f707
|
github
|
|
pangpang20/wavecast.git
|
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
|
entry/src/main/ets/pages/MainPage.ets
|
arkts
|
buildEpisodeItem
|
单集项
|
@Builder
buildEpisodeItem(episode: Episode) {
Column() {
Row() {
// 封面图
Image(episode.imageUrl)
.width(60)
.height(60)
.borderRadius(6)
.objectFit(ImageFit.Cover)
.alt($r('app.media.app_icon'))
// 单集信息
Column() {
Text(episode.title)
.fontSize(14)
.fontWeight(FontWeight.Medium)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row() {
Text(episode.getFormattedDuration())
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
if (episode.downloadStatus === 2) {
Text(' · 已下载')
.fontSize(12)
.fontColor($r('app.color.accent_green'))
}
}
.margin({ top: 4 })
}
.alignItems(HorizontalAlign.Start)
.layoutWeight(1)
.margin({ left: 12 })
}
.width('100%')
// 操作按钮
Row() {
Button('▶ 播放')
.height(28)
.fontSize(11)
.backgroundColor($r('app.color.primary'))
.fontColor($r('app.color.text_on_primary'))
.onClick(async () => {
console.info(`[MainPage] Play: ${episode.title}`);
await this.playerService.playEpisode(episode);
this.checkCurrentEpisode();
})
Button('+ 待听')
.height(28)
.fontSize(11)
.margin({ left: 8 })
.backgroundColor($r('app.color.accent_green'))
.fontColor($r('app.color.text_on_primary'))
.onClick(() => {
console.info(`[MainPage] Add to queue: ${episode.title}`);
this.addToQueue(episode);
})
}
.width('100%')
.margin({ top: 8 })
}
.width('100%')
.padding(12)
.backgroundColor($r('app.color.background_card'))
.borderRadius(8)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEpisodeItem AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 封面图 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left episode AST#expression#Right . imageUrl AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 6 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alt ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.app_icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 单集信息 AST#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 episode AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . 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 . maxLines ( AST#expression#Left 2 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#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left episode AST#expression#Right . getFormattedDuration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left episode AST#expression#Right . downloadStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left ' · 已下载' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.accent_green' 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#ui_if_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 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 操作按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '▶ 播放' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 11 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_on_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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] Play: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left episode 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#statement#Right 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 . playerService AST#member_expression#Right AST#expression#Right . playEpisode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left episode AST#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 . checkCurrentEpisode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '+ 待听' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 11 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 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.accent_green' 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.text_on_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainPage] Add to queue: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left episode 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#statement#Right 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 . addToQueue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left episode AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.background_card' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildEpisodeItem(episode: Episode) {
Column() {
Row() {
Image(episode.imageUrl)
.width(60)
.height(60)
.borderRadius(6)
.objectFit(ImageFit.Cover)
.alt($r('app.media.app_icon'))
Column() {
Text(episode.title)
.fontSize(14)
.fontWeight(FontWeight.Medium)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row() {
Text(episode.getFormattedDuration())
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
if (episode.downloadStatus === 2) {
Text(' · 已下载')
.fontSize(12)
.fontColor($r('app.color.accent_green'))
}
}
.margin({ top: 4 })
}
.alignItems(HorizontalAlign.Start)
.layoutWeight(1)
.margin({ left: 12 })
}
.width('100%')
Row() {
Button('▶ 播放')
.height(28)
.fontSize(11)
.backgroundColor($r('app.color.primary'))
.fontColor($r('app.color.text_on_primary'))
.onClick(async () => {
console.info(`[MainPage] Play: ${episode.title}`);
await this.playerService.playEpisode(episode);
this.checkCurrentEpisode();
})
Button('+ 待听')
.height(28)
.fontSize(11)
.margin({ left: 8 })
.backgroundColor($r('app.color.accent_green'))
.fontColor($r('app.color.text_on_primary'))
.onClick(() => {
console.info(`[MainPage] Add to queue: ${episode.title}`);
this.addToQueue(episode);
})
}
.width('100%')
.margin({ top: 8 })
}
.width('100%')
.padding(12)
.backgroundColor($r('app.color.background_card'))
.borderRadius(8)
}
|
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L1066-L1136
|
ed81f0fda0453038c50ec4593fee37f64a11346e
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/social/CommunityService.ets
|
arkts
|
评论接口
|
export interface Comment {
id: string;
postId: string;
authorId: string;
author: UserProfile;
content: string;
parentId?: string; // 回复评论的ID
replies?: Comment[];
likes: number;
isLiked: boolean;
createdAt: string;
updatedAt: string;
status: 'active' | 'hidden' | 'deleted';
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface Comment AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left postId : 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 authorId : 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 author : AST#type_annotation#Left AST#primary_type#Left UserProfile AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left parentId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 回复评论的ID AST#type_member#Left replies ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left likes : 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 isLiked : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left createdAt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left updatedAt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#ERROR#Left status : 'active' | 'hidden' | 'deleted' ; AST#ERROR#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface Comment {
id: string;
postId: string;
authorId: string;
author: UserProfile;
content: string;
parentId?: string;
replies?: Comment[];
likes: number;
isLiked: boolean;
createdAt: string;
updatedAt: string;
status: 'active' | 'hidden' | 'deleted';
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L114-L127
|
93f0b995104653a521a77345ab903e6712e3e6f4
|
github
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
WaterFlowSample/entry/src/main/ets/model/SectionsWaterFlowDataSource.ets
|
arkts
|
Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export class SectionsWaterFlowDataSource implements IDataSource {
dataArray: number[] = [];
private listeners: DataChangeListener[] = [];
constructor() {
for (let i: number = 0; i < 100; i++) {
this.dataArray.push(i);
}
}
public getData(index: number): number {
return this.dataArray[index];
}
notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
}
notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
})
}
notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
}
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
}
notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
}
public totalCount(): number {
return this.dataArray.length;
}
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
}
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos: number = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
}
public add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray.length);
this.notifyDataAdd(0);
}
public addLastItem(): void {
this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length);
this.notifyDataAdd(this.dataArray.length - 1);
}
public addItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray.length);
this.notifyDataAdd(index);
}
public delete1stItem(): void {
this.dataArray.splice(0, 1);
this.notifyDataDelete(0);
}
public delete2ndItem(): void {
this.dataArray.splice(1, 1);
this.notifyDataDelete(1);
}
public deleteLastItem(): void {
this.dataArray.splice(-1, 1);
this.notifyDataDelete(this.dataArray.length);
}
public deleteItem(index: number): void {
this.dataArray.splice(index, 1);
this.notifyDataDelete(index);
}
public reload(): void {
this.dataArray.splice(1, 1);
this.dataArray.splice(2, 1);
this.notifyDataReload();
}
public indexOf(item: number): number {
return this.dataArray.indexOf(item);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class SectionsWaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListener [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : AST#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#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . push 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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left notifyDataReload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataReloaded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataMove AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left from AST#expression#Right , AST#expression#Left to AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pos : AST#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 . listeners AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left pos AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pos AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public add1stItem 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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public addLastItem 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 . dataArray AST#member_expression#Right AST#expression#Right . splice 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 . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public addItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public delete1stItem 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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public delete2ndItem 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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 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 deleteLastItem 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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public deleteItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public reload 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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataReload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public indexOf AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 SectionsWaterFlowDataSource implements IDataSource {
dataArray: number[] = [];
private listeners: DataChangeListener[] = [];
constructor() {
for (let i: number = 0; i < 100; i++) {
this.dataArray.push(i);
}
}
public getData(index: number): number {
return this.dataArray[index];
}
notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
}
notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
})
}
notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
}
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
}
notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
}
public totalCount(): number {
return this.dataArray.length;
}
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
}
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos: number = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
}
public add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray.length);
this.notifyDataAdd(0);
}
public addLastItem(): void {
this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length);
this.notifyDataAdd(this.dataArray.length - 1);
}
public addItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray.length);
this.notifyDataAdd(index);
}
public delete1stItem(): void {
this.dataArray.splice(0, 1);
this.notifyDataDelete(0);
}
public delete2ndItem(): void {
this.dataArray.splice(1, 1);
this.notifyDataDelete(1);
}
public deleteLastItem(): void {
this.dataArray.splice(-1, 1);
this.notifyDataDelete(this.dataArray.length);
}
public deleteItem(index: number): void {
this.dataArray.splice(index, 1);
this.notifyDataDelete(index);
}
public reload(): void {
this.dataArray.splice(1, 1);
this.dataArray.splice(2, 1);
this.notifyDataReload();
}
public indexOf(item: number): number {
return this.dataArray.indexOf(item);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/SectionsWaterFlowDataSource.ets#L16-L121
|
d6f76b7f8513f86a26d3b6b4c28854e6f6a7d879
|
gitee
|
|
salehelper/algorithm_arkts.git
|
61af15272038646775a4745fca98a48ba89e1f4e
|
entry/src/main/ets/strings/RabinKarp.ets
|
arkts
|
contains
|
检查文本是否包含模式串
@param text 文本字符串
@param pattern 模式串
@returns 是否包含模式串
|
static contains(text: string, pattern: string): boolean {
if (!text || !pattern || pattern.length === 0) {
return false;
}
const m = pattern.length;
const n = text.length;
const patternHash = RabinKarp.hash(pattern);
let textHash = RabinKarp.hash(text.substring(0, m));
const highestPower = RabinKarp.power(RabinKarp.BASE, m - 1);
for (let i = 0; i <= n - m; i++) {
if (patternHash === textHash) {
if (text.substring(i, i + m) === pattern) {
return true;
}
}
if (i < n - m) {
textHash = RabinKarp.rehash(textHash, text[i], text[i + m], highestPower);
}
}
return false;
}
|
AST#method_declaration#Left static contains AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left text AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left pattern AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left pattern AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left m = AST#expression#Left AST#member_expression#Left AST#expression#Left pattern AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left n = AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left patternHash = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RabinKarp AST#expression#Right . hash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pattern 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 textHash = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RabinKarp AST#expression#Right . hash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left m AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left highestPower = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RabinKarp AST#expression#Right . power AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RabinKarp AST#expression#Right . BASE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left m 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#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 AST#binary_expression#Left AST#expression#Left n AST#expression#Right - AST#expression#Left m AST#expression#Right AST#binary_expression#Right 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 patternHash AST#expression#Right === AST#expression#Left textHash AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left m AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left pattern AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left AST#binary_expression#Left AST#expression#Left n AST#expression#Right - AST#expression#Left m AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left textHash = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RabinKarp AST#expression#Right . rehash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left textHash AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left text AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left text AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left m AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left highestPower AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_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
|
static contains(text: string, pattern: string): boolean {
if (!text || !pattern || pattern.length === 0) {
return false;
}
const m = pattern.length;
const n = text.length;
const patternHash = RabinKarp.hash(pattern);
let textHash = RabinKarp.hash(text.substring(0, m));
const highestPower = RabinKarp.power(RabinKarp.BASE, m - 1);
for (let i = 0; i <= n - m; i++) {
if (patternHash === textHash) {
if (text.substring(i, i + m) === pattern) {
return true;
}
}
if (i < n - m) {
textHash = RabinKarp.rehash(textHash, text[i], text[i + m], highestPower);
}
}
return false;
}
|
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L149-L173
|
8e2843c9535f9a006b15883e7d6817832885aa5c
|
github
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
HCIA/complete/FormKitDemo/entry/src/main/ets/common/CommonConstants.ets
|
arkts
|
公共常量类
|
export default class CommonConstants{
// font-size
static readonly GOODS_LIST_PADDING: number = 8;
static readonly GOODS_EVALUATE_FONT_SIZE: number = 12;
static readonly NORMAL_FONT_SIZE: number = 16;
static readonly BIGGER_FONT_SIZE: number = 20;
static readonly MAX_FONT_SIZE: number = 32;
// margin
static readonly REFRESH_ICON_MARGIN_RIGHT: number = 20;
static readonly MARGIN_RIGHT: number = 32;
// width or height
static readonly ICON_WIDTH: number = 40;
static readonly ICON_HEIGHT: number = 40;
static readonly IMAGE_WIDTH: string = '94%';
static readonly IMAGE_HEIGHT: string = '40%';
static readonly IMAGE_WIDTH2: number = 24;
static readonly IMAGE_HEIGHT2: number = 24;
static readonly NOV_HEIGHT: number = 24;
static readonly GOODS_LIST_HEIGHT: string = '16%';
static readonly GOODS_IMAGE_WIDTH: string = '40%';
static readonly GOODS_FONT_WIDTH: string = '60%';
static readonly GOODS_LIST_WIDTH: string = '94%';
static readonly LAYOUT_WIDTH_OR_HEIGHT: string = '100%';
// list space
static readonly LIST_ITEM_SPACE: number = 16;
//column space
static readonly COLUMN_ITEM_SPACE1: number =5;
static readonly COLUMN_ITEM_SPACE2: number =10;
//listItem borderRadius
static readonly ITEM_RADIUS: number = 8;
//list margin
static readonly LIST_MARGIN_TOP: number = 8;
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { // font-size AST#property_declaration#Left static readonly GOODS_LIST_PADDING : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly GOODS_EVALUATE_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly NORMAL_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 16 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BIGGER_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MAX_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 32 AST#expression#Right ; AST#property_declaration#Right // margin AST#property_declaration#Left static readonly REFRESH_ICON_MARGIN_RIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_RIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 32 AST#expression#Right ; AST#property_declaration#Right // width or height AST#property_declaration#Left static readonly ICON_WIDTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 40 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly ICON_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 40 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly IMAGE_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '94%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly IMAGE_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '40%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly IMAGE_WIDTH2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly IMAGE_HEIGHT2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly NOV_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly GOODS_LIST_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '16%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly GOODS_IMAGE_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '40%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly GOODS_FONT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '60%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly GOODS_LIST_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '94%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly LAYOUT_WIDTH_OR_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 // list space AST#property_declaration#Left static readonly LIST_ITEM_SPACE : 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 //column space AST#property_declaration#Left static readonly COLUMN_ITEM_SPACE1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly COLUMN_ITEM_SPACE2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right //listItem borderRadius AST#property_declaration#Left static readonly ITEM_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right //list margin AST#property_declaration#Left static readonly LIST_MARGIN_TOP : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class CommonConstants{
static readonly GOODS_LIST_PADDING: number = 8;
static readonly GOODS_EVALUATE_FONT_SIZE: number = 12;
static readonly NORMAL_FONT_SIZE: number = 16;
static readonly BIGGER_FONT_SIZE: number = 20;
static readonly MAX_FONT_SIZE: number = 32;
static readonly REFRESH_ICON_MARGIN_RIGHT: number = 20;
static readonly MARGIN_RIGHT: number = 32;
static readonly ICON_WIDTH: number = 40;
static readonly ICON_HEIGHT: number = 40;
static readonly IMAGE_WIDTH: string = '94%';
static readonly IMAGE_HEIGHT: string = '40%';
static readonly IMAGE_WIDTH2: number = 24;
static readonly IMAGE_HEIGHT2: number = 24;
static readonly NOV_HEIGHT: number = 24;
static readonly GOODS_LIST_HEIGHT: string = '16%';
static readonly GOODS_IMAGE_WIDTH: string = '40%';
static readonly GOODS_FONT_WIDTH: string = '60%';
static readonly GOODS_LIST_WIDTH: string = '94%';
static readonly LAYOUT_WIDTH_OR_HEIGHT: string = '100%';
static readonly LIST_ITEM_SPACE: number = 16;
static readonly COLUMN_ITEM_SPACE1: number =5;
static readonly COLUMN_ITEM_SPACE2: number =10;
static readonly ITEM_RADIUS: number = 8;
static readonly LIST_MARGIN_TOP: number = 8;
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/FormKitDemo/entry/src/main/ets/common/CommonConstants.ets#L4-L38
|
e056a606530d01f904e043acd0fec152c56adeae
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets
|
arkts
|
getDLPSupported
|
查询当前可支持权限设置和校验的文件扩展名类型列表
|
async getDLPSupported(fileSuffix: string): Promise<void> {
try {
let res: Array<string> = await dlpPermission.getDLPSupportedFileTypes(); // 获取支持DLP的文件类型
Logger.info(TAG, 'file extension support permission :' + JSON.stringify(res));
Logger.info(TAG, 'file extension is:' + fileSuffix);
this.fileSuffixIncludes = res.includes(fileSuffix);
Logger.info(TAG, 'the file extension in the list:' + this.fileSuffixIncludes);
promptAction.showToast({
message: 'file extension is:' + fileSuffix + ',in the list:' + this.fileSuffixIncludes,
duration: 2000
});
} catch (err) {
Logger.error(TAG, 'getDLPSupportedFileTypes error' + (err as BusinessError).code + (err as BusinessError).message);
}
}
|
AST#method_declaration#Left async getDLPSupported AST#parameter_list#Left ( AST#parameter#Left fileSuffix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left dlpPermission AST#expression#Right AST#await_expression#Right AST#expression#Right . getDLPSupportedFileTypes 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 // 获取支持DLP的文件类型 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'file extension support permission :' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left res AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'file extension is:' AST#expression#Right + AST#expression#Left fileSuffix 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 this AST#expression#Right . fileSuffixIncludes AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileSuffix 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 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'the file extension in the list:' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . fileSuffixIncludes 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 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#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 'file extension is:' AST#expression#Right + AST#expression#Left fileSuffix AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ',in the list:' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . fileSuffixIncludes AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#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#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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#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 'getDLPSupportedFileTypes error' AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right 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 AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getDLPSupported(fileSuffix: string): Promise<void> {
try {
let res: Array<string> = await dlpPermission.getDLPSupportedFileTypes();
Logger.info(TAG, 'file extension support permission :' + JSON.stringify(res));
Logger.info(TAG, 'file extension is:' + fileSuffix);
this.fileSuffixIncludes = res.includes(fileSuffix);
Logger.info(TAG, 'the file extension in the list:' + this.fileSuffixIncludes);
promptAction.showToast({
message: 'file extension is:' + fileSuffix + ',in the list:' + this.fileSuffixIncludes,
duration: 2000
});
} catch (err) {
Logger.error(TAG, 'getDLPSupportedFileTypes error' + (err as BusinessError).code + (err as BusinessError).message);
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets#L148-L162
|
0aa92de12b5a182914bf65118d666044ae6c0e83
|
gitee
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/api/Router.ets
|
arkts
|
getParamByKey
|
获取路由参数 建议带上默认值和泛型
@param key
@param defVal
@returns
|
public static getParamByKey<P = ObjectOrNull>(key: string, defVal: ObjectOrNull = null): P {
return ZRouter.getInstance().getParamByKey<P>(key, defVal)
}
|
AST#method_declaration#Left public static getParamByKey AST#type_parameters#Left < AST#type_parameter#Left P = AST#type_annotation#Left AST#primary_type#Left ObjectOrNull AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defVal : AST#type_annotation#Left AST#primary_type#Left ObjectOrNull AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left P 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 ZRouter 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 . getParamByKey AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left P AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left defVal AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static getParamByKey<P = ObjectOrNull>(key: string, defVal: ObjectOrNull = null): P {
return ZRouter.getInstance().getParamByKey<P>(key, defVal)
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L358-L360
|
e58dfb21c334458cc3c60af1c61bc49f09ad1492
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/views/card/wordcard/WordCardsView.ets
|
arkts
|
autoPlaySound
|
自动发音
|
async autoPlaySound(){
///会员检查
if(!MemberManager.shared.checkAutoPronUsable(false)){
return;
}
// 单词 自动发音
if (SettingManager.shared.autoPlaySound) {
await AudioPlayer.shared.play(this.word.wordEnSoundText)
}
//例句
if (SettingManager.shared.autoPlaySoundEx) {
//排队播放
await AudioPlayer.shared.prepareToPlay(this.word.exampleEn1)
}
}
|
AST#method_declaration#Left async autoPlaySound AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { ///会员检查 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left MemberManager AST#expression#Right AST#unary_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . checkAutoPronUsable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SettingManager AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . autoPlaySound 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 AST#await_expression#Left await AST#expression#Left AudioPlayer AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . play AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . word AST#member_expression#Right AST#expression#Right . wordEnSoundText 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SettingManager AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . autoPlaySoundEx 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 AST#await_expression#Left await AST#expression#Left AudioPlayer AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . prepareToPlay 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 . word AST#member_expression#Right AST#expression#Right . exampleEn1 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async autoPlaySound(){
if(!MemberManager.shared.checkAutoPronUsable(false)){
return;
}
if (SettingManager.shared.autoPlaySound) {
await AudioPlayer.shared.play(this.word.wordEnSoundText)
}
if (SettingManager.shared.autoPlaySoundEx) {
await AudioPlayer.shared.prepareToPlay(this.word.exampleEn1)
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardsView.ets#L629-L647
|
91ce5709939328dc4bc00ca7bdd6191e8cc6dce5
|
github
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/accuracy/field_sensitive/container/array_003_T.ets
|
arkts
|
Introduction 数组索引
|
export function array_003_T(taint_src : string) {
let arr = [[taint_src], ["b"], "c"]
taint.Sink(arr[0][0]);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function array_003_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 arr = 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#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left taint_src AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left "b" AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left "c" AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#ERROR#Left ta AST#ERROR#Right in AST#expression#Left t AST#expression#Right AST#binary_expression#Right AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function array_003_T(taint_src : string) {
let arr = [[taint_src], ["b"], "c"]
taint.Sink(arr[0][0]);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/array_003_T.ets#L6-L9
|
a88726bdc5ba2215d76b93d22fd109e920ba4087
|
github
|
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets
|
arkts
|
Error receive event when the web page receives a web resource loading error.
@typedef OnErrorReceiveEvent
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12
|
export declare interface OnErrorReceiveEvent {
/**
* Web resource request of event.
*
* @type { WebResourceRequest }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
request: WebResourceRequest;
/**
* Web resource error of event.
*
* @type { WebResourceError }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
error: WebResourceError;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnErrorReceiveEvent AST#object_type#Left { /**
* Web resource request of event.
*
* @type { WebResourceRequest }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left request : AST#type_annotation#Left AST#primary_type#Left WebResourceRequest AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Web resource error of event.
*
* @type { WebResourceError }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left error : AST#type_annotation#Left AST#primary_type#Left WebResourceError AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export declare interface OnErrorReceiveEvent {
request: WebResourceRequest;
error: WebResourceError;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L188-L207
|
d3b3e0a82aa8cd101ffaeef36bbcccabf5cdbd31
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Card/MovieCard/entry/src/main/ets/detailsability/EntryDetailsAbility.ets
|
arkts
|
Lift cycle management of Ability.
|
export default class EntryDetailsAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
Logger.info(CommonConstants.TAG_DETAILS, 'want =' + JSON.stringify(want));
Logger.info(CommonConstants.TAG_DETAILS, 'launchParam =' + JSON.stringify(launchParam));
let params = want?.parameters?.params as string;
Logger.info(CommonConstants.TAG_DETAILS, 'params ' + params);
let parseParams = JSON.parse(params) as Record<string, number>;
Logger.info(CommonConstants.TAG_DETAILS, 'parseParams ' + parseParams);
let index: number = parseParams?.index as number;
GlobalContext.getContext().setObject('position', index);
}
onWindowStageCreate(windowStage: window.WindowStage) {
// Main window is created, set main page for this ability.
windowStage.loadContent('pages/MovieDetailsPage', (err, data) => {
if (err.code) {
Logger.error(CommonConstants.TAG_DETAILS, 'Failed to load ' + JSON.stringify(err));
return;
}
Logger.info(CommonConstants.TAG_DETAILS, 'Succeeded loading ' + JSON.stringify(data));
});
}
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class EntryDetailsAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TAG_DETAILS AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'want =' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left want AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info 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 . TAG_DETAILS AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'launchParam =' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left launchParam 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 params = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right ?. parameters AST#member_expression#Right AST#expression#Right ?. params AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TAG_DETAILS AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'params ' AST#expression#Right + AST#expression#Left params AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left parseParams = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TAG_DETAILS AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'parseParams ' AST#expression#Right + AST#expression#Left parseParams AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left index : AST#type_annotation#Left AST#primary_type#Left number 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 parseParams AST#expression#Right ?. index 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#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 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 . setObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'position' AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // Main window is created, set main page for this ability. AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowStage AST#expression#Right . loadContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pages/MovieDetailsPage' 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TAG_DETAILS AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Failed to load ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err 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#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 AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TAG_DETAILS AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Succeeded loading ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class EntryDetailsAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
Logger.info(CommonConstants.TAG_DETAILS, 'want =' + JSON.stringify(want));
Logger.info(CommonConstants.TAG_DETAILS, 'launchParam =' + JSON.stringify(launchParam));
let params = want?.parameters?.params as string;
Logger.info(CommonConstants.TAG_DETAILS, 'params ' + params);
let parseParams = JSON.parse(params) as Record<string, number>;
Logger.info(CommonConstants.TAG_DETAILS, 'parseParams ' + parseParams);
let index: number = parseParams?.index as number;
GlobalContext.getContext().setObject('position', index);
}
onWindowStageCreate(windowStage: window.WindowStage) {
windowStage.loadContent('pages/MovieDetailsPage', (err, data) => {
if (err.code) {
Logger.error(CommonConstants.TAG_DETAILS, 'Failed to load ' + JSON.stringify(err));
return;
}
Logger.info(CommonConstants.TAG_DETAILS, 'Succeeded loading ' + JSON.stringify(data));
});
}
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/detailsability/EntryDetailsAbility.ets#L27-L49
|
abc5667d6c446c32a69e434f31575bdb81b47805
|
gitee
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
|
arkts
|
onTouchMove
|
Touch move.
@param x
@param y
|
onTouchMove(x: number, y: number): void {
Logger.debug(TAG, `onTouchMove: [state: ${this.state}] [x: ${x}, y: ${y}]`);
let offsetX = x - this.touchPoint.x;
let offsetY = y - this.touchPoint.y;
if (this.state === CropTouchState.CROP_MOVE) {
this.cropShow.moveCropRect(offsetX, offsetY);
} else if (this.state === CropTouchState.IMAGE_DRAG) {
this.onImageDrag(offsetX, offsetY);
} else {
return;
}
this.refresh();
this.touchPoint.set(x, y);
}
|
AST#method_declaration#Left onTouchMove AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug 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 ` onTouchMove: [state: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . state AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] [x: AST#template_substitution#Left $ { AST#expression#Left x AST#expression#Right } AST#template_substitution#Right , y: AST#template_substitution#Left $ { AST#expression#Left y AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offsetX = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left x AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . touchPoint AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offsetY = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left y AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . touchPoint AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 . state AST#member_expression#Right AST#expression#Right === AST#expression#Left CropTouchState AST#expression#Right AST#binary_expression#Right AST#expression#Right . CROP_MOVE 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 . cropShow AST#member_expression#Right AST#expression#Right . moveCropRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetX AST#expression#Right , AST#expression#Left offsetY AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . state AST#member_expression#Right AST#expression#Right === AST#expression#Left CropTouchState AST#expression#Right AST#binary_expression#Right AST#expression#Right . IMAGE_DRAG AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onImageDrag AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetX AST#expression#Right , AST#expression#Left offsetY AST#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#return_statement#Left return ; 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refresh 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 . touchPoint AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
onTouchMove(x: number, y: number): void {
Logger.debug(TAG, `onTouchMove: [state: ${this.state}] [x: ${x}, y: ${y}]`);
let offsetX = x - this.touchPoint.x;
let offsetY = y - this.touchPoint.y;
if (this.state === CropTouchState.CROP_MOVE) {
this.cropShow.moveCropRect(offsetX, offsetY);
} else if (this.state === CropTouchState.IMAGE_DRAG) {
this.onImageDrag(offsetX, offsetY);
} else {
return;
}
this.refresh();
this.touchPoint.set(x, y);
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L237-L250
|
f048c23277f3b051a0200560e9c3419e10a52688
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/main/src/main/ets/view/CategoryPage.ets
|
arkts
|
onRightListScroll
|
右侧列表滚动同步左侧选中
@param {number} startIndex - 当前可见起始索引
@returns {void} 无返回值
|
private onRightListScroll(startIndex: number): void {
this.vm.onRightListScroll(startIndex);
}
|
AST#method_declaration#Left private onRightListScroll AST#parameter_list#Left ( AST#parameter#Left startIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . onRightListScroll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left startIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private onRightListScroll(startIndex: number): void {
this.vm.onRightListScroll(startIndex);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CategoryPage.ets#L210-L212
|
4a955d76e28f49e4aa9e1023f60b66a36c23dfa4
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/utils/Tools.ets
|
arkts
|
generatePreviewInfo
|
根据文件uri构建PreviewInfo
@param uri 文件的uri
@returns
|
static generatePreviewInfo(uri: string): filePreview.PreviewInfo {
const fileName = FileUtils.getFileName(uri);
const fileExtention = FileUtils.getFileExtention(fileName);
const mimeType = Tools.getMimeType(fileExtention);
let previewInfo: filePreview.PreviewInfo = {
title: fileName,
uri: uri,
mimeType: mimeType
};
return previewInfo;
}
|
AST#method_declaration#Left static generatePreviewInfo AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left filePreview . PreviewInfo AST#qualified_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 fileName = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtils AST#expression#Right . getFileName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fileExtention = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtils AST#expression#Right . getFileExtention AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mimeType = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tools AST#expression#Right . getMimeType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileExtention AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left previewInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left filePreview . PreviewInfo 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 title AST#property_name#Right : AST#expression#Left fileName AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left uri AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left mimeType AST#property_name#Right : AST#expression#Left mimeType AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left previewInfo AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static generatePreviewInfo(uri: string): filePreview.PreviewInfo {
const fileName = FileUtils.getFileName(uri);
const fileExtention = FileUtils.getFileExtention(fileName);
const mimeType = Tools.getMimeType(fileExtention);
let previewInfo: filePreview.PreviewInfo = {
title: fileName,
uri: uri,
mimeType: mimeType
};
return previewInfo;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L310-L320
|
089fd40139c737d06b825e97dd8e58fc24d15b3c
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
|
arkts
|
setZoomRatioFn
|
Zoom
|
setZoomRatioFn(zoomRatio: number): void {
Logger.info(TAG, `setZoomRatioFn value ${zoomRatio}`);
// Get the supported zoom range
try {
let zoomRatioRange = this.getZoomRatioRange();
Logger.info(TAG, `getZoomRatioRange success: ${JSON.stringify(zoomRatioRange)}`);
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `getZoomRatioRange fail: ${JSON.stringify(err)}`);
}
try {
this.session?.setZoomRatio(zoomRatio);
Logger.info(TAG, 'setZoomRatioFn success');
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `setZoomRatioFn fail: ${JSON.stringify(err)}`);
}
}
|
AST#method_declaration#Left setZoomRatioFn AST#parameter_list#Left ( AST#parameter#Left zoomRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 ` setZoomRatioFn value AST#template_substitution#Left $ { AST#expression#Left zoomRatio 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 // Get the supported zoom range AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left zoomRatioRange = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getZoomRatioRange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` getZoomRatioRange success: 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 zoomRatioRange 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#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 ` getZoomRatioRange 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 err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. setZoomRatio AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left zoomRatio AST#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 TAG AST#expression#Right , AST#expression#Left 'setZoomRatioFn 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#variable_declaration#Left let AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 ` setZoomRatioFn 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 err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
setZoomRatioFn(zoomRatio: number): void {
Logger.info(TAG, `setZoomRatioFn value ${zoomRatio}`);
try {
let zoomRatioRange = this.getZoomRatioRange();
Logger.info(TAG, `getZoomRatioRange success: ${JSON.stringify(zoomRatioRange)}`);
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `getZoomRatioRange fail: ${JSON.stringify(err)}`);
}
try {
this.session?.setZoomRatio(zoomRatio);
Logger.info(TAG, 'setZoomRatioFn success');
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `setZoomRatioFn fail: ${JSON.stringify(err)}`);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L228-L246
|
1246eaea0f52ecd4a5b11461b5243ce417cdffd1
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
JSCrash/entry/src/main/ets/pages/utils.ets
|
arkts
|
showFatal
|
Outputs fatal-level logs.
@param tag Identifies the log tag.
@param format Indicates the log format string.
@param args Indicates the log parameters.
@since 7
|
static showFatal(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.FATAL)) {
hilog.fatal(DOMAIN, TAG, tag + SYMBOL + format, args);
}
}
|
AST#method_declaration#Left static showFatal 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 format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . isLoggable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . LogLevel AST#member_expression#Right AST#expression#Right . FATAL AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . fatal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left tag AST#expression#Right + AST#expression#Left SYMBOL AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left format AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left args AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static showFatal(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.FATAL)) {
hilog.fatal(DOMAIN, TAG, tag + SYMBOL + format, args);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/utils.ets#L78-L82
|
de997f5aa56da58d610a15f562545f19ae9a9696
|
gitee
|
tomorrowKreswell/Ledger.git
|
1f2783ae70b8540d677af8a27f29db1b4089ea69
|
ledger/entry/src/main/ets/common/database/tables/AccountTable.ets
|
arkts
|
定义一个类 AccountTable,用于操作记账数据的数据库表
|
export default class AccountTable {
// 创建一个 Rdb 对象,用于处理数据库表的操作
private accountTable = new Rdb(
CommonConstants.ACCOUNT_TABLE.tableName,
CommonConstants.ACCOUNT_TABLE.sqlCreate,
CommonConstants.ACCOUNT_TABLE.columns
);
// 类构造函数,用于初始化数据库表
constructor(callback: Function = () => {
}) {
// 获取数据库表的 RdbStore 对象,并调用回调函数
this.accountTable.getRdbStore(callback);
}
// 获取数据库表的 RdbStore 对象,并调用回调函数
getRdbStore(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback);
}
// 插入一条账目数据
insertData(account: Account, callback: Function) {
// 生成值桶(ValuesBucket),包含要插入的数据
const valueBucket: relationalStore.ValuesBucket = generateBucket(account);
// 调用 Rdb 对象的插入数据方法,并传入回调函数
this.accountTable.insertData(valueBucket, callback);
}
// 批量插入账目数据
batchInsert(accounts: Account[], callback: Function) {
// 将账户数据转换为值桶数组
const valueBuckets: relationalStore.ValuesBucket[] = accounts.map((account) => generateBucket(account));
// 调用 Rdb 对象的批量插入数据方法,并传入回调函数
this.accountTable.batchInsert(valueBuckets, callback)
}
// 批量删除账目数据
batchDelete(accounts: Account[], callback: Function) {
// 创建 RdbPredicates 对象,用于指定删除条件
let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName);
// 设置删除条件为账目ID在给定账目数组中
predicates.in('id', accounts.map((account) => account.id));
// 调用 Rdb 对象的删除数据方法,并传入回调函数
this.accountTable.deleteData(predicates, callback);
}
// 删除单条账目数据
deleteData(account: Account, callback: Function) {
// 调用批量删除方法,传入包含单条账目数据的数组
this.batchDelete([account], callback)
}
// 更新账目数据
updateData(account: Account, callback: Function) {
// 生成值桶,包含要更新的数据
const valueBucket: relationalStore.ValuesBucket = generateBucket(account);
// 创建 RdbPredicates 对象,指定更新条件为账目ID匹配
let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName);
predicates.equalTo('id', account.id);
// 调用 Rdb 对象的更新数据方法,并传入回调函数
this.accountTable.updateData(predicates, valueBucket, callback);
}
// 查询数据库表数据
query(callback: Function, predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName)) {
// 调用 Rdb 对象的查询方法,传入查询条件和回调函数
this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet) => {
// 获取查询结果的行数
let count: number = resultSet.rowCount;
// 如果查询结果为空,则输出提示信息,并调用回调函数传入空数组
if (count === 0 || typeof count === 'string') {
console.log(`${CommonConstants.TABLE_TAG}` + 'Query no results!');
callback([]);
} else {
// 如果有查询结果,遍历结果集,将数据转换为 Account 对象数组
resultSet.goToFirstRow();
const result: Account[] = [];
for (let i = 0; i < count; i++) {
let tmp: Account = new Account()
tmp.id = resultSet.getDouble(resultSet.getColumnIndex('id'));
tmp.accountType = resultSet.getDouble(resultSet.getColumnIndex('accountType'));
tmp.typeText = resultSet.getString(resultSet.getColumnIndex('typeText'));
tmp.amount = resultSet.getDouble(resultSet.getColumnIndex('amount'));
tmp.date = new Date(resultSet.getLong(resultSet.getColumnIndex('date')))
tmp.desc = resultSet.getString(resultSet.getColumnIndex('desc'));
result[i] = tmp;
resultSet.goToNextRow();
}
// 调用回调函数,传入查询结果数组
callback(result);
}
});
}
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class AccountTable AST#class_body#Left { // 创建一个 Rdb 对象,用于处理数据库表的操作 AST#property_declaration#Left private accountTable = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Rdb AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ACCOUNT_TABLE AST#member_expression#Right AST#expression#Right . tableName AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ACCOUNT_TABLE AST#member_expression#Right AST#expression#Right . sqlCreate AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ACCOUNT_TABLE AST#member_expression#Right AST#expression#Right . columns AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 类构造函数,用于初始化数据库表 AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_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 { // 获取数据库表的 RdbStore 对象,并调用回调函数 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 . accountTable AST#member_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right // 获取数据库表的 RdbStore 对象,并调用回调函数 AST#method_declaration#Left getRdbStore AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_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#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 . accountTable AST#member_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left callback 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 insertData AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left Account AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 生成值桶(ValuesBucket),包含要插入的数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left valueBucket : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left generateBucket AST#expression#Right AST#argument_list#Left ( AST#expression#Left account 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 // 调用 Rdb 对象的插入数据方法,并传入回调函数 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 . accountTable AST#member_expression#Right AST#expression#Right . insertData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left valueBucket AST#expression#Right , AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 批量插入账目数据 AST#method_declaration#Left batchInsert AST#parameter_list#Left ( AST#parameter#Left accounts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Account [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 将账户数据转换为值桶数组 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left valueBuckets : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left relationalStore AST#ERROR#Left . ValuesBucket AST#ERROR#Right [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left accounts AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left account AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left generateBucket AST#expression#Right AST#argument_list#Left ( AST#expression#Left account AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 调用 Rdb 对象的批量插入数据方法,并传入回调函数 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 . accountTable AST#member_expression#Right AST#expression#Right . batchInsert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left valueBuckets AST#expression#Right , AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 批量删除账目数据 AST#method_declaration#Left batchDelete AST#parameter_list#Left ( AST#parameter#Left accounts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Account [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 创建 RdbPredicates 对象,用于指定删除条件 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left predicates = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ACCOUNT_TABLE AST#member_expression#Right AST#expression#Right . tableName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 设置删除条件为账目ID在给定账目数组中 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . in AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'id' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left accounts AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left account AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left account 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 调用 Rdb 对象的删除数据方法,并传入回调函数 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 . accountTable AST#member_expression#Right AST#expression#Right . deleteData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right , AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 删除单条账目数据 AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left Account AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 调用批量删除方法,传入包含单条账目数据的数组 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . batchDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left account AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 更新账目数据 AST#method_declaration#Left updateData AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left Account AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 生成值桶,包含要更新的数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left valueBucket : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left generateBucket AST#expression#Right AST#argument_list#Left ( AST#expression#Left account 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 // 创建 RdbPredicates 对象,指定更新条件为账目ID匹配 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left predicates = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ACCOUNT_TABLE AST#member_expression#Right AST#expression#Right . tableName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . equalTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'id' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left account AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 调用 Rdb 对象的更新数据方法,并传入回调函数 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 . accountTable AST#member_expression#Right AST#expression#Right . updateData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right , AST#expression#Left valueBucket AST#expression#Right , AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 查询数据库表数据 AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ACCOUNT_TABLE AST#member_expression#Right AST#expression#Right . tableName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 调用 Rdb 对象的查询方法,传入查询条件和回调函数 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 . accountTable AST#member_expression#Right AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resultSet : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 获取查询结果的行数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . rowCount 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 count AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left count AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#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 AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TABLE_TAG AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right + AST#expression#Left 'Query no results!' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ ] 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#block_statement#Right else AST#block_statement#Left { // 如果有查询结果,遍历结果集,将数据转换为 Account 对象数组 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToFirstRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Account [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tmp : AST#type_annotation#Left AST#primary_type#Left Account AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Account AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left tmp AST#ERROR#Right . id AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble 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 resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'id' 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#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 tmp AST#expression#Right . accountType AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble 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 resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'accountType' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 tmp AST#expression#Right . typeText AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'typeText' 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 tmp AST#expression#Right . amount AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble 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 resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'amount' 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 tmp AST#expression#Right . date AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getLong AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'date' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 tmp AST#expression#Right . desc AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'desc' 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#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = tmp AST#ERROR#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 resultSet AST#expression#Right . goToNextRow 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#for_statement#Right AST#statement#Right // 调用回调函数,传入查询结果数组 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left 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#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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class AccountTable {
private accountTable = new Rdb(
CommonConstants.ACCOUNT_TABLE.tableName,
CommonConstants.ACCOUNT_TABLE.sqlCreate,
CommonConstants.ACCOUNT_TABLE.columns
);
constructor(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback);
}
getRdbStore(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback);
}
insertData(account: Account, callback: Function) {
const valueBucket: relationalStore.ValuesBucket = generateBucket(account);
this.accountTable.insertData(valueBucket, callback);
}
batchInsert(accounts: Account[], callback: Function) {
const valueBuckets: relationalStore.ValuesBucket[] = accounts.map((account) => generateBucket(account));
this.accountTable.batchInsert(valueBuckets, callback)
}
batchDelete(accounts: Account[], callback: Function) {
let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName);
predicates.in('id', accounts.map((account) => account.id));
this.accountTable.deleteData(predicates, callback);
}
deleteData(account: Account, callback: Function) {
this.batchDelete([account], callback)
}
updateData(account: Account, callback: Function) {
const valueBucket: relationalStore.ValuesBucket = generateBucket(account);
let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName);
predicates.equalTo('id', account.id);
this.accountTable.updateData(predicates, valueBucket, callback);
}
query(callback: Function, predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName)) {
this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet) => {
let count: number = resultSet.rowCount;
if (count === 0 || typeof count === 'string') {
console.log(`${CommonConstants.TABLE_TAG}` + 'Query no results!');
callback([]);
} else {
resultSet.goToFirstRow();
const result: Account[] = [];
for (let i = 0; i < count; i++) {
let tmp: Account = new Account()
tmp.id = resultSet.getDouble(resultSet.getColumnIndex('id'));
tmp.accountType = resultSet.getDouble(resultSet.getColumnIndex('accountType'));
tmp.typeText = resultSet.getString(resultSet.getColumnIndex('typeText'));
tmp.amount = resultSet.getDouble(resultSet.getColumnIndex('amount'));
tmp.date = new Date(resultSet.getLong(resultSet.getColumnIndex('date')))
tmp.desc = resultSet.getString(resultSet.getColumnIndex('desc'));
result[i] = tmp;
resultSet.goToNextRow();
}
callback(result);
}
});
}
}
|
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/database/tables/AccountTable.ets#L10-L104
|
d1a6bb0ee8e43411e5d4d34efc42d3b4a65854aa
|
github
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
AppColdStart/entry/src/main/ets/pages/ComputeTaskAsync.ets
|
arkts
|
computeTaskAsync
|
Asynchronous processing of computing tasks
|
private computeTaskAsync(): void {
setTimeout(() => { // SetTimeout is used here to achieve asynchronous delayed operation.
this.computeTask();
}, DELAYED_TIME);
}
|
AST#method_declaration#Left private computeTaskAsync 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 setTimeout ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // SetTimeout is used here to achieve asynchronous delayed operation. 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 . computeTask AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left DELAYED_TIME AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private computeTaskAsync(): void {
setTimeout(() => {
this.computeTask();
}, DELAYED_TIME);
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/pages/ComputeTaskAsync.ets#L51-L55
|
8c03999a7dbf47f02ba785f9176fec04a8494ecc
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets
|
arkts
|
drawValue
|
Draws the value of the given entry by using the provided IValueFormatter.
@param c canvas
@param formatter formatter for custom value-formatting
@param value the value to be drawn
@param entry the entry the value belongs to
@param dataSetIndex the index of the DataSet the drawn Entry belongs to
@param x position
@param y position
@param color
|
public drawValue(
formatter: IValueFormatter,
value: number,
entry: EntryOhos,
dataSetIndex: number,
x: number,
y: number,
color: number
): Paint[] {
this.mValuePaint.setColor(color);
let textPaint = new TextPaint();
textPaint.set(this.mValuePaint);
textPaint.setText(formatter.getFormattedValue(value, entry, dataSetIndex, this.mViewPortHandler));
textPaint.setX(x);
textPaint.setY(y);
return [textPaint];
}
|
AST#method_declaration#Left public drawValue AST#parameter_list#Left ( AST#parameter#Left formatter : AST#type_annotation#Left AST#primary_type#Left IValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left entry : AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSetIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Paint [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValuePaint AST#member_expression#Right AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left textPaint = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TextPaint 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 textPaint AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValuePaint 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 textPaint AST#expression#Right . setText 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 formatter AST#expression#Right . getFormattedValue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right , AST#expression#Left entry AST#expression#Right , AST#expression#Left dataSetIndex AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left textPaint AST#expression#Right . setX AST#member_expression#Right 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#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 textPaint AST#expression#Right . setY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ AST#expression#Left textPaint AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public drawValue(
formatter: IValueFormatter,
value: number,
entry: EntryOhos,
dataSetIndex: number,
x: number,
y: number,
color: number
): Paint[] {
this.mValuePaint.setColor(color);
let textPaint = new TextPaint();
textPaint.set(this.mValuePaint);
textPaint.setText(formatter.getFormattedValue(value, entry, dataSetIndex, this.mViewPortHandler));
textPaint.setX(x);
textPaint.setY(y);
return [textPaint];
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets#L162-L178
|
f15897a9cbc2fe8f3c8e13bf1b4e0356ad3c6c77
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets
|
arkts
|
足迹数据模型
|
export interface Footprint {
id: number;
goodsId: number;
goodsMainPic: string;
viewTime: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface Footprint AST#object_type#Left { AST#type_member#Left id : 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 goodsId : 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 goodsMainPic : 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 viewTime : 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 Footprint {
id: number;
goodsId: number;
goodsMainPic: string;
viewTime: string;
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets#L111-L116
|
9b3e36ac2ca8c9e801579f6481fc0bd104d0775c
|
github
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.