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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_ui/src/main/ets/ui/prompt/efLoading.ets
|
arkts
|
弹框形状布局
|
export enum LoadingShape {
/**
* 正方形
*/
SQUARE,
/**
* 矩形
*/
RECTANGLE
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum LoadingShape AST#enum_body#Left { /**
* 正方形
*/ AST#enum_member#Left SQUARE AST#enum_member#Right , /**
* 矩形
*/ AST#enum_member#Left RECTANGLE AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum LoadingShape {
SQUARE,
RECTANGLE
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/efLoading.ets#L203-L212
|
22b893b813682f4d8f56a42c79ca31e3bf19c4c2
|
gitee
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/blocks/modules/meowTabsVertical.ets
|
arkts
|
on_scroll_to_idx
|
Events
|
on_scroll_to_idx() {
if (this.scroll_to_idx < 0) {
return;
}
this.try_scroll_to(this.scroll_to_idx)
this.scroll_to_idx = -1;
}
|
AST#method_declaration#Left on_scroll_to_idx AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroll_to_idx AST#member_expression#Right AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right 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 . try_scroll_to 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 . scroll_to_idx 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 . scroll_to_idx AST#member_expression#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
on_scroll_to_idx() {
if (this.scroll_to_idx < 0) {
return;
}
this.try_scroll_to(this.scroll_to_idx)
this.scroll_to_idx = -1;
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowTabsVertical.ets#L284-L290
|
e40321a87b3ade8bb8e6a1d056a9e8483f7a51f3
|
gitee
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/interface_class/complex_class/complex_class_003_T.ets
|
arkts
|
Introduction 跨类访问
|
export function complex_class_003_T(taint_src : string) {
let b = new B();
let a = new A(taint_src);
taint.Sink(b.getData(a));
}
|
AST#export_declaration#Left export AST#function_declaration#Left function complex_class_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 b = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left B AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left a = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left A AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left a 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#function_declaration#Right AST#export_declaration#Right
|
export function complex_class_003_T(taint_src : string) {
let b = new B();
let a = new A(taint_src);
taint.Sink(b.getData(a));
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/interface_class/complex_class/complex_class_003_T.ets#L6-L10
|
42d69e9ff079dae09612c071ce0b6e465d118c8e
|
github
|
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/ScrollItem.ets
|
arkts
|
restore
|
还原
|
restore() {
let that = this;
let intervalID = setInterval(() => {
that.move(that.sx += 0.01);
if (that.sx >= 1) {
clearInterval(intervalID);
}
}, 10)
}
|
AST#method_declaration#Left restore AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left that = AST#expression#Left this 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 intervalID = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . move AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . sx AST#member_expression#Right += AST#expression#Left 0.01 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . sx AST#member_expression#Right AST#expression#Right >= AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left intervalID AST#expression#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 10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
restore() {
let that = this;
let intervalID = setInterval(() => {
that.move(that.sx += 0.01);
if (that.sx >= 1) {
clearInterval(intervalID);
}
}, 10)
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/ScrollItem.ets#L113-L121
|
4d7a2a6e80aedee0d766c26c1340cc8bfbf5873c
|
gitee
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets
|
arkts
|
checkUserData
|
User name, nickname, password, and confirm password data verification.
@returns Check whether the check is passed.
|
checkUserData(): boolean {
if (this.username === '' || this.password === '' || this.confirmPassword === '') {
PromptUtil.promptMessage($r('app.string.message_register_empty'), CommonConstants.PROMPT_TIME);
return false;
}
// RegExp for matching username.
let namePattern = CommonConstants.REGEXP_NAME;
if (!namePattern.exec(this.username)) {
this.isPromptName = true;
PromptUtil.promptMessage($r('app.string.message_name_format'), CommonConstants.PROMPT_TIME);
return false;
}
this.isPromptName = false;
// RegExp for matching passwords.
let passwordPattern = CommonConstants.REGEXP_PASSWORD;
if (!passwordPattern.exec(this.password)) {
this.isPromptPassword = true;
PromptUtil.promptMessage($r('app.string.message_password_format'), CommonConstants.PROMPT_TIME);
return false;
}
this.isPromptPassword = false;
// Check whether the password and confirm password are the same.
if (this.password !== this.confirmPassword) {
PromptUtil.promptMessage($r('app.string.message_password_prompt'), CommonConstants.PROMPT_TIME);
return false;
}
return true;
}
|
AST#method_declaration#Left checkUserData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . username 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 . password 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 . confirmPassword AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PromptUtil AST#expression#Right . promptMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.message_register_empty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PROMPT_TIME 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 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 // RegExp for matching username. AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left namePattern = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . REGEXP_NAME AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left namePattern AST#expression#Right AST#unary_expression#Right AST#expression#Right . exec 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#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 . isPromptName AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PromptUtil AST#expression#Right . promptMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.message_name_format' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PROMPT_TIME 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 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPromptName AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // RegExp for matching passwords. AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left passwordPattern = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . REGEXP_PASSWORD AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left passwordPattern AST#expression#Right AST#unary_expression#Right AST#expression#Right . exec 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#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 . isPromptPassword AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PromptUtil AST#expression#Right . promptMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.message_password_format' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PROMPT_TIME 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 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPromptPassword AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Check whether the password and confirm password are the same. 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 . password AST#member_expression#Right AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . confirmPassword 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 PromptUtil AST#expression#Right . promptMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.message_password_prompt' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PROMPT_TIME 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 AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
checkUserData(): boolean {
if (this.username === '' || this.password === '' || this.confirmPassword === '') {
PromptUtil.promptMessage($r('app.string.message_register_empty'), CommonConstants.PROMPT_TIME);
return false;
}
let namePattern = CommonConstants.REGEXP_NAME;
if (!namePattern.exec(this.username)) {
this.isPromptName = true;
PromptUtil.promptMessage($r('app.string.message_name_format'), CommonConstants.PROMPT_TIME);
return false;
}
this.isPromptName = false;
let passwordPattern = CommonConstants.REGEXP_PASSWORD;
if (!passwordPattern.exec(this.password)) {
this.isPromptPassword = true;
PromptUtil.promptMessage($r('app.string.message_password_format'), CommonConstants.PROMPT_TIME);
return false;
}
this.isPromptPassword = false;
if (this.password !== this.confirmPassword) {
PromptUtil.promptMessage($r('app.string.message_password_prompt'), CommonConstants.PROMPT_TIME);
return false;
}
return true;
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets#L150-L177
|
8b72d0061e601951929865bdd2d9f323ca0199cc
|
gitee
|
pangpang20/wavecast.git
|
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
|
entry/src/main/ets/service/DatabaseService.ets
|
arkts
|
checkAndMigrateDatabase
|
检查并执行数据库迁移
|
private async checkAndMigrateDatabase(): Promise<void> {
if (!this.rdbStore) return;
try {
// 获取当前数据库版本
const currentVersion = await this.getDatabaseVersion();
const targetVersion = Constants.DB_VERSION;
console.info(`[DatabaseService] Current DB version: ${currentVersion}, Target version: ${targetVersion}`);
if (currentVersion === 0) {
// 新安装,创建所有表
await this.createTables();
await this.setDatabaseVersion(targetVersion);
console.info('[DatabaseService] Fresh install, tables created');
} else if (currentVersion < targetVersion) {
// 需要升级
await this.migrateDatabase(currentVersion, targetVersion);
await this.setDatabaseVersion(targetVersion);
console.info(`[DatabaseService] Migration completed: v${currentVersion} -> v${targetVersion}`);
} else {
console.info('[DatabaseService] Database is up to date');
}
} catch (error) {
console.error('[DatabaseService] Migration failed:', error);
// 迁移失败时尝试创建表(容错处理)
await this.createTables();
}
}
|
AST#method_declaration#Left private async checkAndMigrateDatabase AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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#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 { // 获取当前数据库版本 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentVersion = 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 . getDatabaseVersion 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 targetVersion = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DB_VERSION AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [DatabaseService] Current DB version: AST#template_substitution#Left $ { AST#expression#Left currentVersion AST#expression#Right } AST#template_substitution#Right , Target version: AST#template_substitution#Left $ { AST#expression#Left targetVersion 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left currentVersion 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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . createTables 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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . setDatabaseVersion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left targetVersion AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Fresh install, tables created' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left currentVersion AST#expression#Right < AST#expression#Left targetVersion 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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . migrateDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left currentVersion AST#expression#Right , AST#expression#Left targetVersion AST#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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . setDatabaseVersion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left targetVersion AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [DatabaseService] Migration completed: v AST#template_substitution#Left $ { AST#expression#Left currentVersion AST#expression#Right } AST#template_substitution#Right -> v AST#template_substitution#Left $ { AST#expression#Left targetVersion 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Database is up to date' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Migration failed:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 迁移失败时尝试创建表(容错处理) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . createTables 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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async checkAndMigrateDatabase(): Promise<void> {
if (!this.rdbStore) return;
try {
const currentVersion = await this.getDatabaseVersion();
const targetVersion = Constants.DB_VERSION;
console.info(`[DatabaseService] Current DB version: ${currentVersion}, Target version: ${targetVersion}`);
if (currentVersion === 0) {
await this.createTables();
await this.setDatabaseVersion(targetVersion);
console.info('[DatabaseService] Fresh install, tables created');
} else if (currentVersion < targetVersion) {
await this.migrateDatabase(currentVersion, targetVersion);
await this.setDatabaseVersion(targetVersion);
console.info(`[DatabaseService] Migration completed: v${currentVersion} -> v${targetVersion}`);
} else {
console.info('[DatabaseService] Database is up to date');
}
} catch (error) {
console.error('[DatabaseService] Migration failed:', error);
await this.createTables();
}
}
|
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DatabaseService.ets#L70-L98
|
634370fcc71d177d07a2c88adfaeaf35f3da42f3
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/WebCookie/entry/src/main/ets/common/constants/CommonConstant.ets
|
arkts
|
Type of cookie Operation.
|
export enum CookieOperation {
GET_COOKIE = '读取cookie',
SET_COOKIE = '设置cookie',
DELETE_COOKIE = '删除cookie',
VERIFY_COOKIE = '验证cookie'
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum CookieOperation AST#enum_body#Left { AST#enum_member#Left GET_COOKIE = AST#expression#Left '读取cookie' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SET_COOKIE = AST#expression#Left '设置cookie' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DELETE_COOKIE = AST#expression#Left '删除cookie' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left VERIFY_COOKIE = AST#expression#Left '验证cookie' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum CookieOperation {
GET_COOKIE = '读取cookie',
SET_COOKIE = '设置cookie',
DELETE_COOKIE = '删除cookie',
VERIFY_COOKIE = '验证cookie'
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/WebCookie/entry/src/main/ets/common/constants/CommonConstant.ets#L152-L157
|
3d48fd3551f850081e8bd57591f7bbceee3ed9ac
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
|
arkts
|
customTabBar
|
自定义TabBar
|
@Builder
customTabBar() {
RelativeContainer() {
Row() {
// 选择的省名
this.locationItem({ index: AddressType.Province, name: this.currentSelectInfo.province })
// 选择的市名
this.locationItem({ index: AddressType.City, name: this.currentSelectInfo.city })
// 选择的区名
this.locationItem({ index: AddressType.Region, name: this.currentSelectInfo.region })
}
.width($r('app.string.custom_address_picker_percent_eighty_five'))
.height($r('app.string.custom_address_picker_percent_eighty'))
.alignRules({ 'center': { 'anchor': '__container__', 'align': VerticalAlign.Center } })
.margin({ bottom: $r('app.float.custom_address_picker_size_ten') })
.padding({
top: $r('app.float.custom_address_picker_size_fifteen'),
left: $r('app.float.custom_address_picker_size_twenty')
})
Row() {
// 选择的省市区名下方的下滑线
Divider()
.width(Constants.DIVIDER_WIDTH)
.strokeWidth(Constants.STROKE_WIDTH)
.color($r('app.color.custom_address_picker_divider_color'))
.margin({ left: this.leftMargin })
}
.width($r('app.string.custom_address_picker_percent_eighty_five'))
.height($r('app.string.custom_address_picker_percent_twenty'))
.alignRules({ 'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom } })
.padding({ left: $r('app.float.custom_address_picker_size_twenty') })
Row() {
Image($r('app.media.address_picker_close'))
.objectFit(ImageFit.Contain)// 图片保持其原始的宽高比进行缩小或放大
.width($r('app.float.custom_address_picker_size_fourteen'))
.height($r('app.float.custom_address_picker_size_fourteen'))
.margin({ left: $r('app.float.custom_address_picker_size_twenty') })
}
.onClick(() => {
// 关闭半模态页面
this.isShow = false;
})
.width($r('app.string.custom_address_picker_percent_fifteen'))
.height($r('app.string.custom_address_picker_full_size'))
.alignRules({ 'right': { 'anchor': '__container__', 'align': HorizontalAlign.End } })
}
.width($r('app.string.custom_address_picker_full_size'))
.height($r('app.float.custom_address_picker_size_forty_eight'))
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customTabBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 选择的省名 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . locationItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left index AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Province AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . province AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 选择的市名 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . locationItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left index AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . City AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . city AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 选择的区名 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . locationItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left index AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AddressType AST#expression#Right . Region AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectInfo AST#member_expression#Right AST#expression#Right . region AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_percent_eighty_five' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_percent_eighty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'center' AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'anchor' AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'align' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_ten' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_fifteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 选择的省市区名下方的下滑线 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DIVIDER_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . STROKE_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_address_picker_divider_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftMargin AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_percent_eighty_five' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_percent_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'bottom' AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'anchor' AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'align' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.address_picker_close' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) // 图片保持其原始的宽高比进行缩小或放大 AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_fourteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_fourteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 关闭半模态页面 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShow AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_percent_fifteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'right' AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'anchor' AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'align' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_address_picker_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.custom_address_picker_size_forty_eight' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
customTabBar() {
RelativeContainer() {
Row() {
this.locationItem({ index: AddressType.Province, name: this.currentSelectInfo.province })
this.locationItem({ index: AddressType.City, name: this.currentSelectInfo.city })
this.locationItem({ index: AddressType.Region, name: this.currentSelectInfo.region })
}
.width($r('app.string.custom_address_picker_percent_eighty_five'))
.height($r('app.string.custom_address_picker_percent_eighty'))
.alignRules({ 'center': { 'anchor': '__container__', 'align': VerticalAlign.Center } })
.margin({ bottom: $r('app.float.custom_address_picker_size_ten') })
.padding({
top: $r('app.float.custom_address_picker_size_fifteen'),
left: $r('app.float.custom_address_picker_size_twenty')
})
Row() {
Divider()
.width(Constants.DIVIDER_WIDTH)
.strokeWidth(Constants.STROKE_WIDTH)
.color($r('app.color.custom_address_picker_divider_color'))
.margin({ left: this.leftMargin })
}
.width($r('app.string.custom_address_picker_percent_eighty_five'))
.height($r('app.string.custom_address_picker_percent_twenty'))
.alignRules({ 'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom } })
.padding({ left: $r('app.float.custom_address_picker_size_twenty') })
Row() {
Image($r('app.media.address_picker_close'))
.objectFit(ImageFit.Contain)
.width($r('app.float.custom_address_picker_size_fourteen'))
.height($r('app.float.custom_address_picker_size_fourteen'))
.margin({ left: $r('app.float.custom_address_picker_size_twenty') })
}
.onClick(() => {
this.isShow = false;
})
.width($r('app.string.custom_address_picker_percent_fifteen'))
.height($r('app.string.custom_address_picker_full_size'))
.alignRules({ 'right': { 'anchor': '__container__', 'align': HorizontalAlign.End } })
}
.width($r('app.string.custom_address_picker_full_size'))
.height($r('app.float.custom_address_picker_size_forty_eight'))
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L230-L280
|
b517002bac68dec1e93341cec6173916d0ae731d
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.batteryInfo.d.ets
|
arkts
|
Battery capacity level of a device.
@enum { int }
@syscap SystemCapability.PowerManager.BatteryManager.Core
@since 20
|
export enum BatteryCapacityLevel {
/**
* The battery is in unknown capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 22
*/
LEVEL_NONE,
/**
* The battery is in full capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
LEVEL_FULL,
/**
* The battery is in high capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
LEVEL_HIGH,
/**
* The battery is in normal capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
LEVEL_NORMAL,
/**
* The battery is in low capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
LEVEL_LOW,
/**
* The battery is in warning low capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
LEVEL_WARNING,
/**
* The battery is in critical low capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
LEVEL_CRITICAL,
/**
* The battery is in the lowest capacity level, system will shut down automatically in a few seconds.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
LEVEL_SHUTDOWN
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum BatteryCapacityLevel AST#enum_body#Left { /**
* The battery is in unknown capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 22
*/ AST#enum_member#Left LEVEL_NONE AST#enum_member#Right , /**
* The battery is in full capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left LEVEL_FULL AST#enum_member#Right , /**
* The battery is in high capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left LEVEL_HIGH AST#enum_member#Right , /**
* The battery is in normal capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left LEVEL_NORMAL AST#enum_member#Right , /**
* The battery is in low capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left LEVEL_LOW AST#enum_member#Right , /**
* The battery is in warning low capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left LEVEL_WARNING AST#enum_member#Right , /**
* The battery is in critical low capacity level.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left LEVEL_CRITICAL AST#enum_member#Right , /**
* The battery is in the lowest capacity level, system will shut down automatically in a few seconds.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left LEVEL_SHUTDOWN AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum BatteryCapacityLevel {
LEVEL_NONE,
LEVEL_FULL,
LEVEL_HIGH,
LEVEL_NORMAL,
LEVEL_LOW,
LEVEL_WARNING,
LEVEL_CRITICAL,
LEVEL_SHUTDOWN
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.batteryInfo.d.ets#L331-L388
|
0c36f9926ce5beb2773a2aae12cd18289dcd8fa5
|
gitee
|
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets
|
arkts
|
showToastMessage
|
信息提示
|
showToastMessage(message: Resource) {
promptAction.showToast({
message: message,
duration: CommonConstants.DURATION
});
}
|
AST#method_declaration#Left showToastMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#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 message AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DURATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
showToastMessage(message: Resource) {
promptAction.showToast({
message: message,
duration: CommonConstants.DURATION
});
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets#L99-L104
|
ae32208b2162b13f438c9805de9c29e9991bb11b
|
gitee
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/animation/param/OpacityAnimateOptions.ets
|
arkts
|
@author: HHBin
@date: 2024-11-23
@desc: 渐变动画
|
export class OpacityAnimateOptions implements INavAnimateOptions {
_options?: number | Resource;
_isBeforePage: boolean = false
constructor
|
AST#export_declaration#Left export AST#ERROR#Left class OpacityAnimateOptions AST#implements_clause#Left implements INavAnimateOptions AST#implements_clause#Right { AST#property_declaration#Left _options ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right _isBeforePage : 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#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
|
export class OpacityAnimateOptions implements INavAnimateOptions {
_options?: number | Resource;
_isBeforePage: boolean = false
constructor
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/param/OpacityAnimateOptions.ets#L10-L14
|
82e8529ff85c4c72c31f509f1b4548393d97b754
|
gitee
|
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/viewmodel/TaskViewModel.ets
|
arkts
|
notifyListeners
|
通知所有监听器
|
private notifyListeners() {
this.listeners.forEach(listener => {
listener.onTasksChanged(this.tasks);
});
}
|
AST#method_declaration#Left private notifyListeners AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . 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 . onTasksChanged 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 . tasks AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private notifyListeners() {
this.listeners.forEach(listener => {
listener.onTasksChanged(this.tasks);
});
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L49-L53
|
8cb55b4fa6f77cc55d6f3cc905da2a9cdfef004e
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets
|
arkts
|
this
|
节点的path更新后需要调用invalidate()方法触发重新渲染
|
this.currentNodeDraw.invalidate();
|
AST#method_declaration#Left this AST#ERROR#Left . currentNodeDraw . in validate AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right
|
this.currentNodeDraw.invalidate();
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets#L302-L302
|
8e28dc5623a7e47a42cd0f8879f7dfbbfe813f52
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets
|
arkts
|
createBarcode
|
生成QR方形码
@param content 内容
@param size 大小
@returns PixelMap
|
async function createBarcode(content: string, size: number): Promise<image.PixelMap | null> {
if (canIUse("SystemCapability.Multimedia.Scan.Core") && canIUse("SystemCapability.Multimedia.Scan.GenerateBarcode")) {
try {
// 以QR码为例,码图生成参数
let options: generateBarcode.CreateOptions = {
scanType: scanCore.ScanType.QR_CODE,
height: size,
width: size
};
let pixelMap: image.PixelMap = await generateBarcode.createBarcode(content, options);
console.debug("生成码图成功");
return pixelMap;
} catch (error) {
hilog.error(0x0001, '[generateBarcode]',
`Failed to createBarcode by promise with options. Code: ${error.code}, message: ${error.message}`);
return null;
}
} else {
console.error("该设备暂不支持生成二维码");
return null;
}
}
|
AST#function_declaration#Left async function createBarcode AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ( AST#expression#Left "SystemCapability.Multimedia.Scan.Core" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left canIUse AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "SystemCapability.Multimedia.Scan.GenerateBarcode" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 以QR码为例,码图生成参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left generateBarcode . CreateOptions 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 scanType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left scanCore AST#expression#Right . ScanType AST#member_expression#Right AST#expression#Right . QR_CODE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left size AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left size 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 pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left generateBarcode AST#expression#Right AST#await_expression#Right AST#expression#Right . createBarcode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left content 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 console AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "生成码图成功" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left pixelMap 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 0x0001 AST#expression#Right , AST#expression#Left '[generateBarcode]' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to createBarcode by promise with options. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "该设备暂不支持生成二维码" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
async function createBarcode(content: string, size: number): Promise<image.PixelMap | null> {
if (canIUse("SystemCapability.Multimedia.Scan.Core") && canIUse("SystemCapability.Multimedia.Scan.GenerateBarcode")) {
try {
let options: generateBarcode.CreateOptions = {
scanType: scanCore.ScanType.QR_CODE,
height: size,
width: size
};
let pixelMap: image.PixelMap = await generateBarcode.createBarcode(content, options);
console.debug("生成码图成功");
return pixelMap;
} catch (error) {
hilog.error(0x0001, '[generateBarcode]',
`Failed to createBarcode by promise with options. Code: ${error.code}, message: ${error.message}`);
return null;
}
} else {
console.error("该设备暂不支持生成二维码");
return null;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets#L192-L213
|
d997248601c7185128dc68fe56850cb8643f75c7
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/app/views/buttons/IconTintButton.ets
|
arkts
|
IconTintButton
|
/////////////////////////////////// / png图片使用的,可以着色的图标按钮 ///////////////////////////////////
|
@ComponentV2
export struct IconTintButton {
// 必需属性(通过@Param从外部传入)
@Param icon : Resource | null = null
@Param isSvg : boolean = false //默认是png
@Event onClickCallBack : () => void = () => {}
// 可选样式属性(通过@Param支持外部修改)
@Param iconSize : number | string = 22
@Param iconColor : ResourceColor = $r('app.color.colorPrimary')
@Param iconColorSelected : ResourceColor = $r('app.color.colorAccent2')
@Param bgColor : ResourceColor = Color.Transparent
@Param buttonType : ButtonType = ButtonType.Normal
@Param isEnabled : boolean = true
// 内部状态管理(使用@Local)
@Local pressed: boolean = false
build() {
Button() {
TintImage({src: this.icon, colorStr: getColor(this.pressed ? this.iconColorSelected : this.iconColor), iconSize: this.iconSize, isSvg: this.isSvg})
.width(this.iconSize)
.height(this.iconSize)
}
.width(this.iconSize)
.height(this.iconSize)
.type(this.buttonType)
.backgroundColor(this.bgColor)
.enabled(this.isEnabled)
.opacity(this.isEnabled ? 1 : 0.6)
.onTouch((event: TouchEvent)=>{
///按下状态
if (event.type === TouchType.Down || event.type === TouchType.Move) {
this.pressed = true
}else{
this.pressed = false
}
})
.onClick(() => {
this.onClickCallBack();
vibrate() //震动
})
.stateEffect(this.pressed) // 响应状态变化
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct IconTintButton AST#component_body#Left { // 必需属性(通过@Param从外部传入) AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right icon : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right isSvg : 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 //默认是png AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Event AST#decorator#Right onClickCallBack : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right // 可选样式属性(通过@Param支持外部修改) AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right iconSize : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left 22 AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right iconColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.colorPrimary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right iconColorSelected : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.colorAccent2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right bgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right buttonType : AST#type_annotation#Left AST#primary_type#Left ButtonType AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right isEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right // 内部状态管理(使用@Local) AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right pressed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TintImage ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . icon AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left colorStr : AST#expression#Left AST#call_expression#Left AST#expression#Left getColor AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pressed AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . iconColorSelected AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . iconColor AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left iconSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . iconSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isSvg : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSvg AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . iconSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . iconSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . iconSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . iconSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonType AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnabled AST#member_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#Left . onTouch ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { ///按下状态 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left TouchType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Down AST#member_expression#Right AST#expression#Right || AST#expression#Left event AST#expression#Right AST#binary_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left TouchType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Move 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 . pressed AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#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 . pressed AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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 . onClickCallBack 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 vibrate AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right //震动 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . stateEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pressed AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 响应状态变化 } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct IconTintButton {
@Param icon : Resource | null = null
@Param isSvg : boolean = false
@Event onClickCallBack : () => void = () => {}
@Param iconSize : number | string = 22
@Param iconColor : ResourceColor = $r('app.color.colorPrimary')
@Param iconColorSelected : ResourceColor = $r('app.color.colorAccent2')
@Param bgColor : ResourceColor = Color.Transparent
@Param buttonType : ButtonType = ButtonType.Normal
@Param isEnabled : boolean = true
@Local pressed: boolean = false
build() {
Button() {
TintImage({src: this.icon, colorStr: getColor(this.pressed ? this.iconColorSelected : this.iconColor), iconSize: this.iconSize, isSvg: this.isSvg})
.width(this.iconSize)
.height(this.iconSize)
}
.width(this.iconSize)
.height(this.iconSize)
.type(this.buttonType)
.backgroundColor(this.bgColor)
.enabled(this.isEnabled)
.opacity(this.isEnabled ? 1 : 0.6)
.onTouch((event: TouchEvent)=>{
if (event.type === TouchType.Down || event.type === TouchType.Move) {
this.pressed = true
}else{
this.pressed = false
}
})
.onClick(() => {
this.onClickCallBack();
vibrate()
})
.stateEffect(this.pressed)
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/buttons/IconTintButton.ets#L8-L58
|
a31f8c5b87aba6308045441761679e07333648df
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/main/src/main/ets/view/MePage.ets
|
arkts
|
buildOrderStatusItem
|
构建订单状态项
@param {OrderStatusItem} item - 订单状态数据
@returns {void} 无返回值
|
@Builder
private buildOrderStatusItem(item: OrderStatusItem): void {
Column() {
IBestBadge({
content: item.count,
max: 99,
showZero: false,
color: $r("app.color.danger"),
badgePosition: "top-right"
}) {
CommonIcon({
icon: item.icon,
iconSize: 24,
tintColor: $r("app.color.text_primary")
});
}
SpaceVerticalXSmall();
Text(item.label)
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_secondary"));
}
.alignItems(HorizontalAlign.Center)
.layoutWeight(1)
.padding({
top: $r("app.float.space_vertical_medium"),
bottom: $r("app.float.space_vertical_medium")
})
.onClick((): void => {
const tab: string = `${item.tabIndex}`;
OrderNavigator.toList(tab);
});
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildOrderStatusItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left OrderStatusItem 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#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 IBestBadge ( AST#component_parameters#Left { AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . count AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left max : AST#expression#Left 99 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left showZero : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left color : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.danger" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left badgePosition : AST#expression#Left "top-right" AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left CommonIcon ( AST#component_parameters#Left { AST#component_parameter#Left icon : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . icon AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left iconSize : AST#expression#Left 24 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left tintColor : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_primary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_custom_component_statement#Left SpaceVerticalXSmall ( ) ; AST#ui_custom_component_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . label 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#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center 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 . 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.space_vertical_medium" 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.space_vertical_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tab : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . tabIndex AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tab AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private buildOrderStatusItem(item: OrderStatusItem): void {
Column() {
IBestBadge({
content: item.count,
max: 99,
showZero: false,
color: $r("app.color.danger"),
badgePosition: "top-right"
}) {
CommonIcon({
icon: item.icon,
iconSize: 24,
tintColor: $r("app.color.text_primary")
});
}
SpaceVerticalXSmall();
Text(item.label)
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_secondary"));
}
.alignItems(HorizontalAlign.Center)
.layoutWeight(1)
.padding({
top: $r("app.float.space_vertical_medium"),
bottom: $r("app.float.space_vertical_medium")
})
.onClick((): void => {
const tab: string = `${item.tabIndex}`;
OrderNavigator.toList(tab);
});
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L354-L387
|
4ed712a6a6f77134c04a33ca2c1f82c5d4e238d8
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets
|
arkts
|
getCigenWordsByCid
|
============================================================ 根据 CID 查询 ============================================================
|
async getCigenWordsByCid(cid: number): Promise<Array<CigenWord> | null> {
if (!this.db) return null;
const sql = `
SELECT
a.${CigenTable.CWord.idx} AS CWord_idx,
a.${CigenTable.CWord.cid} AS CWord_cid,
a.${CigenTable.CWord.titleEn} AS CWord_titleEn,
a.${CigenTable.CWord.mnemonic} AS CWord_mnemonic,
b.${CigenTable.Cgcz.vid} AS Cgcz_vid,
b.${CigenTable.Cgcz.desc} AS Cgcz_desc
FROM ${CigenTable.CWord.table} a
LEFT JOIN ${CigenTable.Cgcz.table} b
ON a.${CigenTable.CWord.cid} = b.${CigenTable.Cgcz.cid}
WHERE a.${CigenTable.CWord.cid} = ?
`;
return await this.db.getDatas(sql, [cid], rs => this.createCigenWordFromRs(rs));
}
|
AST#method_declaration#Left async getCigenWordsByCid AST#parameter_list#Left ( AST#parameter#Left cid : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CigenWord AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#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 . db AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sql = AST#expression#Left AST#template_literal#Left `
SELECT
a. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . CWord AST#member_expression#Right AST#expression#Right . idx AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AS CWord_idx,
a. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . CWord AST#member_expression#Right AST#expression#Right . cid AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AS CWord_cid,
a. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . CWord AST#member_expression#Right AST#expression#Right . titleEn AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AS CWord_titleEn,
a. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . CWord AST#member_expression#Right AST#expression#Right . mnemonic AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AS CWord_mnemonic,
b. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . Cgcz AST#member_expression#Right AST#expression#Right . vid AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AS Cgcz_vid,
b. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . Cgcz AST#member_expression#Right AST#expression#Right . desc AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AS Cgcz_desc
FROM AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . CWord AST#member_expression#Right AST#expression#Right . table AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right a
LEFT JOIN AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . Cgcz AST#member_expression#Right AST#expression#Right . table AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right b
ON a. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . CWord AST#member_expression#Right AST#expression#Right . cid AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right = b. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . Cgcz AST#member_expression#Right AST#expression#Right . cid AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
WHERE a. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CigenTable AST#expression#Right . CWord AST#member_expression#Right AST#expression#Right . cid 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . db AST#member_expression#Right AST#expression#Right . getDatas AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left cid AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left rs => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createCigenWordFromRs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getCigenWordsByCid(cid: number): Promise<Array<CigenWord> | null> {
if (!this.db) return null;
const sql = `
SELECT
a.${CigenTable.CWord.idx} AS CWord_idx,
a.${CigenTable.CWord.cid} AS CWord_cid,
a.${CigenTable.CWord.titleEn} AS CWord_titleEn,
a.${CigenTable.CWord.mnemonic} AS CWord_mnemonic,
b.${CigenTable.Cgcz.vid} AS Cgcz_vid,
b.${CigenTable.Cgcz.desc} AS Cgcz_desc
FROM ${CigenTable.CWord.table} a
LEFT JOIN ${CigenTable.Cgcz.table} b
ON a.${CigenTable.CWord.cid} = b.${CigenTable.Cgcz.cid}
WHERE a.${CigenTable.CWord.cid} = ?
`;
return await this.db.getDatas(sql, [cid], rs => this.createCigenWordFromRs(rs));
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets#L120-L138
|
04fbd80985dbb0b8681900797e9d6a96fb6d3335
|
github
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/attribute/RowAttribute.ets
|
arkts
|
获取横向起始 + 垂直顶部的 Row 对齐修饰器
@returns {AttributeModifier<RowAttribute>} Row 对齐修饰器
@example
Row() { Text("Hi"); }.attributeModifier(rowStartTop());
|
export function rowStartTop(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.Start);
instance.alignItems(VerticalAlign.Top);
}
};
}
|
AST#export_declaration#Left export AST#function_declaration#Left function rowStartTop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttribute AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left applyNormalAttribute AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left instance : AST#type_annotation#Left AST#primary_type#Left RowAttribute AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left instance AST#expression#Right . justifyContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left instance AST#expression#Right . alignItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function rowStartTop(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.Start);
instance.alignItems(VerticalAlign.Top);
}
};
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/RowAttribute.ets#L102-L109
|
26d9c335ee43f75306b092ba4d294ebc43a03486
|
github
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/formatter/DefaultAxisValueFormatter.ets
|
arkts
|
Constructor that specifies to how many digits the value should be
formatted.
@param digits
|
constructor(digits: number) {
this.digits = digits;
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left digits : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . digits AST#member_expression#Right = AST#expression#Left digits 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(digits: number) {
this.digits = digits;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/formatter/DefaultAxisValueFormatter.ets#L33-L35
|
630729de586b57e3cc0804995fb54966bac9ec87
|
gitee
|
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets
|
arkts
|
Declare ToolBarModifier use in ToolBar
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 13
|
export declare class ToolBarModifier {
/**
* Sets the height of the toolBar.
*
* @param { LengthMetrics } height - toolBar's height.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
height(height: LengthMetrics): ToolBarModifier;
/**
* Sets the backgroundColor of the toolBar.
*
* @param { ResourceColor } backgroundColor - toolBar's backgroundColor.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
backgroundColor(backgroundColor: ResourceColor): ToolBarModifier;
/**
* Sets the left and right padding of the toolbar.
*
* @param { LengthMetrics } padding - left and right padding.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
padding(padding: LengthMetrics): ToolBarModifier;
/**
* Sets whether or not to display the press status effect.
*
* @param { boolean } stateEffect - press status effect.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
stateEffect(stateEffect: boolean): ToolBarModifier;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ToolBarModifier AST#class_body#Left { /**
* Sets the height of the toolBar.
*
* @param { LengthMetrics } height - toolBar's height.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#method_declaration#Left height AST#parameter_list#Left ( AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left LengthMetrics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarModifier AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /**
* Sets the backgroundColor of the toolBar.
*
* @param { ResourceColor } backgroundColor - toolBar's backgroundColor.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#method_declaration#Left backgroundColor AST#parameter_list#Left ( AST#parameter#Left backgroundColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarModifier AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /**
* Sets the left and right padding of the toolbar.
*
* @param { LengthMetrics } padding - left and right padding.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#method_declaration#Left padding AST#parameter_list#Left ( AST#parameter#Left padding : AST#type_annotation#Left AST#primary_type#Left LengthMetrics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarModifier AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /**
* Sets whether or not to display the press status effect.
*
* @param { boolean } stateEffect - press status effect.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#method_declaration#Left stateEffect AST#parameter_list#Left ( AST#parameter#Left stateEffect : 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 ToolBarModifier AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class ToolBarModifier {
height(height: LengthMetrics): ToolBarModifier;
backgroundColor(backgroundColor: ResourceColor): ToolBarModifier;
padding(padding: LengthMetrics): ToolBarModifier;
stateEffect(stateEffect: boolean): ToolBarModifier;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L231-L272
|
cbba647848643801d1075107e9fb078a058a8d05
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/SettingsTypes.ets
|
arkts
|
网络配置接口
|
export interface NetworkConfig {
timeout: number;
retryAttempts: number;
useProxy: boolean;
proxyConfig?: ProxyConfig;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface NetworkConfig AST#object_type#Left { AST#type_member#Left timeout : 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 retryAttempts : 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 useProxy : 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 proxyConfig ? : AST#type_annotation#Left AST#primary_type#Left ProxyConfig 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 NetworkConfig {
timeout: number;
retryAttempts: number;
useProxy: boolean;
proxyConfig?: ProxyConfig;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L129-L134
|
679472c66fd66582fe258d6d42529b7714708ec7
|
github
|
|
azhuge233/ASFShortcut-HN.git
|
d1669c920c56317611b5b0375aa5315c1b91211b
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
resultPopup
|
执行指令后,显示结果的对话框
|
private resultPopup(commandNickname: string, message: string) {
this.pageStack.pushPath({
name: "SelectableDialog",
param: [commandNickname, message],
onPop: (popInfo) => {
CommonUtils.returnFromSubPage(popInfo);
}
});
}
|
AST#method_declaration#Left private resultPopup AST#parameter_list#Left ( AST#parameter#Left commandNickname : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 . pageStack AST#member_expression#Right AST#expression#Right . pushPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "SelectableDialog" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left param AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left commandNickname AST#expression#Right , AST#expression#Left message AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onPop AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left popInfo 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 CommonUtils AST#expression#Right . returnFromSubPage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left popInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private resultPopup(commandNickname: string, message: string) {
this.pageStack.pushPath({
name: "SelectableDialog",
param: [commandNickname, message],
onPop: (popInfo) => {
CommonUtils.returnFromSubPage(popInfo);
}
});
}
|
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L130-L138
|
8cea3728528fd2baeabc4bd910a0599ff44617a3
|
github
|
Active-hue/ArkTS-Accounting.git
|
c432916d305b407557f08e35017c3fd70668e441
|
entry/src/main/ets/common/BillData.ets
|
arkts
|
deleteBill
|
Delete bill by ID
|
static async deleteBill(billId: string): Promise<boolean> {
try {
console.info('BillDataManager: 开始删除账单, ID:', billId);
const bills = await BillDataManager.getAllBills();
const newBills = bills.filter(bill => bill.id !== billId);
if (newBills.length === bills.length) {
console.warn('BillDataManager: 未找到要删除的账单');
return false;
}
const jsonData = JSON.stringify(newBills);
AppStorage.SetOrCreate(BillDataManager.STORAGE_KEY, jsonData);
console.info('BillDataManager: 账单删除成功,剩余数量:', newBills.length);
return true;
} catch (err) {
console.error('删除账单失败:', err);
return false;
}
}
|
AST#method_declaration#Left static async deleteBill AST#parameter_list#Left ( AST#parameter#Left billId : 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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 'BillDataManager: 开始删除账单, ID:' AST#expression#Right , AST#expression#Left billId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left bills = 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 BillDataManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getAllBills 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 newBills = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bills AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left bill => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . id AST#member_expression#Right AST#expression#Right !== AST#expression#Left billId AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newBills AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left bills 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'BillDataManager: 未找到要删除的账单' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left jsonData = 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 newBills 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 AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left BillDataManager AST#expression#Right . STORAGE_KEY AST#member_expression#Right AST#expression#Right , AST#expression#Left jsonData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'BillDataManager: 账单删除成功,剩余数量:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left newBills AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '删除账单失败:' AST#expression#Right , 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#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async deleteBill(billId: string): Promise<boolean> {
try {
console.info('BillDataManager: 开始删除账单, ID:', billId);
const bills = await BillDataManager.getAllBills();
const newBills = bills.filter(bill => bill.id !== billId);
if (newBills.length === bills.length) {
console.warn('BillDataManager: 未找到要删除的账单');
return false;
}
const jsonData = JSON.stringify(newBills);
AppStorage.SetOrCreate(BillDataManager.STORAGE_KEY, jsonData);
console.info('BillDataManager: 账单删除成功,剩余数量:', newBills.length);
return true;
} catch (err) {
console.error('删除账单失败:', err);
return false;
}
}
|
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/BillData.ets#L58-L77
|
e090646b30c21ccd414eddf3096cc9210f6ae06c
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/Index_backup.ets
|
arkts
|
initializePage
|
初始化页面数据
|
private async initializePage(): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Index initializePage - starting');
console.log('[Index] Starting page initialization');
// 加载生日数据
await this.loadBirthdayData();
console.log('[Index] Birthday data loaded');
// 更新统计数据
await this.updateBirthdayStats();
console.log('[Index] Birthday stats updated');
// 加载通知设置
await this.loadNotificationSettings();
console.log('[Index] Notification settings loaded');
// 检查通知权限状态
await this.checkInitialNotificationPermission();
console.log('[Index] Notification permission checked');
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Index initializePage - completed');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize page: ${error}`);
console.error('[Index] Initialization failed:', error);
}
}
|
AST#method_declaration#Left private async initializePage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 'Index initializePage - starting' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[Index] Starting page initialization' AST#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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . loadBirthdayData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[Index] Birthday data loaded' AST#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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . updateBirthdayStats AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[Index] Birthday stats updated' AST#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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . loadNotificationSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[Index] Notification settings loaded' AST#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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . checkInitialNotificationPermission AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[Index] Notification permission checked' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . 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 'Index initializePage - completed' AST#expression#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 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 initialize page: 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#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 '[Index] Initialization failed:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async initializePage(): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Index initializePage - starting');
console.log('[Index] Starting page initialization');
await this.loadBirthdayData();
console.log('[Index] Birthday data loaded');
await this.updateBirthdayStats();
console.log('[Index] Birthday stats updated');
await this.loadNotificationSettings();
console.log('[Index] Notification settings loaded');
await this.checkInitialNotificationPermission();
console.log('[Index] Notification permission checked');
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Index initializePage - completed');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize page: ${error}`);
console.error('[Index] Initialization failed:', error);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L176-L202
|
7bbbc992130f162aa149e7f2af471d8297fe5cb4
|
github
|
openharmony-sig/knowledge_demo_smart_home
|
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
|
FA/DistScheduleEts/entry/src/main/ets/default/common/components/myComponent.ets
|
arkts
|
MyComponent
|
首页 “我的”tab子页面
|
@Component
export struct MyComponent {
private familyName: string = "xTeam"
@Prop userName: string
@Prop userPhone: string
@Prop userId: string
/**
* 列表项
*/
@Builder MyComponentItem(itemImage:Resource, itemName:Resource) {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Image(itemImage).width(24).height(24).margin({ right: 10 })
Text(itemName).fontSize(12).flexGrow(1)
Image($r("app.media.icon_main_right")).width(16).height(16).objectFit(ImageFit.Contain)
}.height(60)
}
build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Start }) {
// 头部header,跳转注销页面
Flex({ direction: FlexDirection.Row }) {
Row() {
Image($r("app.media.icon_touxiang_papa")).width(48).height(48)
Column() {
Text(this.userName).fontSize(14)
Text($r("app.string.totalDevice", "1")).fontSize(12).fontColor('#606162')
}.margin({ left: 10 })
}.flexGrow(1)
Row() {
Image($r("app.media.icon_qr_code")).width(16).height(16).margin({ right: 5 }).objectFit(ImageFit.Contain)
Image($r("app.media.icon_main_right")).width(16).height(16).objectFit(ImageFit.Contain)
}.onClick(() => {
router.push({
uri: 'pages/personDetail',
})
})
}.width('100%').height(60)
// 我的家庭
Flex({ direction: FlexDirection.Column }) {
Text($r("app.string.myFamily", "1")).fontSize(14).height(30)
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text(this.familyName).fontSize(12).flexGrow(1)
Image($r("app.media.icon_main_right")).width(16).height(16).objectFit(ImageFit.Contain)
}
.width('100%')
.height(90)
.backgroundColor(Color.White)
.padding({ left: 8, right: 8 })
.margin({ top: 10 })
.borderRadius(10)
}.margin({ top: 20 }).height(120)
// 生活服务
Flex({ direction: FlexDirection.Column }) {
Text($r("app.string.lifeService")).fontSize(14).height(30)
Flex({ direction: FlexDirection.Column }) {
this.MyComponentItem($r("app.media.icon_myzhangben"), $r("app.string.myAccountBook"))
}
.width('100%')
.height(60)
.backgroundColor(Color.White)
.padding({ left: 8, right: 8 })
.margin({ top: 10 })
.borderRadius(10)
}.margin({ top: 20 }).height(110)
// 监控出行
Flex({ direction: FlexDirection.Column }) {
Text($r("app.string.healthTrip")).fontSize(14).height(30)
Flex({ direction: FlexDirection.Column }) {
this.MyComponentItem($r("app.media.icon_mybus"), $r("app.string.myBusCard"))
this.MyComponentItem($r("app.media.icon_my_health_code"), $r("app.string.myQrCode"))
this.MyComponentItem($r("app.media.icon_mycar"), $r("app.string.myCar"))
}
.width('100%')
.height(180)
.backgroundColor(Color.White)
.padding({ left: 8, right: 8 })
.margin({ top: 10 })
.borderRadius(10)
}.margin({ top: 20 }).height(210)
}
.width('100%').height('100%')
.padding({ left: 16, right: 16, top: 30 }).backgroundColor($r("app.color.background_grey"))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyComponent AST#component_body#Left { AST#property_declaration#Left private familyName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "xTeam" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right userName : 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 userPhone : 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 userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right /**
* 列表项
*/ AST#property_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right MyComponentItem AST#parameter_list#Left ( AST#parameter#Left itemImage : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left itemName : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Row AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left itemImage AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left itemName 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 . flexGrow ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_main_right" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 头部header,跳转注销页面 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Row 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 Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_touxiang_papa" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userName 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#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.totalDevice" AST#expression#Right , AST#expression#Left "1" AST#expression#Right ) AST#resource_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 '#606162' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 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 . flexGrow ( AST#expression#Left 1 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_qr_code" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_main_right" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left 'pages/personDetail' AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#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 60 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 Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_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.myFamily" AST#expression#Right , AST#expression#Left "1" 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 . height ( AST#expression#Left 30 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 Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Row AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . familyName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . flexGrow ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_main_right" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 90 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 120 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 Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_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.lifeService" 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 . height ( AST#expression#Left 30 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 Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . MyComponentItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_myzhangben" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.myAccountBook" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#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 60 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 110 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 Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_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.healthTrip" 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 . height ( AST#expression#Left 30 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 Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . MyComponentItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_mybus" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.myBusCard" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . MyComponentItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_my_health_code" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.myQrCode" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . MyComponentItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.icon_mycar" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.myCar" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#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 180 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 210 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 30 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.background_grey" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct MyComponent {
private familyName: string = "xTeam"
@Prop userName: string
@Prop userPhone: string
@Prop userId: string
@Builder MyComponentItem(itemImage:Resource, itemName:Resource) {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Image(itemImage).width(24).height(24).margin({ right: 10 })
Text(itemName).fontSize(12).flexGrow(1)
Image($r("app.media.icon_main_right")).width(16).height(16).objectFit(ImageFit.Contain)
}.height(60)
}
build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Start }) {
Flex({ direction: FlexDirection.Row }) {
Row() {
Image($r("app.media.icon_touxiang_papa")).width(48).height(48)
Column() {
Text(this.userName).fontSize(14)
Text($r("app.string.totalDevice", "1")).fontSize(12).fontColor('#606162')
}.margin({ left: 10 })
}.flexGrow(1)
Row() {
Image($r("app.media.icon_qr_code")).width(16).height(16).margin({ right: 5 }).objectFit(ImageFit.Contain)
Image($r("app.media.icon_main_right")).width(16).height(16).objectFit(ImageFit.Contain)
}.onClick(() => {
router.push({
uri: 'pages/personDetail',
})
})
}.width('100%').height(60)
Flex({ direction: FlexDirection.Column }) {
Text($r("app.string.myFamily", "1")).fontSize(14).height(30)
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text(this.familyName).fontSize(12).flexGrow(1)
Image($r("app.media.icon_main_right")).width(16).height(16).objectFit(ImageFit.Contain)
}
.width('100%')
.height(90)
.backgroundColor(Color.White)
.padding({ left: 8, right: 8 })
.margin({ top: 10 })
.borderRadius(10)
}.margin({ top: 20 }).height(120)
Flex({ direction: FlexDirection.Column }) {
Text($r("app.string.lifeService")).fontSize(14).height(30)
Flex({ direction: FlexDirection.Column }) {
this.MyComponentItem($r("app.media.icon_myzhangben"), $r("app.string.myAccountBook"))
}
.width('100%')
.height(60)
.backgroundColor(Color.White)
.padding({ left: 8, right: 8 })
.margin({ top: 10 })
.borderRadius(10)
}.margin({ top: 20 }).height(110)
Flex({ direction: FlexDirection.Column }) {
Text($r("app.string.healthTrip")).fontSize(14).height(30)
Flex({ direction: FlexDirection.Column }) {
this.MyComponentItem($r("app.media.icon_mybus"), $r("app.string.myBusCard"))
this.MyComponentItem($r("app.media.icon_my_health_code"), $r("app.string.myQrCode"))
this.MyComponentItem($r("app.media.icon_mycar"), $r("app.string.myCar"))
}
.width('100%')
.height(180)
.backgroundColor(Color.White)
.padding({ left: 8, right: 8 })
.margin({ top: 10 })
.borderRadius(10)
}.margin({ top: 20 }).height(210)
}
.width('100%').height('100%')
.padding({ left: 16, right: 16, top: 30 }).backgroundColor($r("app.color.background_grey"))
}
}
|
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/default/common/components/myComponent.ets#L20-L107
|
9677cf0c9a2abb16fa4c7e1518f33df973e63363
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_core/src/main/ets/core/util/ObjectUtil.ets
|
arkts
|
@Author csx
@DateTime 2023/12/29 20:07
@TODO ObjectUtil 对象工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_core
|
export class ObjectUtil {
/**
* 判断两个传入的数值或者是字符串是否相等
* @param source
* @param target
* @returns
*/
static equal(source: string | number, target: string | number): boolean {
return source === target;
}
/**
* 判断两个传入的数值或者是字符串是否不相等
* @param source
* @param target
* @returns
*/
static notEqual(source: string | number, target: string | number): boolean {
return false == ObjectUtil.equal(source, target);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ObjectUtil AST#class_body#Left { /**
* 判断两个传入的数值或者是字符串是否相等
* @param source
* @param target
* @returns
*/ AST#method_declaration#Left static equal AST#parameter_list#Left ( AST#parameter#Left source : 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#parameter#Right , AST#parameter#Left target : 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#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left source AST#expression#Right === AST#expression#Left target AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 判断两个传入的数值或者是字符串是否不相等
* @param source
* @param target
* @returns
*/ AST#method_declaration#Left static notEqual AST#parameter_list#Left ( AST#parameter#Left source : 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#parameter#Right , AST#parameter#Left target : 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#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#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right == AST#expression#Left ObjectUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . equal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left source AST#expression#Right , AST#expression#Left target 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 ObjectUtil {
static equal(source: string | number, target: string | number): boolean {
return source === target;
}
static notEqual(source: string | number, target: string | number): boolean {
return false == ObjectUtil.equal(source, target);
}
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/ObjectUtil.ets#L23-L43
|
c7e99bcb006f1bb54f6030eebaed283434f3a244
|
gitee
|
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
Q2/DxinTranslate/entry/src/main/ets/fun/getData.ets
|
arkts
|
向外暴露一个函数:给我一个英文标记。返回给你一个对应中文名称
|
export function getLangaugeText(lang: string): string {
// todo: 从 src/main/ets/common/Constants.ets数组中查
let obj: Language = Constants.languageItem.find((item: Language) => item.lang === lang)
return obj.chinese
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getLangaugeText AST#parameter_list#Left ( AST#parameter#Left lang : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // todo: 从 src/main/ets/common/Constants.ets数组中查 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left obj : AST#type_annotation#Left AST#primary_type#Left Language 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 Constants AST#expression#Right . languageItem AST#member_expression#Right AST#expression#Right . find 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 Language AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . lang AST#member_expression#Right AST#expression#Right === AST#expression#Left lang AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left obj AST#expression#Right . chinese AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function getLangaugeText(lang: string): string {
let obj: Language = Constants.languageItem.find((item: Language) => item.lang === lang)
return obj.chinese
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q2/DxinTranslate/entry/src/main/ets/fun/getData.ets#L6-L10
|
ff9a0396bffa2bf3e9975cf864bcb8fca1b9e63e
|
gitee
|
|
zhangyuhang0914/ArkTs-HarmonyOs.git
|
c9773cad7ebeee413f98ee1a57cc8fba91fecf7d
|
entry/src/main/ets/viewmodel/TabViewModel.ets
|
arkts
|
let tabViewModel = new TabViewModel() export default tabViewModel as TabViewModel
|
export default TabViewModel
|
AST#export_declaration#Left export default AST#expression#Left TabViewModel AST#expression#Right AST#export_declaration#Right
|
export default TabViewModel
|
https://github.com/zhangyuhang0914/ArkTs-HarmonyOs.git/blob/c9773cad7ebeee413f98ee1a57cc8fba91fecf7d/entry/src/main/ets/viewmodel/TabViewModel.ets#L58-L58
|
12e147bd4709bf3955f0b640cf7020002ed50a9c
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets
|
arkts
|
buildGreetingHistoryItem
|
构建祝福历史项
|
@Builder
buildGreetingHistoryItem(history: GreetingHistory) {
Column({ space: 4 }) {
Row() {
Text(history.occasion)
.fontSize(12)
.fontColor('#666666')
Blank()
Text(DateUtils.getRelativeTime(history.createdAt))
.fontSize(12)
.fontColor('#999999')
}
.width('100%')
Text(history.content)
.fontSize(14)
.fontColor('#333333')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('100%')
}
.width('100%')
.padding(12)
.backgroundColor('#f8f9fa')
.borderRadius(8)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingHistoryItem AST#parameter_list#Left ( AST#parameter#Left history : AST#type_annotation#Left AST#primary_type#Left GreetingHistory 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 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 history AST#expression#Right . occasion AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtils AST#expression#Right . getRelativeTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left history AST#expression#Right . createdAt AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999999' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left history AST#expression#Right . content 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 . fontColor ( AST#expression#Left '#333333' 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#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 '#f8f9fa' 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
buildGreetingHistoryItem(history: GreetingHistory) {
Column({ space: 4 }) {
Row() {
Text(history.occasion)
.fontSize(12)
.fontColor('#666666')
Blank()
Text(DateUtils.getRelativeTime(history.createdAt))
.fontSize(12)
.fontColor('#999999')
}
.width('100%')
Text(history.content)
.fontSize(14)
.fontColor('#333333')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('100%')
}
.width('100%')
.padding(12)
.backgroundColor('#f8f9fa')
.borderRadius(8)
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L530-L557
|
b621f4061a18996b49f58f094fe536d683462e50
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets
|
arkts
|
getBackgroundColor
|
获取日期背景色(仅用于月视图和周视图)
@param day 日期信息
@param currentSelectDay 当前选择的日期
@param calendarStyle 自定义日历样式
@returns 返回颜色
|
static getBackgroundColor(day: Day, currentSelectDay: DayInfo,
calendarStyle: CalendarStyle): Color | number | string | Resource {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month &&
currentSelectDay.date === day.dayInfo.date;
const IS_TODAY: boolean =
day.dayInfo.year === Constants.TODAY_YEAR && day.dayInfo.month === Constants.TODAY_MONTH &&
day.dayInfo.date === Constants.TODAY;
if (IS_TODAY && IS_SELECT_DAY) {
return calendarStyle.backgroundColor ? calendarStyle.backgroundColor : Color.Red;
} else {
return Color.Transparent;
}
}
|
AST#method_declaration#Left static getBackgroundColor 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#Left currentSelectDay : AST#type_annotation#Left AST#primary_type#Left DayInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left calendarStyle : AST#type_annotation#Left AST#primary_type#Left CalendarStyle AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Color AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left IS_SELECT_DAY : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#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 currentSelectDay AST#expression#Right . year AST#member_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 . year AST#member_expression#Right AST#expression#Right && AST#expression#Left currentSelectDay AST#expression#Right AST#binary_expression#Right AST#expression#Right . month AST#member_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 currentSelectDay AST#expression#Right AST#binary_expression#Right AST#expression#Right . date AST#member_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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left IS_TODAY : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#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#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 Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . TODAY_YEAR AST#member_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 Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . TODAY_MONTH AST#member_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#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . TODAY 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 IS_TODAY AST#expression#Right && AST#expression#Left IS_SELECT_DAY AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left calendarStyle AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left calendarStyle AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getBackgroundColor(day: Day, currentSelectDay: DayInfo,
calendarStyle: CalendarStyle): Color | number | string | Resource {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month &&
currentSelectDay.date === day.dayInfo.date;
const IS_TODAY: boolean =
day.dayInfo.year === Constants.TODAY_YEAR && day.dayInfo.month === Constants.TODAY_MONTH &&
day.dayInfo.date === Constants.TODAY;
if (IS_TODAY && IS_SELECT_DAY) {
return calendarStyle.backgroundColor ? calendarStyle.backgroundColor : Color.Red;
} else {
return Color.Transparent;
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets#L89-L102
|
bdaf13c5ccba14af95fa0ca4a9cc06da1403f8ac
|
gitee
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/modules/auth/AuthService.ets
|
arkts
|
getCurrentUser
|
获取当前用户
|
getCurrentUser(): UserInfo | null {
return this.currentUser;
}
|
AST#method_declaration#Left getCurrentUser AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left UserInfo AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentUser AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getCurrentUser(): UserInfo | null {
return this.currentUser;
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L196-L198
|
d5a42966e7634aa5709c2203f7c01614c5833c00
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/services/analytics/AnalyticsService.ets
|
arkts
|
getGreetingStats
|
获取祝福语统计
|
async getGreetingStats(): Promise<GreetingStats> {
const greetings = await this.greetingService.searchGreetings({ pageSize: 10000 });
const totalGenerated = greetings.length;
const totalUsed = greetings.reduce((sum, g) => sum + g.usageCount, 0);
const averageRating = greetings.length > 0
? greetings.reduce((sum, g) => sum + g.rating, 0) / greetings.length
: 0;
// 热门样式统计
const styleMap = new Map<string, number>();
greetings.forEach(g => {
if (g.style) {
styleMap.set(g.style, (styleMap.get(g.style) || 0) + 1);
}
});
const popularStyles = Array.from(styleMap.entries())
.map(([style, count]) => ({
style,
count,
percentage: Math.round((count / greetings.length) * 100)
}))
.sort((a, b) => b.count - a.count)
.slice(0, 5);
// 热门场合统计
const occasionMap = new Map<string, number>();
greetings.forEach(g => {
if (g.occasion) {
occasionMap.set(g.occasion, (occasionMap.get(g.occasion) || 0) + 1);
}
});
const popularOccasions = Array.from(occasionMap.entries())
.map(([occasion, count]) => ({
occasion,
count,
percentage: Math.round((count / greetings.length) * 100)
}))
.sort((a, b) => b.count - a.count)
.slice(0, 5);
// 最近活动(按天统计)
const recentActivity = this.calculateRecentActivity(greetings, 7);
// 评分最高的祝福语
const topRatedGreetings = [...greetings]
.sort((a, b) => b.rating - a.rating)
.slice(0, 5);
// 使用最多的祝福语
const mostUsedGreetings = [...greetings]
.sort((a, b) => b.usageCount - a.usageCount)
.slice(0, 5);
return {
totalGenerated,
totalUsed,
averageRating: Math.round(averageRating * 10) / 10,
popularStyles,
popularOccasions,
recentActivity,
topRatedGreetings,
mostUsedGreetings
};
}
|
AST#method_declaration#Left async getGreetingStats 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 GreetingStats 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 greetings = 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 . greetingService AST#member_expression#Right AST#expression#Right . searchGreetings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left pageSize AST#property_name#Right : AST#expression#Left 10000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left totalGenerated = AST#expression#Left AST#member_expression#Left AST#expression#Left greetings 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 totalUsed = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left greetings 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#parameter#Right , AST#parameter#Left g AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sum AST#expression#Right + AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right . usageCount AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left averageRating = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left greetings AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 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 greetings 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#parameter#Right , AST#parameter#Left g AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sum AST#expression#Right + AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right . rating AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left greetings 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#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 热门样式统计 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left styleMap = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left greetings AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left g => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left g AST#expression#Right . style 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 styleMap 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 g AST#expression#Right . style AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left styleMap 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 g AST#expression#Right . style AST#member_expression#Right 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#parenthesized_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left popularStyles = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Array AST#expression#Right . from 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 styleMap AST#expression#Right . entries 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 . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left style AST#expression#Right , AST#expression#Left count AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#ERROR#Left => AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left style AST#property_assignment#Right , AST#property_assignment#Left count AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right / AST#expression#Left greetings AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . count AST#member_expression#Right AST#expression#Right - AST#expression#Left a AST#expression#Right AST#binary_expression#Right AST#expression#Right . count 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 . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 5 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 occasionMap = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left greetings AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left g => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left g AST#expression#Right . occasion 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 occasionMap 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 g AST#expression#Right . occasion AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left occasionMap 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 g AST#expression#Right . occasion AST#member_expression#Right 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#parenthesized_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left popularOccasions = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Array AST#expression#Right . from 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 occasionMap AST#expression#Right . entries 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 . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left occasion AST#expression#Right , AST#expression#Left count AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#ERROR#Left => AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left occasion AST#property_assignment#Right , AST#property_assignment#Left count AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right / AST#expression#Left greetings AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . count AST#member_expression#Right AST#expression#Right - AST#expression#Left a AST#expression#Right AST#binary_expression#Right AST#expression#Right . count 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 . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 5 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 recentActivity = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateRecentActivity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left greetings AST#expression#Right , AST#expression#Left 7 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 topRatedGreetings = 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#array_literal#Left [ ... AST#expression#Left greetings AST#expression#Right ] AST#array_literal#Right AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . rating AST#member_expression#Right AST#expression#Right - AST#expression#Left a AST#expression#Right AST#binary_expression#Right AST#expression#Right . rating 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 . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 5 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 mostUsedGreetings = 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#array_literal#Left [ ... AST#expression#Left greetings AST#expression#Right ] AST#array_literal#Right AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . usageCount AST#member_expression#Right AST#expression#Right - AST#expression#Left a AST#expression#Right AST#binary_expression#Right AST#expression#Right . usageCount 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 . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left totalGenerated AST#property_assignment#Right , AST#property_assignment#Left totalUsed AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left averageRating AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left averageRating AST#expression#Right * AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left popularStyles AST#property_assignment#Right , AST#property_assignment#Left popularOccasions AST#property_assignment#Right , AST#property_assignment#Left recentActivity AST#property_assignment#Right , AST#property_assignment#Left topRatedGreetings AST#property_assignment#Right , AST#property_assignment#Left mostUsedGreetings AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getGreetingStats(): Promise<GreetingStats> {
const greetings = await this.greetingService.searchGreetings({ pageSize: 10000 });
const totalGenerated = greetings.length;
const totalUsed = greetings.reduce((sum, g) => sum + g.usageCount, 0);
const averageRating = greetings.length > 0
? greetings.reduce((sum, g) => sum + g.rating, 0) / greetings.length
: 0;
const styleMap = new Map<string, number>();
greetings.forEach(g => {
if (g.style) {
styleMap.set(g.style, (styleMap.get(g.style) || 0) + 1);
}
});
const popularStyles = Array.from(styleMap.entries())
.map(([style, count]) => ({
style,
count,
percentage: Math.round((count / greetings.length) * 100)
}))
.sort((a, b) => b.count - a.count)
.slice(0, 5);
const occasionMap = new Map<string, number>();
greetings.forEach(g => {
if (g.occasion) {
occasionMap.set(g.occasion, (occasionMap.get(g.occasion) || 0) + 1);
}
});
const popularOccasions = Array.from(occasionMap.entries())
.map(([occasion, count]) => ({
occasion,
count,
percentage: Math.round((count / greetings.length) * 100)
}))
.sort((a, b) => b.count - a.count)
.slice(0, 5);
const recentActivity = this.calculateRecentActivity(greetings, 7);
const topRatedGreetings = [...greetings]
.sort((a, b) => b.rating - a.rating)
.slice(0, 5);
const mostUsedGreetings = [...greetings]
.sort((a, b) => b.usageCount - a.usageCount)
.slice(0, 5);
return {
totalGenerated,
totalUsed,
averageRating: Math.round(averageRating * 10) / 10,
popularStyles,
popularOccasions,
recentActivity,
topRatedGreetings,
mostUsedGreetings
};
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/analytics/AnalyticsService.ets#L278-L344
|
77ca6cd1f7ce95fe58c787b6ccedd8579d1076d1
|
github
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/components/player/VHWarmPlayerView.ets
|
arkts
|
onVideoFrameSize
|
视频流播放成功后,回调视频流的宽髙。用户可根据视频流实际宽高,调整播放容器大小。
@param width 视频帧宽度
@param height 视频帧高度
|
onVideoFrameSize(width: number, height: number){
}
|
AST#method_declaration#Left onVideoFrameSize 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#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
|
onVideoFrameSize(width: number, height: number){
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWarmPlayerView.ets#L222-L224
|
f7913604c09d7b6392e63f03544434eef9e2df50
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/builder/PlayerSettingBuilder.ets
|
arkts
|
sectionStyle
|
section的样式
|
@Styles
sectionStyle() {
.width('100%')
.backgroundColor(Color.White)
.borderRadius(4)
.padding({
left: 4,
right:4
})
}
|
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right sectionStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 4 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#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#method_declaration#Right
|
@Styles
sectionStyle() {
.width('100%')
.backgroundColor(Color.White)
.borderRadius(4)
.padding({
left: 4,
right:4
})
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/PlayerSettingBuilder.ets#L121-L130
|
2782b9ead9209207541f4be35a27995bd8d9ebca
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
完整农历系统设计.ets
|
arkts
|
isYearSupported
|
验证年份是否支持
|
public static isYearSupported(year: number): boolean {
return AuthorityLunarDatabase.lunarYears.has(year);
}
|
AST#method_declaration#Left public static isYearSupported AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AuthorityLunarDatabase AST#expression#Right . lunarYears AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year 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 isYearSupported(year: number): boolean {
return AuthorityLunarDatabase.lunarYears.has(year);
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L234-L236
|
782b978b1c99bccb2fc41a2961b430db6b9d0dcf
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/Notification/CustomNotificationPush/entry/src/main/ets/feature/NotificationFilterUtil.ets
|
arkts
|
setNotificationEnableFilter
|
使能和去使能通知过滤功能
|
setNotificationEnableFilter(enable: boolean) {
if (enable) {
try {
notification.on("checkNotification", this.OnCheckNotification);
this.disableContentTypes.fill(false);
} catch (error) {
logger.error(`notificationManager.on error: ${JSON.stringify(error as Base.BusinessError)}`);
}
logger.info("notificationFilter enable success");
}
else {
try {
notification.off("checkNotification");
} catch (error) {
logger.error(`notificationManager.off error: ${JSON.stringify(error as Base.BusinessError)}`);
}
logger.info("notificationFilter disable success");
}
}
|
AST#method_declaration#Left setNotificationEnableFilter AST#parameter_list#Left ( AST#parameter#Left enable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left enable AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "checkNotification" AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . OnCheckNotification AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . disableContentTypes AST#member_expression#Right AST#expression#Right . fill 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 AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` notificationManager.on error: 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#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Base . BusinessError AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "notificationFilter enable 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 else 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 notification AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "checkNotification" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` notificationManager.off error: 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#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Base . BusinessError AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "notificationFilter disable 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
setNotificationEnableFilter(enable: boolean) {
if (enable) {
try {
notification.on("checkNotification", this.OnCheckNotification);
this.disableContentTypes.fill(false);
} catch (error) {
logger.error(`notificationManager.on error: ${JSON.stringify(error as Base.BusinessError)}`);
}
logger.info("notificationFilter enable success");
}
else {
try {
notification.off("checkNotification");
} catch (error) {
logger.error(`notificationManager.off error: ${JSON.stringify(error as Base.BusinessError)}`);
}
logger.info("notificationFilter disable success");
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Notification/CustomNotificationPush/entry/src/main/ets/feature/NotificationFilterUtil.ets#L46-L64
|
891114fba09a7768830488c97eb12f244296a016
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
|
arkts
|
digest
|
摘要
@param str 带摘要的字符串
@param symAlgName 秘钥规格
@param resultCoding 返回结果编码方式(hex/base64)
@returns 摘要后的字符串
|
static digest(str: string, symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<string> {
//摘要对象
let md = crypto.createMd(symAlgName);
//字符串转换的字节流对象
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200; // 默认以200字节为单位进行分段update
for (let i = 0; i < messageData.length; i += updateLength) {
let updateMessage = messageData.subarray(i, i + updateLength);
let updateMessageBlob: crypto.DataBlob = { data: updateMessage };
md.updateSync(updateMessageBlob);
}
let mdOutput = md.digestSync();
return OutDTO.OKByDataRow<string>(symAlgName + '摘要数据成功!',
StrAndUintUtil.unitArray2StrCoding(mdOutput.data, resultCoding));
}
|
AST#method_declaration#Left static digest AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //摘要对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left md = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createMd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symAlgName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //字符串转换的字节流对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left messageData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left 'utf-8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateLength = AST#expression#Left 200 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 默认以200字节为单位进行分段update AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left messageData AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left updateLength AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messageData AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left updateLength AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessageBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateMessage AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left md AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateMessageBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mdOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left md AST#expression#Right . digestSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . OKByDataRow AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left symAlgName AST#expression#Right + AST#expression#Left '摘要数据成功!' 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 StrAndUintUtil AST#expression#Right . unitArray2StrCoding AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left mdOutput AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 digest(str: string, symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<string> {
let md = crypto.createMd(symAlgName);
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200;
for (let i = 0; i < messageData.length; i += updateLength) {
let updateMessage = messageData.subarray(i, i + updateLength);
let updateMessageBlob: crypto.DataBlob = { data: updateMessage };
md.updateSync(updateMessageBlob);
}
let mdOutput = md.digestSync();
return OutDTO.OKByDataRow<string>(symAlgName + '摘要数据成功!',
StrAndUintUtil.unitArray2StrCoding(mdOutput.data, resultCoding));
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L487-L501
|
9de20c06728e28e71ba197809f2811a37598130e
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/component/Row.ets
|
arkts
|
渲染布局
@returns {void} 无返回值
@example
RowSpaceEvenlyCenter() { Text("A"); Text("B"); Text("C"); }
|
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: VerticalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceEvenly AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right
|
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: VerticalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L604-L619
|
34cd500a99197e43672aabfc317b4fefccf584fc
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
buildCalendarHeader
|
日历头部 - 月份导航
|
@Builder
buildCalendarHeader() {
Column({ space: 16 }) {
// 月份选择器
Row() {
// 上个月按钮
Row() {
Text('◀')
.fontSize(16)
.fontColor(this.COLORS.primary)
}
.padding(8)
.backgroundColor(this.COLORS.primaryLight)
.borderRadius(8)
.onClick(() => {
this.currentMonth--;
if (this.currentMonth < 1) {
this.currentMonth = 12;
this.currentYear--;
}
})
// 当前月份年份显示
Text(`${this.currentYear}年${this.currentMonth}月`)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
.textAlign(TextAlign.Center)
// 下个月按钮
Row() {
Text('▶')
.fontSize(16)
.fontColor(this.COLORS.primary)
}
.padding(8)
.backgroundColor(this.COLORS.primaryLight)
.borderRadius(8)
.onClick(() => {
this.currentMonth++;
if (this.currentMonth > 12) {
this.currentMonth = 1;
this.currentYear++;
}
})
}
.width('100%')
// 快捷按钮
Row({ space: 8 }) {
Text('今天')
.fontSize(12)
.fontColor(this.COLORS.primary)
.padding({ left: 12, right: 12, top: 6, bottom: 6 })
.backgroundColor(this.COLORS.primaryLight)
.borderRadius(12)
.onClick(() => {
const today = new Date();
this.currentMonth = today.getMonth() + 1;
this.currentYear = today.getFullYear();
})
Text('本月生日')
.fontSize(12)
.fontColor(this.COLORS.redPrimary)
.padding({ left: 12, right: 12, top: 6, bottom: 6 })
.backgroundColor('#FEF2F2')
.borderRadius(12)
.onClick(() => {
promptAction.showToast({
message: `本月共有 ${this.birthdayStats.thisMonth} 人生日`,
duration: 2000
});
})
}
.width('100%')
.justifyContent(FlexAlign.Center)
}
.width('100%')
.padding(20)
.backgroundColor(this.COLORS.whitePrimary)
.borderRadius(16)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.08)',
offsetX: 0,
offsetY: 2
})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCalendarHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 月份选择器 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 上个月按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '◀' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primaryLight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 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#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right -- AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right < AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right = AST#expression#Left 12 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#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentYear AST#member_expression#Right AST#expression#Right -- AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 当前月份年份显示 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentYear AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 年 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 月 ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . textPrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primaryLight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 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#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right > AST#expression#Left 12 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 . currentMonth AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentYear AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '今天' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 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#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primaryLight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_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 today 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#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 . currentYear AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left today 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#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#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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . redPrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 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#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FEF2F2' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 本月共有 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayStats AST#member_expression#Right AST#expression#Right . thisMonth AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 人生日 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 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#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 . 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . whitePrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.08)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildCalendarHeader() {
Column({ space: 16 }) {
Row() {
Row() {
Text('◀')
.fontSize(16)
.fontColor(this.COLORS.primary)
}
.padding(8)
.backgroundColor(this.COLORS.primaryLight)
.borderRadius(8)
.onClick(() => {
this.currentMonth--;
if (this.currentMonth < 1) {
this.currentMonth = 12;
this.currentYear--;
}
})
Text(`${this.currentYear}年${this.currentMonth}月`)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
.textAlign(TextAlign.Center)
Row() {
Text('▶')
.fontSize(16)
.fontColor(this.COLORS.primary)
}
.padding(8)
.backgroundColor(this.COLORS.primaryLight)
.borderRadius(8)
.onClick(() => {
this.currentMonth++;
if (this.currentMonth > 12) {
this.currentMonth = 1;
this.currentYear++;
}
})
}
.width('100%')
Row({ space: 8 }) {
Text('今天')
.fontSize(12)
.fontColor(this.COLORS.primary)
.padding({ left: 12, right: 12, top: 6, bottom: 6 })
.backgroundColor(this.COLORS.primaryLight)
.borderRadius(12)
.onClick(() => {
const today = new Date();
this.currentMonth = today.getMonth() + 1;
this.currentYear = today.getFullYear();
})
Text('本月生日')
.fontSize(12)
.fontColor(this.COLORS.redPrimary)
.padding({ left: 12, right: 12, top: 6, bottom: 6 })
.backgroundColor('#FEF2F2')
.borderRadius(12)
.onClick(() => {
promptAction.showToast({
message: `本月共有 ${this.birthdayStats.thisMonth} 人生日`,
duration: 2000
});
})
}
.width('100%')
.justifyContent(FlexAlign.Center)
}
.width('100%')
.padding(20)
.backgroundColor(this.COLORS.whitePrimary)
.borderRadius(16)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.08)',
offsetX: 0,
offsetY: 2
})
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L2471-L2560
|
f387380dbc39a7d78fb14d8fc3bbf435ab4dbb08
|
github
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxMark.ets
|
arkts
|
CheckboxMarkBuilder
|
Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Builder
export function CheckboxMarkBuilder(name: string, param: Object) {
CheckboxMarkExample()
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CheckboxMarkBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left CheckboxMarkExample ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
|
@Builder
export function CheckboxMarkBuilder(name: string, param: Object) {
CheckboxMarkExample()
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxMark.ets#L16-L19
|
3cf31b930fe35557f8e03af9b2c705497bc4c474
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/services/storage/DatabaseService.ets
|
arkts
|
query
|
查询数据
@param tableName 表名
@param columns 查询列
@param whereClause 条件子句
@param whereArgs 条件参数
@param orderBy 排序
@param limit 限制条数
@param offset 偏移量
@returns 查询结果
|
async query(
tableName: string,
columns?: Array<string>,
whereClause?: string,
whereArgs?: Array<string>,
orderBy?: string,
limit?: number,
offset?: number
): Promise<Record<string, relationalStore.ValueType>[]> {
try {
this.checkInitialized();
const predicates = new relationalStore.RdbPredicates(tableName);
if (whereClause && whereArgs) {
predicates.sql(whereClause, whereArgs);
}
if (orderBy) {
const orderParts = orderBy.split(' ');
const column = orderParts[0];
const direction = orderParts[1];
if (direction && direction.toUpperCase() === 'DESC') {
predicates.orderByDesc(column);
} else {
predicates.orderByAsc(column);
}
}
if (limit !== undefined) {
predicates.limit(limit);
}
if (offset !== undefined) {
predicates.offset(offset);
}
const resultSet = await this.store!.query(predicates, columns);
const results: Record<string, relationalStore.ValueType>[] = [];
while (!resultSet.isAtLastRow) {
resultSet.goToNextRow();
const row: Record<string, relationalStore.ValueType> = {};
for (let i = 0; i < resultSet.columnCount; i++) {
const columnName = resultSet.getColumnName(i);
const columnType: relationalStore.ColumnType = resultSet.getColumnType(i);
switch (columnType) {
case relationalStore.ColumnType.TYPE_INTEGER:
row[columnName] = resultSet.getLong(i);
break;
case relationalStore.ColumnType.TYPE_REAL:
row[columnName] = resultSet.getDouble(i);
break;
case relationalStore.ColumnType.TYPE_STRING:
const stringValue = resultSet.getString(i);
// 尝试解析JSON字符串
if (stringValue && (stringValue.startsWith('{') || stringValue.startsWith('['))) {
try {
row[columnName] = JSON.parse(stringValue);
} catch {
row[columnName] = stringValue;
|
AST#method_declaration#Left async query AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left columns ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left whereClause ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left whereArgs ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left orderBy ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left limit ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offset ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#ERROR#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValueType 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#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right { try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialized AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const 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 tableName 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 whereClause AST#expression#Right && AST#expression#Left whereArgs 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 predicates AST#expression#Right . sql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left whereClause AST#expression#Right , AST#expression#Left whereArgs AST#expression#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 orderBy AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left orderParts = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left orderBy AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ' ' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left column = AST#expression#Left AST#subscript_expression#Left AST#expression#Left orderParts AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left direction = AST#expression#Left AST#subscript_expression#Left AST#expression#Left orderParts AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 direction AST#expression#Right && AST#expression#Left direction AST#expression#Right AST#binary_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#expression#Left 'DESC' 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 predicates AST#expression#Right . orderByDesc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left column AST#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 predicates AST#expression#Right . orderByAsc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left column AST#expression#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#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left limit AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . limit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left limit AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left offset AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . offset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offset AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resultSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . store AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_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 columns 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 results : AST#ERROR#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValueType 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#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#ERROR#Left while ( 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 resultSet AST#expression#Right AST#unary_expression#Right AST#expression#Right . isAtLastRow AST#member_expression#Right AST#expression#Right AST#ERROR#Left ) { 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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left row : 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 AST#qualified_type#Left relationalStore . ValueType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right for ( AST#ERROR#Left 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 resultSet AST#expression#Right AST#binary_expression#Right AST#expression#Right . columnCount AST#member_expression#Right AST#expression#Right AST#ERROR#Left ; AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right AST#ERROR#Left ) { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left columnName = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnName 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left columnType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ColumnType 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 resultSet AST#expression#Right . getColumnType 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#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 switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left columnType AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right { AST#property_name#Left case AST#property_name#Right relationalStore AST#ERROR#Right . ColumnType AST#member_expression#Right AST#expression#Right . TYPE_INTEGER AST#member_expression#Right AST#expression#Right AST#ERROR#Left : row AST#ERROR#Right [ AST#expression#Left columnName AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = resultSet AST#ERROR#Right . getLong 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 ; break ; AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left case AST#expression#Right AST#ERROR#Left relationalStore AST#ERROR#Right . ColumnType AST#member_expression#Right AST#expression#Right . TYPE_REAL AST#member_expression#Right AST#expression#Right AST#ERROR#Left : row AST#ERROR#Right [ AST#expression#Left columnName AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = resultSet AST#ERROR#Right . getDouble 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#Left break AST#expression#Right AST#ERROR#Right ; AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left case AST#expression#Right AST#ERROR#Left relationalStore AST#ERROR#Right . ColumnType AST#member_expression#Right AST#expression#Right . TYPE_STRING AST#member_expression#Right AST#expression#Right : AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left stringValue = 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 i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right // 尝试解析JSON字符串 AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left if AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left stringValue AST#expression#Right && AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stringValue AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '{' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left stringValue AST#expression#Right AST#binary_expression#Right AST#expression#Right . startsWith 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#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right { AST#property_name#Left try AST#property_name#Right AST#ERROR#Right { AST#ERROR#Left AST#property_name#Left row AST#property_name#Right AST#ERROR#Right AST#property_name#Left [ AST#expression#Left columnName AST#expression#Right ] AST#property_name#Right = JSON AST#ERROR#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left stringValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#ERROR#Right } AST#block_statement#Right catch { AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left columnName AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right = AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left stringValue AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
async query(
tableName: string,
columns?: Array<string>,
whereClause?: string,
whereArgs?: Array<string>,
orderBy?: string,
limit?: number,
offset?: number
): Promise<Record<string, relationalStore.ValueType>[]> {
try {
this.checkInitialized();
const predicates = new relationalStore.RdbPredicates(tableName);
if (whereClause && whereArgs) {
predicates.sql(whereClause, whereArgs);
}
if (orderBy) {
const orderParts = orderBy.split(' ');
const column = orderParts[0];
const direction = orderParts[1];
if (direction && direction.toUpperCase() === 'DESC') {
predicates.orderByDesc(column);
} else {
predicates.orderByAsc(column);
}
}
if (limit !== undefined) {
predicates.limit(limit);
}
if (offset !== undefined) {
predicates.offset(offset);
}
const resultSet = await this.store!.query(predicates, columns);
const results: Record<string, relationalStore.ValueType>[] = [];
while (!resultSet.isAtLastRow) {
resultSet.goToNextRow();
const row: Record<string, relationalStore.ValueType> = {};
for (let i = 0; i < resultSet.columnCount; i++) {
const columnName = resultSet.getColumnName(i);
const columnType: relationalStore.ColumnType = resultSet.getColumnType(i);
switch (columnType) {
case relationalStore.ColumnType.TYPE_INTEGER:
row[columnName] = resultSet.getLong(i);
break;
case relationalStore.ColumnType.TYPE_REAL:
row[columnName] = resultSet.getDouble(i);
break;
case relationalStore.ColumnType.TYPE_STRING:
const stringValue = resultSet.getString(i);
if (stringValue && (stringValue.startsWith('{') || stringValue.startsWith('['))) {
try {
row[columnName] = JSON.parse(stringValue);
} catch {
row[columnName] = stringValue;
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/DatabaseService.ets#L306-L368
|
24cbcb2aafeb22c922e9a79da86ec7864da290cd
|
github
|
wenfujing/honms-super-market.git
|
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
|
common/src/main/ets/utils/LocalDataManager.ets
|
arkts
|
deleteShopCart
|
Delete data from shopCartData by ids.
@param ids deleted id
@returns Product[]
|
deleteShopCart(ids: string[]) {
ids.forEach((id: string) => {
const result = this.shopCartData.filter((item: Product) => item.id === id);
if (result.length > 0) {
this.shopCartData.splice(this.shopCartData.indexOf(result[0]), 1);
}
});
return this.shopCartData;
}
|
AST#method_declaration#Left deleteShopCart AST#parameter_list#Left ( AST#parameter#Left ids : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ids 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 id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shopCartData 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 Product AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 result AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shopCartData AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shopCartData AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left result 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#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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shopCartData AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
deleteShopCart(ids: string[]) {
ids.forEach((id: string) => {
const result = this.shopCartData.filter((item: Product) => item.id === id);
if (result.length > 0) {
this.shopCartData.splice(this.shopCartData.indexOf(result[0]), 1);
}
});
return this.shopCartData;
}
|
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L93-L101
|
e8b3dca42a33289f34e7dac7309833779fd9cdab
|
github
|
iotjin/JhHarmonyDemo.git
|
819e6c3b1db9984c042a181967784550e171b2e8
|
JhCommon/src/main/ets/JhCommon/components/JhToast.ets
|
arkts
|
showToast
|
/ 系统Toast
|
public static showToast(loadingText: ResourceStr) {
promptAction.showToast({
message: loadingText,
duration: _closeTime,
alignment: _alignment,
offset: _offset,
})
}
|
AST#method_declaration#Left public static showToast AST#parameter_list#Left ( AST#parameter#Left loadingText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#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 loadingText AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left _closeTime AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left _alignment AST#expression#Right AST#property_assignment#Right , 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#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static showToast(loadingText: ResourceStr) {
promptAction.showToast({
message: loadingText,
duration: _closeTime,
alignment: _alignment,
offset: _offset,
})
}
|
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhToast.ets#L29-L36
|
cbda264599af6931b0cb89db124b1e345c3ffffd
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_ui/src/main/ets/ui/prompt/DialogUtil.ets
|
arkts
|
showAlertDialog
|
弹出一个警告提示框
@param options
{
msg:警告消息,
title:提示标题默认为(警告提示),
subtitle:副标题,
autoCancel:点击遮罩是否自动关闭默认为(false),
alignment:弹框对齐方式默认为(底部Bottom),
gridCount:宽度所占用栅格数默认为10,
buttons:按钮,
offset:弹窗相对alignment所在位置的偏移量,
maskRect:弹窗遮蔽层区域
}
@Param buttons:AlertDialogBtn 弹框按钮类只允许有两个第一个为确认按按,第二个为取消按钮
@Param AlertDialogBtn
{
value:按钮值
fontColor:按钮前景色
backgroundColor:按钮背景色
callBack:按钮事件
enabled:点击Button是否响应
defaultFocus:设置Button是否是默认焦点
style:设置Button的风格样式
}
@Param 确定按钮值: value:确定按钮文本默认为确定,fontColor:文本颜色默认为#fff,backgroundColor:背景颜色默认值为#409eff,callBack:确定按钮回调事件
@Param 取消按钮值: value:取消按钮文本默认为取消,fontColor:文本颜色默认为#fff,backgroundColor:背景颜色默认值为#dcdfe6,callBack:取消按钮回调事件
|
static showAlertDialog(options?: AlertOption) {
//设置默认值
const defaultButtons = new Array<AlertDialogBtn>();
//如果没传则初始化
if (!options) {
options = new AlertOption();
}
if (!options.subtitle) {
options.subtitle = '';
}
if (!options.title) {
options.title = Const.ALERT_TITLE;
}
if (!options.gridCount) {
options.gridCount = 10;
}
if (options.alignment == undefined) {
options.alignment = DialogAlignment.Bottom;
}
if (!options.maskRect) {
options.maskRect = { x: 0, y: 0, width: '100%', height: '100%' };
}
if (options.autoCancel == undefined) {
options.autoCancel = false;
}
if (!options.offset) {
options.offset = options.alignment == DialogAlignment.Bottom || options.alignment == DialogAlignment.BottomEnd || options.alignment == DialogAlignment.BottomStart ? {
dx: 0,
dy: -20
} : options.alignment == DialogAlignment.Top || options.alignment == DialogAlignment.TopStart || options.alignment == DialogAlignment.TopEnd ? {
dx: 0,
dy: 20
} : { dx: 0, dy: 0 };
}
//是否需要初始化默认按钮
if (!options.buttons) {
//设置默认按钮
//确定按钮的默认值
defaultButtons.push({
value: Const.DIALOG_OK,
fontColor: Const.ALERT_OK_COLOR,
backgroundColor: Const.ALERT_OK_BG_COLOR,
enabled: true,
defaultFocus: false,
style: DialogButtonStyle.DEFAULT
});
//取消按钮的默认值
defaultButtons.push({
value: Const.DIALOG_CANCEL,
fontColor: Const.ALERT_CANCEL_COLOR,
backgroundColor: Const.DIALOG_CANCEL_COLOR,
enabled: true,
defaultFocus: false,
style: DialogButtonStyle.DEFAULT
});
options.buttons = defaultButtons;
}
//分解数据
let primaryBtn = options.buttons[0];
let secondBtn: AlertDialogBtn;
if (options.buttons.length > 1) {
secondBtn = options.buttons[1];
} else {
secondBtn = {
value: Const.DIALOG_CANCEL,
fontColor: Const.ALERT_CANCEL_COLOR,
backgroundColor: Const.DIALOG_CANCEL_COLOR,
enabled: true,
defaultFocus: false,
style: DialogButtonStyle.DEFAULT
};
}
//创建警告弹框
AlertDialog.show({
title: options.title,
subtitle: options.subtitle,
maskRect: options.maskRect,
message: options.msg,
autoCancel: options.autoCancel,
alignment: options.alignment,
offset: options.offset,
primaryButton: {
value: !primaryBtn.value ? Const.DIALOG_OK : primaryBtn.value,
fontColor: !primaryBtn.fontColor ? Const.ALERT_OK_COLOR : primaryBtn.fontColor,
backgroundColor: !primaryBtn.backgroundColor ? Const.ALERT_OK_BG_COLOR : primaryBtn.backgroundColor,
action: primaryBtn.callBack,
enabled: !primaryBtn.enabled ? true : primaryBtn.enabled,
defaultFocus: !primaryBtn.defaultFocus ? false : primaryBtn.defaultFocus,
style: !primaryBtn.style ? DialogButtonStyle.DEFAULT : primaryBtn.style
},
secondaryButton: {
value: !secondBtn.value ? Const.DIALOG_CANCEL : secondBtn.value,
fontColor: !secondBtn.fontColor ? Const.ALERT_CANCEL_COLOR : secondBtn.fontColor,
backgroundColor: !secondBtn.backgroundColor ? Const.DIALOG_CANCEL_COLOR : secondBtn.backgroundColor,
action: secondBtn.callBack,
enabled: !secondBtn.enabled ? true : secondBtn.enabled,
defaultFocus: !secondBtn.defaultFocus ? false : secondBtn.defaultFocus,
style: !secondBtn.style ? DialogButtonStyle.DEFAULT : secondBtn.style
},
gridCount: options.gridCount
})
}
|
AST#method_declaration#Left static showAlertDialog AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AlertOption 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 defaultButtons = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AlertDialogBtn 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#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left options = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AlertOption AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . subtitle AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . subtitle AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . title AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ALERT_TITLE 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 AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . gridCount AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . gridCount AST#member_expression#Right = AST#expression#Left 10 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . alignment AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Bottom 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 AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . maskRect AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . maskRect AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left '100%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left '100%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . autoCancel AST#member_expression#Right AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . autoCancel AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . offset AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . offset AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right == AST#expression#Left DialogAlignment AST#expression#Right AST#binary_expression#Right AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right || AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right == AST#expression#Left DialogAlignment AST#expression#Right AST#binary_expression#Right AST#expression#Right . BottomEnd AST#member_expression#Right AST#expression#Right || AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right == AST#expression#Left DialogAlignment AST#expression#Right AST#binary_expression#Right AST#expression#Right . BottomStart AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dx AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dy AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 20 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right : AST#expression#Left options AST#expression#Right AST#conditional_expression#Right AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right == AST#expression#Left DialogAlignment AST#expression#Right AST#binary_expression#Right AST#expression#Right . Top AST#member_expression#Right AST#expression#Right || AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right == AST#expression#Left DialogAlignment AST#expression#Right AST#binary_expression#Right AST#expression#Right . TopStart AST#member_expression#Right AST#expression#Right || AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right == AST#expression#Left DialogAlignment AST#expression#Right AST#binary_expression#Right AST#expression#Right . TopEnd AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dx AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dy AST#property_name#Right : AST#expression#Left 20 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 dx AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dy AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //是否需要初始化默认按钮 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . buttons 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 defaultButtons AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DIALOG_OK AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ALERT_OK_COLOR AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ALERT_OK_BG_COLOR AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left defaultFocus AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogButtonStyle AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //取消按钮的默认值 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left defaultButtons AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DIALOG_CANCEL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ALERT_CANCEL_COLOR AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DIALOG_CANCEL_COLOR AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left defaultFocus AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogButtonStyle AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right = AST#expression#Left defaultButtons 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 primaryBtn = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left secondBtn : AST#type_annotation#Left AST#primary_type#Left AlertDialogBtn AST#primary_type#Right AST#type_annotation#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left secondBtn = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 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#assignment_expression#Left secondBtn = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DIALOG_CANCEL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ALERT_CANCEL_COLOR AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DIALOG_CANCEL_COLOR AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left defaultFocus AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogButtonStyle AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 AlertDialog AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subtitle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . subtitle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maskRect AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . maskRect AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . msg AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left autoCancel AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . autoCancel AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . alignment AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offset AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . offset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left primaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left primaryBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DIALOG_OK AST#member_expression#Right AST#expression#Right : AST#expression#Left primaryBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left primaryBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ALERT_OK_COLOR AST#member_expression#Right AST#expression#Right : AST#expression#Left primaryBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left primaryBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ALERT_OK_BG_COLOR AST#member_expression#Right AST#expression#Right : AST#expression#Left primaryBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left primaryBtn AST#expression#Right . callBack AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enabled AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left primaryBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left primaryBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left defaultFocus AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left primaryBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . defaultFocus AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right : AST#expression#Left primaryBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . defaultFocus AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left primaryBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left DialogButtonStyle AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right : AST#expression#Left primaryBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left secondBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DIALOG_CANCEL AST#member_expression#Right AST#expression#Right : AST#expression#Left secondBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left secondBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ALERT_CANCEL_COLOR AST#member_expression#Right AST#expression#Right : AST#expression#Left secondBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left secondBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DIALOG_CANCEL_COLOR AST#member_expression#Right AST#expression#Right : AST#expression#Left secondBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left secondBtn AST#expression#Right . callBack AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enabled AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left secondBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left secondBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left defaultFocus AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left secondBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . defaultFocus AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right : AST#expression#Left secondBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . defaultFocus AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left secondBtn AST#expression#Right AST#unary_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left DialogButtonStyle AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right : AST#expression#Left secondBtn AST#expression#Right AST#conditional_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gridCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . gridCount AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static showAlertDialog(options?: AlertOption) {
const defaultButtons = new Array<AlertDialogBtn>();
if (!options) {
options = new AlertOption();
}
if (!options.subtitle) {
options.subtitle = '';
}
if (!options.title) {
options.title = Const.ALERT_TITLE;
}
if (!options.gridCount) {
options.gridCount = 10;
}
if (options.alignment == undefined) {
options.alignment = DialogAlignment.Bottom;
}
if (!options.maskRect) {
options.maskRect = { x: 0, y: 0, width: '100%', height: '100%' };
}
if (options.autoCancel == undefined) {
options.autoCancel = false;
}
if (!options.offset) {
options.offset = options.alignment == DialogAlignment.Bottom || options.alignment == DialogAlignment.BottomEnd || options.alignment == DialogAlignment.BottomStart ? {
dx: 0,
dy: -20
} : options.alignment == DialogAlignment.Top || options.alignment == DialogAlignment.TopStart || options.alignment == DialogAlignment.TopEnd ? {
dx: 0,
dy: 20
} : { dx: 0, dy: 0 };
}
if (!options.buttons) {
defaultButtons.push({
value: Const.DIALOG_OK,
fontColor: Const.ALERT_OK_COLOR,
backgroundColor: Const.ALERT_OK_BG_COLOR,
enabled: true,
defaultFocus: false,
style: DialogButtonStyle.DEFAULT
});
defaultButtons.push({
value: Const.DIALOG_CANCEL,
fontColor: Const.ALERT_CANCEL_COLOR,
backgroundColor: Const.DIALOG_CANCEL_COLOR,
enabled: true,
defaultFocus: false,
style: DialogButtonStyle.DEFAULT
});
options.buttons = defaultButtons;
}
let primaryBtn = options.buttons[0];
let secondBtn: AlertDialogBtn;
if (options.buttons.length > 1) {
secondBtn = options.buttons[1];
} else {
secondBtn = {
value: Const.DIALOG_CANCEL,
fontColor: Const.ALERT_CANCEL_COLOR,
backgroundColor: Const.DIALOG_CANCEL_COLOR,
enabled: true,
defaultFocus: false,
style: DialogButtonStyle.DEFAULT
};
}
AlertDialog.show({
title: options.title,
subtitle: options.subtitle,
maskRect: options.maskRect,
message: options.msg,
autoCancel: options.autoCancel,
alignment: options.alignment,
offset: options.offset,
primaryButton: {
value: !primaryBtn.value ? Const.DIALOG_OK : primaryBtn.value,
fontColor: !primaryBtn.fontColor ? Const.ALERT_OK_COLOR : primaryBtn.fontColor,
backgroundColor: !primaryBtn.backgroundColor ? Const.ALERT_OK_BG_COLOR : primaryBtn.backgroundColor,
action: primaryBtn.callBack,
enabled: !primaryBtn.enabled ? true : primaryBtn.enabled,
defaultFocus: !primaryBtn.defaultFocus ? false : primaryBtn.defaultFocus,
style: !primaryBtn.style ? DialogButtonStyle.DEFAULT : primaryBtn.style
},
secondaryButton: {
value: !secondBtn.value ? Const.DIALOG_CANCEL : secondBtn.value,
fontColor: !secondBtn.fontColor ? Const.ALERT_CANCEL_COLOR : secondBtn.fontColor,
backgroundColor: !secondBtn.backgroundColor ? Const.DIALOG_CANCEL_COLOR : secondBtn.backgroundColor,
action: secondBtn.callBack,
enabled: !secondBtn.enabled ? true : secondBtn.enabled,
defaultFocus: !secondBtn.defaultFocus ? false : secondBtn.defaultFocus,
style: !secondBtn.style ? DialogButtonStyle.DEFAULT : secondBtn.style
},
gridCount: options.gridCount
})
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/DialogUtil.ets#L142-L247
|
9f06bdb727c5da771e651a7ea52496f9061d083f
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets
|
arkts
|
aboutToAppear
|
页面出现时的生命周期回调
@returns {void} 无返回值
|
aboutToAppear(): void {
this.executeRequest();
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . executeRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
aboutToAppear(): void {
this.executeRequest();
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L39-L41
|
10ef6891a7de5d546e73cd93f511b6b835886843
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
SimpleChatList/entry/src/main/ets/pages/EdgeBlur.ets
|
arkts
|
overlayBuilder
|
[Start linearGradient]
|
@Builder
overlayBuilder() {
Stack().height('100%').height('100%')
.linearGradient({
direction: GradientDirection.Bottom, // Gradient direction.
colors: [[0x00000000, 0.0], [0xB3000000, 1.0]]
})
.blendMode(BlendMode.DST_IN, BlendApplyType.OFFSCREEN)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right overlayBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( 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 . linearGradient ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left direction AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left GradientDirection AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // Gradient direction. AST#property_assignment#Left AST#property_name#Left colors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x00000000 AST#expression#Right , AST#expression#Left 0.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0xB3000000 AST#expression#Right , AST#expression#Left 1.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . blendMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left BlendMode AST#expression#Right . DST_IN AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left BlendApplyType AST#expression#Right . OFFSCREEN 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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
overlayBuilder() {
Stack().height('100%').height('100%')
.linearGradient({
direction: GradientDirection.Bottom,
colors: [[0x00000000, 0.0], [0xB3000000, 1.0]]
})
.blendMode(BlendMode.DST_IN, BlendApplyType.OFFSCREEN)
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SimpleChatList/entry/src/main/ets/pages/EdgeBlur.ets#L23-L31
|
6ed91a87751e9f6926d9423b4eae920fe69d4b2b
|
gitee
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/others/DnsResolve/entry/src/main/ets/pages/Index.ets
|
arkts
|
resolveHost
|
解析域名
|
async resolveHost() {
let netHandle = connection.getDefaultNetSync();
let addrList: ArrayList<string> = new ArrayList<string>();
await netHandle.getAddressesByName(this.hostName)
.then(data => {
//解析结果有一些重复的ip,这里进行去重
for (let i = 0; i < data.length; i++) {
if (!addrList.has(data[i].address)) {
addrList.add(data[i].address)
}
}
})
.catch((err) => {
this.msgHistory += '解析出错: ' + err.message + "\r\n";
return
})
this.msgHistory += `解析域名[${this.hostName}]的结果:\r\n`
for (let i = 0; i < addrList.length; i++) {
this.msgHistory += addrList[i] + "\r\n";
}
}
|
AST#method_declaration#Left async resolveHost AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left netHandle = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left connection AST#expression#Right . getDefaultNetSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left addrList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ArrayList 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#new_expression#Left new AST#expression#Left ArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left netHandle AST#expression#Right AST#await_expression#Right AST#expression#Right . getAddressesByName 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 . hostName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left data => AST#block_statement#Left { //解析结果有一些重复的ip,这里进行去重 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 data 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left addrList AST#expression#Right AST#unary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left data AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . address AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left addrList AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left data AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . address 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#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#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 . msgHistory 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#expression#Right + AST#expression#Left err AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" 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#return_statement#Left return 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#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 . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` 解析域名[ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hostName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ]的结果: \r \n ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#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 addrList 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left addrList AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left "\r\n" 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#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async resolveHost() {
let netHandle = connection.getDefaultNetSync();
let addrList: ArrayList<string> = new ArrayList<string>();
await netHandle.getAddressesByName(this.hostName)
.then(data => {
for (let i = 0; i < data.length; i++) {
if (!addrList.has(data[i].address)) {
addrList.add(data[i].address)
}
}
})
.catch((err) => {
this.msgHistory += '解析出错: ' + err.message + "\r\n";
return
})
this.msgHistory += `解析域名[${this.hostName}]的结果:\r\n`
for (let i = 0; i < addrList.length; i++) {
this.msgHistory += addrList[i] + "\r\n";
}
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/others/DnsResolve/entry/src/main/ets/pages/Index.ets#L71-L92
|
289af3a5ab1e350999153d1eb66b226832401b18
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/lyric/LyricConst.ets
|
arkts
|
Lyrics scrolling effect.
|
export const enum LyricScrollEffect {
/**
* Full line scrolling
*/
Line,
/**
* Gradient Color
*/
LetterGradient,
/**
* Single character scaling and gradation.
*/
LetterScaleGradient,
/**
* Star scrolling style.
*/
LetterStar
}
|
AST#export_declaration#Left export AST#enum_declaration#Left const enum LyricScrollEffect AST#enum_body#Left { /**
* Full line scrolling
*/ AST#enum_member#Left Line AST#enum_member#Right , /**
* Gradient Color
*/ AST#enum_member#Left LetterGradient AST#enum_member#Right , /**
* Single character scaling and gradation.
*/ AST#enum_member#Left LetterScaleGradient AST#enum_member#Right , /**
* Star scrolling style.
*/ AST#enum_member#Left LetterStar AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export const enum LyricScrollEffect {
Line,
LetterGradient,
LetterScaleGradient,
LetterStar
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/lyric/LyricConst.ets#L19-L39
|
f1d55a29eb2bfff594cff33a299cefc17260fca7
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets
|
arkts
|
buildGreetingEditor
|
构建祝福语编辑器
|
@Builder
buildGreetingEditor() {
Column({ space: 12 }) {
Row() {
Text('祝福语内容')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
// 样式选择按钮
Button(this.getStyleLabel(this.selectedStyle))
.type(ButtonType.Capsule)
.fontSize(12)
.backgroundColor('#f0f0f0')
.fontColor('#666666')
.height(28)
.onClick(() => {
this.showStyleSelector = true;
})
// 重新生成按钮
Button() {
if (this.aiGenerating) {
LoadingProgress()
.width(16)
.height(16)
.color('#007AFF')
} else {
Image($r('app.media.ic_refresh'))
.width(16)
.height(16)
.fillColor('#007AFF')
}
}
.type(ButtonType.Circle)
.width(32)
.height(32)
.backgroundColor('transparent')
.enabled(!this.aiGenerating)
.onClick(() => {
this.generateAISuggestions();
})
}
// 文本编辑区域
TextArea({
placeholder: '在这里输入或编辑祝福语...',
text: this.customContent
})
.fontSize(16)
.fontColor('#333333')
.backgroundColor('#ffffff')
.borderRadius(8)
.padding(12)
.height(120)
.onChange((value: string) => {
this.customContent = value;
})
// 字数统计
Text(`${this.customContent.length}/200`)
.fontSize(12)
.fontColor('#999999')
.alignSelf(ItemAlign.End)
}
.width('100%')
.padding(16)
.backgroundColor('#ffffff')
.borderRadius(12)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.1)',
offsetX: 0,
offsetY: 2
})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingEditor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 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 Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '祝福语内容' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 样式选择按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getStyleLabel 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 . selectedStyle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f0f0f0' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showStyleSelector AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aiGenerating AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#007AFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_refresh' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left '#007AFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Circle AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 32 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 32 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 'transparent' AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( 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 . aiGenerating 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 . generateAISuggestions 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 文本编辑区域 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextArea ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '在这里输入或编辑祝福语...' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customContent AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 120 AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customContent AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 字数统计 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customContent AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /200 ` AST#template_literal#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 '#999999' AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.1)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildGreetingEditor() {
Column({ space: 12 }) {
Row() {
Text('祝福语内容')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
Button(this.getStyleLabel(this.selectedStyle))
.type(ButtonType.Capsule)
.fontSize(12)
.backgroundColor('#f0f0f0')
.fontColor('#666666')
.height(28)
.onClick(() => {
this.showStyleSelector = true;
})
Button() {
if (this.aiGenerating) {
LoadingProgress()
.width(16)
.height(16)
.color('#007AFF')
} else {
Image($r('app.media.ic_refresh'))
.width(16)
.height(16)
.fillColor('#007AFF')
}
}
.type(ButtonType.Circle)
.width(32)
.height(32)
.backgroundColor('transparent')
.enabled(!this.aiGenerating)
.onClick(() => {
this.generateAISuggestions();
})
}
TextArea({
placeholder: '在这里输入或编辑祝福语...',
text: this.customContent
})
.fontSize(16)
.fontColor('#333333')
.backgroundColor('#ffffff')
.borderRadius(8)
.padding(12)
.height(120)
.onChange((value: string) => {
this.customContent = value;
})
Text(`${this.customContent.length}/200`)
.fontSize(12)
.fontColor('#999999')
.alignSelf(ItemAlign.End)
}
.width('100%')
.padding(16)
.backgroundColor('#ffffff')
.borderRadius(12)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.1)',
offsetX: 0,
offsetY: 2
})
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L309-L385
|
cdc4d1f1ba88d2304fe3e7321c0dd42d827b2fff
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/vibrateeffect/src/main/ets/VibrateEffect.ets
|
arkts
|
startAnimation
|
触发提示文本抖动动画效果
|
startAnimation() {
if (!this.uiContext) {
return;
}
this.translateX = CONFIGURATION.POSITION_ZERO;
// TODO: 知识点:通过keyframeAnimateTo关键帧动画指定状态变化过渡动效
this.uiContext.keyframeAnimateTo({ iterations: CONFIGURATION.PLAYBACK_COUNT }, [
{
// 第一段动画时长为100ms,translateX属性从0到5
duration: CONFIGURATION.ANIMATION_TIME,
event: () => {
this.translateX = CONFIGURATION.TRANSLATE_OFFSET_X;
}
},
{
// 第二段动画时长为100ms,translateX属性从5到0
duration: CONFIGURATION.ANIMATION_TIME,
event: () => {
this.translateX = CONFIGURATION.POSITION_ZERO;
}
}
]);
}
|
AST#method_declaration#Left startAnimation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . uiContext AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . translateX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . POSITION_ZERO AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // TODO: 知识点:通过keyframeAnimateTo关键帧动画指定状态变化过渡动效 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 . uiContext AST#member_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . PLAYBACK_COUNT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { // 第一段动画时长为100ms,translateX属性从0到5 AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . ANIMATION_TIME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . translateX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . TRANSLATE_OFFSET_X AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { // 第二段动画时长为100ms,translateX属性从5到0 AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . ANIMATION_TIME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . translateX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . POSITION_ZERO AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#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 AST#method_declaration#Right
|
startAnimation() {
if (!this.uiContext) {
return;
}
this.translateX = CONFIGURATION.POSITION_ZERO;
this.uiContext.keyframeAnimateTo({ iterations: CONFIGURATION.PLAYBACK_COUNT }, [
{
duration: CONFIGURATION.ANIMATION_TIME,
event: () => {
this.translateX = CONFIGURATION.TRANSLATE_OFFSET_X;
}
},
{
duration: CONFIGURATION.ANIMATION_TIME,
event: () => {
this.translateX = CONFIGURATION.POSITION_ZERO;
}
}
]);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/vibrateeffect/src/main/ets/VibrateEffect.ets#L70-L92
|
fff422957887210f998218615b81baa3e54ef458
|
gitee
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/accuracy/flow_sensitive/loop_stmt/for_002_F.ets
|
arkts
|
Introduction 循环结构-for
|
export function for_002_F(taint_src : string) {
let res = ""
for (let i = 0; i < 1; i++) {
taint.Sink(res)
res = taint_src
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function for_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res = 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#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#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 taint AST#expression#Right . Sink 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left res = AST#expression#Left taint_src AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function for_002_F(taint_src : string) {
let res = ""
for (let i = 0; i < 1; i++) {
taint.Sink(res)
res = taint_src
}
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/flow_sensitive/loop_stmt/for_002_F.ets#L6-L12
|
b6f5e3f51d6f12b907b3d08869850d71c40bc1a5
|
github
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
entry/src/main/ets/pages/index/DialogPage.ets
|
arkts
|
showBindSheet
|
显示自定义半模态
|
showBindSheet(index: number) {
// let targetId = this.getUniqueId();
let targetId = "10001";
//自定义一个底部的MenuLayout
let menuOptions: MenuSheetOptions = {
dialogId: DialogHelper.generateId(),
title: {
title: "分享我的动态",
},
detents: [SheetSize.FIT_CONTENT, SheetSize.MEDIUM, SheetSize.FIT_CONTENT],
borderWidth: 10,
borderColor: Color.White,
targetId: targetId,
mode: SheetMode.EMBEDDED,
preferType: SheetType.BOTTOM,
menus: Utils.getMenus(),
onItemClick: (menu) => {
router.pushUrl({ url: "pages/spinkit/SpinKit1" });
DialogHelper.showToast(menu.text);
}
};
DialogHelper.showBindSheet(wrapBuilder(MenuSheetBuilder), menuOptions);
}
|
AST#method_declaration#Left showBindSheet AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // let targetId = this.getUniqueId(); AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left targetId = AST#expression#Left "10001" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //自定义一个底部的MenuLayout AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left menuOptions : AST#type_annotation#Left AST#primary_type#Left MenuSheetOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dialogId AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . generateId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#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#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left detents AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SheetSize AST#expression#Right . FIT_CONTENT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SheetSize AST#expression#Right . MEDIUM AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SheetSize AST#expression#Right . FIT_CONTENT AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left borderWidth AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left borderColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left targetId AST#property_name#Right : AST#expression#Left targetId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left mode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left SheetMode AST#expression#Right . EMBEDDED AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left SheetType AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left menus AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . getMenus AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onItemClick AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left menu 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 router AST#expression#Right . pushUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left "pages/spinkit/SpinKit1" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left menu AST#expression#Right . text AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#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 DialogHelper AST#expression#Right . showBindSheet AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left MenuSheetBuilder AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left menuOptions AST#expression#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
|
showBindSheet(index: number) {
let targetId = "10001";
let menuOptions: MenuSheetOptions = {
dialogId: DialogHelper.generateId(),
title: {
title: "分享我的动态",
},
detents: [SheetSize.FIT_CONTENT, SheetSize.MEDIUM, SheetSize.FIT_CONTENT],
borderWidth: 10,
borderColor: Color.White,
targetId: targetId,
mode: SheetMode.EMBEDDED,
preferType: SheetType.BOTTOM,
menus: Utils.getMenus(),
onItemClick: (menu) => {
router.pushUrl({ url: "pages/spinkit/SpinKit1" });
DialogHelper.showToast(menu.text);
}
};
DialogHelper.showBindSheet(wrapBuilder(MenuSheetBuilder), menuOptions);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L953-L976
|
c5f59f7ef50dbe1855cc5b6e29a218bb3ca9afad
|
gitee
|
Hyricane/Interview_Success.git
|
9783273fe05fc8951b99bf32d3887c605268db8f
|
entry/src/main/ets/models/index.ets
|
arkts
|
排序方式的枚举
|
export enum SortType {
Default = 0,
Easy2Hard = 10,
Hard2Easy = 11,
Low2High = 20,
High2Low = 21,
Recommend = 30
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum SortType AST#enum_body#Left { AST#enum_member#Left Default = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Easy2Hard = AST#expression#Left 10 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Hard2Easy = AST#expression#Left 11 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Low2High = AST#expression#Left 20 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left High2Low = AST#expression#Left 21 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Recommend = AST#expression#Left 30 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum SortType {
Default = 0,
Easy2Hard = 10,
Hard2Easy = 11,
Low2High = 20,
High2Low = 21,
Recommend = 30
}
|
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/models/index.ets#L38-L45
|
a90b91251bb8769a1e8b5285669a103bf161fa6f
|
github
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/model/src/main/ets/request/PasswordLoginRequest.ets
|
arkts
|
构造函数
@param {string} phone - 手机号
@param {string} password - 密码
|
constructor(phone: string = "", password: string = "") {
this.phone = phone;
this.password = password;
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right = AST#expression#Left phone 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 . password AST#member_expression#Right = AST#expression#Left password 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(phone: string = "", password: string = "") {
this.phone = phone;
this.password = password;
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/request/PasswordLoginRequest.ets#L20-L23
|
b2a3b2665f98a0f6de67435b204d31344e4be30b
|
github
|
|
JHB11Hinson/mineMointorAPP.git
|
b6b853cf534021ac39e66c9b3a35113896a272b2
|
entry/src/main/ets/common/utils/Request.ets
|
arkts
|
post
|
POST 请求
@param url 接口地址
@param data 请求体数据
|
static async post<T>(url: string, data?: Object): Promise<T> {
// 显式传入三个泛型:<T, R, D>
return instance.post<T, T, Object>(url, data);
}
|
AST#method_declaration#Left static async post AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 显式传入三个泛型:<T, R, D> 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 instance AST#expression#Right . post AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left data 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 post<T>(url: string, data?: Object): Promise<T> {
return instance.post<T, T, Object>(url, data);
}
|
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/common/utils/Request.ets#L39-L42
|
b4baeea33c89cb728692496a0afe81b1a78206c6
|
github
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement_nowear_api12/entry/src/main/ets/MainAbility/common/MessageManager.ets
|
arkts
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export type Callback = (message: ESObject) => void
|
AST#export_declaration#Left export AST#type_declaration#Left type Callback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#type_declaration#Right AST#export_declaration#Right
|
export type Callback = (message: ESObject) => void
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement_nowear_api12/entry/src/main/ets/MainAbility/common/MessageManager.ets#L15-L15
|
d18d326104d59b0da82ce958316508c6ae2c3f56
|
gitee
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
arkts/@arkts.collections.d.ets
|
arkts
|
from
|
Creates an ArkTS Array from an iterable object.
@param { Iterable<T> } iterable - An iterable object to convert to an ArkTS Array.
@returns { Array<T> } A new Array instance
@throws { BusinessError } 401 - Parameter error.
@throws { BusinessError } 10200011 - The from method cannot be bound.
@static
@syscap SystemCapability.Utils.Lang
@atomicservice
@since 12
Creates an ArkTS array from an iterable object.
@param { Iterable<T> } iterable - Array-like object.
@returns { Array<T> } A new Array instance
@throws { BusinessError } 401 - Parameter error: Possible causes: 1. Mandatory parameters are left unspecified;
2. Incorrect parameter types; 3. Parameter verification failed.
@static
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 18
|
static from<T>(iterable: Iterable<T>): Array<T>;
|
AST#method_declaration#Left static from AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left iterable : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Iterable AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
static from<T>(iterable: Iterable<T>): Array<T>;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L507-L507
|
b83993564d23e0f4589730d84a63b13830f5e613
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/model/AlertOptions.ets
|
arkts
|
TODO 操作确认类弹出框,参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18
|
export interface AlertOptions extends HmDialogOptions {
primaryTitle?: ResourceStr; //确认框一级标题。
secondaryTitle?: ResourceStr; //确认框二级标题。
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface AlertOptions AST#extends_clause#Left extends HmDialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left primaryTitle ? : 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 secondaryTitle ? : 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 AlertOptions extends HmDialogOptions {
primaryTitle?: ResourceStr;
secondaryTitle?: ResourceStr;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/AlertOptions.ets#L23-L28
|
4553e5b627c5e1bee4886b9d69ca5b8ca5a0827d
|
gitee
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets
|
arkts
|
clearLearnTimes
|
====== 清空学习次数 ======
|
async clearLearnTimes(): Promise<void> {
if (!this.db) return;
const sql = `UPDATE ${Tables.Learn.NAME} SET ${Tables.Learn.Col.LEARN_TIMES} = 0`;
await this.db.updateDb(sql);
}
|
AST#method_declaration#Left async clearLearnTimes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 . db AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sql = AST#expression#Left AST#template_literal#Left ` UPDATE AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . NAME AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right SET AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . LEARN_TIMES AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right = 0 ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . db AST#member_expression#Right AST#expression#Right . updateDb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async clearLearnTimes(): Promise<void> {
if (!this.db) return;
const sql = `UPDATE ${Tables.Learn.NAME} SET ${Tables.Learn.Col.LEARN_TIMES} = 0`;
await this.db.updateDb(sql);
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L481-L486
|
432d00f25be3b5153a2016c8b5146f0e87dcd7de
|
github
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/MineView.ets
|
arkts
|
showDevelopingToast
|
显示开发中提示
|
private showDevelopingToast() {
showToast('此功能开发中');
}
|
AST#method_declaration#Left private showDevelopingToast AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left showToast ( AST#expression#Left '此功能开发中' AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private showDevelopingToast() {
showToast('此功能开发中');
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/MineView.ets#L142-L144
|
4d8680245adc592735200a7b6c76ccb44f69791a
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets
|
arkts
|
ensureMigrated
|
确保搜索历史表完成迁移
@returns {void} 无返回
|
private ensureMigrated(): void {
if (!SearchHistoryLocalDataSourceImpl.migrated) {
this.orm.migrate(SearchHistoryEntity);
SearchHistoryLocalDataSourceImpl.migrated = true;
}
}
|
AST#method_declaration#Left private ensureMigrated AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left SearchHistoryLocalDataSourceImpl AST#expression#Right AST#unary_expression#Right AST#expression#Right . migrated AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orm AST#member_expression#Right AST#expression#Right . migrate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left SearchHistoryEntity 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 SearchHistoryLocalDataSourceImpl AST#expression#Right . migrated AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private ensureMigrated(): void {
if (!SearchHistoryLocalDataSourceImpl.migrated) {
this.orm.migrate(SearchHistoryEntity);
SearchHistoryLocalDataSourceImpl.migrated = true;
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L32-L37
|
59ba7234b367c1f4ca9878825ed6f852131773c8
|
github
|
IceYuanyyy/OxHornCampus.git
|
bb5686f77fa36db89687502e35898cda218d601f
|
entry/src/main/ets/common/constants/CommonConstants.ets
|
arkts
|
Train route.
|
export enum TrainsLine {
LINE_ONE = 0,
LINE_TWO = 1,
LINE_THREE = 2,
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum TrainsLine AST#enum_body#Left { AST#enum_member#Left LINE_ONE = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LINE_TWO = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LINE_THREE = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right , } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum TrainsLine {
LINE_ONE = 0,
LINE_TWO = 1,
LINE_THREE = 2,
}
|
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/constants/CommonConstants.ets#L539-L543
|
b71e61d3aa219128ede0ece96ea1295703b62aa8
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/common/Route.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 interface Route {
title: string;
name: string;
items?: Route[];
description?: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface Route AST#object_type#Left { AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left items ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Route [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left description ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface Route {
title: string;
name: string;
items?: Route[];
description?: string;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/common/Route.ets#L16-L21
|
8487cad8712fdf1724c6c28357c3e4d8c4a51140
|
gitee
|
|
nutsus/nut-jokes
|
1dc09db3e87922ae4a8edb59017b63ddbe899f40
|
entry/src/main/ets/MainAbility/model/jokeDetailModel.ets
|
arkts
|
Copyright (c) 2021 JianGuo 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 JokeDetailData {
content: string // 内容
hashId: string // 哈希值
unixtime: number //
updatetime: string //更新时间
}
|
AST#export_declaration#Left export AST#class_declaration#Left class JokeDetailData AST#class_body#Left { AST#property_declaration#Left content AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right // 内容 AST#ERROR#Left h as hId AST#ERROR#Right : AST#ERROR#Left string // 哈希值 unixtime : number // updatetime : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right //更新时间 AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class JokeDetailData {
content: string
hashId: string
unixtime: number
updatetime: string 更新时间
}
|
https://github.com/nutsus/nut-jokes/blob/1dc09db3e87922ae4a8edb59017b63ddbe899f40/entry/src/main/ets/MainAbility/model/jokeDetailModel.ets#L17-L24
|
58b05f76279c19148a05c858498aac3eb47a09db
|
gitee
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/components/AxisBase.ets
|
arkts
|
setLabelCount
|
sets the number of label entries for the y-axis max = 25, min = 2, default: 6, be aware
that this number is not
fixed (if force == false) and can only be approximated.
@param count the number of y-axis labels that should be displayed
@param force if enabled, the set label count will be forced, meaning that the exact
specified count of labels will
be drawn and evenly distributed alongside the axis - this might cause labels
to have uneven values
|
public setLabelCount(count: number, force?: boolean): void {
if (count > this.getAxisMaxLabels())
count = this.getAxisMaxLabels();
if (count < this.getAxisMinLabels())
count = this.getAxisMinLabels();
this.mLabelCount = count;
this.mForceLabels = false;
if (force != null || force != undefined) {
this.mForceLabels = force;
}
}
|
AST#method_declaration#Left public setLabelCount AST#parameter_list#Left ( AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left force ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . getAxisMaxLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left count = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getAxisMaxLabels 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . getAxisMinLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left count = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getAxisMinLabels 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLabelCount AST#member_expression#Right = AST#expression#Left count 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 . mForceLabels AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left force AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left force AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mForceLabels AST#member_expression#Right = AST#expression#Left force 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#method_declaration#Right
|
public setLabelCount(count: number, force?: boolean): void {
if (count > this.getAxisMaxLabels())
count = this.getAxisMaxLabels();
if (count < this.getAxisMinLabels())
count = this.getAxisMinLabels();
this.mLabelCount = count;
this.mForceLabels = false;
if (force != null || force != undefined) {
this.mForceLabels = force;
}
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L366-L376
|
bd9d21c6e49a5c34abcc8fa24ea810c971505be8
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/components/StickerComponent.ets
|
arkts
|
aboutToAppear
|
删除回调
|
aboutToAppear(): void {
this.clearTimer()
this.borderShow = true
this.timerId = setTimeout(() => {
this.borderShow = false
}, 2000)
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clearTimer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . borderShow AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . borderShow AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 2000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
aboutToAppear(): void {
this.clearTimer()
this.borderShow = true
this.timerId = setTimeout(() => {
this.borderShow = false
}, 2000)
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/components/StickerComponent.ets#L12-L18
|
c574fbbe91462e23deb6ba537b586cd3e5a68072
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets
|
arkts
|
time range
|
export const DEFAULT_TIME: string = '08:00';
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DEFAULT_TIME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '08:00' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const DEFAULT_TIME: string = '08:00';
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets#L56-L56
|
b4e2472e6e7ae6b9be1dbb790c66ffbe574f2e3d
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/social/SearchPage.ets
|
arkts
|
buildSearchResults
|
构建搜索结果
|
@Builder
buildSearchResults() {
Scroll() {
Column({ space: 16 }) {
// 结果统计
Text(`找到 ${this.searchResults.total} 个相关结果`)
.fontSize(14)
.fontColor($r('app.color.text_secondary'))
.width('100%')
.padding({ left: 16, right: 16 })
switch (this.selectedType) {
case SearchType.ALL:
this.buildAllResults();
break;
case SearchType.POSTS:
this.buildPostResults();
break;
case SearchType.TOPICS:
this.buildTopicResults();
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchResults AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left Scroll AST#expression#Right AST#ERROR#Left ( ) { Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) { // 结果统计 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 找到 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchResults AST#member_expression#Right AST#expression#Right . total AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 个相关结果 ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#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 '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 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#ERROR#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedType AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SearchType AST#expression#Right . ALL AST#member_expression#Right AST#expression#Right AST#expression_statement#Right : AST#ERROR#Left AST#qualified_type#Left this . buildAllResults AST#qualified_type#Right AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SearchType AST#expression#Right . POSTS AST#member_expression#Right AST#expression#Right AST#expression_statement#Right : AST#ERROR#Left AST#qualified_type#Left this . buildPostResults AST#qualified_type#Right AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SearchType AST#expression#Right . TOPICS AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right : AST#ERROR#Left AST#qualified_type#Left this . buildTopicResults AST#qualified_type#Right AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right ; AST#method_declaration#Right
|
@Builder
buildSearchResults() {
Scroll() {
Column({ space: 16 }) {
Text(`找到 ${this.searchResults.total} 个相关结果`)
.fontSize(14)
.fontColor($r('app.color.text_secondary'))
.width('100%')
.padding({ left: 16, right: 16 })
switch (this.selectedType) {
case SearchType.ALL:
this.buildAllResults();
break;
case SearchType.POSTS:
this.buildPostResults();
break;
case SearchType.TOPICS:
this.buildTopicResults();
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/SearchPage.ets#L417-L436
|
67acbf8d2284a28de634889215116809907196ea
|
github
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.arkui.advanced.TreeView.d.ets
|
arkts
|
Declare class TreeListener
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare class TreeListener
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
|
export declare class TreeListener {
/**
* Event registration and processing.
* The event will not be destroyed after being processed.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Event registration and processing.
* The event will not be destroyed after being processed.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void;
/**
* Event registration and processing.
* After the event is processed once, it will be destroyed.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Event registration and processing.
* After the event is processed once, it will be destroyed.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void;
/**
* Destroy event.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Destroy event.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
off(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TreeListener AST#class_body#Left { /**
* Event registration and processing.
* The event will not be destroyed after being processed.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Event registration and processing.
* The event will not be destroyed after being processed.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#method_declaration#Left on AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TreeListenType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left callbackParam : AST#type_annotation#Left AST#primary_type#Left CallbackParam AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /**
* Event registration and processing.
* After the event is processed once, it will be destroyed.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Event registration and processing.
* After the event is processed once, it will be destroyed.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#method_declaration#Left once AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TreeListenType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left callbackParam : AST#type_annotation#Left AST#primary_type#Left CallbackParam AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /**
* Destroy event.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Destroy event.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#method_declaration#Left off AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TreeListenType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left callbackParam : AST#type_annotation#Left AST#primary_type#Left CallbackParam AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class TreeListener {
on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void;
once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void;
off(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L114-L175
|
d1fc94db35402bfbead12c5d461292eed9d3085f
|
gitee
|
|
openharmony/multimedia_camera_framework
|
9873dd191f59efda885bc06897acf9b0660de8f2
|
frameworks/js/camera_napi/demo/entry/src/main/ets/views/FocusPage.ets
|
arkts
|
FocusPage
|
曝光选择
|
@Component
export struct FocusPage {
@Link focusPointBol: boolean;
@Link focusPointVal: Array<number>;
// 刻度、焦距值 和 对焦框不能共存的显示
@Link exposureBol: boolean;
// 曝光值
@Link exposureNum: number;
build() {
if (this.focusPointBol) {
Row() {
if (this.exposureBol) {
// 对焦框
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween }) {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Row() {
}
.border({
width: { left: 1.6, right: 0, top: 1.6, bottom: 0 },
color: Color.White,
radius: { topLeft: 10, topRight: 0, bottomLeft: 0, bottomRight: 0 }
})
.size({ width: 40, height: 40 })
Row() {
}
.border({
width: { left: 0, right: 1.6, top: 1.6, bottom: 0 },
color: Color.White,
radius: { topLeft: 0, topRight: 10, bottomLeft: 0, bottomRight: 0 }
})
.size({ width: 40, height: 40 })
}
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Row() {
}
.border({
width: { left: 1.6, right: 0, top: 0, bottom: 1.6 },
color: Color.White,
radius: { topLeft: 0, topRight: 0, bottomLeft: 10, bottomRight: 0 }
})
.size({ width: 40, height: 40 })
Row() {
}
.border({
width: { left: 0, right: 1.6, top: 0, bottom: 1.6 },
color: Color.White,
radius: { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 10 }
})
.size({ width: 40, height: 40 })
}
}
.width(120)
.height(120)
.position({ x: this.focusPointVal[0] - 60, y: this.focusPointVal[1] - 60 })
} else {
// 焦距值
Text(this.exposureNum + '')
.fontSize(60)
.fontColor(Color.White)
.fontWeight(400)
.position({
x: this.focusPointVal[0] - 58,
y: this.focusPointVal[1] - 30
})
// 刻度值
Flex() {
Column() {
Text('+4')
.fontColor(Color.White)
Text('0')
.margin({ top: 50, bottom: 50 })
.fontColor(Color.White)
Text('-4')
.fontColor(Color.White)
}.margin({ right: 9 })
// 刻度
Column() {
Text('')
.height(67)
.border({
width: { left: '0', right: 4, top: '0', bottom: '0' },
color: Color.White,
radius: 2,
style: BorderStyle.Dotted
})
Text('')
.height(8)
.border({
width: { left: '0', right: 8, top: '0', bottom: '0' },
color: Color.White,
radius: 4,
style: BorderStyle.Solid
})
.margin({ top: 4 })
Text('')
.height(67)
.border({
width: { left: '0', right: 4, top: '0', bottom: '0' },
color: Color.White,
radius: 2,
style: BorderStyle.Dotted
})
.margin({ top: 4 })
}
}
.position({
x: this.focusPointVal[0] + 56.6,
y: this.focusPointVal[1] - 73
})
}
// 曝光图标
Image($r('app.media.ic_public_brightness'))
.size({ width: 24, height: 24 })
.position({
x: this.focusPointVal[0] + 75,
y: this.focusPointVal[1] - 10 - (this.exposureNum * 18)
})
}
.zIndex(99)
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FocusPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right focusPointBol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right focusPointVal : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 刻度、焦距值 和 对焦框不能共存的显示 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right exposureBol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 曝光值 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right exposureNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusPointBol AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . exposureBol AST#member_expression#Right AST#expression#Right ) { // 对焦框 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween 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 Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 1.6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 1.6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 40 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 Row ( ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 1.6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 1.6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 1.6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 1.6 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 40 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 Row ( ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 1.6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 1.6 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 120 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 120 AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusPointVal AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusPointVal AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { // 焦距值 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . exposureNum 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 . fontSize ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 400 AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusPointVal AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left 58 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusPointVal AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left 30 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 刻度值 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( ) 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 '+4' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 '0' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 50 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 50 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '-4' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 right AST#property_name#Right : AST#expression#Left 9 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 刻度 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 67 AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Dotted 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#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 . height ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 67 AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Dotted AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusPointVal AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left 56.6 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusPointVal AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left 73 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 曝光图标 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_public_brightness' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusPointVal AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left 75 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusPointVal AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . exposureNum AST#member_expression#Right AST#expression#Right * AST#expression#Left 18 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#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 . zIndex ( AST#expression#Left 99 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct FocusPage {
@Link focusPointBol: boolean;
@Link focusPointVal: Array<number>;
@Link exposureBol: boolean;
@Link exposureNum: number;
build() {
if (this.focusPointBol) {
Row() {
if (this.exposureBol) {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween }) {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Row() {
}
.border({
width: { left: 1.6, right: 0, top: 1.6, bottom: 0 },
color: Color.White,
radius: { topLeft: 10, topRight: 0, bottomLeft: 0, bottomRight: 0 }
})
.size({ width: 40, height: 40 })
Row() {
}
.border({
width: { left: 0, right: 1.6, top: 1.6, bottom: 0 },
color: Color.White,
radius: { topLeft: 0, topRight: 10, bottomLeft: 0, bottomRight: 0 }
})
.size({ width: 40, height: 40 })
}
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Row() {
}
.border({
width: { left: 1.6, right: 0, top: 0, bottom: 1.6 },
color: Color.White,
radius: { topLeft: 0, topRight: 0, bottomLeft: 10, bottomRight: 0 }
})
.size({ width: 40, height: 40 })
Row() {
}
.border({
width: { left: 0, right: 1.6, top: 0, bottom: 1.6 },
color: Color.White,
radius: { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 10 }
})
.size({ width: 40, height: 40 })
}
}
.width(120)
.height(120)
.position({ x: this.focusPointVal[0] - 60, y: this.focusPointVal[1] - 60 })
} else {
Text(this.exposureNum + '')
.fontSize(60)
.fontColor(Color.White)
.fontWeight(400)
.position({
x: this.focusPointVal[0] - 58,
y: this.focusPointVal[1] - 30
})
Flex() {
Column() {
Text('+4')
.fontColor(Color.White)
Text('0')
.margin({ top: 50, bottom: 50 })
.fontColor(Color.White)
Text('-4')
.fontColor(Color.White)
}.margin({ right: 9 })
Column() {
Text('')
.height(67)
.border({
width: { left: '0', right: 4, top: '0', bottom: '0' },
color: Color.White,
radius: 2,
style: BorderStyle.Dotted
})
Text('')
.height(8)
.border({
width: { left: '0', right: 8, top: '0', bottom: '0' },
color: Color.White,
radius: 4,
style: BorderStyle.Solid
})
.margin({ top: 4 })
Text('')
.height(67)
.border({
width: { left: '0', right: 4, top: '0', bottom: '0' },
color: Color.White,
radius: 2,
style: BorderStyle.Dotted
})
.margin({ top: 4 })
}
}
.position({
x: this.focusPointVal[0] + 56.6,
y: this.focusPointVal[1] - 73
})
}
Image($r('app.media.ic_public_brightness'))
.size({ width: 24, height: 24 })
.position({
x: this.focusPointVal[0] + 75,
y: this.focusPointVal[1] - 10 - (this.exposureNum * 18)
})
}
.zIndex(99)
}
}
}
|
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/views/FocusPage.ets#L17-L142
|
6c9a0d0833c831e444317ee44563152e1e916398
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
|
arkts
|
aboutToAppear
|
页面出现生命周期
@returns {void} 无返回值
|
aboutToAppear(): void {
if (this.shouldLoadAddress()) {
this.executeRequest();
return;
}
this.initCreateMode();
}
|
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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shouldLoadAddress AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . executeRequest 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initCreateMode 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
|
aboutToAppear(): void {
if (this.shouldLoadAddress()) {
this.executeRequest();
return;
}
this.initCreateMode();
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L119-L125
|
2381cdcc4c0679c661738197aa7cd250bf1cb23a
|
github
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/data/MockData.ets
|
arkts
|
分类数据
|
export const mockCategories: Category[] = [
{ id: 1, name: '手机', pic: 'https://picsum.photos/100/100?random=11' },
{ id: 2, name: '服装', pic: 'https://picsum.photos/100/100?random=12' },
{ id: 3, name: '电脑', pic: 'https://picsum.photos/100/100?random=13' },
{ id: 4, name: '优惠', pic: 'https://picsum.photos/100/100?random=14' },
{ id: 5, name: '家电', pic: 'https://picsum.photos/100/100?random=15' },
{ id: 6, name: '户外', pic: 'https://picsum.photos/100/100?random=16' },
{ id: 7, name: '潮鞋', pic: 'https://picsum.photos/100/100?random=17' },
{ id: 8, name: '会员', pic: 'https://picsum.photos/100/100?random=18' },
{ id: 9, name: '包包', pic: 'https://picsum.photos/100/100?random=19' },
{ id: 10, name: '网络', pic: 'https://picsum.photos/100/100?random=20' }
];
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left mockCategories : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Category [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '手机' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=11' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '服装' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=12' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '电脑' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=13' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '优惠' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=14' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '家电' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=15' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '户外' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=16' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 7 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '潮鞋' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=17' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '会员' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=18' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 9 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '包包' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=19' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '网络' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pic AST#property_name#Right : AST#expression#Left 'https://picsum.photos/100/100?random=20' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const mockCategories: Category[] = [
{ id: 1, name: '手机', pic: 'https://picsum.photos/100/100?random=11' },
{ id: 2, name: '服装', pic: 'https://picsum.photos/100/100?random=12' },
{ id: 3, name: '电脑', pic: 'https://picsum.photos/100/100?random=13' },
{ id: 4, name: '优惠', pic: 'https://picsum.photos/100/100?random=14' },
{ id: 5, name: '家电', pic: 'https://picsum.photos/100/100?random=15' },
{ id: 6, name: '户外', pic: 'https://picsum.photos/100/100?random=16' },
{ id: 7, name: '潮鞋', pic: 'https://picsum.photos/100/100?random=17' },
{ id: 8, name: '会员', pic: 'https://picsum.photos/100/100?random=18' },
{ id: 9, name: '包包', pic: 'https://picsum.photos/100/100?random=19' },
{ id: 10, name: '网络', pic: 'https://picsum.photos/100/100?random=20' }
];
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/data/MockData.ets#L27-L38
|
fb672ab3dd09ceb2a155aa7a80e9e5d20cf7fc82
|
github
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
|
arkts
|
prebuild
|
[EndExclude builder_node_pool] [StartExclude builder_node_pool]
|
prebuild(uiContext: UIContext) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
}
|
AST#method_declaration#Left prebuild AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 . node AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left BuilderNode AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uiContext AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . node AST#member_expression#Right AST#expression#Right . build 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 . builder AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
prebuild(uiContext: UIContext) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L56-L59
|
8342d25497e6eac8490353df0b49f2b59d8ae161
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/view/CustomKeyboardToH5.ets
|
arkts
|
浏览器对象
|
build() {
Column() {
TabletTitle({ browser: $browser })
Progress({ value: this.browser.progress, total: PROGRESS_TOTAL })
.color($r('app.color.custom_keyboard_to_h5_progress_color'))
.visibility(this.browser.hideProgress ? Visibility.None : Visibility.Visible)
Divider()
.color($r('app.color.custom_keyboard_to_h5_divider_color'))
.width($r('app.string.custom_keyboard_to_h5_layout_100'))
.flexShrink(FLEX_SHRINK_NUMBER)
WebTab({ browser: $browser })
}
}
|
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 TabletTitle ( AST#component_parameters#Left { AST#component_parameter#Left browser : AST#expression#Left $browser AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Progress ( 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 . browser AST#member_expression#Right AST#expression#Right . progress AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left total : AST#expression#Left PROGRESS_TOTAL AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_keyboard_to_h5_progress_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . browser AST#member_expression#Right AST#expression#Right . hideProgress AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . None AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_keyboard_to_h5_divider_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_keyboard_to_h5_layout_100' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . flexShrink ( AST#expression#Left FLEX_SHRINK_NUMBER 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 WebTab ( AST#component_parameters#Left { AST#component_parameter#Left browser : AST#expression#Left $browser AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column() {
TabletTitle({ browser: $browser })
Progress({ value: this.browser.progress, total: PROGRESS_TOTAL })
.color($r('app.color.custom_keyboard_to_h5_progress_color'))
.visibility(this.browser.hideProgress ? Visibility.None : Visibility.Visible)
Divider()
.color($r('app.color.custom_keyboard_to_h5_divider_color'))
.width($r('app.string.custom_keyboard_to_h5_layout_100'))
.flexShrink(FLEX_SHRINK_NUMBER)
WebTab({ browser: $browser })
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/view/CustomKeyboardToH5.ets#L34-L46
|
dc3d47d7faad75f7aa3c002d5147256429098100
|
gitee
|
|
YShelter/Accouting_ArkTS.git
|
8c663c85f2c11738d4eabf269c23dc1ec84eb013
|
entry/src/main/ets/view/HomeComponent.ets
|
arkts
|
allSize
|
match parent
|
@Styles
function allSize() {
.width(Const.THOUSANDTH_1000)
.height(Const.THOUSANDTH_1000)
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function allSize AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . THOUSANDTH_1000 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . THOUSANDTH_1000 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#decorated_function_declaration#Right
|
@Styles
function allSize() {
.width(Const.THOUSANDTH_1000)
.height(Const.THOUSANDTH_1000)
}
|
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/HomeComponent.ets#L14-L18
|
75dabe154045a632b8acca5745a8cdded45dcf69
|
github
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
entry/src/main/ets/pages/lineCharts/LineChartPage.ets
|
arkts
|
menuCallback
|
标题栏菜单回调
|
@Monitor("titleModel.index")
menuCallback() {
if (this.titleModel === null || this.titleModel === undefined) {
return
}
if (this.model === null || this.model === undefined) {
return
}
let index: number = this.titleModel.getIndex()
if (index === undefined || index === null || index === -1) {
return
}
let data = this.model.getData();
let sets: JArrayList<ILineDataSet> | null = null;
if (data) {
sets = data.getDataSets();
}
switch (this.menuItemArr[index]) {
case Constants.TOGGLE_VALUES:
this.toggleValues(data, sets)
break;
case Constants.TOGGLE_PINCHZOOM:
this.togglePinchZoom()
break;
|
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left "titleModel.index" AST#expression#Right ) AST#decorator#Right menuCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleModel AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . titleModel AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#ERROR#Left return AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . model AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleModel AST#member_expression#Right AST#expression#Right . getIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . model AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sets AST#ERROR#Left : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ILineDataSet AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#ERROR#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left data AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sets = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . getDataSets AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#ERROR#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . menuItemArr AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . TOGGLE_VALUES AST#member_expression#Right AST#expression#Right AST#expression_statement#Right : AST#ERROR#Left AST#qualified_type#Left this . toggleValues AST#qualified_type#Right AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right , AST#parameter#Left sets AST#parameter#Right ) AST#parameter_list#Right break AST#ERROR#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . TOGGLE_PINCHZOOM AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Right : AST#ERROR#Left AST#qualified_type#Left this . togglePinchZoom AST#qualified_type#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left break AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
@Monitor("titleModel.index")
menuCallback() {
if (this.titleModel === null || this.titleModel === undefined) {
return
}
if (this.model === null || this.model === undefined) {
return
}
let index: number = this.titleModel.getIndex()
if (index === undefined || index === null || index === -1) {
return
}
let data = this.model.getData();
let sets: JArrayList<ILineDataSet> | null = null;
if (data) {
sets = data.getDataSets();
}
switch (this.menuItemArr[index]) {
case Constants.TOGGLE_VALUES:
this.toggleValues(data, sets)
break;
case Constants.TOGGLE_PINCHZOOM:
this.togglePinchZoom()
break;
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/lineCharts/LineChartPage.ets#L301-L326
|
013e07195e3e5d26caf869d1ec40ed9331c02868
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/sidebaranimation/src/main/ets/constants/SideBarAnimationViewConstants.ets
|
arkts
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export class SideBarAnimationViewConstants {
static readonly SIDEBAR_ANIMATION_DURATION: number = 500;
static readonly SIDEBAR_WIDTH: number = 200;
static readonly GROUP_NAME_FONT_WEIGHT: number = 16;
static readonly MEMBER_COUNT: number = 10;
static readonly SIDEBAR_OPACITY_SHOW: number = 1;
static readonly SIDEBAR_OPACITY_HIDDEN: number = 0;
static readonly SIDEBAR_IS_SHOW_BUTTON: boolean = false;
static readonly SIDEBAR_IS_BUTTON_AUTORESIZE: boolean = true;
static readonly SIDEBAR_IS_AUTO_HIDE: boolean = false;
}
|
AST#export_declaration#Left export AST#class_declaration#Left class SideBarAnimationViewConstants AST#class_body#Left { AST#property_declaration#Left static readonly SIDEBAR_ANIMATION_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SIDEBAR_WIDTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly GROUP_NAME_FONT_WEIGHT : 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 MEMBER_COUNT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SIDEBAR_OPACITY_SHOW : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SIDEBAR_OPACITY_HIDDEN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SIDEBAR_IS_SHOW_BUTTON : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SIDEBAR_IS_BUTTON_AUTORESIZE : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SIDEBAR_IS_AUTO_HIDE : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class SideBarAnimationViewConstants {
static readonly SIDEBAR_ANIMATION_DURATION: number = 500;
static readonly SIDEBAR_WIDTH: number = 200;
static readonly GROUP_NAME_FONT_WEIGHT: number = 16;
static readonly MEMBER_COUNT: number = 10;
static readonly SIDEBAR_OPACITY_SHOW: number = 1;
static readonly SIDEBAR_OPACITY_HIDDEN: number = 0;
static readonly SIDEBAR_IS_SHOW_BUTTON: boolean = false;
static readonly SIDEBAR_IS_BUTTON_AUTORESIZE: boolean = true;
static readonly SIDEBAR_IS_AUTO_HIDE: boolean = false;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sidebaranimation/src/main/ets/constants/SideBarAnimationViewConstants.ets#L16-L26
|
da66752db17c9185146473d717214fe8c6317742
|
gitee
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/utils/MyMath.ets
|
arkts
|
toRadians
|
Converts an angle measured in degrees to an approximately
equivalent angle measured in radians. The conversion from
degrees to radians is generally inexact.
@param angdeg an angle, in degrees
@return the measurement of the angle {@code angdeg}
in radians.
|
public static toRadians(ang: number): number {
return ang * MyMath.degrees;
}
|
AST#method_declaration#Left public static toRadians AST#parameter_list#Left ( AST#parameter#Left ang : 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ang AST#expression#Right * AST#expression#Left MyMath AST#expression#Right AST#binary_expression#Right AST#expression#Right . degrees AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static toRadians(ang: number): number {
return ang * MyMath.degrees;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/MyMath.ets#L37-L39
|
65c70817f4c331a27000081299c8acab383592a9
|
gitee
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets
|
arkts
|
loadCert
|
加载客户端证书文件内容
|
loadCert() {
try {
this.cert = this.readStringFromFile(certFileUri)
this.certLoaded = true
}
catch (e) {
this.msgHistory += 'readText failed ' + e.message + "\r\n";
}
}
|
AST#method_declaration#Left loadCert AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cert 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 . readStringFromFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left certFileUri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . certLoaded 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#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'readText failed ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
loadCert() {
try {
this.cert = this.readStringFromFile(certFileUri)
this.certLoaded = true
}
catch (e) {
this.msgHistory += 'readText failed ' + e.message + "\r\n";
}
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets#L331-L339
|
30cdc3e3b7d000e956e4be8c34ee04a4bf43c3d7
|
gitee
|
JHB11Hinson/mineMointorAPP.git
|
b6b853cf534021ac39e66c9b3a35113896a272b2
|
entry/src/main/ets/model/HomeModel.ets
|
arkts
|
历史记录接口
|
export interface RecordItem {
id: number;
handler: string;
source: string;
result: string;
time: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface RecordItem 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 handler : 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 source : 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 result : 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 time : 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 RecordItem {
id: number;
handler: string;
source: string;
result: string;
time: string;
}
|
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/model/HomeModel.ets#L21-L27
|
28f0002fa397a4f092aa5c4c1505070ac136bc9b
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/game/GameificationService.ets
|
arkts
|
calculateUserLevel
|
计算用户等级
|
private calculateUserLevel(experience: number): UserLevel {
for (let i = this.levelConfig.length - 1; i >= 0; i--) {
if (experience >= this.levelConfig[i].requiredExp) {
return this.levelConfig[i];
}
}
return this.levelConfig[0];
}
|
AST#method_declaration#Left private calculateUserLevel AST#parameter_list#Left ( AST#parameter#Left experience : 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 UserLevel AST#primary_type#Right AST#type_annotation#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 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 . levelConfig 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#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right >= AST#expression#Left 0 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#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left experience AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . levelConfig AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . requiredExp AST#member_expression#Right AST#expression#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 . levelConfig AST#member_expression#Right 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 AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . levelConfig AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 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
|
private calculateUserLevel(experience: number): UserLevel {
for (let i = this.levelConfig.length - 1; i >= 0; i--) {
if (experience >= this.levelConfig[i].requiredExp) {
return this.levelConfig[i];
}
}
return this.levelConfig[0];
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L689-L696
|
43ba6d895bc577cdd330e5d16863770284d933b7
|
github
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/ui/chart/BaseChart.ets
|
arkts
|
基础图表组件
支持折线图、柱状图、饼图等
|
export interface ChartData {
label: string;
value: number;
color?: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ChartData AST#object_type#Left { AST#type_member#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left color ? : 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 ChartData {
label: string;
value: number;
color?: string;
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/chart/BaseChart.ets#L5-L9
|
abc6d24384a289dd869c4642be4aa713da2861b6
|
github
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/component/TextInputDialogView.ets
|
arkts
|
getVpByStr
|
获取vp数据
@param str
@returns
|
private getVpByStr(str: string): number {
if (str.toLowerCase().endsWith('vp')) {
str = str.replaceAll('vp', '');
return parseInt(str);
} else if (str.toLowerCase().endsWith('px')) {
str = str.replaceAll('px', '');
return px2vp(parseInt(str));
} else if (str.toLowerCase().endsWith('lpx')) {
str = str.replaceAll('lpx', '');
return lpx2px(px2vp(parseInt(str)));
} else if (str.toLowerCase().endsWith('fp')) {
str = str.replaceAll('fp', '');
return fp2px(px2vp(parseInt(str)));
} else {
return parseInt(str);
}
}
|
AST#method_declaration#Left private getVpByStr AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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#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 str AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'vp' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . replaceAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'vp' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'px' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . replaceAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'px' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#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 str AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'lpx' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . replaceAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'lpx' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left lpx2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'fp' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . replaceAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'fp' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left fp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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#block_statement#Right AST#method_declaration#Right
|
private getVpByStr(str: string): number {
if (str.toLowerCase().endsWith('vp')) {
str = str.replaceAll('vp', '');
return parseInt(str);
} else if (str.toLowerCase().endsWith('px')) {
str = str.replaceAll('px', '');
return px2vp(parseInt(str));
} else if (str.toLowerCase().endsWith('lpx')) {
str = str.replaceAll('lpx', '');
return lpx2px(px2vp(parseInt(str)));
} else if (str.toLowerCase().endsWith('fp')) {
str = str.replaceAll('fp', '');
return fp2px(px2vp(parseInt(str)));
} else {
return parseInt(str);
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/component/TextInputDialogView.ets#L226-L242
|
1a67d0364d8f4c4190e538bd90f618715941a49b
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
|
arkts
|
TODO 加解密公用工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/07/01
|
export class CryptoUtil {
/**
* 加密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param key 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/
static async encrypt(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, params);
let cipherData = await cipher.doFinal(data);
return cipherData;
}
/**
* 加密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param key 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/
static encryptSync(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher(transformation);
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, params);
let cipherData = cipher.doFinalSync(data);
return cipherData;
}
/**
* 解密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param key 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/
static async decrypt(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
let decoder = cryptoFramework.createCipher(transformation);
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, key, params);
let decryptData = await decoder.doFinal(data);
return decryptData;
}
/**
* 解密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param key 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/
static decryptSync(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
let decoder = cryptoFramework.createCipher(transformation);
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, key, params);
let decryptData = decoder.doFinalSync(data);
return decryptData;
}
/**
* 生成对称密钥SymKey,异步
* @param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
* @returns
*/
static async generateSymKey(algName: string): Promise<cryptoFramework.SymKey> {
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(algName); //创建对称密钥生成器
let symKey = await symKeyGenerator.generateSymKey(); //获取该对称密钥生成器随机生成的密钥
return symKey;
}
/**
* 生成对称密钥SymKey,同步
* @param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
* @returns
*/
static generateSymKeySync(algName: string): cryptoFramework.SymKey {
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(algName); //创建对称密钥生成器
let symKey = symKeyGenerator.generateSymKeySync(); //获取该对称密钥生成器随机生成的密钥
return symKey;
}
/**
* 获取转换的对称密钥SymKey,异步
* @param key 字符串key
* @param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @param keyLen 密钥规格的最小长度,默认为0,为0时不补全。
* @returns
*/
static async getConvertSymKey(algName: string, key: string | Uint8Array | cryptoFramework.DataBlob,
keyCoding: crypto.BhuCoding, keyLen: number = 0): Promise<cryptoFramework.SymKey> {
let symKeyBlob: cryptoFramework.DataBlob = CryptoHelper.getSymKeyDataBlob(key, keyCoding, keyLen);
let aesGenerator = cryptoFramework.createSymKeyGenerator(algName);
let symKey = await aesGenerator.convertKey(symKeyBlob);
return symKey;
}
/**
* 获取转换的对称密钥SymKey,同步
* @param key 字符串key
* @param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @param keyLen 密钥规格的最小长度,默认为0,为0时不补全。
* @returns
*/
static getConvertSymKeySync(algName: string, key: string | Uint8Array | cryptoFramework.DataBlob,
keyCoding: crypto.BhuCoding, keyLen: number = 0): cryptoFramework.SymKey {
let symKeyBlob: cryptoFramework.DataBlob = CryptoHelper.getSymKeyDataBlob(key, keyCoding, keyLen);
let aesGenerator = cryptoFramework.createSymKeyGenerator(algName);
let symKey = aesGenerator.convertKeySync(symKeyBlob);
return symKey;
}
/**
* 生成非对称密钥KeyPair,异步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)。
* @returns
*/
static async generateKeyPair(algName: string): Promise<cryptoFramework.KeyPair> {
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); //非对称密钥生成器的对象。
let keyPair = await asyKeyGenerator.generateKeyPair() //获取该非对称密钥生成器随机生成的密钥
return keyPair;
}
/**
* 生成非对称密钥KeyPair,同步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)。
* @returns
*/
static generateKeyPairSync(algName: string): cryptoFramework.KeyPair {
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); //非对称密钥生成器的对象。
let keyPair = asyKeyGenerator.generateKeyPairSync() //获取该非对称密钥生成器随机生成的密钥
return keyPair;
}
/**
* 获取转换的非对称密钥KeyPair,异步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)
* @param pubKey 公钥字符串
* @param priKey 私钥字符串
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @returns
*/
static async getConvertKeyPair(algName: string, pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding): Promise<cryptoFramework.KeyPair> {
let pubKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(pubKey, keyCoding);
let priKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(priKey, keyCoding);
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); //非对称密钥生成器的对象。
let keyPair = await asyKeyGenerator.convertKey(pubKeyBlob, priKeyBlob); //获取该非对称密钥生成器随机生成的密钥
return keyPair;
}
/**
* 获取转换的非对称密钥KeyPair,同步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)
* @param pubKey 公钥字符串
* @param priKey 私钥字符串
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @returns
*/
static getConvertKeyPairSync(algName: string, pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null,
keyCoding: crypto.BhuCoding): cryptoFramework.KeyPair {
let pubKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(pubKey, keyCoding);
let priKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(priKey, keyCoding);
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); //非对称密钥生成器的对象。
let keyPair = asyKeyGenerator.convertKeySync(pubKeyBlob, priKeyBlob); //获取该非对称密钥生成器随机生成的密钥
return keyPair;
}
/**
* 获取指定数据生成非对称密钥。
* @param algName
* @param pubKey 指定的公钥材料。如果公钥不需要转换,可直接传入null。
* @param priKey 指定的私钥材料。如果私钥不需要转换,可直接传入null。注:公钥和私钥材料不能同时为null。
* @returns
*/
static async getPemKeyPair(algName: string, pubKey: string, priKey: string): Promise<cryptoFramework.KeyPair> {
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName);
let keyPair = await asyKeyGenerator.convertPemKey(pubKey, priKey);
// let pubStr = keyPair.pubKey.getEncodedPem('X509');
// let priStr = keyPair.priKey.getEncodedPem('PKCS8');
return keyPair;
}
/**
* 生成IvParamsSpec
* @returns
*/
static generateIvParamsSpec(): cryptoFramework.IvParamsSpec {
let dataIv = CryptoHelper.getRandomUint8Array(16);
let ivBlob: cryptoFramework.DataBlob = { data: dataIv };
let ivParamsSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivBlob };
return ivParamsSpec;
}
/**
* 获取转换IvParamsSpec
* @param ivStr 字符串iv
* @param ivCoding 编码方式(base64/hex/utf8/utf-8)
* @returns
*/
static getIvParamsSpec(ivStr: string, ivCoding: crypto.BhuCoding): cryptoFramework.IvParamsSpec {
let ivBlob: cryptoFramework.DataBlob = { data: CryptoHelper.strToUint8Array(ivStr, ivCoding) };
let ivParamsSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivBlob };
return ivParamsSpec;
}
/**
* 生成GcmParamsSpec
*/
static generateGcmParamsSpec(): cryptoFramework.GcmParamsSpec {
let ivBlob: cryptoFramework.DataBlob = { data: CryptoHelper.getRandomUint8Array(12) };
let aadBlob: cryptoFramework.DataBlob = { data: CryptoHelper.getRandomUint8Array(8) };
let tagBlob: cryptoFramework.DataBlob = { data: CryptoHelper.getRandomUint8Array(16) };
//GCM的authTag在加密时从doFinal结果中获取,在解密时填入init函数的params参数中
let gcmParamsSpec: cryptoFramework.GcmParamsSpec = {
iv: ivBlob,
aad: aadBlob,
authTag: tagBlob,
algName: "GcmParamsSpec"
};
return gcmParamsSpec;
}
/**
* 获取转换GcmParamsSpec
*/
static getGcmParamsSpec(iv: Uint8Array, aad: Uint8Array, authTag: Uint8Array): cryptoFramework.GcmParamsSpec {
//GCM的authTag在加密时从doFinal结果中获取,在解密时填入init函数的params参数中
let gcmParamsSpec: cryptoFramework.GcmParamsSpec = {
iv: { data: iv },
aad: { data: aad },
authTag: { data: authTag },
algName: "GcmParamsSpec"
};
return gcmParamsSpec;
}
/**
* 对数据进行签名,异步
* @param dataBlob 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @returns
*/
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): Promise<cryptoFramework.DataBlob> {
let signer = cryptoFramework.createSign(algName);
await signer.init(priKey);
let signData = await signer.sign(dataBlob);
return signData;
}
/**
* 对数据进行签名,同步
* @param dataBlob 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @returns
*/
static signSync(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): cryptoFramework.DataBlob {
let signer = cryptoFramework.createSign(algName);
signer.initSync(priKey);
let signData = signer.signSync(dataBlob);
return signData;
}
/**
* 对数据进行验签,异步
* @param dataBlob 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @returns
*/
static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): Promise<boolean> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
let res = await verifier.verify(dataBlob, signDataBlob);
return res;
}
/**
* 对数据进行验签,同步
* @param dataBlob 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @returns
*/
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
let res = verifier.verifySync(dataBlob, signDataBlob);
return res;
}
/**
* 对数据进行分段签名,异步
* @param data 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @param len 自定义的数据拆分长度。
* @returns
*/
static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): Promise<cryptoFramework.DataBlob> {
let signer = cryptoFramework.createSign(algName);
await signer.init(priKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
await signer.update(updateDataBlob); //分段update
}
//已通过分段传入所有明文,故此处sign传入null
let signData = await signer.sign(null);
return signData;
}
/**
* 对数据进行分段签名,同步
* @param data 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @param len 自定义的数据拆分长度。
* @returns
*/
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): cryptoFramework.DataBlob {
let signer = cryptoFramework.createSign(algName);
signer.initSync(priKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
signer.updateSync(updateDataBlob); //分段update
}
//已通过分段传入所有明文,故此处sign传入null
let signData = signer.signSync(null);
return signData;
}
/**
* 对数据进行分段验签,异步
* @param data 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @param len 自定义的数据拆分长度。
* @returns
*/
static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): Promise<boolean> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
await verifier.update(updateDataBlob); //分段update
}
//已通过分段传入所有明文,故此处verify第一个参数传入null
let res = await verifier.verify(null, signDataBlob);
return res;
}
/**
* 对数据进行分段验签,同步
* @param data 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @param len 自定义的数据拆分长度。
* @returns
*/
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
verifier.updateSync(updateDataBlob); //分段update
}
//已通过分段传入所有明文,故此处verify第一个参数传入null
let res = verifier.verifySync(null, signDataBlob);
return res;
}
/**
* 密钥协商,异步
* @param algName 密钥协商算法规格(ECC256、X25519、DH_modp1536、等)
* @param pubKey 公钥(一般为外部传入)
* @param priKey 私钥
* @param coding 编码方式(base64/hex/utf8/utf-8)
* @returns 共享密钥
*/
static async dynamicKey(algName: string, pubKey: Uint8Array | string, priKey: Uint8Array | string, coding: crypto.BhuCoding): Promise<string> {
if (typeof pubKey === 'string') {
pubKey = CryptoHelper.strToUint8Array(pubKey, coding);
}
if (typeof priKey === 'string') {
priKey = CryptoHelper.strToUint8Array(priKey, coding);
}
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); //非对称密钥生成器的对象。
let keyPairA = await asyKeyGenerator.convertKey({ data: pubKey }, null); //转换公私钥
let keyPairB = await asyKeyGenerator.convertKey(null, { data: priKey }); //转换私钥
let keyAgreement = cryptoFramework.createKeyAgreement(algName); //使用密钥协商方法之前需要创建该实例进行操作
let secret = await keyAgreement.generateSecret(keyPairB.priKey, keyPairA.pubKey); //传入的私钥与公钥进行密钥协商
if (secret.data) {
return CryptoHelper.uint8ArrayToStr(secret.data, coding);
}
return "";
}
/**
* 密钥协商,同步
* @param algName 密钥协商算法规格(ECC256、X25519、DH_modp1536、等)
* @param pubKey 公钥(一般为外部传入)
* @param priKey 私钥
* @param coding 编码方式(base64/hex/utf8/utf-8)
* @returns 共享密钥
*/
static dynamicKeySync(algName: string, pubKey: Uint8Array | string, priKey: Uint8Array | string, coding: crypto.BhuCoding): string {
if (typeof pubKey === 'string') {
pubKey = CryptoHelper.strToUint8Array(pubKey, coding);
}
if (typeof priKey === 'string') {
priKey = CryptoHelper.strToUint8Array(priKey, coding);
}
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); //非对称密钥生成器的对象。
let keyPairA = asyKeyGenerator.convertKeySync({ data: pubKey }, null); //转换公私钥
let keyPairB = asyKeyGenerator.convertKeySync(null, { data: priKey }); //转换私钥
let keyAgreement = cryptoFramework.createKeyAgreement(algName); //使用密钥协商方法之前需要创建该实例进行操作
let secret = keyAgreement.generateSecretSync(keyPairB.priKey, keyPairA.pubKey); //传入的私钥与公钥进行密钥协商
if (secret.data) {
return CryptoHelper.uint8ArrayToStr(secret.data, coding);
}
return "";
}
/**
* 摘要,异步
* @param data 待摘要的数据
* @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param resultCoding 摘要的编码方式(base64/hex)
* @returns
*/
static async digest(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
let md = cryptoFramework.createMd(algName);
//数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制
await md.update({ data: CryptoHelper.strToUint8Array(data, 'utf-8') });
let dataBlob = await md.digest();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
/**
* 摘要,同步
* @param data 待摘要的数据
* @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @returns
*/
static digestSync(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex'): string {
let md = cryptoFramework.createMd(algName);
//数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制
md.updateSync({ data: CryptoHelper.strToUint8Array(data, 'utf-8') });
let dataBlob = md.digestSync();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
/**
* 摘要,分段,同步
* @param data 待摘要的数据
* @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @param len 自定义的数据拆分长度
* @returns
*/
static async digestSegment(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
let md = cryptoFramework.createMd(algName);
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
for (let i = 0; i < messageData.length; i += len) {
let updateMessage = messageData.subarray(i, i + len);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
await md.update(updateMessageBlob);
}
let dataBlob = await md.digest();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
/**
* 摘要,分段,同步
* @param data 待摘要的数据
* @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @param len 自定义的数据拆分长度
* @returns
*/
static digestSegmentSync(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string {
let md = cryptoFramework.createMd(algName);
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
for (let i = 0; i < messageData.length; i += len) {
let updateMessage = messageData.subarray(i, i + len);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
md.updateSync(updateMessageBlob);
}
let dataBlob = md.digestSync();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
/**
* 消息认证码计算,异步
* @param data 传入的消息
* @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param symKey 共享对称密钥(SymKey)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
*/
static async hmac(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
let mac = cryptoFramework.createMac(algName);
await mac.init(symKey); //使用对称密钥初始化Mac计算
//数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制
await mac.update({ data: CryptoHelper.strToUint8Array(data, 'utf-8') }); //传入消息进行Mac更新计算
let dataBlob = await mac.doFinal(); //通过注册回调函数返回Mac的计算结果
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
/**
* 消息认证码计算,同步
* @param data 传入的消息
* @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param symKey 共享对称密钥(SymKey)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
*/
static hmacSync(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex'): string {
let mac = cryptoFramework.createMac(algName);
mac.initSync(symKey); //使用对称密钥初始化Mac计算
//数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制
mac.updateSync({ data: CryptoHelper.strToUint8Array(data, 'utf-8') }); //传入消息进行Mac更新计算
let dataBlob = mac.doFinalSync(); //通过注册回调函数返回Mac的计算结果
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
/**
* 消息认证码计算,分段,异步
* @param data 传入的消息
* @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param symKey 共享对称密钥(SymKey)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @param len 自定义的数据拆分长度
*/
static async hmacSegment(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
let mac = cryptoFramework.createMac(algName);
await mac.init(symKey); //使用对称密钥初始化Mac计算
for (let i = 0; i < messageData.length; i += len) {
let updateMessage = messageData.subarray(i, i + len);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
await mac.update(updateMessageBlob); //传入消息进行Mac更新计算
}
let dataBlob = await mac.doFinal(); //通过注册回调函数返回Mac的计算结果
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
/**
* 消息认证码计算,分段,同步
* @param data 传入的消息
* @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param symKey 共享对称密钥(SymKey)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @param len 自定义的数据拆分长度
*/
static hmacSegmentSync(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex', len: number = 128): string {
if (typeof symKey === 'string') {
symKey = CryptoUtil.generateSymKeySync(symKey); //生成对称密钥
}
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
let mac = cryptoFramework.createMac(algName);
mac.initSync(symKey); //使用对称密钥初始化Mac计算
for (let i = 0; i < messageData.length; i += len) {
let updateMessage = messageData.subarray(i, i + len);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
mac.updateSync(updateMessageBlob); //传入消息进行Mac更新计算
}
let dataBlob = mac.doFinalSync(); //通过注册回调函数返回Mac的计算结果
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CryptoUtil AST#class_body#Left { /**
* 加密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param key 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/ AST#method_declaration#Left static async encrypt 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 key : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . Key AST#qualified_type#Right 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#qualified_type#Left cryptoFramework . ParamsSpec AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : 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 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 transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left 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 key AST#expression#Right , AST#expression#Left params AST#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 cipherData = 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 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 AST#statement#Left AST#return_statement#Left return AST#expression#Left cipherData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 加密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param key 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/ AST#method_declaration#Left static encryptSync 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 key : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . Key AST#qualified_type#Right 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#qualified_type#Left cryptoFramework . ParamsSpec AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : 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 cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left 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 transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cipher AST#expression#Right . initSync 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 key AST#expression#Right , AST#expression#Left params AST#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 cipherData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cipher AST#expression#Right . doFinalSync 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 AST#statement#Left AST#return_statement#Left return AST#expression#Left cipherData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 解密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param key 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/ AST#method_declaration#Left static async decrypt 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 key : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . Key AST#qualified_type#Right 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#qualified_type#Left cryptoFramework . ParamsSpec AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : 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 AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . DECRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left params AST#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 decryptData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 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 AST#statement#Left AST#return_statement#Left return AST#expression#Left decryptData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 解密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param key 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
* @returns
*/ AST#method_declaration#Left static decryptSync 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 key : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . Key AST#qualified_type#Right 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#qualified_type#Left cryptoFramework . ParamsSpec AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : 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 cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decoder AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . DECRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left params AST#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 decryptData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decoder AST#expression#Right . doFinalSync 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 AST#statement#Left AST#return_statement#Left return AST#expression#Left decryptData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成对称密钥SymKey,异步
* @param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
* @returns
*/ AST#method_declaration#Left static async generateSymKey AST#parameter_list#Left ( AST#parameter#Left algName : 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 AST#qualified_type#Left cryptoFramework . SymKey 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 symKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSymKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //创建对称密钥生成器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left symKeyGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . generateSymKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //获取该对称密钥生成器随机生成的密钥 AST#statement#Left AST#return_statement#Left return AST#expression#Left symKey AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成对称密钥SymKey,同步
* @param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
* @returns
*/ AST#method_declaration#Left static generateSymKeySync AST#parameter_list#Left ( AST#parameter#Left algName : 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 cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSymKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //创建对称密钥生成器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left symKeyGenerator AST#expression#Right . generateSymKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //获取该对称密钥生成器随机生成的密钥 AST#statement#Left AST#return_statement#Left return AST#expression#Left symKey AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取转换的对称密钥SymKey,异步
* @param key 字符串key
* @param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @param keyLen 密钥规格的最小长度,默认为0,为0时不补全。
* @returns
*/ AST#method_declaration#Left static async getConvertSymKey AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyLen : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < 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#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 symKeyBlob : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getSymKeyDataBlob AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left keyLen 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 aesGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSymKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left aesGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . convertKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symKeyBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left symKey AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取转换的对称密钥SymKey,同步
* @param key 字符串key
* @param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @param keyLen 密钥规格的最小长度,默认为0,为0时不补全。
* @returns
*/ AST#method_declaration#Left static getConvertSymKeySync AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyLen : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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#variable_declaration#Left let AST#variable_declarator#Left symKeyBlob : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getSymKeyDataBlob AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left keyLen 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 aesGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSymKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left aesGenerator AST#expression#Right . convertKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symKeyBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left symKey AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成非对称密钥KeyPair,异步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)。
* @returns
*/ AST#method_declaration#Left static async generateKeyPair AST#parameter_list#Left ( AST#parameter#Left algName : 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 AST#qualified_type#Left cryptoFramework . KeyPair 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 asyKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 keyPair = 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 asyKeyGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . generateKeyPair AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right //获取该非对称密钥生成器随机生成的密钥 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left keyPair AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成非对称密钥KeyPair,同步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)。
* @returns
*/ AST#method_declaration#Left static generateKeyPairSync AST#parameter_list#Left ( AST#parameter#Left algName : 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 cryptoFramework . KeyPair AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left asyKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 keyPair = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left asyKeyGenerator AST#expression#Right . generateKeyPairSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right //获取该非对称密钥生成器随机生成的密钥 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left keyPair AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取转换的非对称密钥KeyPair,异步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)
* @param pubKey 公钥字符串
* @param priKey 私钥字符串
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @returns
*/ AST#method_declaration#Left static async getConvertKeyPair AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding 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 . KeyPair 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 pubKeyBlob : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getKeyDataBlob AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left priKeyBlob : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getKeyDataBlob AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left priKey AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left asyKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 keyPair = 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 asyKeyGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . convertKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKeyBlob AST#expression#Right , AST#expression#Left priKeyBlob 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 keyPair AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取转换的非对称密钥KeyPair,同步
* @param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)
* @param pubKey 公钥字符串
* @param priKey 私钥字符串
* @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
* @returns
*/ AST#method_declaration#Left static getConvertKeyPairSync AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . KeyPair AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pubKeyBlob : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getKeyDataBlob AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left priKeyBlob : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getKeyDataBlob AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left priKey AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left asyKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 keyPair = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left asyKeyGenerator AST#expression#Right . convertKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKeyBlob AST#expression#Right , AST#expression#Left priKeyBlob 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 keyPair AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取指定数据生成非对称密钥。
* @param algName
* @param pubKey 指定的公钥材料。如果公钥不需要转换,可直接传入null。
* @param priKey 指定的私钥材料。如果私钥不需要转换,可直接传入null。注:公钥和私钥材料不能同时为null。
* @returns
*/ AST#method_declaration#Left static async getPemKeyPair AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . KeyPair 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 asyKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 keyPair = 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 asyKeyGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . convertPemKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left priKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // let pubStr = keyPair.pubKey.getEncodedPem('X509'); // let priStr = keyPair.priKey.getEncodedPem('PKCS8'); AST#statement#Left AST#return_statement#Left return AST#expression#Left keyPair AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成IvParamsSpec
* @returns
*/ AST#method_declaration#Left static generateIvParamsSpec AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataIv = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getRandomUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ivBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left dataIv 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 ivParamsSpec : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left algName AST#property_name#Right : AST#expression#Left "IvParamsSpec" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iv AST#property_name#Right : AST#expression#Left ivBlob 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 ivParamsSpec AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取转换IvParamsSpec
* @param ivStr 字符串iv
* @param ivCoding 编码方式(base64/hex/utf8/utf-8)
* @returns
*/ AST#method_declaration#Left static getIvParamsSpec AST#parameter_list#Left ( AST#parameter#Left ivStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ivCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . IvParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ivBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ivStr AST#expression#Right , AST#expression#Left ivCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ivParamsSpec : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left algName AST#property_name#Right : AST#expression#Left "IvParamsSpec" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iv AST#property_name#Right : AST#expression#Left ivBlob 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 ivParamsSpec AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成GcmParamsSpec
*/ AST#method_declaration#Left static generateGcmParamsSpec AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ivBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getRandomUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 12 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left aadBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getRandomUint8Array 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#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 tagBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . getRandomUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //GCM的authTag在加密时从doFinal结果中获取,在解密时填入init函数的params参数中 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left gcmParamsSpec : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iv AST#property_name#Right : AST#expression#Left ivBlob AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left aad AST#property_name#Right : AST#expression#Left aadBlob AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left authTag AST#property_name#Right : AST#expression#Left tagBlob AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left algName AST#property_name#Right : AST#expression#Left "GcmParamsSpec" 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 gcmParamsSpec AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取转换GcmParamsSpec
*/ AST#method_declaration#Left static getGcmParamsSpec AST#parameter_list#Left ( AST#parameter#Left iv : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aad : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left authTag : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . GcmParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //GCM的authTag在加密时从doFinal结果中获取,在解密时填入init函数的params参数中 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left gcmParamsSpec : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iv AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left iv AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left aad AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left aad AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left authTag AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left authTag AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left algName AST#property_name#Right : AST#expression#Left "GcmParamsSpec" 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 gcmParamsSpec AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行签名,异步
* @param dataBlob 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @returns
*/ AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left dataBlob : 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 priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : 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 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 signer = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 signer 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 priKey AST#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 signData = 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 signer AST#expression#Right AST#await_expression#Right AST#expression#Right . sign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob 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 signData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行签名,同步
* @param dataBlob 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @returns
*/ AST#method_declaration#Left static signSync AST#parameter_list#Left ( AST#parameter#Left dataBlob : 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 priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : 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 cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left signer = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 signer AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left priKey AST#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 signData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left signer AST#expression#Right . signSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob 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 signData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行验签,异步
* @param dataBlob 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @returns
*/ AST#method_declaration#Left static async verify AST#parameter_list#Left ( AST#parameter#Left dataBlob : 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 signDataBlob : 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 pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : 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 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 let AST#variable_declarator#Left verifier = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createVerify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 verifier 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 pubKey AST#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 res = 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 verifier AST#expression#Right AST#await_expression#Right AST#expression#Right . verify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob AST#expression#Right , AST#expression#Left signDataBlob 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 res AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行验签,同步
* @param dataBlob 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @returns
*/ AST#method_declaration#Left static verifySync AST#parameter_list#Left ( AST#parameter#Left dataBlob : 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 signDataBlob : 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 pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : 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#variable_declaration#Left let AST#variable_declarator#Left verifier = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createVerify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 verifier AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#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 res = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifier AST#expression#Right . verifySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob AST#expression#Right , AST#expression#Left signDataBlob 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 res AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行分段签名,异步
* @param data 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @param len 自定义的数据拆分长度。
* @returns
*/ AST#method_declaration#Left static async signSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#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 signer = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 signer 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 priKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateDataBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateData AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left signer 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 updateDataBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //分段update } AST#block_statement#Right AST#for_statement#Right AST#statement#Right //已通过分段传入所有明文,故此处sign传入null AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left signData = 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 signer AST#expression#Right AST#await_expression#Right AST#expression#Right . sign 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left signData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行分段签名,同步
* @param data 待签名数据
* @param priKey 私钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @param len 自定义的数据拆分长度。
* @returns
*/ AST#method_declaration#Left static signSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : 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#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left signer = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 signer AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left priKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateDataBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateData AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left signer AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateDataBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //分段update } AST#block_statement#Right AST#for_statement#Right AST#statement#Right //已通过分段传入所有明文,故此处sign传入null AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left signData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left signer AST#expression#Right . signSync 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left signData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行分段验签,异步
* @param data 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @param len 自定义的数据拆分长度。
* @returns
*/ AST#method_declaration#Left static async verifySegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : 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 pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left verifier = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createVerify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 verifier 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 pubKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateDataBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateData AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left verifier 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 updateDataBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //分段update } AST#block_statement#Right AST#for_statement#Right AST#statement#Right //已通过分段传入所有明文,故此处verify第一个参数传入null AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res = 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 verifier AST#expression#Right AST#await_expression#Right AST#expression#Right . verify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left signDataBlob 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 res AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 对数据进行分段验签,同步
* @param data 待验签数据
* @param signDataBlob 签名数据
* @param pubKey 公钥
* @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
* @param len 自定义的数据拆分长度。
* @returns
*/ AST#method_declaration#Left static verifySegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : 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 pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left verifier = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createVerify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 verifier AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateDataBlob : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateData AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifier AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateDataBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //分段update } AST#block_statement#Right AST#for_statement#Right AST#statement#Right //已通过分段传入所有明文,故此处verify第一个参数传入null AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifier AST#expression#Right . verifySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left signDataBlob 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 res AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 密钥协商,异步
* @param algName 密钥协商算法规格(ECC256、X25519、DH_modp1536、等)
* @param pubKey 公钥(一般为外部传入)
* @param priKey 私钥
* @param coding 编码方式(base64/hex/utf8/utf-8)
* @returns 共享密钥
*/ AST#method_declaration#Left static async dynamicKey AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left coding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding 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 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#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#unary_expression#Left typeof AST#expression#Left pubKey AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pubKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left coding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left priKey AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left priKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left priKey AST#expression#Right , AST#expression#Left coding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left asyKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left keyPairA = 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 asyKeyGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . convertKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left pubKey AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //转换公私钥 AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left keyPairB = 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 asyKeyGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . convertKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left priKey AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //转换私钥 AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left keyAgreement = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createKeyAgreement AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left secret = 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 keyAgreement AST#expression#Right AST#await_expression#Right AST#expression#Right . generateSecret AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left keyPairB AST#expression#Right . priKey AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left keyPairA AST#expression#Right . pubKey AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //传入的私钥与公钥进行密钥协商 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left secret AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left secret AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left coding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left "" AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 密钥协商,同步
* @param algName 密钥协商算法规格(ECC256、X25519、DH_modp1536、等)
* @param pubKey 公钥(一般为外部传入)
* @param priKey 私钥
* @param coding 编码方式(base64/hex/utf8/utf-8)
* @returns 共享密钥
*/ AST#method_declaration#Left static dynamicKeySync AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left coding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#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#unary_expression#Left typeof AST#expression#Left pubKey AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pubKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left coding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left priKey AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left priKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left priKey AST#expression#Right , AST#expression#Left coding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left asyKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left keyPairA = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left asyKeyGenerator AST#expression#Right . convertKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left pubKey AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //转换公私钥 AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left keyPairB = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left asyKeyGenerator AST#expression#Right . convertKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left priKey AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //转换私钥 AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left keyAgreement = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createKeyAgreement AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left secret = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left keyAgreement AST#expression#Right . generateSecretSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left keyPairB AST#expression#Right . priKey AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left keyPairA AST#expression#Right . pubKey AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //传入的私钥与公钥进行密钥协商 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left secret AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left secret AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left coding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left "" AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 摘要,异步
* @param data 待摘要的数据
* @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param resultCoding 摘要的编码方式(base64/hex)
* @returns
*/ AST#method_declaration#Left static async digest AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left md = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createMd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 //数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制 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 md 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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left 'utf-8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataBlob = 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 md AST#expression#Right AST#await_expression#Right AST#expression#Right . digest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 摘要,同步
* @param data 待摘要的数据
* @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @returns
*/ AST#method_declaration#Left static digestSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left md = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createMd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 //数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left md AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left 'utf-8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataBlob = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left md AST#expression#Right . digestSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 摘要,分段,同步
* @param data 待摘要的数据
* @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @param len 自定义的数据拆分长度
* @returns
*/ AST#method_declaration#Left static async digestSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left md = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createMd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left messageData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left 'utf-8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left messageData AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messageData AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessageBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateMessage AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left md 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 updateMessageBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataBlob = 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 md AST#expression#Right AST#await_expression#Right AST#expression#Right . digest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 摘要,分段,同步
* @param data 待摘要的数据
* @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @param len 自定义的数据拆分长度
* @returns
*/ AST#method_declaration#Left static digestSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left md = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createMd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left messageData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left 'utf-8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left messageData AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messageData AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessageBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateMessage AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left md AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateMessageBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataBlob = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left md AST#expression#Right . digestSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 消息认证码计算,异步
* @param data 传入的消息
* @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param symKey 共享对称密钥(SymKey)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
*/ AST#method_declaration#Left static async hmac AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string 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 resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mac = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createMac AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 mac 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 symKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //使用对称密钥初始化Mac计算 //数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制 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 mac 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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left 'utf-8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //传入消息进行Mac更新计算 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataBlob = 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 mac AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal 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 //通过注册回调函数返回Mac的计算结果 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 CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 消息认证码计算,同步
* @param data 传入的消息
* @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param symKey 共享对称密钥(SymKey)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
*/ AST#method_declaration#Left static hmacSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string 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 resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mac = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createMac AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 mac AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //使用对称密钥初始化Mac计算 //数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mac AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left 'utf-8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //传入消息进行Mac更新计算 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataBlob = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mac AST#expression#Right . doFinalSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //通过注册回调函数返回Mac的计算结果 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 CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 消息认证码计算,分段,异步
* @param data 传入的消息
* @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param symKey 共享对称密钥(SymKey)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @param len 自定义的数据拆分长度
*/ AST#method_declaration#Left static async hmacSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string 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 resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left messageData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left 'utf-8' 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 mac = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createMac AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 mac 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 symKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //使用对称密钥初始化Mac计算 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left messageData AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messageData AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessageBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateMessage AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left mac 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 updateMessageBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //传入消息进行Mac更新计算 } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataBlob = 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 mac AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal 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 //通过注册回调函数返回Mac的计算结果 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 CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 消息认证码计算,分段,同步
* @param data 传入的消息
* @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
* @param symKey 共享对称密钥(SymKey)。
* @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
* @param len 自定义的数据拆分长度
*/ AST#method_declaration#Left static hmacSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string 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 resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hex' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left symKey AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left symKey = 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 symKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //生成对称密钥 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left messageData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left 'utf-8' 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 mac = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createMac AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName 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 mac AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //使用对称密钥初始化Mac计算 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left messageData AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messageData AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessageBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateMessage AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mac AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateMessageBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //传入消息进行Mac更新计算 } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataBlob = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mac AST#expression#Right . doFinalSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //通过注册回调函数返回Mac的计算结果 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 CryptoHelper AST#expression#Right . uint8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class CryptoUtil {
static async encrypt(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, params);
let cipherData = await cipher.doFinal(data);
return cipherData;
}
static encryptSync(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher(transformation);
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, params);
let cipherData = cipher.doFinalSync(data);
return cipherData;
}
static async decrypt(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
let decoder = cryptoFramework.createCipher(transformation);
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, key, params);
let decryptData = await decoder.doFinal(data);
return decryptData;
}
static decryptSync(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
let decoder = cryptoFramework.createCipher(transformation);
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, key, params);
let decryptData = decoder.doFinalSync(data);
return decryptData;
}
static async generateSymKey(algName: string): Promise<cryptoFramework.SymKey> {
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(algName);
let symKey = await symKeyGenerator.generateSymKey();
return symKey;
}
static generateSymKeySync(algName: string): cryptoFramework.SymKey {
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(algName);
let symKey = symKeyGenerator.generateSymKeySync();
return symKey;
}
static async getConvertSymKey(algName: string, key: string | Uint8Array | cryptoFramework.DataBlob,
keyCoding: crypto.BhuCoding, keyLen: number = 0): Promise<cryptoFramework.SymKey> {
let symKeyBlob: cryptoFramework.DataBlob = CryptoHelper.getSymKeyDataBlob(key, keyCoding, keyLen);
let aesGenerator = cryptoFramework.createSymKeyGenerator(algName);
let symKey = await aesGenerator.convertKey(symKeyBlob);
return symKey;
}
static getConvertSymKeySync(algName: string, key: string | Uint8Array | cryptoFramework.DataBlob,
keyCoding: crypto.BhuCoding, keyLen: number = 0): cryptoFramework.SymKey {
let symKeyBlob: cryptoFramework.DataBlob = CryptoHelper.getSymKeyDataBlob(key, keyCoding, keyLen);
let aesGenerator = cryptoFramework.createSymKeyGenerator(algName);
let symKey = aesGenerator.convertKeySync(symKeyBlob);
return symKey;
}
static async generateKeyPair(algName: string): Promise<cryptoFramework.KeyPair> {
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName);
let keyPair = await asyKeyGenerator.generateKeyPair()
return keyPair;
}
static generateKeyPairSync(algName: string): cryptoFramework.KeyPair {
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName);
let keyPair = asyKeyGenerator.generateKeyPairSync()
return keyPair;
}
static async getConvertKeyPair(algName: string, pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding): Promise<cryptoFramework.KeyPair> {
let pubKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(pubKey, keyCoding);
let priKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(priKey, keyCoding);
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName);
let keyPair = await asyKeyGenerator.convertKey(pubKeyBlob, priKeyBlob);
return keyPair;
}
static getConvertKeyPairSync(algName: string, pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null,
keyCoding: crypto.BhuCoding): cryptoFramework.KeyPair {
let pubKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(pubKey, keyCoding);
let priKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(priKey, keyCoding);
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName);
let keyPair = asyKeyGenerator.convertKeySync(pubKeyBlob, priKeyBlob);
return keyPair;
}
static async getPemKeyPair(algName: string, pubKey: string, priKey: string): Promise<cryptoFramework.KeyPair> {
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName);
let keyPair = await asyKeyGenerator.convertPemKey(pubKey, priKey);
return keyPair;
}
static generateIvParamsSpec(): cryptoFramework.IvParamsSpec {
let dataIv = CryptoHelper.getRandomUint8Array(16);
let ivBlob: cryptoFramework.DataBlob = { data: dataIv };
let ivParamsSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivBlob };
return ivParamsSpec;
}
static getIvParamsSpec(ivStr: string, ivCoding: crypto.BhuCoding): cryptoFramework.IvParamsSpec {
let ivBlob: cryptoFramework.DataBlob = { data: CryptoHelper.strToUint8Array(ivStr, ivCoding) };
let ivParamsSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivBlob };
return ivParamsSpec;
}
static generateGcmParamsSpec(): cryptoFramework.GcmParamsSpec {
let ivBlob: cryptoFramework.DataBlob = { data: CryptoHelper.getRandomUint8Array(12) };
let aadBlob: cryptoFramework.DataBlob = { data: CryptoHelper.getRandomUint8Array(8) };
let tagBlob: cryptoFramework.DataBlob = { data: CryptoHelper.getRandomUint8Array(16) };
let gcmParamsSpec: cryptoFramework.GcmParamsSpec = {
iv: ivBlob,
aad: aadBlob,
authTag: tagBlob,
algName: "GcmParamsSpec"
};
return gcmParamsSpec;
}
static getGcmParamsSpec(iv: Uint8Array, aad: Uint8Array, authTag: Uint8Array): cryptoFramework.GcmParamsSpec {
let gcmParamsSpec: cryptoFramework.GcmParamsSpec = {
iv: { data: iv },
aad: { data: aad },
authTag: { data: authTag },
algName: "GcmParamsSpec"
};
return gcmParamsSpec;
}
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): Promise<cryptoFramework.DataBlob> {
let signer = cryptoFramework.createSign(algName);
await signer.init(priKey);
let signData = await signer.sign(dataBlob);
return signData;
}
static signSync(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): cryptoFramework.DataBlob {
let signer = cryptoFramework.createSign(algName);
signer.initSync(priKey);
let signData = signer.signSync(dataBlob);
return signData;
}
static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): Promise<boolean> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
let res = await verifier.verify(dataBlob, signDataBlob);
return res;
}
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
let res = verifier.verifySync(dataBlob, signDataBlob);
return res;
}
static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): Promise<cryptoFramework.DataBlob> {
let signer = cryptoFramework.createSign(algName);
await signer.init(priKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
await signer.update(updateDataBlob);
}
let signData = await signer.sign(null);
return signData;
}
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): cryptoFramework.DataBlob {
let signer = cryptoFramework.createSign(algName);
signer.initSync(priKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
signer.updateSync(updateDataBlob);
}
let signData = signer.signSync(null);
return signData;
}
static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): Promise<boolean> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
await verifier.update(updateDataBlob);
}
let res = await verifier.verify(null, signDataBlob);
return res;
}
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
verifier.updateSync(updateDataBlob);
}
let res = verifier.verifySync(null, signDataBlob);
return res;
}
static async dynamicKey(algName: string, pubKey: Uint8Array | string, priKey: Uint8Array | string, coding: crypto.BhuCoding): Promise<string> {
if (typeof pubKey === 'string') {
pubKey = CryptoHelper.strToUint8Array(pubKey, coding);
}
if (typeof priKey === 'string') {
priKey = CryptoHelper.strToUint8Array(priKey, coding);
}
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName);
let keyPairA = await asyKeyGenerator.convertKey({ data: pubKey }, null);
let keyPairB = await asyKeyGenerator.convertKey(null, { data: priKey });
let keyAgreement = cryptoFramework.createKeyAgreement(algName);
let secret = await keyAgreement.generateSecret(keyPairB.priKey, keyPairA.pubKey);
if (secret.data) {
return CryptoHelper.uint8ArrayToStr(secret.data, coding);
}
return "";
}
static dynamicKeySync(algName: string, pubKey: Uint8Array | string, priKey: Uint8Array | string, coding: crypto.BhuCoding): string {
if (typeof pubKey === 'string') {
pubKey = CryptoHelper.strToUint8Array(pubKey, coding);
}
if (typeof priKey === 'string') {
priKey = CryptoHelper.strToUint8Array(priKey, coding);
}
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName);
let keyPairA = asyKeyGenerator.convertKeySync({ data: pubKey }, null);
let keyPairB = asyKeyGenerator.convertKeySync(null, { data: priKey });
let keyAgreement = cryptoFramework.createKeyAgreement(algName);
let secret = keyAgreement.generateSecretSync(keyPairB.priKey, keyPairA.pubKey);
if (secret.data) {
return CryptoHelper.uint8ArrayToStr(secret.data, coding);
}
return "";
}
static async digest(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
let md = cryptoFramework.createMd(algName);
await md.update({ data: CryptoHelper.strToUint8Array(data, 'utf-8') });
let dataBlob = await md.digest();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
static digestSync(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex'): string {
let md = cryptoFramework.createMd(algName);
md.updateSync({ data: CryptoHelper.strToUint8Array(data, 'utf-8') });
let dataBlob = md.digestSync();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
static async digestSegment(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
let md = cryptoFramework.createMd(algName);
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
for (let i = 0; i < messageData.length; i += len) {
let updateMessage = messageData.subarray(i, i + len);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
await md.update(updateMessageBlob);
}
let dataBlob = await md.digest();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
static digestSegmentSync(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string {
let md = cryptoFramework.createMd(algName);
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
for (let i = 0; i < messageData.length; i += len) {
let updateMessage = messageData.subarray(i, i + len);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
md.updateSync(updateMessageBlob);
}
let dataBlob = md.digestSync();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
static async hmac(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
let mac = cryptoFramework.createMac(algName);
await mac.init(symKey);
await mac.update({ data: CryptoHelper.strToUint8Array(data, 'utf-8') });
let dataBlob = await mac.doFinal();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
static hmacSync(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex'): string {
let mac = cryptoFramework.createMac(algName);
mac.initSync(symKey);
mac.updateSync({ data: CryptoHelper.strToUint8Array(data, 'utf-8') });
let dataBlob = mac.doFinalSync();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
static async hmacSegment(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
let mac = cryptoFramework.createMac(algName);
await mac.init(symKey);
for (let i = 0; i < messageData.length; i += len) {
let updateMessage = messageData.subarray(i, i + len);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
await mac.update(updateMessageBlob);
}
let dataBlob = await mac.doFinal();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
static hmacSegmentSync(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex', len: number = 128): string {
if (typeof symKey === 'string') {
symKey = CryptoUtil.generateSymKeySync(symKey);
}
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
let mac = cryptoFramework.createMac(algName);
mac.initSync(symKey);
for (let i = 0; i < messageData.length; i += len) {
let updateMessage = messageData.subarray(i, i + len);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
mac.updateSync(updateMessageBlob);
}
let dataBlob = mac.doFinalSync();
let result = CryptoHelper.uint8ArrayToStr(dataBlob.data, resultCoding);
return result;
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L26-L652
|
1c9cbb872b52c2210cadccf736d30f59cdd3f4a4
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/UniversialData.ets
|
arkts
|
univesal/properties/InteractionSample
|
export let placementsNameData = ['TopLeft', 'Top', 'TopRight', 'RightTop', 'Right', 'RightBottom', 'LeftTop', 'Left', 'LeftBottom', 'BottomLeft', 'Bottom', 'BottomRight'];
|
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left placementsNameData = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'TopLeft' AST#expression#Right , AST#expression#Left 'Top' AST#expression#Right , AST#expression#Left 'TopRight' AST#expression#Right , AST#expression#Left 'RightTop' AST#expression#Right , AST#expression#Left 'Right' AST#expression#Right , AST#expression#Left 'RightBottom' AST#expression#Right , AST#expression#Left 'LeftTop' AST#expression#Right , AST#expression#Left 'Left' AST#expression#Right , AST#expression#Left 'LeftBottom' AST#expression#Right , AST#expression#Left 'BottomLeft' AST#expression#Right , AST#expression#Left 'Bottom' AST#expression#Right , AST#expression#Left 'BottomRight' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export let placementsNameData = ['TopLeft', 'Top', 'TopRight', 'RightTop', 'Right', 'RightBottom', 'LeftTop', 'Left', 'LeftBottom', 'BottomLeft', 'Bottom', 'BottomRight'];
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/UniversialData.ets#L292-L292
|
7581a439034ed282514062435c5ea2a6ffee871c
|
gitee
|
|
conradsheeran/steam-totp.git
|
af0eba089e77ff73e6983ce61fa89190c628721e
|
src/main/ets/pages/SteamTOTP.ets
|
arkts
|
generateConfirmationCode
|
生成用于移动交易确认的 base64 确认密钥。该密钥只能使用一次。
@param identitySecret - 启用双重身份验证时获得的 identity_secret
@param time - 生成 secret 的 Unix 时间戳,通常为当前时间
@param tag - 标识请求的标签,例如 "conf"、"details"、"allow"、"cancel"
@returns { string }
|
public static async generateConfirmationCode(identitySecret: buffer.Buffer | string, time: number, tag: string): Promise<string> {
const secretBuffer: buffer.Buffer = SteamTOTP.SecretToBuffer(identitySecret);
const data = buffer.alloc(8 + buffer.byteLength(tag));
data.writeBigUInt64BE(BigInt(time), 0);
if (tag) {
data.write(tag, 8);
}
const HMAC = await GenerateHMAC(secretBuffer.buffer, data.buffer, "SHA1");
return new util.Base64Helper().encodeToStringSync(HMAC);
}
|
AST#method_declaration#Left public static async generateConfirmationCode AST#parameter_list#Left ( AST#parameter#Left identitySecret : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left buffer . Buffer AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left secretBuffer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . Buffer 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 SteamTOTP AST#expression#Right . SecretToBuffer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left identitySecret AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left buffer AST#expression#Right . alloc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 8 AST#expression#Right + AST#expression#Left buffer AST#expression#Right AST#binary_expression#Right AST#expression#Right . byteLength AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . writeBigUInt64BE AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left time AST#expression#Right ) 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left tag AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . write AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tag AST#expression#Right , 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#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left HMAC = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left GenerateHMAC AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left secretBuffer AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right , AST#expression#Left "SHA1" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . encodeToStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left HMAC 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 async generateConfirmationCode(identitySecret: buffer.Buffer | string, time: number, tag: string): Promise<string> {
const secretBuffer: buffer.Buffer = SteamTOTP.SecretToBuffer(identitySecret);
const data = buffer.alloc(8 + buffer.byteLength(tag));
data.writeBigUInt64BE(BigInt(time), 0);
if (tag) {
data.write(tag, 8);
}
const HMAC = await GenerateHMAC(secretBuffer.buffer, data.buffer, "SHA1");
return new util.Base64Helper().encodeToStringSync(HMAC);
}
|
https://github.com/conradsheeran/steam-totp.git/blob/af0eba089e77ff73e6983ce61fa89190c628721e/src/main/ets/pages/SteamTOTP.ets#L94-L105
|
b6f49e501bb6de424eeb49e781d36f910913a5c0
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/analytics/ReportsPage.ets
|
arkts
|
buildSearchAndFilter
|
构建搜索和筛选
|
@Builder
buildSearchAndFilter() {
Column({ space: 12 }) {
// 搜索框
Row({ space: 8 }) {
Image($r('app.media.ic_search'))
.width('20vp')
.height('20vp')
.fillColor($r('app.color.text_secondary'))
TextInput({ text: this.searchText, placeholder: '搜索报告...' })
.backgroundColor(Color.Transparent)
.fontSize(14)
.layoutWeight(1)
.onChange((value: string) => {
this.searchText = value;
this.filterReports();
})
if (this.searchText) {
Button() {
Image($r('app.media.ic_clear'))
.width('16vp')
.height('16vp')
.fillColor($r('app.color.text_secondary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.width('32vp')
.height('32vp')
.onClick(() => {
this.searchText = '';
this.filterReports();
})
}
}
.width('100%')
.height('40vp')
.padding({ left: 12, right: 12 })
.backgroundColor(Color.White)
.borderRadius(20)
// 筛选标签
Scroll() {
Row({ space: 8 }) {
ForEach(this.filterOptions, (option) => {
Button() {
Row({ space: 6 }) {
Image($r(`app.media.ic_${option.icon}`))
.width('16vp')
.height('16vp')
.fillColor(this.selectedFilter === option.value ?
Color.White : $r('app.color.text_secondary'))
Text(option.label)
.fontSize(12)
.fontColor(this.selectedFilter === option.value ?
Color.White : $r('app.color.text_primary'))
}
}
.type(ButtonType.Normal)
.backgroundColor(this.selectedFilter === option.value ?
$r('app.color.primary') : Color.White)
.height('32vp')
.padding({ left: 12, right: 12 })
.onClick(() => {
this.selectedFilter = option.value;
this.filterReports();
})
})
}
.padding({ right: 16 })
}
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
}
.width('100%')
.padding(16)
.backgroundColor($r('app.color.background_light'))
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchAndFilter AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 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 Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_search' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '20vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '20vp' AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchText AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left placeholder : AST#expression#Left '搜索报告...' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchText AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterReports AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchText AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_clear' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '16vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '16vp' AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left AST#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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '32vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '32vp' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchText AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterReports 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '40vp' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 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 Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterOptions AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left option 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 Button ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 6 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left AST#template_literal#Left ` app.media.ic_ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left option AST#expression#Right . icon AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '16vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '16vp' AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedFilter AST#member_expression#Right AST#expression#Right === AST#expression#Left option AST#expression#Right AST#binary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left option AST#expression#Right . label AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedFilter AST#member_expression#Right AST#expression#Right === AST#expression#Left option AST#expression#Right AST#binary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedFilter AST#member_expression#Right AST#expression#Right === AST#expression#Left option AST#expression#Right AST#binary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '32vp' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedFilter AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left option AST#expression#Right . value AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterReports 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#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . scrollable ( AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollDirection AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.background_light' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildSearchAndFilter() {
Column({ space: 12 }) {
Row({ space: 8 }) {
Image($r('app.media.ic_search'))
.width('20vp')
.height('20vp')
.fillColor($r('app.color.text_secondary'))
TextInput({ text: this.searchText, placeholder: '搜索报告...' })
.backgroundColor(Color.Transparent)
.fontSize(14)
.layoutWeight(1)
.onChange((value: string) => {
this.searchText = value;
this.filterReports();
})
if (this.searchText) {
Button() {
Image($r('app.media.ic_clear'))
.width('16vp')
.height('16vp')
.fillColor($r('app.color.text_secondary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.width('32vp')
.height('32vp')
.onClick(() => {
this.searchText = '';
this.filterReports();
})
}
}
.width('100%')
.height('40vp')
.padding({ left: 12, right: 12 })
.backgroundColor(Color.White)
.borderRadius(20)
Scroll() {
Row({ space: 8 }) {
ForEach(this.filterOptions, (option) => {
Button() {
Row({ space: 6 }) {
Image($r(`app.media.ic_${option.icon}`))
.width('16vp')
.height('16vp')
.fillColor(this.selectedFilter === option.value ?
Color.White : $r('app.color.text_secondary'))
Text(option.label)
.fontSize(12)
.fontColor(this.selectedFilter === option.value ?
Color.White : $r('app.color.text_primary'))
}
}
.type(ButtonType.Normal)
.backgroundColor(this.selectedFilter === option.value ?
$r('app.color.primary') : Color.White)
.height('32vp')
.padding({ left: 12, right: 12 })
.onClick(() => {
this.selectedFilter = option.value;
this.filterReports();
})
})
}
.padding({ right: 16 })
}
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
}
.width('100%')
.padding(16)
.backgroundColor($r('app.color.background_light'))
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/ReportsPage.ets#L191-L271
|
5a1bd40d1beb18172d72bb508b49a5614d922323
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/pipwindow/src/main/ets/model/PipManager.ets
|
arkts
|
getInstance
|
视频播放控制器对象
|
public static getInstance(): PipManager {
return PipManager.instance;
}
|
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PipManager 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 PipManager AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static getInstance(): PipManager {
return PipManager.instance;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/PipManager.ets#L46-L48
|
04ecc4b573e89a7bc0ba4406edbea8137880fc29
|
gitee
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/api/Router.ets
|
arkts
|
popToRootWithResult
|
@deprecated
@see {ZRouter.getInstance().popToRootWithResult}
@param result
@param animated
|
public static popToRootWithResult<T>(result: T, animated: boolean = true) {
ZRouter.getRouterMgr().popToRootWithResult<T>(result, animated)
}
|
AST#method_declaration#Left public static popToRootWithResult AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animated : 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#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ZRouter AST#expression#Right . getRouterMgr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . popToRootWithResult AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right , AST#expression#Left animated AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static popToRootWithResult<T>(result: T, animated: boolean = true) {
ZRouter.getRouterMgr().popToRootWithResult<T>(result, animated)
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L478-L480
|
a3b04759c42e0007838bc8a9c6b47963e9baf49c
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/constants/ShowToast.ets
|
arkts
|
Display the toast message based on the prompt character string or BusinessError.
@param error Prompt character string or BusinessError.
|
export function showToast(error: BusinessError | string) {
const message: string = typeof error === 'string' ? error : getErrorHint(error);
promptAction.showToast({
message,
duration: 2000
});
}
|
AST#export_declaration#Left export AST#function_declaration#Left function showToast AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BusinessError AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left message : 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#unary_expression#Left typeof AST#expression#Left error 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#variable_declarator#Right AST#ERROR#Left ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right AST#ERROR#Left : AST#ERROR#Left getErrorHint AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left error AST#primary_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right ; promptAction AST#ERROR#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left message 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#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function showToast(error: BusinessError | string) {
const message: string = typeof error === 'string' ? error : getErrorHint(error);
promptAction.showToast({
message,
duration: 2000
});
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/constants/ShowToast.ets#L20-L26
|
a4e3bc9da28a740485f6d752792e94dbb70c46a1
|
github
|
|
lime-zz/Ark-ui_RubbishRecycleApp.git
|
c2a9bff8fbb5bc46d922934afad0327cc1696969
|
rubbish/rubbish/entry/src/main/ets/pages/store.ets
|
arkts
|
formatTime
|
格式化时间为 HH:MM:SS
|
formatTime(seconds: number): string {
const hours = Math.floor(seconds / 3600); // 计算小时
const minutes = Math.floor((seconds % 3600) / 60); // 计算分钟
const remainingSeconds = seconds % 60; // 计算秒数
// 使用 padStart 来保证两位数格式
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;
}
|
AST#method_declaration#Left formatTime AST#parameter_list#Left ( AST#parameter#Left seconds : 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 hours = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left seconds AST#expression#Right / AST#expression#Left 3600 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 计算小时 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left minutes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left seconds AST#expression#Right % AST#expression#Left 3600 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 计算分钟 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left remainingSeconds = AST#expression#Left AST#binary_expression#Left AST#expression#Left seconds AST#expression#Right % AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 计算秒数 // 使用 padStart 来保证两位数格式 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hours AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left minutes AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left remainingSeconds AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
formatTime(seconds: number): string {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const remainingSeconds = seconds % 60;
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;
}
|
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/store.ets#L20-L27
|
f2f98a994fe0b6669695263ded1704ad8fe17d23
|
github
|
pangpang20/wavecast.git
|
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
|
entry/src/main/ets/service/DatabaseService.ets
|
arkts
|
migrateToVersion
|
迁移到指定版本
在这里添加每个版本的迁移逻辑
|
private async migrateToVersion(version: number): Promise<void> {
if (!this.rdbStore) return;
console.info(`[DatabaseService] Migrating to v${version}`);
switch (version) {
case 1:
// v1: 初始版本,创建基础表
await this.createTables();
break;
case 2:
// v2: 添加 isFetchFailed 和 lastSuccessfulFetch 字段
try {
await this.rdbStore.executeSql('ALTER TABLE podcast ADD COLUMN isFetchFailed INTEGER DEFAULT 0');
} catch (e) {
// 字段可能已存在,忽略错误
console.warn('[DatabaseService] Column isFetchFailed may already exist');
}
try {
await this.rdbStore.executeSql('ALTER TABLE podcast ADD COLUMN lastSuccessfulFetch INTEGER DEFAULT 0');
} catch (e) {
// 字段可能已存在,忽略错误
console.warn('[DatabaseService] Column lastSuccessfulFetch may already exist');
}
console.info('[DatabaseService] Added isFetchFailed and lastSuccessfulFetch columns to podcast table');
break;
default:
console.warn(`[DatabaseService] Unknown migration version: ${version}`);
}
|
AST#method_declaration#Left private async migrateToVersion AST#parameter_list#Left ( AST#parameter#Left version : 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#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#return_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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [DatabaseService] Migrating to v AST#template_substitution#Left $ { AST#expression#Left version 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 switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left version AST#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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Left 1 AST#ERROR#Right : // v1: 初始版本,创建基础表 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 . createTables AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 2 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right // v2: 添加 isFetchFailed 和 lastSuccessfulFetch 字段 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ALTER TABLE podcast ADD COLUMN isFetchFailed INTEGER DEFAULT 0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { // 字段可能已存在,忽略错误 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Column isFetchFailed may already exist' AST#expression#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 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 . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ALTER TABLE podcast ADD COLUMN lastSuccessfulFetch INTEGER DEFAULT 0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { // 字段可能已存在,忽略错误 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Column lastSuccessfulFetch may already exist' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Added isFetchFailed and lastSuccessfulFetch columns to podcast table' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#qualified_type#Left console . warn AST#qualified_type#Right ( AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#template_literal#Left ` [DatabaseService] Unknown migration version: AST#template_substitution#Left $ { AST#expression#Left version AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async migrateToVersion(version: number): Promise<void> {
if (!this.rdbStore) return;
console.info(`[DatabaseService] Migrating to v${version}`);
switch (version) {
case 1:
await this.createTables();
break;
case 2:
try {
await this.rdbStore.executeSql('ALTER TABLE podcast ADD COLUMN isFetchFailed INTEGER DEFAULT 0');
} catch (e) {
console.warn('[DatabaseService] Column isFetchFailed may already exist');
}
try {
await this.rdbStore.executeSql('ALTER TABLE podcast ADD COLUMN lastSuccessfulFetch INTEGER DEFAULT 0');
} catch (e) {
console.warn('[DatabaseService] Column lastSuccessfulFetch may already exist');
}
console.info('[DatabaseService] Added isFetchFailed and lastSuccessfulFetch columns to podcast table');
break;
default:
console.warn(`[DatabaseService] Unknown migration version: ${version}`);
}
|
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DatabaseService.ets#L154-L184
|
a1e32b39e148b466f7ba68ebce9f1f0ec8dd0726
|
github
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
arkts/@arkts.utils.d.ets
|
arkts
|
request
|
Find or create an instance of ConditionVariable using the specified name.
@param { string } name - Name of the ConditionVariable to find or create.
@returns { ConditionVariable } Returns an instance of ConditionVariable.
@static
@syscap SystemCapability.Utils.Lang
@atomicservice
@since 18
|
static request(name: string): ConditionVariable;
|
AST#method_declaration#Left static request AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ConditionVariable AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
static request(name: string): ConditionVariable;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.utils.d.ets#L663-L663
|
adfaf2b330cb9d8673aa09379c17820921bae204
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/SettingsTypes.ets
|
arkts
|
设置迁移配置接口
|
export interface SettingsMigrationConfig {
fromVersion: string;
toVersion: string;
migrations: SettingsMigrationRule[];
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface SettingsMigrationConfig AST#object_type#Left { AST#type_member#Left fromVersion : 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 toVersion : 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 migrations : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SettingsMigrationRule [ ] 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 SettingsMigrationConfig {
fromVersion: string;
toVersion: string;
migrations: SettingsMigrationRule[];
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L534-L538
|
9fb1f3af8cb96b3f53f37449d436121b7ce41a2b
|
github
|
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/model/MoodEntry.ets
|
arkts
|
getTodayDateString
|
Get today's date string in YYYY-MM-DD format
|
static getTodayDateString(): string {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
|
AST#method_declaration#Left static getTodayDateString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left year = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left month = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left day = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 year AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left month AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left day 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
|
static getTodayDateString(): string {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/MoodEntry.ets#L85-L91
|
d6f8beecf267391a3fb865537e43d6292e38bfc2
|
github
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/processes/zone_actions.ets
|
arkts
|
Marks a window to be NO LONGER a zone.
@param window_id The id of zone / window.
@returns True if success, undefined if is already NOT a zone.
|
export function off_zone(window_id: string) {
let storage = storage_of_id(window_id);
let alias = storage.get('my_window_alias') as string;
// Read all web_states out
let zone_dir = meowContext().filesDir + '/' + 'zones/' + alias;
console.log('[off_zone] zone_dir: ' + zone_dir);
let tabs_list = fileIo.listFileSync(zone_dir);
let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs;
for (let index = 0; index < Math.floor(tabs_list.length / 2); index++) {
if (tabs.Tabs[index].web_state_array) {
// Already loaded, do nothing
} else {
try {
let state_file = 'zones/' + alias + "/continue_tabs_web_state_array_" + index.toString();
let array_buffer = sandbox_read_arrayBuffer_sync(state_file); // State of that tab
if (array_buffer) {
tabs.Tabs[index].web_state_array = new Uint8Array(array_buffer);
} else {
console.error("[off_zone] Read web state failed! Read NOTHING from disk???");
}
} catch (e) {
console.error('[off_zone][restore_zone] Failed: ' + e);
}
}
}
// After work
sandbox_rmdir_sync('zones/' + alias);
let lord = AppStorage.get('THE_LORD_OF_THE_WINDOWS') as string;
if (window_id == lord) {
// If is lord, resave web states;
let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs;
tabs.re_save_web_state(0, 'continue');
} else {
// If is other window, then directly save web states to /zone/name
// Do nothing
}
storage.setOrCreate('is_zone', false);
refresh_AppStorage_zones();
// Window Title
let windowClass = window_of_id(window_id);
if (windowClass) {
windowClass.setWindowTitle(alias).catch((e: BusinessError) => {
console.error('[set_zone][change_window_alias] Set alias failed! ' + JSON.stringify(e));
});
}
return true;
}
|
AST#export_declaration#Left export AST#function_declaration#Left function off_zone AST#parameter_list#Left ( AST#parameter#Left window_id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left storage = AST#expression#Left AST#call_expression#Left AST#expression#Left storage_of_id AST#expression#Right AST#argument_list#Left ( AST#expression#Left window_id 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 alias = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left storage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'my_window_alias' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Read all web_states out AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left zone_dir = 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#call_expression#Left AST#expression#Left meowContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'zones/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left alias 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 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 '[off_zone] zone_dir: ' AST#expression#Right + AST#expression#Left zone_dir 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 tabs_list = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . listFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left zone_dir 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 tabs = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left storage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'bunch_of_tabs' 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_tabs AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tabs_list AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tabs AST#expression#Right . Tabs AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . web_state_array AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // Already loaded, do nothing } AST#block_statement#Right else 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 state_file = 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#binary_expression#Left AST#expression#Left 'zones/' AST#expression#Right + AST#expression#Left alias AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "/continue_tabs_web_state_array_" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left index 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left array_buffer = AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_read_arrayBuffer_sync AST#expression#Right AST#argument_list#Left ( AST#expression#Left state_file 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 // State of that tab AST#statement#Left AST#if_statement#Left if ( AST#expression#Left array_buffer AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tabs AST#expression#Right . Tabs AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . web_state_array AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array_buffer 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 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "[off_zone] Read web state failed! Read NOTHING from disk???" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '[off_zone][restore_zone] Failed: ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // After work AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_rmdir_sync AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'zones/' AST#expression#Right + AST#expression#Left alias 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 lord = 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 'THE_LORD_OF_THE_WINDOWS' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#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 window_id AST#expression#Right == AST#expression#Left lord AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // If is lord, resave web states; AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tabs = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left storage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'bunch_of_tabs' 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_tabs 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 tabs AST#expression#Right . re_save_web_state AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 'continue' AST#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 { // If is other window, then directly save web states to /zone/name // Do nothing } 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 storage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'is_zone' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left refresh_AppStorage_zones 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 // Window Title AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left windowClass = AST#expression#Left AST#call_expression#Left AST#expression#Left window_of_id AST#expression#Right AST#argument_list#Left ( AST#expression#Left window_id 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 windowClass AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowClass AST#expression#Right . setWindowTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left alias AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[set_zone][change_window_alias] Set alias failed! ' 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 e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function off_zone(window_id: string) {
let storage = storage_of_id(window_id);
let alias = storage.get('my_window_alias') as string;
let zone_dir = meowContext().filesDir + '/' + 'zones/' + alias;
console.log('[off_zone] zone_dir: ' + zone_dir);
let tabs_list = fileIo.listFileSync(zone_dir);
let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs;
for (let index = 0; index < Math.floor(tabs_list.length / 2); index++) {
if (tabs.Tabs[index].web_state_array) {
} else {
try {
let state_file = 'zones/' + alias + "/continue_tabs_web_state_array_" + index.toString();
let array_buffer = sandbox_read_arrayBuffer_sync(state_file);
if (array_buffer) {
tabs.Tabs[index].web_state_array = new Uint8Array(array_buffer);
} else {
console.error("[off_zone] Read web state failed! Read NOTHING from disk???");
}
} catch (e) {
console.error('[off_zone][restore_zone] Failed: ' + e);
}
}
}
sandbox_rmdir_sync('zones/' + alias);
let lord = AppStorage.get('THE_LORD_OF_THE_WINDOWS') as string;
if (window_id == lord) {
let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs;
tabs.re_save_web_state(0, 'continue');
} else {
}
storage.setOrCreate('is_zone', false);
refresh_AppStorage_zones();
let windowClass = window_of_id(window_id);
if (windowClass) {
windowClass.setWindowTitle(alias).catch((e: BusinessError) => {
console.error('[set_zone][change_window_alias] Set alias failed! ' + JSON.stringify(e));
});
}
return true;
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L140-L189
|
af68c06052277bd9820e0cfbd3a1f61007d5eac6
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/barchart/Index.ets
|
arkts
|
BarChartPage
|
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 { BarChartPage } from './src/main/ets/view/BarChart';
|
AST#export_declaration#Left export { BarChartPage } from './src/main/ets/view/BarChart' ; AST#export_declaration#Right
|
export { BarChartPage } from './src/main/ets/view/BarChart';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/Index.ets#L16-L16
|
0752db8bab3f56f5801a91345f50525ba278e57f
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/widget/BirthdayWidgetFormExtension.ets
|
arkts
|
getWidgetData
|
获取小组件数据
|
private getWidgetData(formName?: string): WidgetData {
try {
const today = new Date();
const currentDate = `${today.getMonth() + 1}月${today.getDate()}日`;
const widgetData: WidgetData = {
title: 'AI生日提醒',
subtitle: '今天有0人生日',
todayCount: 0,
upcomingCount: 0,
todayBirthdays: [],
widgetBackgroundColor: '#FFFFFF',
widgetTextColor: '#333333',
showLunar: false,
currentDate: currentDate
};
return widgetData;
} catch (error) {
hilog.error(0x0001, 'AI生日小组件', `Error getting widget data: ${error}`);
// 返回默认数据
return {
title: 'AI生日提醒',
subtitle: '暂无生日信息',
todayCount: 0,
upcomingCount: 0,
todayBirthdays: [],
widgetBackgroundColor: '#FFFFFF',
widgetTextColor: '#333333',
showLunar: false,
currentDate: `${new Date().getMonth() + 1}月${new Date().getDate()}日`
};
}
}
|
AST#method_declaration#Left private getWidgetData AST#parameter_list#Left ( AST#parameter#Left formName ? : 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 WidgetData 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 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#variable_declaration#Left const AST#variable_declarator#Left currentDate = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#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 today 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#template_substitution#Right 月 AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left today 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#template_substitution#Right 日 ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left widgetData : AST#type_annotation#Left AST#primary_type#Left WidgetData 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 'AI生日提醒' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subtitle AST#property_name#Right : AST#expression#Left '今天有0人生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left todayCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left upcomingCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left todayBirthdays AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left widgetBackgroundColor AST#property_name#Right : AST#expression#Left '#FFFFFF' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left widgetTextColor AST#property_name#Right : AST#expression#Left '#333333' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showLunar AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentDate AST#property_name#Right : AST#expression#Left currentDate 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 widgetData 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 0x0001 AST#expression#Right , AST#expression#Left 'AI生日小组件' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Error getting widget data: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 返回默认数据 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left 'AI生日提醒' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subtitle AST#property_name#Right : AST#expression#Left '暂无生日信息' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left todayCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left upcomingCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left todayBirthdays AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left widgetBackgroundColor AST#property_name#Right : AST#expression#Left '#FFFFFF' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left widgetTextColor AST#property_name#Right : AST#expression#Left '#333333' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showLunar AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentDate AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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#template_substitution#Right 月 AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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#template_substitution#Right 日 ` AST#template_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
|
private getWidgetData(formName?: string): WidgetData {
try {
const today = new Date();
const currentDate = `${today.getMonth() + 1}月${today.getDate()}日`;
const widgetData: WidgetData = {
title: 'AI生日提醒',
subtitle: '今天有0人生日',
todayCount: 0,
upcomingCount: 0,
todayBirthdays: [],
widgetBackgroundColor: '#FFFFFF',
widgetTextColor: '#333333',
showLunar: false,
currentDate: currentDate
};
return widgetData;
} catch (error) {
hilog.error(0x0001, 'AI生日小组件', `Error getting widget data: ${error}`);
return {
title: 'AI生日提醒',
subtitle: '暂无生日信息',
todayCount: 0,
upcomingCount: 0,
todayBirthdays: [],
widgetBackgroundColor: '#FFFFFF',
widgetTextColor: '#333333',
showLunar: false,
currentDate: `${new Date().getMonth() + 1}月${new Date().getDate()}日`
};
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widget/BirthdayWidgetFormExtension.ets#L61-L95
|
ac15e6bd0589b915e0e6895ec6ca78b854560fdd
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/entry3ability/Entry3Ability.ets
|
arkts
|
onWindowStageCreate
|
[EndExclude create_main_window]
|
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
// 创建Web动态组件(需传入UIContext),loadContent之后的任意时机均可创建,应用仅创建一个Web组件
createNWeb(defaultUrl, windowStage.getMainWindowSync().getUIContext());
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});
}
|
AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Main window is created, set main page for this ability AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'Ability onWindowStageCreate' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowStage AST#expression#Right . loadContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pages/Index' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left 'Failed to load the content. Cause: %{public}s' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 创建Web动态组件(需传入UIContext),loadContent之后的任意时机均可创建,应用仅创建一个Web组件 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left createNWeb AST#expression#Right AST#argument_list#Left ( AST#expression#Left defaultUrl AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowStage AST#expression#Right . getMainWindowSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left 'Succeeded in loading the content.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
onWindowStageCreate(windowStage: window.WindowStage): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
createNWeb(defaultUrl, windowStage.getMainWindowSync().getUIContext());
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/entry3ability/Entry3Ability.ets#L33-L46
|
1e750df5fa38890f55ae0722e60f5125995fe851
|
gitee
|
XiangRui_FuZi/harmony-oscourse
|
da885f9a777a1eace7a07e1cd81137746687974b
|
class1/entry/src/main/ets/commons/network/HttpUtils.ets
|
arkts
|
The HttpUtils provides the capability of accessing the network through HTTP.
|
export class HttpUtils {
httpRequest: http.HttpRequest;
constructor() {
this.httpRequest = http.createHttp();
}
/**
* The method of initiating a GET request through HTTP.
*/
async getHttpRequest(cacheDir: string): Promise<string> {
let responsePictureUri: string = '';
await this.httpRequest.request(IMAGE_URL, { method: http.RequestMethod.GET })
.then((data: http.HttpResponse) => {
let filePath = cacheDir + '/test.svg';
let file = fileIo.openSync(filePath, fileIo.OpenMode.CREATE | fileIo.OpenMode.READ_WRITE);
responsePictureUri = fileUri.getUriFromPath(filePath);
fileIo.writeSync(file.fd, data.result as ArrayBuffer);
fileIo.closeSync(file.fd);
})
return responsePictureUri;
}
/**
* The method of initiating a POST request through HTTP.
*/
async postHttpRequest(): Promise<ListInfo[]> {
let responseData: Array<ListInfo> = [];
await this.httpRequest.request(RESOURCE_URL,
{
method: http.RequestMethod.POST, extraData: {
'status': '1',
'belong': '1',
'language': 'cn',
'needTop': 1,
'displayChannel': [1, 3],
'count': 4,
'pagestart': 1,
'type': '1,4,5,6'
},
header: new Header('application/json;charset=UTF-8')
}).then((data: http.HttpResponse) => {
let result: ResponseData = JSON.parse(data.result as string);
responseData = result.value.list;
}).catch((err: Error) => {
hilog.info(0x0000, TAG, JSON.stringify(err));
});
return responseData;
}
/**
* The method of destroying httpRequest.
*/
destroyHttpRequest() {
this.httpRequest.destroy();
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class HttpUtils AST#class_body#Left { AST#property_declaration#Left httpRequest : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . httpRequest AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /**
* The method of initiating a GET request through HTTP.
*/ AST#method_declaration#Left async getHttpRequest AST#parameter_list#Left ( AST#parameter#Left cacheDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left responsePictureUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . httpRequest AST#member_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left IMAGE_URL AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . GET 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 . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left cacheDir AST#expression#Right + AST#expression#Left '/test.svg' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left file = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE AST#member_expression#Right AST#expression#Right | AST#expression#Left fileIo AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left responsePictureUri = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileUri AST#expression#Right . getUriFromPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 fileIo 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 AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#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 fileIo 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left responsePictureUri AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* The method of initiating a POST request through HTTP.
*/ AST#method_declaration#Left async postHttpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ListInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left responseData : 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 ListInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 . httpRequest AST#member_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left RESOURCE_URL AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . POST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extraData AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'status' AST#property_name#Right : AST#expression#Left '1' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'belong' AST#property_name#Right : AST#expression#Left '1' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'language' AST#property_name#Right : AST#expression#Left 'cn' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'needTop' AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'displayChannel' AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left 1 AST#expression#Right , AST#expression#Left 3 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'count' AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'pagestart' AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'type' AST#property_name#Right : AST#expression#Left '1,4,5,6' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Header AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'application/json;charset=UTF-8' 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 . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left ResponseData 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left responseData = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . value AST#member_expression#Right AST#expression#Right . list AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left TAG 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left responseData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* The method of destroying httpRequest.
*/ AST#method_declaration#Left destroyHttpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . httpRequest AST#member_expression#Right AST#expression#Right . destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class HttpUtils {
httpRequest: http.HttpRequest;
constructor() {
this.httpRequest = http.createHttp();
}
async getHttpRequest(cacheDir: string): Promise<string> {
let responsePictureUri: string = '';
await this.httpRequest.request(IMAGE_URL, { method: http.RequestMethod.GET })
.then((data: http.HttpResponse) => {
let filePath = cacheDir + '/test.svg';
let file = fileIo.openSync(filePath, fileIo.OpenMode.CREATE | fileIo.OpenMode.READ_WRITE);
responsePictureUri = fileUri.getUriFromPath(filePath);
fileIo.writeSync(file.fd, data.result as ArrayBuffer);
fileIo.closeSync(file.fd);
})
return responsePictureUri;
}
async postHttpRequest(): Promise<ListInfo[]> {
let responseData: Array<ListInfo> = [];
await this.httpRequest.request(RESOURCE_URL,
{
method: http.RequestMethod.POST, extraData: {
'status': '1',
'belong': '1',
'language': 'cn',
'needTop': 1,
'displayChannel': [1, 3],
'count': 4,
'pagestart': 1,
'type': '1,4,5,6'
},
header: new Header('application/json;charset=UTF-8')
}).then((data: http.HttpResponse) => {
let result: ResponseData = JSON.parse(data.result as string);
responseData = result.value.list;
}).catch((err: Error) => {
hilog.info(0x0000, TAG, JSON.stringify(err));
});
return responseData;
}
destroyHttpRequest() {
this.httpRequest.destroy();
}
}
|
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/network/HttpUtils.ets#L29-L85
|
97dbd2347b3c9d307ae9ea31cfb9149b3d798a49
|
gitee
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.