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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
JinnyWang-Space/guanlanwenjuan.git
|
601c4aa6c427e643d7bf42bc21945f658738e38c
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
isBackgroundBlur
|
是否开启背景模糊
|
private isBackgroundBlur(): uiEffect.Filter {
if (this.isToolViewShow) {
return uiEffect.createFilter().blur(15);
}
return uiEffect.createFilter().blur(0)
}
|
AST#method_declaration#Left private isBackgroundBlur AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left uiEffect . Filter AST#qualified_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 this AST#expression#Right . isToolViewShow AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uiEffect AST#expression#Right . createFilter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . blur AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 15 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uiEffect AST#expression#Right . createFilter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . blur AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private isBackgroundBlur(): uiEffect.Filter {
if (this.isToolViewShow) {
return uiEffect.createFilter().blur(15);
}
return uiEffect.createFilter().blur(0)
}
|
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L430-L435
|
76645dd9aa0d8bd770f5c6f32de99d390b0f2fd1
|
github
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets
|
arkts
|
TODO DES加解密
author: 桃花镇童长老ᥫ᭡
since: 2024/07/01
|
export class DES {
/**
* 加密(ECB模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/
static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> {
return DES.encrypt(data, symKey, null, '3DES192|ECB|PKCS7');
}
/**
* 加密(ECB模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/
static encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob {
return DES.encryptSync(data, symKey, null, '3DES192|ECB|PKCS7');
}
/**
* 解密(ECB模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/
static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> {
return DES.decrypt(data, symKey, null, '3DES192|ECB|PKCS7');
}
/**
* 解密(ECB模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/
static decryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob {
return DES.decryptSync(data, symKey, null, '3DES192|ECB|PKCS7');
}
/**
* 加密(CBC模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/
static async encryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): Promise<cryptoFramework.DataBlob> {
return DES.encrypt(data, symKey, params, '3DES192|CBC|PKCS7');
}
/**
* 加密(CBC模式),同步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/
static encryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): cryptoFramework.DataBlob {
return DES.encryptSync(data, symKey, params, '3DES192|CBC|PKCS7');
}
/**
* 解密(CBC模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): Promise<cryptoFramework.DataBlob> {
return DES.decrypt(data, symKey, params, '3DES192|CBC|PKCS7');
}
/**
* 解密(CBC模式),同步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|CBC|PKCS7、AES192|CBC|PKCS7、AES128|CBC|PKCS7)。
* @returns
*/
static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): cryptoFramework.DataBlob {
return DES.decryptSync(data, symKey, params, '3DES192|CBC|PKCS7');
}
/**
* 加密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
* @returns
*/
static async encrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.encrypt(data, symKey, params, transformation);
}
/**
* 加密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
* @returns
*/
static encryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, symKey, params, transformation);
}
/**
* 解密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
* @returns
*/
static async decrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, symKey, params, transformation);
}
/**
* 解密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
* @returns
*/
static decryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, symKey, params, transformation);
}
/**
* 生成对称密钥SymKey,异步
* @param symAlgName 待生成对称密钥生成器的算法名称(3DES192)
* @returns
*/
static async generateSymKey(): Promise<cryptoFramework.SymKey> {
return CryptoUtil.generateSymKey('3DES192');
}
/**
* 生成对称密钥SymKey,同步
* @param symAlgName 待生成对称密钥生成器的算法名称(3DES192)
* @returns
*/
static generateSymKeySync(): cryptoFramework.SymKey {
return CryptoUtil.generateSymKeySync('3DES192');
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DES AST#class_body#Left { /**
* 加密(ECB模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/ AST#method_declaration#Left static async encryptECB AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . encrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left '3DES192|ECB|PKCS7' 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 /**
* 加密(ECB模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/ AST#method_declaration#Left static encryptECBSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . encryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left '3DES192|ECB|PKCS7' 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 /**
* 解密(ECB模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/ AST#method_declaration#Left static async decryptECB AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . decrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left '3DES192|ECB|PKCS7' 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 /**
* 解密(ECB模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/ AST#method_declaration#Left static decryptECBSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . decryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left '3DES192|ECB|PKCS7' 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 /**
* 加密(CBC模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/ AST#method_declaration#Left static async encryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . encrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left '3DES192|CBC|PKCS7' 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 /**
* 加密(CBC模式),同步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/ AST#method_declaration#Left static encryptCBCSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ParamsSpec 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 . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . encryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left '3DES192|CBC|PKCS7' 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 /**
* 解密(CBC模式),异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @returns
*/ AST#method_declaration#Left static async decryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . decrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left '3DES192|CBC|PKCS7' 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 /**
* 解密(CBC模式),同步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|CBC|PKCS7、AES192|CBC|PKCS7、AES128|CBC|PKCS7)。
* @returns
*/ AST#method_declaration#Left static decryptCBCSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ParamsSpec 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 . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . decryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left '3DES192|CBC|PKCS7' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 加密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
* @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 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 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . encrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 加密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
* @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 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 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . encryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 解密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
* @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 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 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . decrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 解密,同步
* @param data 加密或者解密的数据。data不能为null。
* @param symKey 指定加密或解密的密钥。
* @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
* @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 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 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . decryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left transformation AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成对称密钥SymKey,异步
* @param symAlgName 待生成对称密钥生成器的算法名称(3DES192)
* @returns
*/ AST#method_declaration#Left static async generateSymKey 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#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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . generateSymKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '3DES192' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成对称密钥SymKey,同步
* @param symAlgName 待生成对称密钥生成器的算法名称(3DES192)
* @returns
*/ AST#method_declaration#Left static generateSymKeySync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . generateSymKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '3DES192' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DES {
static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> {
return DES.encrypt(data, symKey, null, '3DES192|ECB|PKCS7');
}
static encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob {
return DES.encryptSync(data, symKey, null, '3DES192|ECB|PKCS7');
}
static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> {
return DES.decrypt(data, symKey, null, '3DES192|ECB|PKCS7');
}
static decryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob {
return DES.decryptSync(data, symKey, null, '3DES192|ECB|PKCS7');
}
static async encryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): Promise<cryptoFramework.DataBlob> {
return DES.encrypt(data, symKey, params, '3DES192|CBC|PKCS7');
}
static encryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): cryptoFramework.DataBlob {
return DES.encryptSync(data, symKey, params, '3DES192|CBC|PKCS7');
}
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): Promise<cryptoFramework.DataBlob> {
return DES.decrypt(data, symKey, params, '3DES192|CBC|PKCS7');
}
static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): cryptoFramework.DataBlob {
return DES.decryptSync(data, symKey, params, '3DES192|CBC|PKCS7');
}
static async encrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.encrypt(data, symKey, params, transformation);
}
static encryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, symKey, params, transformation);
}
static async decrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, symKey, params, transformation);
}
static decryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, symKey, params, transformation);
}
static async generateSymKey(): Promise<cryptoFramework.SymKey> {
return CryptoUtil.generateSymKey('3DES192');
}
static generateSymKeySync(): cryptoFramework.SymKey {
return CryptoUtil.generateSymKeySync('3DES192');
}
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets#L24-L187
|
b4d2f341dca4aa11f9054b6c7079f673ad82acab
|
github
|
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets
|
arkts
|
loadTaskProgress
|
加载任务进度
|
async loadTaskProgress() {
if (!this.task.id) return;
try {
const progress = await getTaskProgress(this.task.id);
if (progress && progress.length > 0) {
this.taskProgress = progress;
}
} catch (error) {
const err: Error = error as Error;
console.error(`加载任务进度失败: ${err.message}`);
}
}
|
AST#method_declaration#Left async loadTaskProgress 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . task AST#member_expression#Right AST#expression#Right . id 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 progress = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getTaskProgress AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . task AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right 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 progress AST#expression#Right && AST#expression#Left progress AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskProgress AST#member_expression#Right = AST#expression#Left progress 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#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 加载任务进度失败: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async loadTaskProgress() {
if (!this.task.id) return;
try {
const progress = await getTaskProgress(this.task.id);
if (progress && progress.length > 0) {
this.taskProgress = progress;
}
} catch (error) {
const err: Error = error as Error;
console.error(`加载任务进度失败: ${err.message}`);
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L237-L249
|
fcc69e64739dacf3863662cb27c2708bac77c514
|
github
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
features/harA/src/main/ets/components/Page1.ets
|
arkts
|
Page1
|
@author: HZWei
@date: 2024/7/18
@desc:
|
@Route({ name: "harAPage1", needLogin: true })
@Component
export struct Page1 {
@State message: string = 'Hello World';
build() {
NavDestination(){
Column({space:12}){
Button('toHarAPage1').onClick((event: ClickEvent) => {
// ZRouter.push("harAPage1")
ZRouter.getInstance().push("harAPage1")
})
Button('toHarAPage2').onClick((event: ClickEvent) => {
// ZRouter.push("harAPage2")
ZRouter.getInstance().push("harAPage2")
})
Button('toHarBPage1').onClick((event: ClickEvent) => {
// ZRouter.push("harBPage1")
ZRouter.getInstance().push("harBPage1")
})
Button('toHarBPage2').onClick((event: ClickEvent) => {
// ZRouter.push("harBPage2")
ZRouter.getInstance().push("harBPage2")
})
}
}
.title('harAPage1')
.width('100%')
.height('100%')
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "harAPage1" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left needLogin AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Page1 AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Hello World' 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 NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'toHarAPage1' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // ZRouter.push("harAPage1") 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 ZRouter AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "harAPage1" AST#expression#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'toHarAPage2' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // ZRouter.push("harAPage2") 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 ZRouter AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "harAPage2" AST#expression#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'toHarBPage1' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // ZRouter.push("harBPage1") 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 ZRouter AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "harBPage1" AST#expression#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'toHarBPage2' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // ZRouter.push("harBPage2") 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 ZRouter AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "harBPage2" AST#expression#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . title ( AST#expression#Left 'harAPage1' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Route({ name: "harAPage1", needLogin: true })
@Component
export struct Page1 {
@State message: string = 'Hello World';
build() {
NavDestination(){
Column({space:12}){
Button('toHarAPage1').onClick((event: ClickEvent) => {
ZRouter.getInstance().push("harAPage1")
})
Button('toHarAPage2').onClick((event: ClickEvent) => {
ZRouter.getInstance().push("harAPage2")
})
Button('toHarBPage1').onClick((event: ClickEvent) => {
ZRouter.getInstance().push("harBPage1")
})
Button('toHarBPage2').onClick((event: ClickEvent) => {
ZRouter.getInstance().push("harBPage2")
})
}
}
.title('harAPage1')
.width('100%')
.height('100%')
}
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/features/harA/src/main/ets/components/Page1.ets#L10-L45
|
db5673349b03c08089472e0512ec638c0b0ddc75
|
gitee
|
ashcha0/line-inspection-terminal-frontend_arkts.git
|
c82616097e8a3b257b7b01e75b6b83ce428b518c
|
entry/src/main/ets/services/CameraService.ets
|
arkts
|
getCameraInfoList
|
获取摄像头信息列表(设备列表 + UI信息转换的组合方法)
@returns Promise<CameraInfo[]> 摄像头信息列表
|
static async getCameraInfoList(): Promise<CameraInfo[]> {
try {
console.info('[CameraService] 🎬 开始获取摄像头信息列表');
const devices = await CameraService.getCameraDevices();
const cameraInfoList = CameraService.convertToCameraInfo(devices);
const logInfo: CameraListLogInfo = {
totalCount: cameraInfoList.length,
cameras: cameraInfoList.map((c: CameraInfo): CameraInfoItem => ({ id: c.id, name: c.name }))
};
console.info('[CameraService] ✅ 摄像头信息列表获取成功:', JSON.stringify(logInfo));
return cameraInfoList;
} catch (error) {
console.error('[CameraService] ❌ 获取摄像头信息列表失败:', error);
throw new Error(`获取摄像头信息列表失败: ${error}`);
}
}
|
AST#method_declaration#Left static async getCameraInfoList 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 CameraInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#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 '[CameraService] 🎬 开始获取摄像头信息列表' AST#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 devices = 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 CameraService AST#expression#Right AST#await_expression#Right AST#expression#Right . getCameraDevices 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 cameraInfoList = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CameraService AST#expression#Right . convertToCameraInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left devices AST#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 logInfo : AST#type_annotation#Left AST#primary_type#Left CameraListLogInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left cameraInfoList AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cameras AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cameraInfoList AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CameraInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CameraInfoItem AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left c AST#expression#Right . id 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 c AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; 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 '[CameraService] ✅ 摄像头信息列表获取成功:' 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 logInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left cameraInfoList AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[CameraService] ❌ 获取摄像头信息列表失败:' 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#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取摄像头信息列表失败: AST#template_substitution#Left $ { AST#expression#Left 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#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async getCameraInfoList(): Promise<CameraInfo[]> {
try {
console.info('[CameraService] 🎬 开始获取摄像头信息列表');
const devices = await CameraService.getCameraDevices();
const cameraInfoList = CameraService.convertToCameraInfo(devices);
const logInfo: CameraListLogInfo = {
totalCount: cameraInfoList.length,
cameras: cameraInfoList.map((c: CameraInfo): CameraInfoItem => ({ id: c.id, name: c.name }))
};
console.info('[CameraService] ✅ 摄像头信息列表获取成功:', JSON.stringify(logInfo));
return cameraInfoList;
} catch (error) {
console.error('[CameraService] ❌ 获取摄像头信息列表失败:', error);
throw new Error(`获取摄像头信息列表失败: ${error}`);
}
}
|
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/CameraService.ets#L217-L235
|
2706c74223b8b5631ec1dc24d6266470df66a24e
|
github
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
NEXT/OneAutumn/entry/src/main/ets/model/PageRouterParam.ets
|
arkts
|
热门诗人的诗词 跳转查看详细内容时,携带参数
|
export class HotPoetPoemDetailParam {
phrase: HotPoem
poetName: string
constructor
|
AST#export_declaration#Left export AST#ERROR#Left class HotPoetPoemDetailParam { phrase : HotPoem poetName : string 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 HotPoetPoemDetailParam {
phrase: HotPoem
poetName: string
constructor
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/model/PageRouterParam.ets#L5-L9
|
f434294b2c213a06eb9bda8afae847c218663c05
|
gitee
|
|
waylau/harmonyos-tutorial
|
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
|
samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets
|
arkts
|
deletePreferences
|
从内存中移除指定文件对应的Preferences单实例。 移除Preferences单实例时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题。
|
async deletePreferences() {
preferences.deletePreferences(context, options, (err: BusinessError) => {
if (err) {
console.error(`Failed to delete preferences. Code:${err.code}, message:${err.message}`);
return;
}
this.dataPreferences = null;
console.info('Succeeded in deleting preferences.');
})
}
|
AST#method_declaration#Left async deletePreferences 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 preferences AST#expression#Right . deletePreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left options AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to delete preferences. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataPreferences AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 'Succeeded in deleting preferences.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async deletePreferences() {
preferences.deletePreferences(context, options, (err: BusinessError) => {
if (err) {
console.error(`Failed to delete preferences. Code:${err.code}, message:${err.message}`);
return;
}
this.dataPreferences = null;
console.info('Succeeded in deleting preferences.');
})
}
|
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets#L60-L71
|
0c09710726bd3a47f45e39f6a76950fa18ca4d95
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/order/src/main/ets/view/OrderDetailPage.ets
|
arkts
|
PageContent
|
页面内容
@returns {void} 无返回值
|
@Builder
private PageContent() {
ColumnStart({ fillMaxSize: true }) {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.OrderDetailContent()
})
.layoutWeight(1);
if (this.vm.uiState === BaseNetWorkUiState.SUCCESS) {
this.BottomBar();
}
}
// 取消订单弹窗
DictSelectModal({
visible: this.vm.cancelModalVisible,
title: $r("app.string.select_cancel_reason"),
uiState: this.vm.cancelReasonsUiState,
dictList: this.vm.cancelReasonList,
selectedItem: this.vm.selectedCancelReason,
onDismiss: (): void => this.vm.hideCancelModal(),
onItemSelected: (item: DictItem): void => this.vm.selectCancelReason(item),
onConfirm: (): void => this.vm.confirmCancelOrder(),
onRetry: (): void => this.vm.loadCancelReasons()
});
IBestDialog({
visible: this.vm.showConfirmDialog,
title: $r("app.string.confirm_receipt"),
message: $r("app.string.confirm_receipt_message"),
showCancelButton: true,
confirmButtonText: $r("app.string.confirm"),
cancelButtonText: $r("app.string.cancel"),
onConfirm: (): void => this.vm.confirmReceiveOrder(),
onCancel: (): void => this.vm.hideConfirmReceiveDialog(),
onClose: (): void => this.vm.hideConfirmReceiveDialog()
});
OrderGoodsModal({
visible: this.vm.rebuyModalVisible,
title: $r("app.string.select_goods_to_buy"),
buttonText: $r("app.string.rebuy"),
cartList: this.vm.cartList,
onDismiss: (): void => this.vm.hideRebuyModal(),
onItemButtonClick: (goodsId: number): void => this.vm.toGoodsDetail(goodsId)
});
OrderGoodsModal({
visible: this.vm.commentModalVisible,
title: $r("app.string.select_goods_to_comment"),
buttonText: $r("app.string.go_to_comment"),
cartList: this.vm.cartList,
onDismiss: (): void => this.vm.hideCommentModal(),
onItemButtonClick: (goodsId: number): void => this.vm.toOrderCommentForGoods(goodsId)
});
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PageContent 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 ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left BaseNetWorkView ( AST#component_parameters#Left { AST#component_parameter#Left uiState : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . uiState AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onRetry : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . retryRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . OrderDetailContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . uiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . SUCCESS AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . BottomBar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#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 DictSelectModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . cancelModalVisible AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.select_cancel_reason" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left uiState : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . cancelReasonsUiState AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left dictList : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . cancelReasonList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left selectedItem : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . selectedCancelReason AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onDismiss : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hideCancelModal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onItemSelected : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left DictItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . selectCancelReason AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onConfirm : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . confirmCancelOrder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onRetry : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . loadCancelReasons AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left IBestDialog ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . showConfirmDialog AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.confirm_receipt" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left message : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.confirm_receipt_message" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left showCancelButton : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left confirmButtonText : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.confirm" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cancelButtonText : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.cancel" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onConfirm : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . confirmReceiveOrder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onCancel : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hideConfirmReceiveDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onClose : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hideConfirmReceiveDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left OrderGoodsModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . rebuyModalVisible AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.select_goods_to_buy" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left buttonText : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.rebuy" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cartList : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . cartList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onDismiss : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hideRebuyModal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onItemButtonClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . toGoodsDetail AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left OrderGoodsModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . commentModalVisible AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.select_goods_to_comment" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left buttonText : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.go_to_comment" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cartList : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . cartList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onDismiss : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hideCommentModal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onItemButtonClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . toOrderCommentForGoods AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private PageContent() {
ColumnStart({ fillMaxSize: true }) {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.OrderDetailContent()
})
.layoutWeight(1);
if (this.vm.uiState === BaseNetWorkUiState.SUCCESS) {
this.BottomBar();
}
}
DictSelectModal({
visible: this.vm.cancelModalVisible,
title: $r("app.string.select_cancel_reason"),
uiState: this.vm.cancelReasonsUiState,
dictList: this.vm.cancelReasonList,
selectedItem: this.vm.selectedCancelReason,
onDismiss: (): void => this.vm.hideCancelModal(),
onItemSelected: (item: DictItem): void => this.vm.selectCancelReason(item),
onConfirm: (): void => this.vm.confirmCancelOrder(),
onRetry: (): void => this.vm.loadCancelReasons()
});
IBestDialog({
visible: this.vm.showConfirmDialog,
title: $r("app.string.confirm_receipt"),
message: $r("app.string.confirm_receipt_message"),
showCancelButton: true,
confirmButtonText: $r("app.string.confirm"),
cancelButtonText: $r("app.string.cancel"),
onConfirm: (): void => this.vm.confirmReceiveOrder(),
onCancel: (): void => this.vm.hideConfirmReceiveDialog(),
onClose: (): void => this.vm.hideConfirmReceiveDialog()
});
OrderGoodsModal({
visible: this.vm.rebuyModalVisible,
title: $r("app.string.select_goods_to_buy"),
buttonText: $r("app.string.rebuy"),
cartList: this.vm.cartList,
onDismiss: (): void => this.vm.hideRebuyModal(),
onItemButtonClick: (goodsId: number): void => this.vm.toGoodsDetail(goodsId)
});
OrderGoodsModal({
visible: this.vm.commentModalVisible,
title: $r("app.string.select_goods_to_comment"),
buttonText: $r("app.string.go_to_comment"),
cartList: this.vm.cartList,
onDismiss: (): void => this.vm.hideCommentModal(),
onItemButtonClick: (goodsId: number): void => this.vm.toOrderCommentForGoods(goodsId)
});
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L67-L124
|
31ffd2578e723631998f4de20ff325c32cb95b61
|
github
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets
|
arkts
|
FoldSplitContainer
|
Defines FoldSplitContainer container.
@interface FoldSplitContainer
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12
|
@Component
export struct FoldSplitContainer {
/**
* The builder function which will be rendered in the major region of container.
*
* @type { Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
@BuilderParam
primary: Callback<void>;
/**
* The builder function which will be rendered in the minor region of container.
*
* @type { Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
@BuilderParam
secondary: Callback<void>;
/**
* The builder function which will be rendered in the extra region of container.
*
* @type { ?Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
@BuilderParam
extra?: Callback<void>;
/**
* The layout options for the container when the foldable screen is expanded.
*
* @type { ExpandedRegionLayoutOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
@Prop
@Watch('updateLayout')
expandedLayoutOptions: ExpandedRegionLayoutOptions = {
horizontalSplitRatio: PresetSplitRatio.LAYOUT_3V2,
verticalSplitRatio: PresetSplitRatio.LAYOUT_1V1,
isExtraRegionPerpendicular: true,
extraRegionPosition: ExtraRegionPosition.TOP
};
/**
* The layout options for the container when the foldable screen is in hover mode.
*
* @type { HoverModeRegionLayoutOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
@Prop
@Watch('updateLayout')
hoverModeLayoutOptions: HoverModeRegionLayoutOptions = {
horizontalSplitRatio: PresetSplitRatio.LAYOUT_3V2,
showExtraRegion: false,
extraRegionPosition: ExtraRegionPosition.TOP
};
/**
* The layout options for the container when the foldable screen is folded.
*
* @type { FoldedRegionLayoutOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
@Prop
@Watch('updateLayout')
foldedLayoutOptions: FoldedRegionLayoutOptions = {
verticalSplitRatio: PresetSplitRatio.LAYOUT_1V1
};
/**
* The animation options of layout
*
* @type { AnimateParam | null }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
@Prop
animationOptions?: AnimateParam | null = undefined;
/**
* The callback function that is triggered when the foldable screen enters or exits hover mode.
* In hover mode, the upper half of the screen is used for display, and the lower half is used for operation.
*
* @type { ?OnHoverStatusChangeHandler }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
public onHoverStatusChange?: OnHoverStatusChangeHandler = () => {
};
@State primaryLayout: Layout = initLayout();
@State secondaryLayout: Layout = initLayout();
@State extraLayout: Layout = initLayout();
@State extraOpacity: number = 1;
private windowStatusType: window.WindowStatusType = window.WindowStatusType.UNDEFINED;
private foldStatus: display.FoldStatus = display.FoldStatus.FOLD_STATUS_UNKNOWN;
private windowInstance?: window.Window;
private containerSize: Size = { width: 0, height: 0 };
private containerGlobalPosition: Position = { x: 0, y: 0 };
private listener?: mediaQuery.MediaQueryListener;
private isSmallScreen: boolean = false;
private isHoverMode: boolean | undefined = undefined;
aboutToAppear() {
this.listener = mediaQuery.matchMediaSync('(width<=600vp)');
this.isSmallScreen = this.listener.matches;
this.listener.on('change', (result) => {
this.isSmallScreen = result.matches;
});
this.foldStatus = display.getFoldStatus();
display.on('foldStatusChange', (foldStatus) => {
if (this.foldStatus !== foldStatus) {
this.foldStatus = foldStatus;
this.updateLayout();
this.updatePreferredOrientation();
}
});
window.getLastWindow(this.getUIContext().getHostContext(), (error, windowInstance) => {
if (error && error.code) {
Logger.error('Failed to get window instance, error code: %{public}d', error.code);
return;
}
const windowId = windowInstance.getWindowProperties().id;
if (windowId < 0) {
Logger.error('Failed to get window instance because the window id is invalid. window id: %{public}d', windowId);
return;
}
this.windowInstance = windowInstance;
this.updatePreferredOrientation();
this.windowInstance.on('windowStatusChange', (status) => {
this.windowStatusType = status;
});
});
}
aboutToDisappear() {
if (this.listener) {
this.listener.off('change');
this.listener = undefined;
}
display.off('foldStatusChange');
if (this.windowInstance) {
this.windowInstance.off('windowStatusChange');
}
}
build() {
Stack() {
Column() {
if (this.primary) {
this.primary();
}
}
.size(this.primaryLayout.size)
.position({
start: LengthMetrics.vp(this.primaryLayout.position.x),
top: LengthMetrics.vp(this.primaryLayout.position.y),
})
.clip(true)
Column() {
if (this.secondary) {
this.secondary();
}
}
.size(this.secondaryLayout.size)
.position({
start: LengthMetrics.vp(this.secondaryLayout.position.x),
top: LengthMetrics.vp(this.secondaryLayout.position.y),
})
.clip(true)
if (this.extra) {
Column() {
this.extra?.();
}
.opacity(this.extraOpacity)
.animation({ curve: Curve.Linear, duration: 250 })
.size(this.extraLayout.size)
.position({
start: LengthMetrics.vp(this.extraLayout.position.x),
top: LengthMetrics.vp(this.extraLayout.position.y),
})
.clip(true)
}
}
.id('$$FoldSplitContainer$Stack$$')
.width('100%')
.height('100%')
.onSizeChange((_, size) => {
this.updateContainerSize(size);
this.updateContainerPosition();
this.updateLayout();
})
}
private dispatchHoverStatusChange(isHoverMode: boolean) {
if (this.onHoverStatusChange) {
this.onHoverStatusChange({
foldStatus: this.foldStatus,
isHoverMode: isHoverMode,
appRotation: display.getDefaultDisplaySync().rotation,
windowStatusType: this.windowStatusType,
});
}
}
private hasExtraRegion(): boolean {
return !!this.extra;
}
private async updatePreferredOrientation() {
if (this.windowInstance) {
try {
if (this.foldStatus === display.FoldStatus.FOLD_STATUS_FOLDED) {
await this.windowInstance.setPreferredOrientation(window.Orientation.AUTO_ROTATION_PORTRAIT);
} else {
await this.windowInstance.setPreferredOrientation(window.Orientation.AUTO_ROTATION);
}
} catch (err) {
Logger.error('Failed to update preferred orientation.');
}
}
}
private updateContainerSize(size: SizeOptions) {
this.containerSize.width = size.width as number;
this.containerSize.height = size.height as number;
}
private updateContainerPosition() {
const context = this.getUIContext();
const frameNode = context.getFrameNodeById('$$FoldSplitContainer$Stack$$');
if (frameNode) {
this.containerGlobalPosition = frameNode.getPositionToWindow();
}
}
private updateLayout() {
let isHoverMode: boolean = false;
let regionLayout: RegionLayout;
if (this.isSmallScreen) {
regionLayout = this.getFoldedRegionLayouts();
} else {
if (this.foldStatus === display.FoldStatus.FOLD_STATUS_EXPANDED) {
regionLayout = this.getExpandedRegionLayouts();
} else if (this.foldStatus === display.FoldStatus.FOLD_STATUS_HALF_FOLDED) {
if (this.isPortraitOrientation()) {
regionLayout = this.getExpandedRegionLayouts();
} else {
regionLayout = this.getHoverModeRegionLayouts();
isHoverMode = true;
}
} else if (this.foldStatus === display.FoldStatus.FOLD_STATUS_FOLDED) {
regionLayout = this.getFoldedRegionLayouts();
} else {
regionLayout = this.getExpandedRegionLayouts();
}
}
if (this.animationOptions === null) {
this.primaryLayout = regionLayout.primary;
this.secondaryLayout = regionLayout.secondary;
this.extraLayout = regionLayout.extra;
} else if (this.animationOptions === void 0) {
animateTo({ curve: curves.springMotion(0.35, 1, 0) }, () => {
this.primaryLayout = regionLayout.primary;
this.secondaryLayout = regionLayout.secondary;
this.extraLayout = regionLayout.extra;
});
} else {
animateTo(this.animationOptions, () => {
this.primaryLayout = regionLayout.primary;
this.secondaryLayout = regionLayout.secondary;
this.extraLayout = regionLayout.extra;
});
}
if (this.isHoverMode !== isHoverMode) {
this.dispatchHoverStatusChange(isHoverMode);
this.isHoverMode = isHoverMode;
}
if (isHoverMode && !this.hoverModeLayoutOptions.showExtraRegion) {
this.extraOpacity = 0;
} else {
this.extraOpacity = 1;
}
}
private getExpandedRegionLayouts(): RegionLayout {
const width = this.containerSize.width;
const height = this.containerSize.height;
const primaryLayout: Layout = initLayout();
const secondaryLayout: Layout = initLayout();
const extraLayout: Layout = initLayout();
const horizontalSplitRatio =
getSplitRatio(this.expandedLayoutOptions.horizontalSplitRatio, PresetSplitRatio.LAYOUT_3V2);
const verticalSplitRatio =
getSplitRatio(this.expandedLayoutOptions.verticalSplitRatio, PresetSplitRatio.LAYOUT_1V1);
if (this.hasExtraRegion()) {
extraLayout.size.width = width / (horizontalSplitRatio + 1);
} else {
extraLayout.size.width = 0;
}
secondaryLayout.size.height = height / (verticalSplitRatio + 1);
primaryLayout.size.height = height - secondaryLayout.size.height;
primaryLayout.position.x = 0;
secondaryLayout.position.x = 0;
primaryLayout.position.y = 0;
secondaryLayout.position.y = primaryLayout.size.height;
const isExtraRegionPerpendicular = withDefaultValue(this.expandedLayoutOptions.isExtraRegionPerpendicular, true);
if (isExtraRegionPerpendicular) {
primaryLayout.size.width = width - extraLayout.size.width;
secondaryLayout.size.width = width - extraLayout.size.width;
extraLayout.size.height = height;
extraLayout.position.x = primaryLayout.size.width;
extraLayout.position.y = 0;
} else {
const extraRegionPosition =
withDefaultValue(this.expandedLayoutOptions.extraRegionPosition, ExtraRegionPosition.TOP);
if (extraRegionPosition === ExtraRegionPosition.BOTTOM) {
primaryLayout.size.width = width;
secondaryLayout.size.width = width - extraLayout.size.width;
extraLayout.size.height = secondaryLayout.size.height;
extraLayout.position.x = secondaryLayout.size.width;
extraLayout.position.y = primaryLayout.size.height;
} else {
primaryLayout.size.width = width - extraLayout.size.width;
secondaryLayout.size.width = width;
extraLayout.size.height = primaryLayout.size.height;
extraLayout.position.x = primaryLayout.size.width;
extraLayout.position.y = 0;
}
}
return { primary: primaryLayout, secondary: secondaryLayout, extra: extraLayout };
}
private getHoverModeRegionLayouts(): RegionLayout {
const width = this.containerSize.width;
const height = this.containerSize.height;
const primaryLayout: Layout = initLayout();
const secondaryLayout: Layout = initLayout();
const extraLayout: Layout = initLayout();
const creaseRegionRect = this.getCreaseRegionRect();
primaryLayout.position.x = 0;
primaryLayout.position.y = 0;
secondaryLayout.position.x = 0;
secondaryLayout.position.y = creaseRegionRect.top + creaseRegionRect.height;
secondaryLayout.size.height = height - secondaryLayout.position.y;
primaryLayout.size.height = creaseRegionRect.top;
const showExtraRegion = withDefaultValue(this.hoverModeLayoutOptions.showExtraRegion, false);
if (!showExtraRegion) {
primaryLayout.size.width = width;
secondaryLayout.size.width = width;
extraLayout.position.x = width;
const isExpandedExtraRegionPerpendicular =
withDefaultValue(this.expandedLayoutOptions.isExtraRegionPerpendicular, true);
if (isExpandedExtraRegionPerpendicular) {
extraLayout.size.height = this.extraLayout.size.height;
} else {
const expandedExtraRegionPosition =
withDefaultValue(this.expandedLayoutOptions.extraRegionPosition, ExtraRegionPosition.TOP);
if (expandedExtraRegionPosition === ExtraRegionPosition.BOTTOM) {
extraLayout.size.height = secondaryLayout.size.height;
extraLayout.position.y = secondaryLayout.position.y;
} else {
extraLayout.size.height = primaryLayout.size.height;
extraLayout.position.y = 0;
}
}
} else {
const horizontalSplitRatio =
getSplitRatio(this.hoverModeLayoutOptions.horizontalSplitRatio, PresetSplitRatio.LAYOUT_3V2);
const extraRegionPosition =
withDefaultValue(this.hoverModeLayoutOptions.extraRegionPosition, ExtraRegionPosition.TOP);
if (this.hasExtraRegion()) {
extraLayout.size.width = width / (horizontalSplitRatio + 1);
} else {
extraLayout.size.width = 0;
}
if (extraRegionPosition === ExtraRegionPosition.BOTTOM) {
primaryLayout.size.width = width;
secondaryLayout.size.width = width - extraLayout.size.width;
extraLayout.size.height = secondaryLayout.size.height;
extraLayout.position.x = secondaryLayout.size.width;
extraLayout.position.y = secondaryLayout.position.y;
} else {
extraLayout.size.height = primaryLayout.size.height;
primaryLayout.size.width = width - extraLayout.size.width;
secondaryLayout.size.width = width;
extraLayout.position.x = primaryLayout.position.x + primaryLayout.size.width;
extraLayout.position.y = 0;
}
}
return { primary: primaryLayout, secondary: secondaryLayout, extra: extraLayout };
}
private getFoldedRegionLayouts(): RegionLayout {
const width = this.containerSize.width;
const height = this.containerSize.height;
const primaryLayout: Layout = initLayout();
const secondaryLayout: Layout = initLayout();
const extraLayout: Layout = initLayout();
const verticalSplitRatio =
getSplitRatio(this.foldedLayoutOptions.verticalSplitRatio, PresetSplitRatio.LAYOUT_1V1);
secondaryLayout.size.height = height / (verticalSplitRatio + 1);
primaryLayout.size.height = height - secondaryLayout.size.height;
extraLayout.size.height = 0;
primaryLayout.size.width = width;
secondaryLayout.size.width = width;
extraLayout.size.width = 0;
primaryLayout.position.x = 0;
secondaryLayout.position.x = 0;
extraLayout.position.x = width;
primaryLayout.position.y = 0;
secondaryLayout.position.y = primaryLayout.size.height;
extraLayout.position.y = 0;
return { primary: primaryLayout, secondary: secondaryLayout, extra: extraLayout };
}
private getCreaseRegionRect(): display.Rect {
const creaseRegion = display.getCurrentFoldCreaseRegion();
const rects = creaseRegion.creaseRects;
let left: number = 0;
let top: number = 0;
let width: number = 0;
let height: number = 0;
if (rects && rects.length) {
const rect = rects[0];
left = px2vp(rect.left) - this.containerGlobalPosition.x;
top = px2vp(rect.top) - this.containerGlobalPosition.y;
width = px2vp(rect.width);
height = px2vp(rect.height);
}
return { left, top, width, height };
}
private isPortraitOrientation() {
const defaultDisplay = display.getDefaultDisplaySync();
switch (defaultDisplay.orientation) {
case display.Orientation.PORTRAIT:
case display.Orientation.PORTRAIT_INVERTED:
return true;
case display.Orientation.LANDSCAPE:
case display.Orientation.LANDSCAPE_INVERTED:
default:
return false;
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FoldSplitContainer AST#component_body#Left { /**
* The builder function which will be rendered in the major region of container.
*
* @type { Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right primary : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#property_declaration#Right /**
* The builder function which will be rendered in the minor region of container.
*
* @type { Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right secondary : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#property_declaration#Right /**
* The builder function which will be rendered in the extra region of container.
*
* @type { ?Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right extra ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#property_declaration#Right /**
* The layout options for the container when the foldable screen is expanded.
*
* @type { ExpandedRegionLayoutOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updateLayout' AST#expression#Right ) AST#decorator#Right expandedLayoutOptions : AST#type_annotation#Left AST#primary_type#Left ExpandedRegionLayoutOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left horizontalSplitRatio AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PresetSplitRatio AST#expression#Right . LAYOUT_3V2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left verticalSplitRatio AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PresetSplitRatio AST#expression#Right . LAYOUT_1V1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isExtraRegionPerpendicular 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 extraRegionPosition AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ExtraRegionPosition AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* The layout options for the container when the foldable screen is in hover mode.
*
* @type { HoverModeRegionLayoutOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updateLayout' AST#expression#Right ) AST#decorator#Right hoverModeLayoutOptions : AST#type_annotation#Left AST#primary_type#Left HoverModeRegionLayoutOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left horizontalSplitRatio AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PresetSplitRatio AST#expression#Right . LAYOUT_3V2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showExtraRegion 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 extraRegionPosition AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ExtraRegionPosition AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* The layout options for the container when the foldable screen is folded.
*
* @type { FoldedRegionLayoutOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updateLayout' AST#expression#Right ) AST#decorator#Right foldedLayoutOptions : AST#type_annotation#Left AST#primary_type#Left FoldedRegionLayoutOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left verticalSplitRatio AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PresetSplitRatio AST#expression#Right . LAYOUT_1V1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* The animation options of layout
*
* @type { AnimateParam | null }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right animationOptions ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AnimateParam AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* The callback function that is triggered when the foldable screen enters or exits hover mode.
* In hover mode, the upper half of the screen is used for display, and the lower half is used for operation.
*
* @type { ?OnHoverStatusChangeHandler }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left public onHoverStatusChange ? : AST#type_annotation#Left AST#primary_type#Left OnHoverStatusChangeHandler AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right primaryLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right secondaryLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right extraLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right extraOpacity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private windowStatusType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStatusType AST#qualified_type#Right 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 window AST#expression#Right . WindowStatusType AST#member_expression#Right AST#expression#Right . UNDEFINED AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private foldStatus : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . FoldStatus AST#qualified_type#Right 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 display AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_UNKNOWN AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private windowInstance ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private containerSize : AST#type_annotation#Left AST#primary_type#Left Size AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private containerGlobalPosition : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private listener ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left mediaQuery . MediaQueryListener AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private isSmallScreen : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private isHoverMode : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listener AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mediaQuery AST#expression#Right . matchMediaSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '(width<=600vp)' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSmallScreen AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listener AST#member_expression#Right AST#expression#Right . matches AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listener AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'change' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSmallScreen AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . matches AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . foldStatus AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getFoldStatus AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 display AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'foldStatusChange' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left foldStatus AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . foldStatus AST#member_expression#Right AST#expression#Right !== AST#expression#Left foldStatus 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 . foldStatus AST#member_expression#Right = AST#expression#Left foldStatus 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 . updateLayout AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updatePreferredOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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 window AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error AST#parameter#Right , AST#parameter#Left windowInstance 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 error AST#expression#Right && AST#expression#Left error AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Failed to get window instance, error code: %{public}d' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left windowId = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowInstance AST#expression#Right . getWindowProperties AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left windowId 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Failed to get window instance because the window id is invalid. window id: %{public}d' AST#expression#Right , AST#expression#Left windowId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowInstance AST#member_expression#Right = AST#expression#Left windowInstance 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 . updatePreferredOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowInstance AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'windowStatusChange' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left status 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 . windowStatusType AST#member_expression#Right = AST#expression#Left status AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listener 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 . listener AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'change' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listener AST#member_expression#Right = AST#expression#Left undefined AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'foldStatusChange' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowInstance 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 . windowInstance AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'windowStatusChange' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . primary AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . primary AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . primaryLayout AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left start AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LengthMetrics AST#expression#Right . vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . primaryLayout AST#member_expression#Right AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LengthMetrics AST#expression#Right . vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . primaryLayout AST#member_expression#Right AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . secondary AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . secondary AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . secondaryLayout AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left start AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LengthMetrics AST#expression#Right . vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . secondaryLayout AST#member_expression#Right AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LengthMetrics AST#expression#Right . vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . secondaryLayout AST#member_expression#Right AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 . extra AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extra AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extraOpacity AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . animation ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 250 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extraLayout AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left start AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LengthMetrics AST#expression#Right . vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extraLayout AST#member_expression#Right AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LengthMetrics AST#expression#Right . vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extraLayout AST#member_expression#Right AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 . id ( AST#expression#Left '$$FoldSplitContainer$Stack$$' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . onSizeChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left _ AST#parameter#Right , AST#parameter#Left size AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateContainerSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left size AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 . updateContainerPosition AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateLayout 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#build_body#Right AST#build_method#Right AST#method_declaration#Left private dispatchHoverStatusChange AST#parameter_list#Left ( AST#parameter#Left isHoverMode : 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#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onHoverStatusChange AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onHoverStatusChange 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 foldStatus AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . foldStatus AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isHoverMode AST#property_name#Right : AST#expression#Left isHoverMode AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left appRotation AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . rotation AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left windowStatusType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowStatusType AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left private hasExtraRegion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . extra AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private async updatePreferredOrientation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowInstance AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . foldStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_FOLDED AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . windowInstance AST#member_expression#Right AST#expression#Right . setPreferredOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . AUTO_ROTATION_PORTRAIT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . windowInstance AST#member_expression#Right AST#expression#Right . setPreferredOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . Orientation AST#member_expression#Right AST#expression#Right . AUTO_ROTATION 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#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Failed to update preferred orientation.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private updateContainerSize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left SizeOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . containerSize AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . width AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . containerSize AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . height AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left private updateContainerPosition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left frameNode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . getFrameNodeById AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '$$FoldSplitContainer$Stack$$' AST#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 frameNode 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 . containerGlobalPosition AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left frameNode AST#expression#Right . getPositionToWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private updateLayout AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isHoverMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left regionLayout : AST#type_annotation#Left AST#primary_type#Left RegionLayout 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#member_expression#Left AST#expression#Left this AST#expression#Right . isSmallScreen 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 regionLayout = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getFoldedRegionLayouts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . foldStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_EXPANDED AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left regionLayout = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getExpandedRegionLayouts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . foldStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_HALF_FOLDED AST#member_expression#Right AST#expression#Right ) AST#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 . isPortraitOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left regionLayout = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getExpandedRegionLayouts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left regionLayout = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getHoverModeRegionLayouts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left isHoverMode = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . foldStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_FOLDED 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 regionLayout = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getFoldedRegionLayouts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left regionLayout = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getExpandedRegionLayouts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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 . animationOptions AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . primaryLayout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left regionLayout AST#expression#Right . primary AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . secondaryLayout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left regionLayout AST#expression#Right . secondary AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extraLayout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left regionLayout AST#expression#Right . extra AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationOptions AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#unary_expression#Left void AST#expression#Left 0 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left curves AST#expression#Right . springMotion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0.35 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#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 . primaryLayout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left regionLayout AST#expression#Right . primary AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . secondaryLayout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left regionLayout AST#expression#Right . secondary AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extraLayout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left regionLayout AST#expression#Right . extra AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationOptions AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . primaryLayout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left regionLayout AST#expression#Right . primary AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . secondaryLayout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left regionLayout AST#expression#Right . secondary AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extraLayout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left regionLayout AST#expression#Right . extra AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isHoverMode AST#member_expression#Right AST#expression#Right !== AST#expression#Left isHoverMode AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dispatchHoverStatusChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left isHoverMode AST#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 . isHoverMode AST#member_expression#Right = AST#expression#Left isHoverMode 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left isHoverMode AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . hoverModeLayoutOptions AST#member_expression#Right AST#expression#Right . showExtraRegion 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 . extraOpacity AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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 . extraOpacity AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private getExpandedRegionLayouts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RegionLayout AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left width = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . containerSize AST#member_expression#Right AST#expression#Right . width 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 height = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . containerSize AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left primaryLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout 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 secondaryLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout 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 extraLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout 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 horizontalSplitRatio = AST#expression#Left AST#call_expression#Left AST#expression#Left getSplitRatio AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . expandedLayoutOptions AST#member_expression#Right AST#expression#Right . horizontalSplitRatio AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left PresetSplitRatio AST#expression#Right . LAYOUT_3V2 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left verticalSplitRatio = AST#expression#Left AST#call_expression#Left AST#expression#Left getSplitRatio AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . expandedLayoutOptions AST#member_expression#Right AST#expression#Right . verticalSplitRatio AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left PresetSplitRatio AST#expression#Right . LAYOUT_1V1 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hasExtraRegion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left horizontalSplitRatio AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left verticalSplitRatio AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#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 AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right - AST#expression#Left secondaryLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left isExtraRegionPerpendicular = AST#expression#Left AST#call_expression#Left AST#expression#Left withDefaultValue AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . expandedLayoutOptions AST#member_expression#Right AST#expression#Right . isExtraRegionPerpendicular AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isExtraRegionPerpendicular AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right - AST#expression#Left extraLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right - AST#expression#Left extraLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left height AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left extraRegionPosition = AST#expression#Left AST#call_expression#Left AST#expression#Left withDefaultValue AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . expandedLayoutOptions AST#member_expression#Right AST#expression#Right . extraRegionPosition AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ExtraRegionPosition AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left extraRegionPosition AST#expression#Right === AST#expression#Left ExtraRegionPosition AST#expression#Right AST#binary_expression#Right AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right - AST#expression#Left extraLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right - AST#expression#Left extraLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left primary AST#property_name#Right : AST#expression#Left primaryLayout AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondary AST#property_name#Right : AST#expression#Left secondaryLayout AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extra AST#property_name#Right : AST#expression#Left extraLayout AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private getHoverModeRegionLayouts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RegionLayout AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left width = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . containerSize AST#member_expression#Right AST#expression#Right . width 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 height = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . containerSize AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left primaryLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout 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 secondaryLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout 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 extraLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout 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 creaseRegionRect = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCreaseRegionRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left creaseRegionRect AST#expression#Right . top AST#member_expression#Right AST#expression#Right + AST#expression#Left creaseRegionRect AST#expression#Right AST#binary_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right - AST#expression#Left secondaryLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left creaseRegionRect AST#expression#Right . top AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left showExtraRegion = AST#expression#Left AST#call_expression#Left AST#expression#Left withDefaultValue AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hoverModeLayoutOptions AST#member_expression#Right AST#expression#Right . showExtraRegion AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 showExtraRegion 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left isExpandedExtraRegionPerpendicular = AST#expression#Left AST#call_expression#Left AST#expression#Left withDefaultValue AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . expandedLayoutOptions AST#member_expression#Right AST#expression#Right . isExtraRegionPerpendicular AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isExpandedExtraRegionPerpendicular AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . extraLayout AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left expandedExtraRegionPosition = AST#expression#Left AST#call_expression#Left AST#expression#Left withDefaultValue AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . expandedLayoutOptions AST#member_expression#Right AST#expression#Right . extraRegionPosition AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ExtraRegionPosition AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left expandedExtraRegionPosition AST#expression#Right === AST#expression#Left ExtraRegionPosition AST#expression#Right AST#binary_expression#Right AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left horizontalSplitRatio = AST#expression#Left AST#call_expression#Left AST#expression#Left getSplitRatio AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hoverModeLayoutOptions AST#member_expression#Right AST#expression#Right . horizontalSplitRatio AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left PresetSplitRatio AST#expression#Right . LAYOUT_3V2 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left extraRegionPosition = AST#expression#Left AST#call_expression#Left AST#expression#Left withDefaultValue AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hoverModeLayoutOptions AST#member_expression#Right AST#expression#Right . extraRegionPosition AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ExtraRegionPosition AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hasExtraRegion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left horizontalSplitRatio AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left extraRegionPosition AST#expression#Right === AST#expression#Left ExtraRegionPosition AST#expression#Right AST#binary_expression#Right AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right - AST#expression#Left extraLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right - AST#expression#Left extraLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right + AST#expression#Left primaryLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left primary AST#property_name#Right : AST#expression#Left primaryLayout AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondary AST#property_name#Right : AST#expression#Left secondaryLayout AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extra AST#property_name#Right : AST#expression#Left extraLayout AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private getFoldedRegionLayouts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RegionLayout AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left width = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . containerSize AST#member_expression#Right AST#expression#Right . width 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 height = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . containerSize AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left primaryLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout 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 secondaryLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout 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 extraLayout : AST#type_annotation#Left AST#primary_type#Left Layout AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left initLayout 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 verticalSplitRatio = AST#expression#Left AST#call_expression#Left AST#expression#Left getSplitRatio AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . foldedLayoutOptions AST#member_expression#Right AST#expression#Right . verticalSplitRatio AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left PresetSplitRatio AST#expression#Right . LAYOUT_1V1 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left verticalSplitRatio AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#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 AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right - AST#expression#Left secondaryLayout AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left primaryLayout AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extraLayout AST#expression#Right . position AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left primary AST#property_name#Right : AST#expression#Left primaryLayout AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondary AST#property_name#Right : AST#expression#Left secondaryLayout AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extra AST#property_name#Right : AST#expression#Left extraLayout AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private getCreaseRegionRect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Rect AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left creaseRegion = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getCurrentFoldCreaseRegion 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 rects = AST#expression#Left AST#member_expression#Left AST#expression#Left creaseRegion AST#expression#Right . creaseRects AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left top : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left rects AST#expression#Right && AST#expression#Left rects 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#variable_declaration#Left const AST#variable_declarator#Left rect = AST#expression#Left AST#subscript_expression#Left AST#expression#Left rects 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left left = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . left AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . containerGlobalPosition AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left top = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . top AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . containerGlobalPosition AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left width = AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . width AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left height = AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left rect AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left left AST#property_assignment#Right , AST#property_assignment#Left top AST#property_assignment#Right , AST#property_assignment#Left width AST#property_assignment#Right , AST#property_assignment#Left height 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 AST#method_declaration#Left private isPortraitOrientation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#ERROR#Left AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultDisplay = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left defaultDisplay AST#expression#Right . orientation 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#property_name#Left case AST#property_name#Right display AST#ERROR#Right AST#modifier_chain_expression#Left . Orientation AST#modifier_chain_expression#Left . PORTRAIT AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left case AST#ERROR#Left display AST#ERROR#Right . Orientation . PORTRAIT_INVERTED AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left return AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left true AST#ERROR#Right ; AST#method_declaration#Right AST#property_declaration#Left case AST#ERROR#Left display . Orientation . LANDSCAPE : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left case AST#ERROR#Left display AST#ERROR#Right . Orientation . LANDSCAPE_INVERTED AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right : AST#type_annotation#Left AST#primary_type#Left default AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left return AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left false AST#ERROR#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct FoldSplitContainer {
@BuilderParam
primary: Callback<void>;
@BuilderParam
secondary: Callback<void>;
@BuilderParam
extra?: Callback<void>;
@Prop
@Watch('updateLayout')
expandedLayoutOptions: ExpandedRegionLayoutOptions = {
horizontalSplitRatio: PresetSplitRatio.LAYOUT_3V2,
verticalSplitRatio: PresetSplitRatio.LAYOUT_1V1,
isExtraRegionPerpendicular: true,
extraRegionPosition: ExtraRegionPosition.TOP
};
@Prop
@Watch('updateLayout')
hoverModeLayoutOptions: HoverModeRegionLayoutOptions = {
horizontalSplitRatio: PresetSplitRatio.LAYOUT_3V2,
showExtraRegion: false,
extraRegionPosition: ExtraRegionPosition.TOP
};
@Prop
@Watch('updateLayout')
foldedLayoutOptions: FoldedRegionLayoutOptions = {
verticalSplitRatio: PresetSplitRatio.LAYOUT_1V1
};
@Prop
animationOptions?: AnimateParam | null = undefined;
public onHoverStatusChange?: OnHoverStatusChangeHandler = () => {
};
@State primaryLayout: Layout = initLayout();
@State secondaryLayout: Layout = initLayout();
@State extraLayout: Layout = initLayout();
@State extraOpacity: number = 1;
private windowStatusType: window.WindowStatusType = window.WindowStatusType.UNDEFINED;
private foldStatus: display.FoldStatus = display.FoldStatus.FOLD_STATUS_UNKNOWN;
private windowInstance?: window.Window;
private containerSize: Size = { width: 0, height: 0 };
private containerGlobalPosition: Position = { x: 0, y: 0 };
private listener?: mediaQuery.MediaQueryListener;
private isSmallScreen: boolean = false;
private isHoverMode: boolean | undefined = undefined;
aboutToAppear() {
this.listener = mediaQuery.matchMediaSync('(width<=600vp)');
this.isSmallScreen = this.listener.matches;
this.listener.on('change', (result) => {
this.isSmallScreen = result.matches;
});
this.foldStatus = display.getFoldStatus();
display.on('foldStatusChange', (foldStatus) => {
if (this.foldStatus !== foldStatus) {
this.foldStatus = foldStatus;
this.updateLayout();
this.updatePreferredOrientation();
}
});
window.getLastWindow(this.getUIContext().getHostContext(), (error, windowInstance) => {
if (error && error.code) {
Logger.error('Failed to get window instance, error code: %{public}d', error.code);
return;
}
const windowId = windowInstance.getWindowProperties().id;
if (windowId < 0) {
Logger.error('Failed to get window instance because the window id is invalid. window id: %{public}d', windowId);
return;
}
this.windowInstance = windowInstance;
this.updatePreferredOrientation();
this.windowInstance.on('windowStatusChange', (status) => {
this.windowStatusType = status;
});
});
}
aboutToDisappear() {
if (this.listener) {
this.listener.off('change');
this.listener = undefined;
}
display.off('foldStatusChange');
if (this.windowInstance) {
this.windowInstance.off('windowStatusChange');
}
}
build() {
Stack() {
Column() {
if (this.primary) {
this.primary();
}
}
.size(this.primaryLayout.size)
.position({
start: LengthMetrics.vp(this.primaryLayout.position.x),
top: LengthMetrics.vp(this.primaryLayout.position.y),
})
.clip(true)
Column() {
if (this.secondary) {
this.secondary();
}
}
.size(this.secondaryLayout.size)
.position({
start: LengthMetrics.vp(this.secondaryLayout.position.x),
top: LengthMetrics.vp(this.secondaryLayout.position.y),
})
.clip(true)
if (this.extra) {
Column() {
this.extra?.();
}
.opacity(this.extraOpacity)
.animation({ curve: Curve.Linear, duration: 250 })
.size(this.extraLayout.size)
.position({
start: LengthMetrics.vp(this.extraLayout.position.x),
top: LengthMetrics.vp(this.extraLayout.position.y),
})
.clip(true)
}
}
.id('$$FoldSplitContainer$Stack$$')
.width('100%')
.height('100%')
.onSizeChange((_, size) => {
this.updateContainerSize(size);
this.updateContainerPosition();
this.updateLayout();
})
}
private dispatchHoverStatusChange(isHoverMode: boolean) {
if (this.onHoverStatusChange) {
this.onHoverStatusChange({
foldStatus: this.foldStatus,
isHoverMode: isHoverMode,
appRotation: display.getDefaultDisplaySync().rotation,
windowStatusType: this.windowStatusType,
});
}
}
private hasExtraRegion(): boolean {
return !!this.extra;
}
private async updatePreferredOrientation() {
if (this.windowInstance) {
try {
if (this.foldStatus === display.FoldStatus.FOLD_STATUS_FOLDED) {
await this.windowInstance.setPreferredOrientation(window.Orientation.AUTO_ROTATION_PORTRAIT);
} else {
await this.windowInstance.setPreferredOrientation(window.Orientation.AUTO_ROTATION);
}
} catch (err) {
Logger.error('Failed to update preferred orientation.');
}
}
}
private updateContainerSize(size: SizeOptions) {
this.containerSize.width = size.width as number;
this.containerSize.height = size.height as number;
}
private updateContainerPosition() {
const context = this.getUIContext();
const frameNode = context.getFrameNodeById('$$FoldSplitContainer$Stack$$');
if (frameNode) {
this.containerGlobalPosition = frameNode.getPositionToWindow();
}
}
private updateLayout() {
let isHoverMode: boolean = false;
let regionLayout: RegionLayout;
if (this.isSmallScreen) {
regionLayout = this.getFoldedRegionLayouts();
} else {
if (this.foldStatus === display.FoldStatus.FOLD_STATUS_EXPANDED) {
regionLayout = this.getExpandedRegionLayouts();
} else if (this.foldStatus === display.FoldStatus.FOLD_STATUS_HALF_FOLDED) {
if (this.isPortraitOrientation()) {
regionLayout = this.getExpandedRegionLayouts();
} else {
regionLayout = this.getHoverModeRegionLayouts();
isHoverMode = true;
}
} else if (this.foldStatus === display.FoldStatus.FOLD_STATUS_FOLDED) {
regionLayout = this.getFoldedRegionLayouts();
} else {
regionLayout = this.getExpandedRegionLayouts();
}
}
if (this.animationOptions === null) {
this.primaryLayout = regionLayout.primary;
this.secondaryLayout = regionLayout.secondary;
this.extraLayout = regionLayout.extra;
} else if (this.animationOptions === void 0) {
animateTo({ curve: curves.springMotion(0.35, 1, 0) }, () => {
this.primaryLayout = regionLayout.primary;
this.secondaryLayout = regionLayout.secondary;
this.extraLayout = regionLayout.extra;
});
} else {
animateTo(this.animationOptions, () => {
this.primaryLayout = regionLayout.primary;
this.secondaryLayout = regionLayout.secondary;
this.extraLayout = regionLayout.extra;
});
}
if (this.isHoverMode !== isHoverMode) {
this.dispatchHoverStatusChange(isHoverMode);
this.isHoverMode = isHoverMode;
}
if (isHoverMode && !this.hoverModeLayoutOptions.showExtraRegion) {
this.extraOpacity = 0;
} else {
this.extraOpacity = 1;
}
}
private getExpandedRegionLayouts(): RegionLayout {
const width = this.containerSize.width;
const height = this.containerSize.height;
const primaryLayout: Layout = initLayout();
const secondaryLayout: Layout = initLayout();
const extraLayout: Layout = initLayout();
const horizontalSplitRatio =
getSplitRatio(this.expandedLayoutOptions.horizontalSplitRatio, PresetSplitRatio.LAYOUT_3V2);
const verticalSplitRatio =
getSplitRatio(this.expandedLayoutOptions.verticalSplitRatio, PresetSplitRatio.LAYOUT_1V1);
if (this.hasExtraRegion()) {
extraLayout.size.width = width / (horizontalSplitRatio + 1);
} else {
extraLayout.size.width = 0;
}
secondaryLayout.size.height = height / (verticalSplitRatio + 1);
primaryLayout.size.height = height - secondaryLayout.size.height;
primaryLayout.position.x = 0;
secondaryLayout.position.x = 0;
primaryLayout.position.y = 0;
secondaryLayout.position.y = primaryLayout.size.height;
const isExtraRegionPerpendicular = withDefaultValue(this.expandedLayoutOptions.isExtraRegionPerpendicular, true);
if (isExtraRegionPerpendicular) {
primaryLayout.size.width = width - extraLayout.size.width;
secondaryLayout.size.width = width - extraLayout.size.width;
extraLayout.size.height = height;
extraLayout.position.x = primaryLayout.size.width;
extraLayout.position.y = 0;
} else {
const extraRegionPosition =
withDefaultValue(this.expandedLayoutOptions.extraRegionPosition, ExtraRegionPosition.TOP);
if (extraRegionPosition === ExtraRegionPosition.BOTTOM) {
primaryLayout.size.width = width;
secondaryLayout.size.width = width - extraLayout.size.width;
extraLayout.size.height = secondaryLayout.size.height;
extraLayout.position.x = secondaryLayout.size.width;
extraLayout.position.y = primaryLayout.size.height;
} else {
primaryLayout.size.width = width - extraLayout.size.width;
secondaryLayout.size.width = width;
extraLayout.size.height = primaryLayout.size.height;
extraLayout.position.x = primaryLayout.size.width;
extraLayout.position.y = 0;
}
}
return { primary: primaryLayout, secondary: secondaryLayout, extra: extraLayout };
}
private getHoverModeRegionLayouts(): RegionLayout {
const width = this.containerSize.width;
const height = this.containerSize.height;
const primaryLayout: Layout = initLayout();
const secondaryLayout: Layout = initLayout();
const extraLayout: Layout = initLayout();
const creaseRegionRect = this.getCreaseRegionRect();
primaryLayout.position.x = 0;
primaryLayout.position.y = 0;
secondaryLayout.position.x = 0;
secondaryLayout.position.y = creaseRegionRect.top + creaseRegionRect.height;
secondaryLayout.size.height = height - secondaryLayout.position.y;
primaryLayout.size.height = creaseRegionRect.top;
const showExtraRegion = withDefaultValue(this.hoverModeLayoutOptions.showExtraRegion, false);
if (!showExtraRegion) {
primaryLayout.size.width = width;
secondaryLayout.size.width = width;
extraLayout.position.x = width;
const isExpandedExtraRegionPerpendicular =
withDefaultValue(this.expandedLayoutOptions.isExtraRegionPerpendicular, true);
if (isExpandedExtraRegionPerpendicular) {
extraLayout.size.height = this.extraLayout.size.height;
} else {
const expandedExtraRegionPosition =
withDefaultValue(this.expandedLayoutOptions.extraRegionPosition, ExtraRegionPosition.TOP);
if (expandedExtraRegionPosition === ExtraRegionPosition.BOTTOM) {
extraLayout.size.height = secondaryLayout.size.height;
extraLayout.position.y = secondaryLayout.position.y;
} else {
extraLayout.size.height = primaryLayout.size.height;
extraLayout.position.y = 0;
}
}
} else {
const horizontalSplitRatio =
getSplitRatio(this.hoverModeLayoutOptions.horizontalSplitRatio, PresetSplitRatio.LAYOUT_3V2);
const extraRegionPosition =
withDefaultValue(this.hoverModeLayoutOptions.extraRegionPosition, ExtraRegionPosition.TOP);
if (this.hasExtraRegion()) {
extraLayout.size.width = width / (horizontalSplitRatio + 1);
} else {
extraLayout.size.width = 0;
}
if (extraRegionPosition === ExtraRegionPosition.BOTTOM) {
primaryLayout.size.width = width;
secondaryLayout.size.width = width - extraLayout.size.width;
extraLayout.size.height = secondaryLayout.size.height;
extraLayout.position.x = secondaryLayout.size.width;
extraLayout.position.y = secondaryLayout.position.y;
} else {
extraLayout.size.height = primaryLayout.size.height;
primaryLayout.size.width = width - extraLayout.size.width;
secondaryLayout.size.width = width;
extraLayout.position.x = primaryLayout.position.x + primaryLayout.size.width;
extraLayout.position.y = 0;
}
}
return { primary: primaryLayout, secondary: secondaryLayout, extra: extraLayout };
}
private getFoldedRegionLayouts(): RegionLayout {
const width = this.containerSize.width;
const height = this.containerSize.height;
const primaryLayout: Layout = initLayout();
const secondaryLayout: Layout = initLayout();
const extraLayout: Layout = initLayout();
const verticalSplitRatio =
getSplitRatio(this.foldedLayoutOptions.verticalSplitRatio, PresetSplitRatio.LAYOUT_1V1);
secondaryLayout.size.height = height / (verticalSplitRatio + 1);
primaryLayout.size.height = height - secondaryLayout.size.height;
extraLayout.size.height = 0;
primaryLayout.size.width = width;
secondaryLayout.size.width = width;
extraLayout.size.width = 0;
primaryLayout.position.x = 0;
secondaryLayout.position.x = 0;
extraLayout.position.x = width;
primaryLayout.position.y = 0;
secondaryLayout.position.y = primaryLayout.size.height;
extraLayout.position.y = 0;
return { primary: primaryLayout, secondary: secondaryLayout, extra: extraLayout };
}
private getCreaseRegionRect(): display.Rect {
const creaseRegion = display.getCurrentFoldCreaseRegion();
const rects = creaseRegion.creaseRects;
let left: number = 0;
let top: number = 0;
let width: number = 0;
let height: number = 0;
if (rects && rects.length) {
const rect = rects[0];
left = px2vp(rect.left) - this.containerGlobalPosition.x;
top = px2vp(rect.top) - this.containerGlobalPosition.y;
width = px2vp(rect.width);
height = px2vp(rect.height);
}
return { left, top, width, height };
}
private isPortraitOrientation() {
const defaultDisplay = display.getDefaultDisplaySync();
switch (defaultDisplay.orientation) {
case display.Orientation.PORTRAIT:
case display.Orientation.PORTRAIT_INVERTED:
return true;
case display.Orientation.LANDSCAPE:
case display.Orientation.LANDSCAPE_INVERTED:
default:
return false;
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets#L343-L821
|
6a1638227b481fe3b203d982077d65fc379c3434
|
gitee
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/services/LogService.ets
|
arkts
|
isServiceInitialized
|
检查服务是否已初始化
|
isServiceInitialized(): boolean {
return this.isInitialized;
}
|
AST#method_declaration#Left isServiceInitialized AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
isServiceInitialized(): boolean {
return this.isInitialized;
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/LogService.ets#L41-L43
|
1d04434aaaf398483ca814f2c19fe2ab02197c1e
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/DateUtil.ets
|
arkts
|
compareDate
|
比较指定日期相差的毫秒数
@param date1
@param date2
@param abs 是否绝对值
|
static compareDate(date1: number | string | Date, date2: number | string | Date, abs: boolean = false): number {
const dateTime1: number = DateUtil.getFormatDate(date1).getTime();
const dateTime2: number = DateUtil.getFormatDate(date2).getTime();
const diff = dateTime2 - dateTime1;
return abs ? Math.abs(diff) : diff;
}
|
AST#method_declaration#Left static compareDate AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left abs : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dateTime1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . getFormatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dateTime2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . getFormatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left diff = AST#expression#Left AST#binary_expression#Left AST#expression#Left dateTime2 AST#expression#Right - AST#expression#Left dateTime1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left abs AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left diff AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left diff AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static compareDate(date1: number | string | Date, date2: number | string | Date, abs: boolean = false): number {
const dateTime1: number = DateUtil.getFormatDate(date1).getTime();
const dateTime2: number = DateUtil.getFormatDate(date2).getTime();
const diff = dateTime2 - dateTime1;
return abs ? Math.abs(diff) : diff;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L259-L264
|
fb978bb429e521e7c2d33095c285acf49fc38369
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
|
arkts
|
readC1
|
读取C1部分
@param sm2_sequence sm2序列工具
@param data 待读取的数据
@returns C1部分
|
private readC1(sm2_sequence: SM2Sequence, data: string): string {
let xy: string[] = [];
for (let i = 0; i < 2; i++) {
if (data.startsWith("0220")) {
xy[i] = data.slice(4, 68);
data = data.slice(68, data.length);
} else if (data.startsWith("022100")) {
xy[i] = data.slice(6, 70);
data = data.slice(70, data.length);
} else {
Logger.debug('读取SM2字符串中的C1出错~');
}
}
sm2_sequence.C1x = xy[0];
sm2_sequence.C1y = xy[1];
return data;
}
|
AST#method_declaration#Left private readC1 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 xy : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left 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 2 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "0220" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left xy AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = data AST#ERROR#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 AST#expression#Right , AST#expression#Left 68 AST#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 data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 68 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "022100" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left xy AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = data AST#ERROR#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 6 AST#expression#Right , AST#expression#Left 70 AST#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 data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 70 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '读取SM2字符串中的C1出错~' AST#expression#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#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1x AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left xy AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C1y AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left xy 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#statement#Left AST#return_statement#Left return AST#expression#Left data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private readC1(sm2_sequence: SM2Sequence, data: string): string {
let xy: string[] = [];
for (let i = 0; i < 2; i++) {
if (data.startsWith("0220")) {
xy[i] = data.slice(4, 68);
data = data.slice(68, data.length);
} else if (data.startsWith("022100")) {
xy[i] = data.slice(6, 70);
data = data.slice(70, data.length);
} else {
Logger.debug('读取SM2字符串中的C1出错~');
}
}
sm2_sequence.C1x = xy[0];
sm2_sequence.C1y = xy[1];
return data;
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L208-L224
|
51b44480c7cc6bb3b4efaa19c2c5533cb23bae17
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/SM2.ets
|
arkts
|
getSM2PriKey
|
获取转换SM2私钥
@param key 传入的密钥数据,未序列化的原始裸数据
@returns
|
static getSM2PriKey(key: string): cryptoFramework.PriKey {
key = StrUtil.startsWith(key, "0x") ? key : `0x${key}`;
let sk: bigint = BigInt(key);
let priKey: cryptoFramework.ECCPriKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
sk: sk,
algName: "SM2",
specType: cryptoFramework.AsyKeySpecType.PRIVATE_KEY_SPEC
}
let KeyPairGenerator = cryptoFramework.createAsyKeyGeneratorBySpec(priKey);
return KeyPairGenerator.generatePriKeySync();
}
|
AST#method_declaration#Left static getSM2PriKey AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left key = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtil AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left "0x" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#ERROR#Left key : AST#ERROR#Right AST#expression#Left AST#template_literal#Left ` 0x AST#template_substitution#Left $ { AST#expression#Left key AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sk : AST#type_annotation#Left AST#primary_type#Left bigint AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ECCPriKeySpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . ECCKeyUtil AST#member_expression#Right AST#expression#Right . genECCCommonParamsSpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NID_sm2' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sk AST#property_name#Right : AST#expression#Left sk AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left algName AST#property_name#Right : AST#expression#Left "SM2" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left specType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . AsyKeySpecType AST#member_expression#Right AST#expression#Right . PRIVATE_KEY_SPEC AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left KeyPairGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGeneratorBySpec 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#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 KeyPairGenerator AST#expression#Right . generatePriKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getSM2PriKey(key: string): cryptoFramework.PriKey {
key = StrUtil.startsWith(key, "0x") ? key : `0x${key}`;
let sk: bigint = BigInt(key);
let priKey: cryptoFramework.ECCPriKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
sk: sk,
algName: "SM2",
specType: cryptoFramework.AsyKeySpecType.PRIVATE_KEY_SPEC
}
let KeyPairGenerator = cryptoFramework.createAsyKeyGeneratorBySpec(priKey);
return KeyPairGenerator.generatePriKeySync();
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L161-L172
|
9eb1249b84c323369b9f020b39c11076ab291aa5
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/navigation/src/main/ets/common/CommonNavigator.ets
|
arkts
|
toContributors
|
跳转到贡献者列表
@returns {void} 无返回值
|
static toContributors(): void {
navigateTo(CommonRoutes.Contributors);
}
|
AST#method_declaration#Left static toContributors AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonRoutes AST#expression#Right . Contributors AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static toContributors(): void {
navigateTo(CommonRoutes.Contributors);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/common/CommonNavigator.ets#L46-L48
|
325b31b85cb5d3faf96574cb9bb0706d92efad1a
|
github
|
dcm23333/FishManager.git
|
952dde4475268ac16f3480f3d55f82033aa6b467
|
FishManager/entry/src/main/ets/common/contants/commonContants.ets
|
arkts
|
db config day info table
|
export const DAY_INFO = {
tableName: 'dayInfo',
sqlCreate: 'CREATE TABLE IF NOT EXISTS dayInfo(date TEXT NOT NULL PRIMARY KEY, targetTaskNum INTEGER, finTaskNum INTEGER)',
columns: ['date', 'targetTaskNum', 'finTaskNum']
}
/** global info table */
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DAY_INFO = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tableName AST#property_name#Right : AST#expression#Left 'dayInfo' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sqlCreate AST#property_name#Right : AST#expression#Left 'CREATE TABLE IF NOT EXISTS dayInfo(date TEXT NOT NULL PRIMARY KEY, targetTaskNum INTEGER, finTaskNum INTEGER)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left columns AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'date' AST#expression#Right , AST#expression#Left 'targetTaskNum' AST#expression#Right , AST#expression#Left 'finTaskNum' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right /** global info table */ AST#variable_declaration#Right AST#export_declaration#Right
|
export const DAY_INFO = {
tableName: 'dayInfo',
sqlCreate: 'CREATE TABLE IF NOT EXISTS dayInfo(date TEXT NOT NULL PRIMARY KEY, targetTaskNum INTEGER, finTaskNum INTEGER)',
columns: ['date', 'targetTaskNum', 'finTaskNum']
}
|
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L19-L25
|
36f9edcab5ec6e5888b37900636ac6982fa86fdf
|
github
|
|
iichen-bycode/ArkTsWanandroid.git
|
ad128756a6c703d9a72cf7f6da128c27fc63bd00
|
entry/src/main/ets/view/ViewStateComponent.ets
|
arkts
|
convertImage
|
转换图片
@returns
|
convertImage() {
switch (this.viewState) {
case ViewStateConstant.VIEW_STATE_LOADING:
return $r('app.media.loading')
break;
case ViewStateConstant.VIEW_STATE_ERROR:
return $r('app.media.icon_net_error')
break;
case ViewStateConstant.VIEW_STATE_NETWORK_ERROR:
return $r('app.media.icon_time_out')
break;
case ViewStateConstant.VIEW_STATE_EMPTY:
return $r('app.media.icon_empty')
break;
default:
return $r('app.media.loading')
break;
}
}
|
AST#method_declaration#Left convertImage 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 switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewState AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { 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 ViewStateConstant AST#expression#Right . VIEW_STATE_LOADING AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.loading' AST#expression#Right ) AST#resource_expression#Right AST#expression#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 ViewStateConstant AST#expression#Right . VIEW_STATE_ERROR AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon_net_error' AST#expression#Right ) AST#resource_expression#Right AST#expression#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 ViewStateConstant AST#expression#Right . VIEW_STATE_NETWORK_ERROR AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon_time_out' AST#expression#Right ) AST#resource_expression#Right AST#expression#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 ViewStateConstant AST#expression#Right . VIEW_STATE_EMPTY AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon_empty' AST#expression#Right ) AST#resource_expression#Right AST#expression#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 default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.loading' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
convertImage() {
switch (this.viewState) {
case ViewStateConstant.VIEW_STATE_LOADING:
return $r('app.media.loading')
break;
case ViewStateConstant.VIEW_STATE_ERROR:
return $r('app.media.icon_net_error')
break;
case ViewStateConstant.VIEW_STATE_NETWORK_ERROR:
return $r('app.media.icon_time_out')
break;
case ViewStateConstant.VIEW_STATE_EMPTY:
return $r('app.media.icon_empty')
break;
default:
return $r('app.media.loading')
break;
}
}
|
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/view/ViewStateComponent.ets#L82-L100
|
81f985234906d132a1b3892928f5e6fdc840489a
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/services/data/ContactService.ets
|
arkts
|
createContact
|
创建联系人
@param params 创建参数
@returns 创建的联系人
|
async createContact(params: CreateContactParams): Promise<Contact> {
try {
// 验证数据
const validationResult = ContactModel.validate(params);
if (!validationResult.isValid) {
throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`);
}
// 检查联系人数量限制
const totalCount = await this.databaseService.count(StorageConstants.TABLE_CONTACTS);
if (totalCount >= BusinessConstants.MAX_CONTACTS) {
throw new Error(`联系人数量已达到上限 ${BusinessConstants.MAX_CONTACTS}`);
}
// 创建联系人模型
const contact = ContactModel.create(params);
// 转换数据格式用于数据库存储
const dbData = this.contactToDbData(contact);
// 插入数据库
await this.databaseService.insert(StorageConstants.TABLE_CONTACTS, dbData);
// 记录操作日志
await this.logOperation({
type: ContactOperationType.CREATE,
contactId: contact.id,
newData: contact,
description: `创建联系人: ${contact.name}`
});
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Contact created: ${contact.id}`);
return contact;
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to create contact: ${businessError.message}`);
throw businessError;
}
}
|
AST#method_declaration#Left async createContact AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateContactParams 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 Contact AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 验证数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left validationResult = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ContactModel AST#expression#Right . validate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left validationResult AST#expression#Right AST#unary_expression#Right AST#expression#Right . isValid AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 数据验证失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left validationResult AST#expression#Right . errors AST#member_expression#Right AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ', ' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 检查联系人数量限制 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left totalCount = 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 . databaseService AST#member_expression#Right AST#expression#Right . count AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left StorageConstants AST#expression#Right . TABLE_CONTACTS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left totalCount AST#expression#Right >= AST#expression#Left BusinessConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAX_CONTACTS AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 联系人数量已达到上限 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left BusinessConstants AST#expression#Right . MAX_CONTACTS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 创建联系人模型 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left contact = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ContactModel AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 转换数据格式用于数据库存储 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dbData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contactToDbData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contact AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . databaseService AST#member_expression#Right AST#expression#Right . insert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left StorageConstants AST#expression#Right . TABLE_CONTACTS AST#member_expression#Right AST#expression#Right , AST#expression#Left dbData AST#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 . logOperation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ContactOperationType AST#expression#Right . CREATE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contactId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left newData AST#property_name#Right : AST#expression#Left contact AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description 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 contact AST#expression#Right . name AST#member_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#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 AST#template_literal#Left ` Contact created: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left contact AST#expression#Right . id 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 contact AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left businessError = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 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 create contact: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left businessError AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left businessError AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async createContact(params: CreateContactParams): Promise<Contact> {
try {
const validationResult = ContactModel.validate(params);
if (!validationResult.isValid) {
throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`);
}
const totalCount = await this.databaseService.count(StorageConstants.TABLE_CONTACTS);
if (totalCount >= BusinessConstants.MAX_CONTACTS) {
throw new Error(`联系人数量已达到上限 ${BusinessConstants.MAX_CONTACTS}`);
}
const contact = ContactModel.create(params);
const dbData = this.contactToDbData(contact);
await this.databaseService.insert(StorageConstants.TABLE_CONTACTS, dbData);
await this.logOperation({
type: ContactOperationType.CREATE,
contactId: contact.id,
newData: contact,
description: `创建联系人: ${contact.name}`
});
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Contact created: ${contact.id}`);
return contact;
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to create contact: ${businessError.message}`);
throw businessError;
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/data/ContactService.ets#L49-L87
|
c31375b351179a85f0c485f85858b665db1ac825
|
github
|
dcm23333/FishManager.git
|
952dde4475268ac16f3480f3d55f82033aa6b467
|
FishManager/entry/src/main/ets/common/contants/commonContants.ets
|
arkts
|
number days of one week
|
export const WEEK_DAY_TIME: number = WEEK_DAY_NUM * 24 * 60 * 60 * 1000;
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left WEEK_DAY_TIME : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left WEEK_DAY_NUM AST#expression#Right * AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const WEEK_DAY_TIME: number = WEEK_DAY_NUM * 24 * 60 * 60 * 1000;
|
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L188-L188
|
bbfafabdd29587674849d3c7aeea292f691155a9
|
github
|
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/Select/entry/src/main/ets/pages/components/button/buttonControlSize.ets
|
arkts
|
ButtonControlSizeBuilder
|
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 ButtonControlSizeBuilder(name: string, param: Object) {
ButtonControlSizeExample()
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ButtonControlSizeBuilder 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 ButtonControlSizeExample ( ) 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 ButtonControlSizeBuilder(name: string, param: Object) {
ButtonControlSizeExample()
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/button/buttonControlSize.ets#L16-L19
|
a25c13d673dbec821e68a9c1622d8b53364135d8
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/PathUtility.ets
|
arkts
|
isExists
|
检查路径是否存在
@param path 目标路径
@returns 是否存在
|
static isExists(path: string): boolean {
try {
fs.accessSync(path);
return true;
} catch {
return false;
}
}
|
AST#method_declaration#Left static isExists AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean 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 fs AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static isExists(path: string): boolean {
try {
fs.accessSync(path);
return true;
} catch {
return false;
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L144-L151
|
14b158e1a8a11bfc83d5079306bb80db637edef2
|
github
|
kaina404/HarmonyStock.git
|
99233a46fb0dfb21e02294c730fd80e2fb404f9b
|
entry/src/main/ets/router/RouterManager.ets
|
arkts
|
App容器页面
|
export const Path_Main = 'pages/main/ContentPage'
/**
* 搜索股票页面
*/
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left Path_Main = AST#expression#Left 'pages/main/ContentPage' AST#expression#Right AST#variable_declarator#Right /**
* 搜索股票页面
*/ AST#variable_declaration#Right AST#export_declaration#Right
|
export const Path_Main = 'pages/main/ContentPage'
|
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/router/RouterManager.ets#L6-L9
|
7208bafece0090d9f46340672dd27a70ef3d39ab
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/components/DateModel.ets
|
arkts
|
Copyright (c) 2025 Huawei Device Co., Ltd.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice,this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
设置项的数据类
|
export class DateModel {
public day: number;
public week: number;
public month: number;
public year: number;
constructor(day: number, week: number, month: number, year: number) {
this.day = day;
this.week = week;
this.month = month;
this.year = year;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DateModel AST#class_body#Left { AST#property_declaration#Left public day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left public week : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left public month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left public year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left week : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left 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#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 . day AST#member_expression#Right = AST#expression#Left day 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 . week AST#member_expression#Right = AST#expression#Left week 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 . month AST#member_expression#Right = AST#expression#Left month 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 . year AST#member_expression#Right = AST#expression#Left year AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DateModel {
public day: number;
public week: number;
public month: number;
public year: number;
constructor(day: number, week: number, month: number, year: number) {
this.day = day;
this.week = week;
this.month = month;
this.year = year;
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/components/DateModel.ets#L29-L41
|
74f46f7e2802f09336c197ed7cb8e334b0c8da0b
|
gitee
|
|
AlbertZyc/tab-layout
|
4ba256eead3792c84128f8679b26ac159a2d7f06
|
entry/src/main/ets/BasicDataSource.ets
|
arkts
|
notifyDataReload
|
通知LazyForEach组件需要重载所有子组件
|
notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
}
|
AST#method_declaration#Left notifyDataReload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataReloaded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
}
|
https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/entry/src/main/ets/BasicDataSource.ets#L38-L42
|
4b845101652916d488c1249244d24bcb9052e7fb
|
gitee
|
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
|
128861bc002adae9c34c6ce8fbf12686c26e51ec
|
entry/src/main/ets/utils/PreferenceModel.ets
|
arkts
|
getTenantId
|
写入密码
|
async getTenantId(userId:string) {
return this.getPreference(`${userId}:tenantId`);
}
|
AST#method_declaration#Left async getTenantId AST#parameter_list#Left ( AST#parameter#Left userId : 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getPreference AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right :tenantId ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getTenantId(userId:string) {
return this.getPreference(`${userId}:tenantId`);
}
|
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L105-L107
|
49debbba45c9c58cd5cbc9844ff9353f6d46236f
|
github
|
openharmony/update_update_app
|
0157b7917e2f48e914b5585991e8b2f4bc25108a
|
feature/ota/src/main/ets/UpgradeAdapter.ets
|
arkts
|
getNotifyInstance
|
取提醒对象
@return 提醒对象
|
getNotifyInstance(): INotify {
if (!this._notifyInstance) {
this._notifyInstance = new NotificationHelper();
}
return this._notifyInstance;
}
|
AST#method_declaration#Left getNotifyInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left INotify 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 this AST#expression#Right AST#unary_expression#Right AST#expression#Right . _notifyInstance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _notifyInstance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left NotificationHelper AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _notifyInstance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
getNotifyInstance(): INotify {
if (!this._notifyInstance) {
this._notifyInstance = new NotificationHelper();
}
return this._notifyInstance;
}
|
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/UpgradeAdapter.ets#L60-L65
|
4a2da40d000ef9aa56d8511b3f3417a7efbad49a
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/utils/LunarUtils.ets
|
arkts
|
lunarToSolar
|
农历转公历
@param lunarYear 农历年份
@param lunarMonth 农历月份
@param lunarDay 农历日期
@param isLeapMonth 是否闰月
@returns 公历日期字符串(YYYY-MM-DD格式)
|
static lunarToSolar(lunarYear: number, lunarMonth: number, lunarDay: number, isLeapMonth: boolean): string | null;
|
AST#method_declaration#Left static lunarToSolar AST#parameter_list#Left ( AST#parameter#Left lunarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left lunarMonth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left lunarDay : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeapMonth : 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#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
static lunarToSolar(lunarYear: number, lunarMonth: number, lunarDay: number, isLeapMonth: boolean): string | null;
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L243-L243
|
11ec255ca7a7272c75beac0e072466f2fb98b56b
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/LocationUtil.ets
|
arkts
|
onLocationChangeEasy
|
开启位置变化订阅,并发起定位请求。
@param callBack
@returns 失败返回错误码,成功返回0。
|
static onLocationChangeEasy(callBack: Callback<geoLocationManager.Location>): number {
try {
let locationRequest: geoLocationManager.LocationRequest = {
'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, //表示快速获取位置优先,如果应用希望快速拿到一个位置,可以将优先级设置为该字段。
'scenario': geoLocationManager.LocationRequestScenario.UNSET, //表示未设置优先级,表示LocationRequestPriority无效。
'timeInterval': 10, //表示上报位置信息的时间间隔,单位是秒。默认值为1,取值范围为大于等于0。10秒钟获取一下位置
'distanceInterval': 0, //表示上报位置信息的距离间隔。单位是米,默认值为0,取值范围为大于等于0。
'maxAccuracy': 0 //表示精度信息,单位是米。
}; //开启位置变化订阅,默认Request参数
geoLocationManager.on('locationChange', locationRequest, callBack);
return 0; //成功返回-0
} catch (err) {
LogUtil.error(err);
let error = err as BusinessError;
return error.code; //失败返回-错误码
}
}
|
AST#method_declaration#Left static onLocationChangeEasy AST#parameter_list#Left ( AST#parameter#Left callBack : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left geoLocationManager . Location AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left locationRequest : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left geoLocationManager . LocationRequest 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 'priority' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left geoLocationManager AST#expression#Right . LocationRequestPriority AST#member_expression#Right AST#expression#Right . FIRST_FIX AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , //表示快速获取位置优先,如果应用希望快速拿到一个位置,可以将优先级设置为该字段。 AST#property_assignment#Left AST#property_name#Left 'scenario' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left geoLocationManager AST#expression#Right . LocationRequestScenario AST#member_expression#Right AST#expression#Right . UNSET AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , //表示未设置优先级,表示LocationRequestPriority无效。 AST#property_assignment#Left AST#property_name#Left 'timeInterval' AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , //表示上报位置信息的时间间隔,单位是秒。默认值为1,取值范围为大于等于0。10秒钟获取一下位置 AST#property_assignment#Left AST#property_name#Left 'distanceInterval' AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , //表示上报位置信息的距离间隔。单位是米,默认值为0,取值范围为大于等于0。 AST#property_assignment#Left AST#property_name#Left 'maxAccuracy' AST#property_name#Right : AST#expression#Left 0 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 //开启位置变化订阅,默认Request参数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left geoLocationManager AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'locationChange' AST#expression#Right , AST#expression#Left locationRequest AST#expression#Right , AST#expression#Left callBack AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right //成功返回-0 } 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 LogUtil AST#expression#Right . error 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_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left error = AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#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 error AST#expression#Right . code AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right //失败返回-错误码 } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static onLocationChangeEasy(callBack: Callback<geoLocationManager.Location>): number {
try {
let locationRequest: geoLocationManager.LocationRequest = {
'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX,
'scenario': geoLocationManager.LocationRequestScenario.UNSET,
'timeInterval': 10,
'distanceInterval': 0,
'maxAccuracy': 0
};
geoLocationManager.on('locationChange', locationRequest, callBack);
return 0;
} catch (err) {
LogUtil.error(err);
let error = err as BusinessError;
return error.code;
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L91-L107
|
c450aa217c356d945c4d9c80057db3ed77f7aba2
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets
|
arkts
|
省信息类
|
export class Province {
code: string; // 省id
name: string; // 省名
children: City[]; // 存放市、区信息
constructor(code: string = '', name: string = '', children: City[]) {
this.code = code;
this.name = name;
this.children = children;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class Province AST#class_body#Left { AST#property_declaration#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 省id AST#property_declaration#Left name : 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 children : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left City [ ] AST#array_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#Left code : 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 name : 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 children : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left City [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . code AST#member_expression#Right = AST#expression#Left code 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 . name AST#member_expression#Right = AST#expression#Left name 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 . children AST#member_expression#Right = AST#expression#Left children AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class Province {
code: string;
name: string;
children: City[];
constructor(code: string = '', name: string = '', children: City[]) {
this.code = code;
this.name = name;
this.children = children;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets#L32-L42
|
241b61f5414227161ce57ea0d18558d6b7344fcd
|
gitee
|
|
salehelper/algorithm_arkts.git
|
61af15272038646775a4745fca98a48ba89e1f4e
|
entry/src/main/ets/hashing/HashTable.ets
|
arkts
|
哈希表类
|
export class HashTable<K, V> {
private table: Array<HashNode<K, V> | null>;
private size: number;
private capacity: number;
private readonly LOAD_FACTOR: number = 0.75;
constructor(initialCapacity: number = 16) {
this.capacity = initialCapacity;
this.size = 0;
this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null);
}
/**
* 计算哈希值
*/
private hash(key: K): number {
const keyStr = String(key);
let hash = 0;
for (let i = 0; i < keyStr.length; i++) {
hash = ((hash << 5) - hash) + keyStr.charCodeAt(i);
hash = hash & hash; // Convert to 32bit integer
}
return Math.abs(hash) % this.capacity;
}
/**
* 插入键值对
*/
put(key: K, value: V): void {
if (this.size / this.capacity >= this.LOAD_FACTOR) {
this.resize();
}
const index = this.hash(key);
const newNode = new HashNode(key, value);
if (!this.table[index]) {
this.table[index] = newNode;
} else {
let current = this.table[index];
while (current) {
if (current.key === key) {
current.value = value;
return;
}
if (!current.next) {
current.next = newNode;
break;
}
current = current.next;
}
}
this.size++;
}
/**
* 获取值
*/
get(key: K): V | null {
const index = this.hash(key);
let current = this.table[index];
while (current) {
if (current.key === key) {
return current.value;
}
current = current.next;
}
return null;
}
/**
* 删除键值对
*/
remove(key: K): boolean {
const index = this.hash(key);
let current = this.table[index];
let prev: HashNode<K, V> | null = null;
while (current) {
if (current.key === key) {
if (prev) {
prev.next = current.next;
} else {
this.table[index] = current.next;
}
this.size--;
return true;
}
prev = current;
current = current.next;
}
return false;
}
/**
* 检查是否包含键
*/
contains(key: K): boolean {
return this.get(key) !== null;
}
/**
* 获取大小
*/
getSize(): number {
return this.size;
}
/**
* 清空哈希表
*/
clear(): void {
this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null);
this.size = 0;
}
/**
* 扩容
*/
private resize(): void {
const oldTable = this.table;
this.capacity *= 2;
this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null);
this.size = 0;
for (let i = 0; i < oldTable.length; i++) {
let current = oldTable[i];
while (current) {
this.put(current.key, current.value);
current = current.next;
}
}
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class HashTable AST#type_parameters#Left < AST#type_parameter#Left K AST#type_parameter#Right , AST#type_parameter#Left V AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { AST#property_declaration#Left private table : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left HashNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left V 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#property_declaration#Right AST#property_declaration#Left private size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private capacity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private readonly LOAD_FACTOR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.75 AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left initialCapacity : 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#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 . capacity AST#member_expression#Right = AST#expression#Left initialCapacity 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 . size AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . table AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left HashNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left V 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#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . capacity AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /**
* 计算哈希值
*/ AST#method_declaration#Left private hash AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left keyStr = AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hash = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left keyStr AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hash = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left hash AST#expression#Right << AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left hash AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left keyStr AST#expression#Right AST#binary_expression#Right AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hash = AST#expression#Left AST#binary_expression#Left AST#expression#Left hash AST#expression#Right & AST#expression#Left hash AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Convert to 32bit integer } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hash AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right % AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . capacity AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 插入键值对
*/ AST#method_declaration#Left put AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left V AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . size AST#member_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . capacity AST#member_expression#Right AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . LOAD_FACTOR AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left newNode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left HashNode AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . table 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 AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . table AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left = AST#ERROR#Right AST#expression_statement#Left AST#expression#Left newNode AST#expression#Right ; AST#expression_statement#Right } else { 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 current = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . table AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left while ( AST#expression#Left current AST#expression#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . key AST#member_expression#Right AST#expression#Right === AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . value AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left current AST#expression#Right AST#unary_expression#Right AST#expression#Right . next AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . next AST#member_expression#Right = AST#expression#Left newNode AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left current = AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . next AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right 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 . size AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取值
*/ AST#method_declaration#Left get AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left V 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#variable_declaration#Left const AST#variable_declarator#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left current = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . table AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left current AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . key AST#member_expression#Right AST#expression#Right === AST#expression#Left key 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 current AST#expression#Right . value AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left current = AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . next 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#while_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#method_declaration#Right /**
* 删除键值对
*/ AST#method_declaration#Left remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left current = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . table AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left prev : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left HashNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left V AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left current AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . key AST#member_expression#Right AST#expression#Right === AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left prev 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 prev AST#expression#Right . next AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . next AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . table AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = current AST#ERROR#Right . next AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . size 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#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left prev = AST#expression#Left current AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left current = AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . next 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#while_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 检查是否包含键
*/ AST#method_declaration#Left contains AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取大小
*/ AST#method_declaration#Left getSize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . size AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 清空哈希表
*/ AST#method_declaration#Left clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . table AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left HashNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left V 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#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . capacity AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . size AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 扩容
*/ AST#method_declaration#Left private resize 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 oldTable = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . table AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . capacity AST#member_expression#Right *= AST#expression#Left 2 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 . table AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left HashNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left V 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#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . capacity AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . size AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 oldTable AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left current = AST#expression#Left AST#subscript_expression#Left AST#expression#Left oldTable AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left current 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 . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . key AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . value 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 current = AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . next 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#while_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class HashTable<K, V> {
private table: Array<HashNode<K, V> | null>;
private size: number;
private capacity: number;
private readonly LOAD_FACTOR: number = 0.75;
constructor(initialCapacity: number = 16) {
this.capacity = initialCapacity;
this.size = 0;
this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null);
}
private hash(key: K): number {
const keyStr = String(key);
let hash = 0;
for (let i = 0; i < keyStr.length; i++) {
hash = ((hash << 5) - hash) + keyStr.charCodeAt(i);
hash = hash & hash;
}
return Math.abs(hash) % this.capacity;
}
put(key: K, value: V): void {
if (this.size / this.capacity >= this.LOAD_FACTOR) {
this.resize();
}
const index = this.hash(key);
const newNode = new HashNode(key, value);
if (!this.table[index]) {
this.table[index] = newNode;
} else {
let current = this.table[index];
while (current) {
if (current.key === key) {
current.value = value;
return;
}
if (!current.next) {
current.next = newNode;
break;
}
current = current.next;
}
}
this.size++;
}
get(key: K): V | null {
const index = this.hash(key);
let current = this.table[index];
while (current) {
if (current.key === key) {
return current.value;
}
current = current.next;
}
return null;
}
remove(key: K): boolean {
const index = this.hash(key);
let current = this.table[index];
let prev: HashNode<K, V> | null = null;
while (current) {
if (current.key === key) {
if (prev) {
prev.next = current.next;
} else {
this.table[index] = current.next;
}
this.size--;
return true;
}
prev = current;
current = current.next;
}
return false;
}
contains(key: K): boolean {
return this.get(key) !== null;
}
getSize(): number {
return this.size;
}
clear(): void {
this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null);
this.size = 0;
}
private resize(): void {
const oldTable = this.table;
this.capacity *= 2;
this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null);
this.size = 0;
for (let i = 0; i < oldTable.length; i++) {
let current = oldTable[i];
while (current) {
this.put(current.key, current.value);
current = current.next;
}
}
}
}
|
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L19-L153
|
1184a56021ad7d785a1c60ed69f871339d6cd111
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets
|
arkts
|
listCompressBundle
|
读取压缩包输出目录下压缩包
@param outDir 压缩包输出目录
@returns
|
listCompressBundle(outDir: string) {
fs.listFile(outDir).then((fileNames: Array<string>) => {
this.compressBundleName = fileNames[0];
}).catch((err: BusinessError) => {
logger.error(TAG, `list file failed with error message: ${err.message}, error code: ${err.code}`)
})
}
|
AST#method_declaration#Left listCompressBundle AST#parameter_list#Left ( AST#parameter#Left outDir : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . listFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left outDir 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 fileNames : 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_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 . compressBundleName AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left fileNames AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` list file failed with error message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , error code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
listCompressBundle(outDir: string) {
fs.listFile(outDir).then((fileNames: Array<string>) => {
this.compressBundleName = fileNames[0];
}).catch((err: BusinessError) => {
logger.error(TAG, `list file failed with error message: ${err.message}, error code: ${err.code}`)
})
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets#L95-L101
|
f565297fbe7a02134d4c6603a68d27c4e606aa6d
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/entryability/EntryAbility.ets
|
arkts
|
getDistributedObject
|
从分布式对象中恢复迁移数据
@param want 发起方传入的want参数
|
async getDistributedObject(want: Want) {
if (!want.parameters) {
return;
}
// 从want中恢复sessionId
this.sessionId = want?.parameters?.session as string;
Logger.info(TAG, `etDistributedObject() : continuation sessionId: ${this.sessionId},
version = ${want?.parameters?.version}`);
// 每次创建分布式对象时,先将上一次的对象置空
if (this.d_object) {
this.d_object = undefined;
}
// 创建分布式对象
let source: SourceObject = new SourceObject('');
this.d_object = distributedObject.create(this.context, source);
if (this.d_object != undefined) {
Logger.info(TAG, 'getDistributedObject() :this.d_object != null');
this.d_object['notesTitle'] = undefined;
this.d_object['asset'] = undefined;
this.d_object.on('status', (sessionId: string, networkId: string, status: "online" | "offline" | "restored") => {
if (status !== 'restored') {
Logger.info(TAG, `status: ${status}`);
return;
}
Logger.info(TAG, ` status == restored`);
let image2Path = AppStorage.get<string>('image2Path');
if (image2Path) {
Logger.info(TAG, ` image2Path: ${image2Path}`);
LooperUtil.emit(CommonConstants.EVENT_DATA_RESTORE);
} else {
Logger.info(TAG, ` image2Path == undefined`);
}
// 应用冷启动时先给组件属性赋初值\热启动时恢复分布式数据对象的值到双向绑定的'inputText'中
if (this.d_object !== undefined && this.d_object['notesTitle']) {
AppStorage.setOrCreate<string>('inputText', this.d_object['notesTitle']);
Logger.info(TAG, `getDistributedObject() : d_object_notesTitle: ${this.d_object['notesTitle']}`);
}
}
|
AST#method_declaration#Left async getDistributedObject AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 want AST#expression#Right AST#unary_expression#Right AST#expression#Right . parameters 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 // 从want中恢复sessionId 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 . sessionId AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right ?. parameters AST#member_expression#Right AST#expression#Right ?. session 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` etDistributedObject() : continuation sessionId: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sessionId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
version = AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right ?. parameters AST#member_expression#Right AST#expression#Right ?. version 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . d_object 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 . d_object AST#member_expression#Right = AST#expression#Left undefined 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 source : AST#type_annotation#Left AST#primary_type#Left SourceObject 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 SourceObject AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . d_object AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left distributedObject AST#expression#Right . create 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 . context AST#member_expression#Right AST#expression#Right , AST#expression#Left source AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . d_object AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'getDistributedObject() :this.d_object != null' AST#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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . d_object AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'notesTitle' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = undefined AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . d_object AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'asset' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = undefined AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . d_object AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#ERROR#Left ( AST#expression#Left 'status' AST#expression#Right , ( AST#ERROR#Left AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left networkId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left status : AST#ERROR#Left "online" | "offline" | "restored" ) => { if AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left status AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left !== 'restored' AST#ERROR#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left Logger AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` status: AST#template_substitution#Left $ { AST#expression#Left status 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#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` status == restored ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left image2Path = 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#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 'image2Path' AST#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 image2Path AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` image2Path: AST#template_substitution#Left $ { AST#expression#Left image2Path 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 LooperUtil AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . EVENT_DATA_RESTORE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` image2Path == undefined ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 应用冷启动时先给组件属性赋初值\热启动时恢复分布式数据对象的值到双向绑定的'inputText'中 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . d_object AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . d_object AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'notesTitle' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate 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 'inputText' AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . d_object AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'notesTitle' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` getDistributedObject() : d_object_notesTitle: AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . d_object AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'notesTitle' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getDistributedObject(want: Want) {
if (!want.parameters) {
return;
}
this.sessionId = want?.parameters?.session as string;
Logger.info(TAG, `etDistributedObject() : continuation sessionId: ${this.sessionId},
version = ${want?.parameters?.version}`);
if (this.d_object) {
this.d_object = undefined;
}
let source: SourceObject = new SourceObject('');
this.d_object = distributedObject.create(this.context, source);
if (this.d_object != undefined) {
Logger.info(TAG, 'getDistributedObject() :this.d_object != null');
this.d_object['notesTitle'] = undefined;
this.d_object['asset'] = undefined;
this.d_object.on('status', (sessionId: string, networkId: string, status: "online" | "offline" | "restored") => {
if (status !== 'restored') {
Logger.info(TAG, `status: ${status}`);
return;
}
Logger.info(TAG, ` status == restored`);
let image2Path = AppStorage.get<string>('image2Path');
if (image2Path) {
Logger.info(TAG, ` image2Path: ${image2Path}`);
LooperUtil.emit(CommonConstants.EVENT_DATA_RESTORE);
} else {
Logger.info(TAG, ` image2Path == undefined`);
}
if (this.d_object !== undefined && this.d_object['notesTitle']) {
AppStorage.setOrCreate<string>('inputText', this.d_object['notesTitle']);
Logger.info(TAG, `getDistributedObject() : d_object_notesTitle: ${this.d_object['notesTitle']}`);
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/entryability/EntryAbility.ets#L149-L189
|
2e1c000cbf690a35efe32517d040daeeb6c6f463
|
gitee
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
HarmonyOS_NEXT/Web/PageRedirection/entry/src/main/ets/common/constants/CommonConstants.ets
|
arkts
|
Common constants for common component.
|
export class CommonConstants {
// Font family.
static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
// 100 percent.
static readonly FULL_PERCENT: string = '100%';
// 50 percent.
static readonly PERCENT_50: string = '50%';
// Duration.
static readonly TOAST_DURATION: number = 2000;
// Space.
static readonly NORMAL_SPACE: number = 12;
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // Font family. AST#property_declaration#Left static readonly HARMONY_HEI_TI_FONT_FAMILY = AST#expression#Left 'HarmonyHeiTi' AST#expression#Right ; AST#property_declaration#Right // 100 percent. AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right // 50 percent. AST#property_declaration#Left static readonly PERCENT_50 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '50%' AST#expression#Right ; AST#property_declaration#Right // Duration. AST#property_declaration#Left static readonly TOAST_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2000 AST#expression#Right ; AST#property_declaration#Right // Space. AST#property_declaration#Left static readonly NORMAL_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class CommonConstants {
static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
static readonly FULL_PERCENT: string = '100%';
static readonly PERCENT_50: string = '50%';
static readonly TOAST_DURATION: number = 2000;
static readonly NORMAL_SPACE: number = 12;
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Web/PageRedirection/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L34
|
55edb01710d76f5290b5085d118c46d1695bb23d
|
gitee
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/component/Row.ets
|
arkts
|
RowSpaceAroundCenter
|
横向环绕分布 + 垂直居中
|
@ComponentV2
export struct RowSpaceAroundCenter {
/**
* Row 构造参数
*/
@Param
options: RowOptions | RowOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*/
@Param
sizeValue: SizeOptions | undefined = undefined;
/**
* 内边距
*/
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
/**
* 外边距
*/
@Param
marginValue: Margin | Length | LocalizedMargin | undefined = undefined;
/**
* 是否填充最大宽高
*/
@Param
fillMaxSize: boolean = false;
/**
* 背景颜色
*/
@Param
bgColor: ResourceColor | undefined = undefined;
/**
* 点击事件
*/
@Param
onTap: ((event: ClickEvent) => void) | undefined = undefined;
/**
* 内容构建函数
*/
@BuilderParam
content: CustomBuilder;
/**
* 渲染布局
* @returns {void} 无返回值
* @example
* RowSpaceAroundCenter() { Text("A"); Text("B"); Text("C"); }
*/
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
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#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowSpaceAroundCenter AST#component_body#Left { /**
* Row 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RowOptions AST#primary_type#Right | AST#primary_type#Left RowOptionsV2 AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 宽度
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right widthValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 高度
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right heightValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 尺寸(对应官方 size 属性)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right sizeValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left SizeOptions AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 内边距
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right paddingValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Padding AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedPadding AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 外边距
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right marginValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Margin AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedMargin AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 是否填充最大宽高
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right fillMaxSize : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 背景颜色
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right bgColor : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 点击事件
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onTap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 内容构建函数
*/ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left CustomBuilder AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 渲染布局
* @returns {void} 无返回值
* @example
* RowSpaceAroundCenter() { Text("A"); Text("B"); Text("C"); }
*/ 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 . SpaceAround 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 } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct RowSpaceAroundCenter {
@Param
options: RowOptions | RowOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
@Param
marginValue: Margin | Length | LocalizedMargin | undefined = undefined;
@Param
fillMaxSize: boolean = false;
@Param
bgColor: ResourceColor | undefined = undefined;
@Param
onTap: ((event: ClickEvent) => void) | undefined = undefined;
@BuilderParam
content: CustomBuilder;
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
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#L465-L540
|
48be8246f0c0ecdef166457b6584b71c936b1342
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
|
arkts
|
继承NodeController,创建可以复用的子组件
|
export class NodeItem extends NodeController {
public builder: WrappedBuilder<ESObject> | null = null;
public node: BuilderNode<ESObject> | null = null;
public data: ESObject = {};
// 子组件类型,复用时会根据type查找对应的子组件使用
public type: string = '';
public id: number = 0;
aboutToDisappear(): void {
// 当页面销毁时回收组件到复用池中
NodePool.getInstance().recycleNode(this.type, this);
}
update(data: ESObject) {
this.data = data;
this.node?.reuse(data);
}
// 创建节点
makeNode(uiContext: UIContext): FrameNode | null {
if (!this.node) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
} else {
this.update(this.data);
}
return this.node.getFrameNode();
}
// 预创建BuildNode
prebuild(uiContext: UIContext) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class NodeItem extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left public builder : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public node : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left BuilderNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public data : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right // 子组件类型,复用时会根据type查找对应的子组件使用 AST#property_declaration#Left public type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 当页面销毁时回收组件到复用池中 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NodePool AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . recycleNode 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 . type AST#member_expression#Right AST#expression#Right , AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left update AST#parameter_list#Left ( AST#parameter#Left data : 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#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 . data AST#member_expression#Right = AST#expression#Left data 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 ?. reuse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 创建节点 AST#method_declaration#Left makeNode 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#type_annotation#Left AST#union_type#Left AST#primary_type#Left FrameNode AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . node AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . 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 } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . update 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 . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . node AST#member_expression#Right AST#expression#Right . getFrameNode 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 // 预创建BuildNode 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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class NodeItem extends NodeController {
public builder: WrappedBuilder<ESObject> | null = null;
public node: BuilderNode<ESObject> | null = null;
public data: ESObject = {};
public type: string = '';
public id: number = 0;
aboutToDisappear(): void {
NodePool.getInstance().recycleNode(this.type, this);
}
update(data: ESObject) {
this.data = data;
this.node?.reuse(data);
}
makeNode(uiContext: UIContext): FrameNode | null {
if (!this.node) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
} else {
this.update(this.data);
}
return this.node.getFrameNode();
}
prebuild(uiContext: UIContext) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L20-L53
|
e1e550cdadbfaa3cb9dba022150d29941a3826c2
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/ArkTS1.2/TabsSample/entry/src/main/ets/model/functionalScenes/WaterFlowDataSource.ets
|
arkts
|
实现IDataSource接口的对象,用于瀑布流组件加载数据
|
export class WaterFlowDataSource<SceneModuleInfo> implements IDataSource<SceneModuleInfo> {
private dataArray: SceneModuleInfo[] = [];
private listeners: DataChangeListener[] = [];
constructor(dataArray: SceneModuleInfo[]) {
for (let i = 0; i < dataArray.length; i++) {
this.dataArray.push(dataArray[i]);
}
}
/**
* 获取索引对应的数据
* @param index 数组索引
* @returns
*/
public getData(index: number): SceneModuleInfo {
return this.dataArray[index];
}
/**
* 通知控制器数据重新加载
*/
notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
}
/**
* 通知控制器数据增加
* @param index 数组索引
*/
notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
})
}
/**
* 通知控制器数据变化
* @param index 数组索引
*/
notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
}
/**
* 通知控制器数据删除
* @param index 数组索引
*/
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
}
/**
* 通知控制器数据位置变化
* @param from 起始位置
* @param to 最终位置
*/
notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
}
/**
* 获取数据总数
* @returns
*/
public totalCount(): number {
return this.dataArray.length;
}
/**
* 注册改变数据的控制器
* @param listener 数据控制器
*/
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
}
/**
* 注销改变数据的控制器
* @param listener 数据控制器
*/
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
}
/**
* 增加数据
*/
public add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(0);
}
/**
* 在数据尾部增加一个元素
*/
public addLastItem(): void {
this.dataArray.splice(this.dataArray.length, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(this.dataArray.length - 1);
}
/**
* 在指定索引位置增加一个元素
* @param index
*/
public addItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(index);
}
/**
* 删除第一个元素
*/
public delete1stItem(): void {
this.dataArray.splice(0, 1);
this.notifyDataDelete(0);
}
/**
* 删除第二个元素
*/
public delete2ndItem(): void {
this.dataArray.splice(1, 1);
this.notifyDataDelete(1);
}
/**
* 删除最后一个元素
*/
public deleteLastItem(): void {
this.dataArray.splice(-1, 1);
this.notifyDataDelete(this.dataArray.length);
}
/**
* 重新加载数据
*/
public reload(): void {
this.notifyDataReload();
}
/**
* 改变数组数据
* @param data:新数组
*/
public modifyAllData(data: SceneModuleInfo[]): void {
this.dataArray = data;
this.notifyDataReload();
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowDataSource AST#type_parameters#Left < AST#type_parameter#Left SceneModuleInfo AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements AST#generic_type#Left IDataSource AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SceneModuleInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SceneModuleInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListener [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SceneModuleInfo [ ] 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#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 dataArray AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left dataArray AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /**
* 获取索引对应的数据
* @param index 数组索引
* @returns
*/ AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SceneModuleInfo AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 通知控制器数据重新加载
*/ AST#method_declaration#Left notifyDataReload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataReloaded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 通知控制器数据增加
* @param index 数组索引
*/ AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 通知控制器数据变化
* @param index 数组索引
*/ AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 通知控制器数据删除
* @param index 数组索引
*/ AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 通知控制器数据位置变化
* @param from 起始位置
* @param to 最终位置
*/ AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataMove AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left from AST#expression#Right , AST#expression#Left to AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取数据总数
* @returns
*/ AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 注册改变数据的控制器
* @param listener 数据控制器
*/ AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 注销改变数据的控制器
* @param listener 数据控制器
*/ AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pos = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left pos AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pos AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 增加数据
*/ AST#method_declaration#Left public add1stItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 在数据尾部增加一个元素
*/ AST#method_declaration#Left public addLastItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 在指定索引位置增加一个元素
* @param index
*/ AST#method_declaration#Left public addItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 删除第一个元素
*/ AST#method_declaration#Left public delete1stItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 删除第二个元素
*/ AST#method_declaration#Left public delete2ndItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 删除最后一个元素
*/ AST#method_declaration#Left public deleteLastItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 重新加载数据
*/ AST#method_declaration#Left public reload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataReload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 改变数组数据
* @param data:新数组
*/ AST#method_declaration#Left public modifyAllData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SceneModuleInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right = AST#expression#Left data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataReload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class WaterFlowDataSource<SceneModuleInfo> implements IDataSource<SceneModuleInfo> {
private dataArray: SceneModuleInfo[] = [];
private listeners: DataChangeListener[] = [];
constructor(dataArray: SceneModuleInfo[]) {
for (let i = 0; i < dataArray.length; i++) {
this.dataArray.push(dataArray[i]);
}
}
public getData(index: number): SceneModuleInfo {
return this.dataArray[index];
}
notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
}
notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
})
}
notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
}
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
}
notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
}
public totalCount(): number {
return this.dataArray.length;
}
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
}
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
}
public add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(0);
}
public addLastItem(): void {
this.dataArray.splice(this.dataArray.length, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(this.dataArray.length - 1);
}
public addItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(index);
}
public delete1stItem(): void {
this.dataArray.splice(0, 1);
this.notifyDataDelete(0);
}
public delete2ndItem(): void {
this.dataArray.splice(1, 1);
this.notifyDataDelete(1);
}
public deleteLastItem(): void {
this.dataArray.splice(-1, 1);
this.notifyDataDelete(this.dataArray.length);
}
public reload(): void {
this.notifyDataReload();
}
public modifyAllData(data: SceneModuleInfo[]): void {
this.dataArray = data;
this.notifyDataReload();
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/model/functionalScenes/WaterFlowDataSource.ets#L21-L183
|
2fec274c8f338d3253e0031d78aa06922d92f6d4
|
gitee
|
|
salehelper/algorithm_arkts.git
|
61af15272038646775a4745fca98a48ba89e1f4e
|
entry/src/main/ets/strings/KMP.ets
|
arkts
|
contains
|
检查文本是否包含模式串
@param text 文本字符串
@param pattern 模式串
@returns 是否包含模式串
|
static contains(text: string, pattern: string): boolean {
if (!text || !pattern || pattern.length === 0) {
return false;
}
const lps = KMP.computeLPS(pattern);
const m = pattern.length;
const n = text.length;
let i = 0;
let j = 0;
while (i < n) {
if (pattern[j] === text[i]) {
i++;
j++;
}
if (j === m) {
return true;
} else if (i < n && pattern[j] !== text[i]) {
if (j !== 0) {
j = lps[j - 1];
} else {
i++;
}
}
}
return false;
}
|
AST#method_declaration#Left static contains AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left text AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left pattern AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left pattern AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lps = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left KMP AST#expression#Right . computeLPS AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pattern AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left m = AST#expression#Left AST#member_expression#Left AST#expression#Left pattern AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left n = AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left j = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left n AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left pattern AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left AST#subscript_expression#Left AST#expression#Left text AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_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 j 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#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right === AST#expression#Left m AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left n AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left pattern AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right !== AST#expression#Left AST#subscript_expression#Left AST#expression#Left text AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right !== AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left j = AST#expression#Left AST#subscript_expression#Left AST#expression#Left lps AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#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#update_expression#Left AST#expression#Left i 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#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static contains(text: string, pattern: string): boolean {
if (!text || !pattern || pattern.length === 0) {
return false;
}
const lps = KMP.computeLPS(pattern);
const m = pattern.length;
const n = text.length;
let i = 0;
let j = 0;
while (i < n) {
if (pattern[j] === text[i]) {
i++;
j++;
}
if (j === m) {
return true;
} else if (i < n && pattern[j] !== text[i]) {
if (j !== 0) {
j = lps[j - 1];
} else {
i++;
}
}
}
return false;
}
|
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L153-L182
|
2ca6d4f7a7edab10921d8d2357d3bdc511714bb1
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFile.ets
|
arkts
|
CompressFileViewComponent
|
颜色渐变结束位置
功能描述:本示例主要介绍在worker子线程中使用@ohos.zlib模块提供的zlib.compressFile接口对沙箱目录中的文件进行压缩操作,压缩成功后将压缩包所在路径返回主线程,获取压缩文件列表。
推荐场景:文件管理中压缩文件时使用
核心组件:
1.CompressFileComponent: 向子线程发送信息,进行压缩
实现步骤:
1. 目录名称配置:指定压缩成功后压缩包路径
@example
@State compressZipDir: string = 'bundlefile/compress_file.zip';
2. 目录名称配置:指定待压缩文件在rawfile下和应用沙箱目录下(https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/app-sandbox-directory-V5)所处目录名
@example
@State beCompressFileDir: string = 'compressfile';
3. 数据存放配置:压缩后的压缩包存放变量
@example
@State compressBundleName: string = '';
4.构建压缩组件
@example
CompressFileComponent({
compressBundleName: this.compressBundleName,
beCompressFileDir: this.beCompressFileDir,
compressZipPath: this.compressZipDir,
})
|
@Component
export struct CompressFileViewComponent {
@State beCompressFiles: Array<string> = []; // rawfile下所有待压缩文件
@State compressBundleName: string = ''; // 压缩成功后压缩包名字
@State compressZipDir: string = 'bundlefile/compress_file.zip'; // 压缩成功后压缩包文件路径
@State beCompressFileDir: string = 'compressfile'; // 待压缩文件所在目录名
private context: Context = getContext(this);
aboutToAppear(): void {
this.beCompressFiles = this.context.resourceManager.getRawFileListSync(this.beCompressFileDir);
}
build() {
Column() {
Row() {
Column() {
Text($r("app.string.compress_file_message"))
.fontColor($r('app.color.compress_file_message_color'))
.fontWeight(FontWeight.Bolder)
.fontSize($r('app.string.compress_file_message_font_size'))
Text($r('app.string.compress_file_title_message'))
.fontColor($r('app.color.compress_file_message_color'))
}
.width($r('app.string.compress_file_title_message_container_width'))
.alignItems(HorizontalAlign.Start)
Image($r('app.media.compress_file_ic_files_compress'))
.width($r('app.string.compress_file_top_bar_icon_width'))
.height($r('app.string.compress_file_top_bar_icon_height'))
}
.padding($r('app.string.compress_file_top_bar_padding_size'))
.width($r('app.string.compress_file_container_width'))
.height($r('app.string.compress_file_top_bar_container_height'))
.borderRadius($r('app.string.compress_file_top_bar_container_border_radius'))
.justifyContent(FlexAlign.SpaceBetween)
.linearGradient({
direction: GradientDirection.Top, // 渐变方向
repeating: true, // 渐变颜色是否重复
colors: [[$r('app.color.compress_file_linear_gradient_start'), LINEAR_GRADIENT_START],
[$r('app.color.compress_file_linear_gradient_end'), LINEAR_GRADIENT_END]] // 数组末尾元素占比小于1时满足重复着色效果
})
Row() {
Text($r('app.string.compress_file_be_compress_title_message'))
.fontWeight(FontWeight.Bold)
.fontSize($r('app.string.compress_file_title_font_size'))
.fontColor($r('app.color.compress_file_message_color'))
/**
* 构建压缩组件
* compressBundleName: 压缩成功后压缩包的名字
* beCompressFileDir: 待压缩文件所在目录名
* compressZipPath: 压缩成功后压缩包路径
*/
CompressFileComponent({
compressBundleName: this.compressBundleName,
beCompressFileDir: this.beCompressFileDir,
compressZipPath: this.compressZipDir,
})
}
.borderRadius($r('app.string.compress_file_top_bar_container_border_radius'))
.width($r('app.string.compress_file_container_width'))
.backgroundColor($r('app.color.compress_file_title_bar_background_color'))
.padding($r('app.string.compress_file_title_padding_size'))
.margin($r('app.string.compress_file_title_margin_size'))
.justifyContent(FlexAlign.SpaceBetween)
CompressFileList({ fileNames: this.beCompressFiles, iconName: 'app.media.compressed_file_ic_files_documents' })
Text($r('app.string.compress_file_compress_result_message'))
.fontWeight(FontWeight.Bold)
.fontSize($r('app.string.compress_file_title_font_size'))
.textAlign(TextAlign.Start)
.width($r('app.string.compress_file_container_width'))
.padding($r('app.string.compress_file_title_padding_size'))
.fontWeight(FontWeight.Bold)
.backgroundColor($r('app.color.compress_file_title_bar_background_color'))
.fontColor($r('app.color.compress_file_message_color'))
.borderRadius($r('app.string.compress_file_top_bar_container_border_radius'))
if (this.compressBundleName) {
Row() {
Image($r('app.media.compress_file_ic_files_compress'))
.width($r('app.string.compress_file_icon_width'))
.height($r('app.string.compress_file_icon_height'))
.margin({ right: $r('app.string.compress_file_icon_margin_size') })
Text(this.compressBundleName)
.fontSize($r('app.string.compress_file_name_font_size'))
}
.id('compressZip')
.justifyContent(FlexAlign.Start)
.width($r('app.string.compress_file_container_width'))
.height($r('app.string.compress_file_list_item_height'))
}
}
.padding($r('app.string.compress_file_container_padding_size'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CompressFileViewComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right beCompressFiles : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // rawfile下所有待压缩文件 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right compressBundleName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right // 压缩成功后压缩包名字 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right compressZipDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'bundlefile/compress_file.zip' AST#expression#Right ; AST#property_declaration#Right // 压缩成功后压缩包文件路径 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right beCompressFileDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'compressfile' AST#expression#Right ; AST#property_declaration#Right // 待压缩文件所在目录名 AST#property_declaration#Left private context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beCompressFiles AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getRawFileListSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beCompressFileDir AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.compress_file_message" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.compress_file_message_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bolder AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_message_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_title_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.compress_file_message_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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.compress_file_title_message_container_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.compress_file_ic_files_compress' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_top_bar_icon_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_top_bar_icon_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_top_bar_padding_size' 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.compress_file_container_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_top_bar_container_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_top_bar_container_border_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 . Top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 渐变方向 AST#property_assignment#Left AST#property_name#Left repeating 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 colors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.compress_file_linear_gradient_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left LINEAR_GRADIENT_START AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.compress_file_linear_gradient_end' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left LINEAR_GRADIENT_END AST#expression#Right ] AST#array_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right // 数组末尾元素占比小于1时满足重复着色效果 } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_be_compress_title_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_title_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.compress_file_message_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right /**
* 构建压缩组件
* compressBundleName: 压缩成功后压缩包的名字
* beCompressFileDir: 待压缩文件所在目录名
* compressZipPath: 压缩成功后压缩包路径
*/ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left CompressFileComponent ( AST#component_parameters#Left { AST#component_parameter#Left compressBundleName : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compressBundleName AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left beCompressFileDir : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beCompressFileDir AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left compressZipPath : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compressZipDir AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_top_bar_container_border_radius' 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.compress_file_container_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.compress_file_title_bar_background_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_title_padding_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_title_margin_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 CompressFileList ( AST#component_parameters#Left { AST#component_parameter#Left fileNames : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beCompressFiles AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left iconName : AST#expression#Left 'app.media.compressed_file_ic_files_documents' 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 Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_compress_result_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_title_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_container_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_title_padding_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.compress_file_title_bar_background_color' 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.compress_file_message_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_top_bar_container_border_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 . compressBundleName 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#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.compress_file_ic_files_compress' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_icon_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_icon_height' 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 right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_icon_margin_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compressBundleName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_name_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'compressZip' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_container_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_list_item_height' 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#ui_if_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#resource_expression#Left $r ( AST#expression#Left 'app.string.compress_file_container_padding_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct CompressFileViewComponent {
@State beCompressFiles: Array<string> = [];
@State compressBundleName: string = '';
@State compressZipDir: string = 'bundlefile/compress_file.zip';
@State beCompressFileDir: string = 'compressfile';
private context: Context = getContext(this);
aboutToAppear(): void {
this.beCompressFiles = this.context.resourceManager.getRawFileListSync(this.beCompressFileDir);
}
build() {
Column() {
Row() {
Column() {
Text($r("app.string.compress_file_message"))
.fontColor($r('app.color.compress_file_message_color'))
.fontWeight(FontWeight.Bolder)
.fontSize($r('app.string.compress_file_message_font_size'))
Text($r('app.string.compress_file_title_message'))
.fontColor($r('app.color.compress_file_message_color'))
}
.width($r('app.string.compress_file_title_message_container_width'))
.alignItems(HorizontalAlign.Start)
Image($r('app.media.compress_file_ic_files_compress'))
.width($r('app.string.compress_file_top_bar_icon_width'))
.height($r('app.string.compress_file_top_bar_icon_height'))
}
.padding($r('app.string.compress_file_top_bar_padding_size'))
.width($r('app.string.compress_file_container_width'))
.height($r('app.string.compress_file_top_bar_container_height'))
.borderRadius($r('app.string.compress_file_top_bar_container_border_radius'))
.justifyContent(FlexAlign.SpaceBetween)
.linearGradient({
direction: GradientDirection.Top,
repeating: true,
colors: [[$r('app.color.compress_file_linear_gradient_start'), LINEAR_GRADIENT_START],
[$r('app.color.compress_file_linear_gradient_end'), LINEAR_GRADIENT_END]]
})
Row() {
Text($r('app.string.compress_file_be_compress_title_message'))
.fontWeight(FontWeight.Bold)
.fontSize($r('app.string.compress_file_title_font_size'))
.fontColor($r('app.color.compress_file_message_color'))
CompressFileComponent({
compressBundleName: this.compressBundleName,
beCompressFileDir: this.beCompressFileDir,
compressZipPath: this.compressZipDir,
})
}
.borderRadius($r('app.string.compress_file_top_bar_container_border_radius'))
.width($r('app.string.compress_file_container_width'))
.backgroundColor($r('app.color.compress_file_title_bar_background_color'))
.padding($r('app.string.compress_file_title_padding_size'))
.margin($r('app.string.compress_file_title_margin_size'))
.justifyContent(FlexAlign.SpaceBetween)
CompressFileList({ fileNames: this.beCompressFiles, iconName: 'app.media.compressed_file_ic_files_documents' })
Text($r('app.string.compress_file_compress_result_message'))
.fontWeight(FontWeight.Bold)
.fontSize($r('app.string.compress_file_title_font_size'))
.textAlign(TextAlign.Start)
.width($r('app.string.compress_file_container_width'))
.padding($r('app.string.compress_file_title_padding_size'))
.fontWeight(FontWeight.Bold)
.backgroundColor($r('app.color.compress_file_title_bar_background_color'))
.fontColor($r('app.color.compress_file_message_color'))
.borderRadius($r('app.string.compress_file_top_bar_container_border_radius'))
if (this.compressBundleName) {
Row() {
Image($r('app.media.compress_file_ic_files_compress'))
.width($r('app.string.compress_file_icon_width'))
.height($r('app.string.compress_file_icon_height'))
.margin({ right: $r('app.string.compress_file_icon_margin_size') })
Text(this.compressBundleName)
.fontSize($r('app.string.compress_file_name_font_size'))
}
.id('compressZip')
.justifyContent(FlexAlign.Start)
.width($r('app.string.compress_file_container_width'))
.height($r('app.string.compress_file_list_item_height'))
}
}
.padding($r('app.string.compress_file_container_padding_size'))
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFile.ets#L51-L147
|
784a8937f83d139806468937df0530b29276c012
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets
|
arkts
|
checkParam
|
检查输入参数合法性
|
checkParam() {
logger.info('checkParam start');
if (!this.appInfoList.length) {
this.appInfoList.push(new ListInfo($r("app.media.list_exchange_ic_public_cards_filled"), commonConstants.LIST_NAME))
}
if (!this.deductionView) {
this.deductionView = this.deductionView;
}
if (!this.listExchangeCtrl) {
this.listExchangeCtrl = new ListExchangeCtrl();
this.listExchangeCtrl.initData(this.appInfoList);
}
}
|
AST#method_declaration#Left checkParam 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'checkParam start' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . appInfoList AST#member_expression#Right AST#expression#Right . length 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 . appInfoList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListInfo AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.list_exchange_ic_public_cards_filled" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left commonConstants AST#expression#Right . LIST_NAME AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . deductionView AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . deductionView AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . deductionView AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#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 this AST#expression#Right AST#unary_expression#Right AST#expression#Right . listExchangeCtrl AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listExchangeCtrl AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListExchangeCtrl 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#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 . listExchangeCtrl AST#member_expression#Right AST#expression#Right . initData 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 . appInfoList AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
checkParam() {
logger.info('checkParam start');
if (!this.appInfoList.length) {
this.appInfoList.push(new ListInfo($r("app.media.list_exchange_ic_public_cards_filled"), commonConstants.LIST_NAME))
}
if (!this.deductionView) {
this.deductionView = this.deductionView;
}
if (!this.listExchangeCtrl) {
this.listExchangeCtrl = new ListExchangeCtrl();
this.listExchangeCtrl.initData(this.appInfoList);
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets#L155-L167
|
68c36c57373f053491ab939eff20d5aed5df9a81
|
gitee
|
luhenchang/ArkTS_Unit.git
|
40743ac7d273f5a8e40feab2b6ccd95823fc4ddf
|
entry/src/main/ets/component/pullrefresh/NoMoreLayout.ets
|
arkts
|
NoMoreLayout
|
没有更多数据组件.
|
@Component
export struct NoMoreLayout {
build() {
Row() {
Text('没有更多数据了')
.margin({ left: Const.NoMoreLayoutConstant_NORMAL_PADDING })
.fontSize(Const.NoMoreLayoutConstant_TITLE_FONT)
.textAlign(TextAlign.Center)
}
.width(Const.FULL_WIDTH)
.justifyContent(FlexAlign.Center)
.height(Const.CUSTOM_LAYOUT_HEIGHT)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NoMoreLayout AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '没有更多数据了' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . NoMoreLayoutConstant_NORMAL_PADDING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . NoMoreLayoutConstant_TITLE_FONT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 Const AST#expression#Right . FULL_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . CUSTOM_LAYOUT_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct NoMoreLayout {
build() {
Row() {
Text('没有更多数据了')
.margin({ left: Const.NoMoreLayoutConstant_NORMAL_PADDING })
.fontSize(Const.NoMoreLayoutConstant_TITLE_FONT)
.textAlign(TextAlign.Center)
}
.width(Const.FULL_WIDTH)
.justifyContent(FlexAlign.Center)
.height(Const.CUSTOM_LAYOUT_HEIGHT)
}
}
|
https://github.com/luhenchang/ArkTS_Unit.git/blob/40743ac7d273f5a8e40feab2b6ccd95823fc4ddf/entry/src/main/ets/component/pullrefresh/NoMoreLayout.ets#L6-L19
|
6a4f3886326355b27ac6284b4583e49a05cb7566
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets
|
arkts
|
getPx
|
Obtains the screen horizontal adaptation px.
@return number
|
static getPx(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return DimensionUtil.adaptDimension(beforeVp);
}
|
AST#method_declaration#Left static getPx AST#parameter_list#Left ( AST#parameter#Left value : 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#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left beforeVp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . adaptDimension AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left beforeVp 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 getPx(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return DimensionUtil.adaptDimension(beforeVp);
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets#L53-L56
|
f9aa65d8c9adf557fba16d252250834e4c52b232
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/demo/src/main/ets/view/DatabasePage.ets
|
arkts
|
InputSection
|
输入区域
@returns {void} 无返回值
|
@Builder
private InputSection(): void {
ColumnBase({ widthValue: P100 }) {
IBestCellGroup({ inset: true, outerMargin: 0 }) {
IBestField({
value: this.vm.titleInput,
label: $r("app.string.demo_database_title_label"),
placeholder: $r("app.string.demo_database_title_placeholder"),
onChange: (value: IBestFieldValueType): void => {
this.vm.updateTitleInput(value.toString());
}
});
IBestField({
value: this.vm.descInput,
label: $r("app.string.demo_database_desc_label"),
placeholder: $r("app.string.demo_database_desc_placeholder"),
hasBorder: false,
onChange: (value: IBestFieldValueType): void => {
this.vm.updateDescInput(value.toString());
}
});
};
SpaceVerticalMedium();
RowStartCenter() {
IBestButton({
text: $r("app.string.demo_database_action_save"),
type: "primary",
buttonSize: "large",
round: true,
disabled: this.vm.loading,
btnWidth: P100,
onBtnClick: (): void => {
void this.vm.save();
}
});
};
};
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private InputSection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IBestCellGroup ( AST#component_parameters#Left { AST#component_parameter#Left inset : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left outerMargin : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left IBestField ( 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 . vm AST#member_expression#Right AST#expression#Right . titleInput AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left label : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_database_title_label" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left placeholder : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_database_title_placeholder" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onChange : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left IBestFieldValueType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . updateTitleInput 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 value AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left IBestField ( 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 . vm AST#member_expression#Right AST#expression#Right . descInput AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left label : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_database_desc_label" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left placeholder : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_database_desc_placeholder" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hasBorder : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onChange : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left IBestFieldValueType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . updateDescInput 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 value AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalMedium ( ) ; AST#ui_custom_component_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RowStartCenter ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left IBestButton ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_database_action_save" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left "primary" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left buttonSize : AST#expression#Left "large" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left round : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left disabled : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . loading AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left btnWidth : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onBtnClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left void AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private InputSection(): void {
ColumnBase({ widthValue: P100 }) {
IBestCellGroup({ inset: true, outerMargin: 0 }) {
IBestField({
value: this.vm.titleInput,
label: $r("app.string.demo_database_title_label"),
placeholder: $r("app.string.demo_database_title_placeholder"),
onChange: (value: IBestFieldValueType): void => {
this.vm.updateTitleInput(value.toString());
}
});
IBestField({
value: this.vm.descInput,
label: $r("app.string.demo_database_desc_label"),
placeholder: $r("app.string.demo_database_desc_placeholder"),
hasBorder: false,
onChange: (value: IBestFieldValueType): void => {
this.vm.updateDescInput(value.toString());
}
});
};
SpaceVerticalMedium();
RowStartCenter() {
IBestButton({
text: $r("app.string.demo_database_action_save"),
type: "primary",
buttonSize: "large",
round: true,
disabled: this.vm.loading,
btnWidth: P100,
onBtnClick: (): void => {
void this.vm.save();
}
});
};
};
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/DatabasePage.ets#L71-L110
|
26f48c67793810edd37649ce850cac3a6b4ab089
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/user/src/main/ets/view/ProfilePage.ets
|
arkts
|
ProfileBaseInfoCard
|
基础信息卡片
@returns {void} 无返回值
|
@Builder
private ProfileBaseInfoCard(): void {
Card() {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
}) {
IBestCell({
title: $r("app.string.avatar"),
label: $r("app.string.avatar_label"),
hasBorder: true,
isLink: false,
cellPadding: $r("app.float.space_padding_medium"),
rightIconBuilder: (): void => this.AvatarRightContent()
});
IBestCell({
title: $r("app.string.nickname"),
value: this.vm.getNickNameText(),
hasBorder: false,
isLink: false,
cellPadding: $r("app.float.space_padding_large")
});
}
}
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ProfileBaseInfoCard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IBestCellGroup ( AST#component_parameters#Left { AST#component_parameter#Left inset : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left radius : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.radius_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left outerMargin : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left IBestCell ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.avatar" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left label : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.avatar_label" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hasBorder : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isLink : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cellPadding : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left rightIconBuilder : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . AvatarRightContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left IBestCell ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.nickname" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left value : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . getNickNameText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hasBorder : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isLink : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cellPadding : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_large" 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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private ProfileBaseInfoCard(): void {
Card() {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
}) {
IBestCell({
title: $r("app.string.avatar"),
label: $r("app.string.avatar_label"),
hasBorder: true,
isLink: false,
cellPadding: $r("app.float.space_padding_medium"),
rightIconBuilder: (): void => this.AvatarRightContent()
});
IBestCell({
title: $r("app.string.nickname"),
value: this.vm.getNickNameText(),
hasBorder: false,
isLink: false,
cellPadding: $r("app.float.space_padding_large")
});
}
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/ProfilePage.ets#L97-L123
|
5f93e5ac03767504f392333a58e1196fa5a032ec
|
github
|
Lateautumn00/HarmonyOS_WeChat.git
|
88993b308d5018c11d4e6ddf7838a96c6384201c
|
entry/src/main/ets/pages/Wx.ets
|
arkts
|
getList
|
列表的每一列
|
@Builder getList(item:WxList){
Row(){
Row({space:10}){
Image(item.image).width(50).height(50).borderRadius(50)
Column(){
Text(item.name).fontSize(18).fontWeight(FontWeight.Bold)
Text(item.desc).fontSize(16)
}.alignItems(HorizontalAlign.Start)
}
Column(){
Text(item.time).fontSize(20)
Image(item.isremind?'':'')
}
}.width('100%').height(70).justifyContent(FlexAlign.SpaceBetween).padding(20)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getList AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left WxList 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 Row ( ) 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 10 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#member_expression#Left AST#expression#Left item AST#expression#Right . image AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 50 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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . desc AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#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 item AST#expression#Right . time AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#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#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . isremind AST#member_expression#Right AST#expression#Right ? AST#expression#Left '' AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#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 70 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder getList(item:WxList){
Row(){
Row({space:10}){
Image(item.image).width(50).height(50).borderRadius(50)
Column(){
Text(item.name).fontSize(18).fontWeight(FontWeight.Bold)
Text(item.desc).fontSize(16)
}.alignItems(HorizontalAlign.Start)
}
Column(){
Text(item.time).fontSize(20)
Image(item.isremind?'':'')
}
}.width('100%').height(70).justifyContent(FlexAlign.SpaceBetween).padding(20)
}
|
https://github.com/Lateautumn00/HarmonyOS_WeChat.git/blob/88993b308d5018c11d4e6ddf7838a96c6384201c/entry/src/main/ets/pages/Wx.ets#L221-L235
|
f0e08ed7334f3d530d75b5cda67fd08152aabc53
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Connectivity/WebSocket/entry/src/main/ets/common/BindServiceIp.ets
|
arkts
|
BindServiceIp
|
Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Component
export default struct BindServiceIp {
@Link ipAddress: string
private onBind: () => void
build() {
Column() {
Text($r('app.string.welcome'))
.fontSize(25)
.margin({ top: 20 })
.fontWeight(FontWeight.Bold)
TextInput({ placeholder: $r('app.string.ip_placeholder') })
.height(50)
.fontSize(15)
.width('70%')
.margin({ top: 20 })
.key('ipInput')
.id('text_ip_input')
.onChange((value: string) => {
this.ipAddress = `${value}`
})
Button() {
Text($r('app.string.bind_ip'))
.fontSize(20)
.fontColor(Color.White)
}
.id('btn_bind')
.margin({ top: 20 })
.width(200)
.height(50)
.type(ButtonType.Capsule)
.onClick(() => {
this.onBind()
})
}
.width('100%')
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct BindServiceIp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right ipAddress : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left private onBind : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.welcome' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 25 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 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.ip_placeholder' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '70%' 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 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left 'ipInput' AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'text_ip_input' 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 . ipAddress AST#member_expression#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left value AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 Button ( ) 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.bind_ip' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'btn_bind' 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 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 200 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#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 . 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 . onBind 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#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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export default struct BindServiceIp {
@Link ipAddress: string
private onBind: () => void
build() {
Column() {
Text($r('app.string.welcome'))
.fontSize(25)
.margin({ top: 20 })
.fontWeight(FontWeight.Bold)
TextInput({ placeholder: $r('app.string.ip_placeholder') })
.height(50)
.fontSize(15)
.width('70%')
.margin({ top: 20 })
.key('ipInput')
.id('text_ip_input')
.onChange((value: string) => {
this.ipAddress = `${value}`
})
Button() {
Text($r('app.string.bind_ip'))
.fontSize(20)
.fontColor(Color.White)
}
.id('btn_bind')
.margin({ top: 20 })
.width(200)
.height(50)
.type(ButtonType.Capsule)
.onClick(() => {
this.onBind()
})
}
.width('100%')
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/WebSocket/entry/src/main/ets/common/BindServiceIp.ets#L16-L53
|
d50bddb19ba804be01e23c3a79b0c32a84374b09
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets
|
arkts
|
NavDestinationTitle
|
[End get_route_info_and_link_address]
|
@Builder
NavDestinationTitle() {
Column() {
Text($r('app.string.query_Network_connection_information'))
.fontSize(20)
.lineHeight(40)
.fontWeight(700)
.width('100%')
.padding({ left: 12 })
}
.width('100%')
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NavDestinationTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#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.query_Network_connection_information' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 700 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 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
NavDestinationTitle() {
Column() {
Text($r('app.string.query_Network_connection_information'))
.fontSize(20)
.lineHeight(40)
.fontWeight(700)
.width('100%')
.padding({ left: 12 })
}
.width('100%')
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets#L107-L118
|
df405193400d5050f0d494fc1488e43abbe8cff6
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/animation/ChartAnimator.ets
|
arkts
|
getPhaseX
|
Gets the X axis phase of the animation.
@return float value of {@link #mPhaseX}
|
public getPhaseX(): number {
return this.mPhaseX;
}
|
AST#method_declaration#Left public getPhaseX AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mPhaseX AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getPhaseX(): number {
return this.mPhaseX;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/animation/ChartAnimator.ets#L244-L246
|
c049db9e77ac328ef572265cbd6a5dbd4f34c33d
|
gitee
|
LiuAnclouds/Harmony-ArkTS-App.git
|
2119ce333927599b81a31081bc913e1416837308
|
WeatherMind/entry/src/main/ets/pages/ChooseCity.ets
|
arkts
|
setCurrentCity
|
设置当前城市
|
private async setCurrentCity(cityName: string) {
try {
let httpRequest = http.createHttp();
await httpRequest.request(Config.API.SET_CURRENT_CITY, {
method: http.RequestMethod.POST,
extraData: JSON.stringify({
city_name: cityName
}),
header: {
"Content-Type": "application/json"
}
});
} catch (error) {
console.error('设置当前城市失败:', error);
}
}
|
AST#method_declaration#Left private async setCurrentCity AST#parameter_list#Left ( AST#parameter#Left cityName : 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = 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#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 httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request 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 Config AST#expression#Right . API AST#member_expression#Right AST#expression#Right . SET_CURRENT_CITY AST#member_expression#Right 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#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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left city_name AST#property_name#Right : AST#expression#Left cityName AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "Content-Type" AST#property_name#Right : AST#expression#Left "application/json" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '设置当前城市失败:' AST#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 setCurrentCity(cityName: string) {
try {
let httpRequest = http.createHttp();
await httpRequest.request(Config.API.SET_CURRENT_CITY, {
method: http.RequestMethod.POST,
extraData: JSON.stringify({
city_name: cityName
}),
header: {
"Content-Type": "application/json"
}
});
} catch (error) {
console.error('设置当前城市失败:', error);
}
}
|
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L263-L278
|
d82b508242671b44fc36de64a87a58a33a4e284c
|
github
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/data/PieData.ets
|
arkts
|
getYValueSum
|
Returns the sum of all values in this PieData object.
@return
|
public getYValueSum(): number {
let sum: number = 0;
for (let i: number = 0; i < this.getDataSet().getEntryCount(); i++)
sum += this.getDataSet().getEntryForIndex(i).getY();
return sum;
}
|
AST#method_declaration#Left public getYValueSum AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . getDataSet AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getEntryCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sum += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getDataSet AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getEntryForIndex 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 . getY 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#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left sum AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getYValueSum(): number {
let sum: number = 0;
for (let i: number = 0; i < this.getDataSet().getEntryCount(); i++)
sum += this.getDataSet().getEntryForIndex(i).getY();
return sum;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieData.ets#L109-L118
|
783e7111f516dcaafe9fc500c8044666010104a2
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
|
arkts
|
regDisplayListener
|
注册屏幕状态监听
@returns {void}
|
regDisplayListener(): void {
if (display.isFoldable()) {
// 监听折叠屏状态变更,更新折叠态,修改窗口显示方向
display.on('foldStatusChange', async (curFoldStatus: display.FoldStatus) => {
// 无视FOLD_STATUS_UNKNOWN状态
if (curFoldStatus === display.FoldStatus.FOLD_STATUS_UNKNOWN) {
return;
}
// FOLD_STATUS_HALF_FOLDED状态当作FOLD_STATUS_EXPANDED一致处理
if (curFoldStatus === display.FoldStatus.FOLD_STATUS_HALF_FOLDED) {
curFoldStatus = display.FoldStatus.FOLD_STATUS_EXPANDED;
}
// 同一个状态重复触发不做处理
if (this.curFoldStatus === curFoldStatus) {
return;
}
// 缓存当前折叠状态
this.curFoldStatus = curFoldStatus;
// 当前没有相机流资源,只更新相机流宽高设置
if (!this.surfaceId) {
this.updateCameraCompSize();
return;
}
// 关闭闪光灯
this.tryCloseFlashLight();
setTimeout(() => {
// 重新启动扫码
this.restartCustomScan();
}, 10)
})
}
}
|
AST#method_declaration#Left regDisplayListener 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . isFoldable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { // 监听折叠屏状态变更,更新折叠态,修改窗口显示方向 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'foldStatusChange' AST#expression#Right , AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left curFoldStatus : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . FoldStatus AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 无视FOLD_STATUS_UNKNOWN状态 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left curFoldStatus AST#expression#Right === AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_UNKNOWN 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 // FOLD_STATUS_HALF_FOLDED状态当作FOLD_STATUS_EXPANDED一致处理 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left curFoldStatus AST#expression#Right === AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_HALF_FOLDED AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left curFoldStatus = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_EXPANDED AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 this AST#expression#Right . curFoldStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left curFoldStatus AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 缓存当前折叠状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curFoldStatus AST#member_expression#Right = AST#expression#Left curFoldStatus AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 当前没有相机流资源,只更新相机流宽高设置 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . surfaceId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateCameraCompSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 . tryCloseFlashLight 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 setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 重新启动扫码 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . restartCustomScan AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 10 AST#expression#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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
regDisplayListener(): void {
if (display.isFoldable()) {
display.on('foldStatusChange', async (curFoldStatus: display.FoldStatus) => {
if (curFoldStatus === display.FoldStatus.FOLD_STATUS_UNKNOWN) {
return;
}
if (curFoldStatus === display.FoldStatus.FOLD_STATUS_HALF_FOLDED) {
curFoldStatus = display.FoldStatus.FOLD_STATUS_EXPANDED;
}
if (this.curFoldStatus === curFoldStatus) {
return;
}
this.curFoldStatus = curFoldStatus;
if (!this.surfaceId) {
this.updateCameraCompSize();
return;
}
this.tryCloseFlashLight();
setTimeout(() => {
this.restartCustomScan();
}, 10)
})
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L183-L217
|
4400c161354553fb7b8b8e1eee0bd2cdb7052bee
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/util/ChatTools.ets
|
arkts
|
getTimeHH24Human
|
获取仅包含“时间:分钟”部分的字符串,24小时制,且可以显示“上午”、“下午”、“晚上”这样的描述。
@param srcDateObj 原始日期对象
@param timeWithSegmentStr 表示在时间字符串前带上“上午”、“下午”、“晚上”这样的描述
@return 如果成功则返回结果,否则返回空字符串""(不是null)
|
static getTimeHH24Human(srcDateObj: Date, timeWithSegmentStr: boolean): string {
let ret: string = '';
try {
let timePattern: string = 'hh:mm';
// 原始的时间分钟字符串
let timeStr: string = ChatTools.formatDate(srcDateObj, timePattern);
// 时间段描述(形如:“上午”、“下午”、“晚上”这样的描述),只在中文语言下生效
let timeSegmentStr: string = '';
if(timeWithSegmentStr)
timeSegmentStr = ChatTools.getTimeSegmentStr(timeStr);
// 组合成最终的人性化时间分钟字符串形式
ret = timeSegmentStr+timeStr;
} catch (e) {
console.error("【DEBUG-getTimeHH24Human】计算出错:"+ JSON.stringify(e) +" 【NO】");
}
return ret;
}
|
AST#method_declaration#Left static getTimeHH24Human AST#parameter_list#Left ( AST#parameter#Left srcDateObj : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeWithSegmentStr : 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ret : AST#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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left timePattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hh:mm' 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 timeStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ChatTools AST#expression#Right . formatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcDateObj AST#expression#Right , AST#expression#Left timePattern AST#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 timeSegmentStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left timeWithSegmentStr AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left timeSegmentStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ChatTools AST#expression#Right . getTimeSegmentStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left timeStr 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#if_statement#Right AST#statement#Right // 组合成最终的人性化时间分钟字符串形式 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ret = AST#expression#Left AST#binary_expression#Left AST#expression#Left timeSegmentStr AST#expression#Right + AST#expression#Left timeStr AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "【DEBUG-getTimeHH24Human】计算出错:" 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#expression#Left " 【NO】" 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#statement#Left AST#return_statement#Left return AST#expression#Left ret AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getTimeHH24Human(srcDateObj: Date, timeWithSegmentStr: boolean): string {
let ret: string = '';
try {
let timePattern: string = 'hh:mm';
let timeStr: string = ChatTools.formatDate(srcDateObj, timePattern);
let timeSegmentStr: string = '';
if(timeWithSegmentStr)
timeSegmentStr = ChatTools.getTimeSegmentStr(timeStr);
ret = timeSegmentStr+timeStr;
} catch (e) {
console.error("【DEBUG-getTimeHH24Human】计算出错:"+ JSON.stringify(e) +" 【NO】");
}
return ret;
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L254-L273
|
ba1ba95b0ddbdaee22ba068813786a474346819a
|
gitee
|
chongzi/Lucky-ArkTs.git
|
84fc104d4a68def780a483e2543ebf9f53e793fd
|
entry/src/main/ets/common/DatabaseManager.ets
|
arkts
|
WrongQuestion
|
导出接口
|
export { WrongQuestion }
|
AST#export_declaration#Left export { WrongQuestion } AST#export_declaration#Right
|
export { WrongQuestion }
|
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/common/DatabaseManager.ets#L2315-L2315
|
c0b0038a147eabaf0b957da792548801c12a0fdc
|
github
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/utils/storage_tools.ets
|
arkts
|
Read an ArrayBuffer file from sandbox storage in an asynchronous way.
@returns An ArrayBuffer, of the requested file's content or undefined if the file doesn't exist.
|
export function sandbox_read_arrayBuffer(file_path_name: string, context_filesDir?: string) {
let filesDir: string = context_filesDir || meowContext().filesDir;
file_path_name = filesDir + "/" + file_path_name
if (!(fs.accessSync(file_path_name))) {
// file doesn't exist
return undefined;
}
return fs.open(file_path_name, fs.OpenMode.READ_WRITE).then((file) => {
return fs.stat(file_path_name).then((stat) => {
let buf = new ArrayBuffer(stat.size);
return fs.read(file.fd, buf).then((l) => {
let readLen = l;
console.info("[sandbox_open] read file data succeed, Length: " + readLen.toString());
let result = buf.slice(0, readLen);
fs.close(file);
return result;
})
});
})
}
|
AST#export_declaration#Left export AST#function_declaration#Left function sandbox_read_arrayBuffer AST#parameter_list#Left ( AST#parameter#Left file_path_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context_filesDir ? : 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 filesDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left context_filesDir AST#expression#Right || AST#expression#Left meowContext AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left file_path_name = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left filesDir AST#expression#Right + AST#expression#Left "/" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left file_path_name 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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file_path_name AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { // file doesn't exist AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file_path_name AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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 file AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . stat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file_path_name 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 stat AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left buf = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ArrayBuffer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left stat AST#expression#Right . size AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . read 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 buf 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 l AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left readLen = AST#expression#Left l 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "[sandbox_open] read file data succeed, Length: " AST#expression#Right + AST#expression#Left readLen AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 buf 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 readLen AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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#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#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#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#function_declaration#Right AST#export_declaration#Right
|
export function sandbox_read_arrayBuffer(file_path_name: string, context_filesDir?: string) {
let filesDir: string = context_filesDir || meowContext().filesDir;
file_path_name = filesDir + "/" + file_path_name
if (!(fs.accessSync(file_path_name))) {
return undefined;
}
return fs.open(file_path_name, fs.OpenMode.READ_WRITE).then((file) => {
return fs.stat(file_path_name).then((stat) => {
let buf = new ArrayBuffer(stat.size);
return fs.read(file.fd, buf).then((l) => {
let readLen = l;
console.info("[sandbox_open] read file data succeed, Length: " + readLen.toString());
let result = buf.slice(0, readLen);
fs.close(file);
return result;
})
});
})
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L498-L517
|
7932494e945e45cccc7563ad1a153a1a1b80bdbf
|
gitee
|
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
NEXT/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets
|
arkts
|
聊天配置类:单例模式
|
export class ChatConfig {
private static _instance: ChatConfig | null = null;
/**
* 获取对象函数
* @returns
*/
public static getInstance() {
if (!ChatConfig._instance) {
ChatConfig._instance = new ChatConfig();
}
return ChatConfig._instance
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ChatConfig AST#class_body#Left { AST#property_declaration#Left private static _instance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChatConfig 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 /**
* 获取对象函数
* @returns
*/ AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left ChatConfig AST#expression#Right AST#unary_expression#Right AST#expression#Right . _instance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ChatConfig AST#expression#Right . _instance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ChatConfig AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ChatConfig AST#expression#Right . _instance AST#member_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ChatConfig {
private static _instance: ChatConfig | null = null;
public static getInstance() {
if (!ChatConfig._instance) {
ChatConfig._instance = new ChatConfig();
}
return ChatConfig._instance
}
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets#L20-L33
|
415f73d73fa2057bf4a0d9c86cde0a19b9b676f6
|
gitee
|
|
wasd09090030/MyHongmengProject.git
|
a8ed386b658ceeac69ef5bc42a92d78c7980821c
|
entry/src/main/ets/components/ReviewPage.ets
|
arkts
|
HistoryView
|
历史视图
|
@Builder
HistoryView() {
Column() {
// 历史记录列表
if (this.completedTasksList.length === 0) {
Column({ space: 16 }) {
SymbolGlyph($r('sys.symbol.calendar_badge_clock'))
.fontSize(80)
.fontColor(['#CCCCCC'])
Text('暂无完成记录')
.fontSize(18)
.fontColor('#999999')
Text('完成任务后会显示在这里')
.fontSize(14)
.fontColor('#BBBBBB')
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
} else {
List({ space: 12 }) {
ForEach(
this.completedTasksList,
(task: TaskItem, index: number) => {
ListItem() {
EnhancedHistoryCard(task, index, this.completedTasksList.length)
}
}
)
}
.width('100%')
.layoutWeight(1)
.padding({ left: 20, right: 20, bottom: 12 })
.scrollBar(BarState.Auto)
}
// 清除数据按钮
if (this.completedTasksList.length > 0) {
Button({ type: ButtonType.Normal }) {
Row({ space: 8 }) {
SymbolGlyph($r('sys.symbol.trash'))
.fontSize(16)
.fontColor([Color.White])
Text('清除所有历史')
.fontSize(14)
.fontColor(Color.White)
}
}
.width('90%')
.height(44)
.margin({ top: 8, bottom: 20 })
.backgroundColor('#FF3B30')
.borderRadius(12)
.onClick(() => {
AppState.completedTasks = [];
AppState.saveAllData();
this.updateAllStatistics();
})
}
}
.width('100%')
.height('100%')
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right HistoryView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 历史记录列表 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . completedTasksList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 SymbolGlyph ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.calendar_badge_clock' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left '#CCCCCC' AST#expression#Right ] AST#array_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 . fontSize ( AST#expression#Left 18 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#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 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#BBBBBB' 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 . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_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 . completedTasksList AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left TaskItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left EnhancedHistoryCard ( AST#expression#Left task AST#expression#Right , AST#expression#Left index AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . completedTasksList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#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 . width ( AST#expression#Left '100%' 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 left AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Auto AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 清除数据按钮 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . completedTasksList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#component_parameters#Left { AST#component_parameter#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#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 SymbolGlyph ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.trash' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ] AST#array_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 . fontSize ( AST#expression#Left 14 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#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 '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 44 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FF3B30' 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . completedTasks AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . saveAllData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateAllStatistics 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#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
HistoryView() {
Column() {
if (this.completedTasksList.length === 0) {
Column({ space: 16 }) {
SymbolGlyph($r('sys.symbol.calendar_badge_clock'))
.fontSize(80)
.fontColor(['#CCCCCC'])
Text('暂无完成记录')
.fontSize(18)
.fontColor('#999999')
Text('完成任务后会显示在这里')
.fontSize(14)
.fontColor('#BBBBBB')
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
} else {
List({ space: 12 }) {
ForEach(
this.completedTasksList,
(task: TaskItem, index: number) => {
ListItem() {
EnhancedHistoryCard(task, index, this.completedTasksList.length)
}
}
)
}
.width('100%')
.layoutWeight(1)
.padding({ left: 20, right: 20, bottom: 12 })
.scrollBar(BarState.Auto)
}
if (this.completedTasksList.length > 0) {
Button({ type: ButtonType.Normal }) {
Row({ space: 8 }) {
SymbolGlyph($r('sys.symbol.trash'))
.fontSize(16)
.fontColor([Color.White])
Text('清除所有历史')
.fontSize(14)
.fontColor(Color.White)
}
}
.width('90%')
.height(44)
.margin({ top: 8, bottom: 20 })
.backgroundColor('#FF3B30')
.borderRadius(12)
.onClick(() => {
AppState.completedTasks = [];
AppState.saveAllData();
this.updateAllStatistics();
})
}
}
.width('100%')
.height('100%')
}
|
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/ReviewPage.ets#L446-L510
|
9dede6ecd6336114c18e72dced0c6678df58b6b3
|
github
|
openharmony/applications_settings
|
aac607310ec30e30d1d54db2e04d055655f72730
|
common/component/src/main/ets/default/sliderComponent.ets
|
arkts
|
onChangeHandler
|
Change handler
@param value - Change value
@param mode - State
|
onChangeHandler(value: number, mode: SliderChangeMode) {
if (this.onChange) {
this.onChange(value, mode);
}
}
|
AST#method_declaration#Left onChangeHandler AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left SliderChangeMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onChange AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right , AST#expression#Left mode AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
onChangeHandler(value: number, mode: SliderChangeMode) {
if (this.onChange) {
this.onChange(value, mode);
}
}
|
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/sliderComponent.ets#L104-L108
|
f5f7d28b39e727ac4593c38fcc66ce4dad2d7f07
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
|
arkts
|
getTotalCount
|
获取全部试题数量
@returns
|
public getTotalCount(): number {
return this.examDetails.length;
}
|
AST#method_declaration#Left public getTotalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . examDetails AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getTotalCount(): number {
return this.examDetails.length;
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L172-L174
|
42245ec275fe6d52081d51ba00a68ec8cef24563
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
|
arkts
|
createTable
|
创建表
@param tableName 表名
@param columnTypeMap 字段名与其类型
|
async createTable(tableName: string, columnTypeMap: string[][]): Promise<void> {
if (store === undefined) {
return;
}
let fieldStatements: string = Constants.EMPTY_STRING;
columnTypeMap.forEach(columnType => {
fieldStatements += Constants.COMMA + columnType[0] + Constants.SPACE + columnType[1];
})
const createTableSql: string = util.format(Constants.CREATE_TABLE_SQL_TEMPLATE, tableName, fieldStatements);
try {
await store.executeSql(createTableSql);
} catch (err) {
logger.error(`createTable failed,code is ${err.code}, message is ${err.message}`);
}
}
|
AST#method_declaration#Left async createTable 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 columnTypeMap : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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#binary_expression#Left AST#expression#Left store 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#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fieldStatements : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . EMPTY_STRING 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 columnTypeMap AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left columnType => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left fieldStatements += 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 Constants AST#expression#Right . COMMA AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left columnType AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . SPACE AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left columnType AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 createTableSql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . format AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . CREATE_TABLE_SQL_TEMPLATE AST#member_expression#Right AST#expression#Right , AST#expression#Left tableName AST#expression#Right , AST#expression#Left fieldStatements AST#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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left store AST#expression#Right AST#await_expression#Right AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left createTableSql AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` createTable failed,code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async createTable(tableName: string, columnTypeMap: string[][]): Promise<void> {
if (store === undefined) {
return;
}
let fieldStatements: string = Constants.EMPTY_STRING;
columnTypeMap.forEach(columnType => {
fieldStatements += Constants.COMMA + columnType[0] + Constants.SPACE + columnType[1];
})
const createTableSql: string = util.format(Constants.CREATE_TABLE_SQL_TEMPLATE, tableName, fieldStatements);
try {
await store.executeSql(createTableSql);
} catch (err) {
logger.error(`createTable failed,code is ${err.code}, message is ${err.message}`);
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L74-L88
|
b42086e6773b42c9232eb47a358ad3253ddc3b90
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets
|
arkts
|
makeNode
|
必须要重写的方法,用于构建节点数、返回节点挂载在对应NodeContainer中 在对应NodeContainer创建的时候调用、或者通过rebuild方法调用刷新
|
makeNode(uiContext: UIContext): FrameNode | null {
console.log(' uicontext is undefined : '+ (uiContext === undefined));
if (this.rootnode != null) {
// 返回FrameNode节点
return this.rootnode.getFrameNode();
}
// 返回null控制动态组件脱离绑定节点
return null;
}
|
AST#method_declaration#Left makeNode 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#type_annotation#Left AST#union_type#Left AST#primary_type#Left FrameNode AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#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 ' uicontext is undefined : ' AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left uiContext AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootnode 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 ) { // 返回FrameNode节点 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootnode AST#member_expression#Right AST#expression#Right . getFrameNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 返回null控制动态组件脱离绑定节点 AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
makeNode(uiContext: UIContext): FrameNode | null {
console.log(' uicontext is undefined : '+ (uiContext === undefined));
if (this.rootnode != null) {
return this.rootnode.getFrameNode();
}
return null;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets#L46-L54
|
2520f76f7dd31a89777fa9cf2008b0018db18e13
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/commoncomponents/ViewCodeText.ets
|
arkts
|
ViewCodeText
|
Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Component
export struct ViewCodeText {
@StorageLink('sideBarShow') sideBarShow: boolean = false;
private webSrc: Resource = $rawfile('BaseTypeCode.ets.html');
build() {
Column(){
Text($r('app.string.source_code'))
.fontColor($r('app.color.source_code_font_color'))
.fontSize($r('app.float.source_code_font_size'))
.alignSelf(ItemAlign.End)
.id('viewSourceCode')
.onClick(() => {
// 点击查看源码
AppStorage.SetOrCreate('sideBarShow', !this.sideBarShow);
AppStorage.SetOrCreate('webSrc', this.webSrc);
})
}
.width('100%')
.justifyContent(FlexAlign.End)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ViewCodeText AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'sideBarShow' AST#expression#Right ) AST#decorator#Right sideBarShow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private webSrc : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'BaseTypeCode.ets.html' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.source_code' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.source_code_font_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.source_code_font_size' AST#expression#Right ) AST#resource_expression#Right 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#Left . id ( AST#expression#Left 'viewSourceCode' 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 AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'sideBarShow' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . sideBarShow 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 AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'webSrc' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webSrc AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct ViewCodeText {
@StorageLink('sideBarShow') sideBarShow: boolean = false;
private webSrc: Resource = $rawfile('BaseTypeCode.ets.html');
build() {
Column(){
Text($r('app.string.source_code'))
.fontColor($r('app.color.source_code_font_color'))
.fontSize($r('app.float.source_code_font_size'))
.alignSelf(ItemAlign.End)
.id('viewSourceCode')
.onClick(() => {
AppStorage.SetOrCreate('sideBarShow', !this.sideBarShow);
AppStorage.SetOrCreate('webSrc', this.webSrc);
})
}
.width('100%')
.justifyContent(FlexAlign.End)
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/commoncomponents/ViewCodeText.ets#L16-L37
|
ac88a34696fd07ced0c9b5dc701262f9e732ba73
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets
|
arkts
|
getNavPathStack
|
通过名称获取router
|
private static getNavPathStack(): NavPathStack {
return DynamicsRouter.navPathStack;
}
|
AST#method_declaration#Left private static getNavPathStack AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NavPathStack 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 DynamicsRouter AST#expression#Right . navPathStack AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static getNavPathStack(): NavPathStack {
return DynamicsRouter.navPathStack;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets#L76-L78
|
b24bab67648639cd4dda28d78b15fd3f08891737
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/main/src/main/ets/viewmodel/MainViewModel.ets
|
arkts
|
updateCurrentPage
|
更新当前页面索引
@param {number} index - 目标页面索引
@returns {void} 无返回值
|
updateCurrentPage(index: number): void {
this.currentPageIndex = index;
}
|
AST#method_declaration#Left updateCurrentPage AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentPageIndex AST#member_expression#Right = AST#expression#Left index AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
updateCurrentPage(index: number): void {
this.currentPageIndex = index;
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L30-L32
|
04a08438a21e1e616f0ddac380bba34c240a4b7f
|
github
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/common/RdbHelper.ets
|
arkts
|
updateTaskStatus
|
Update task status
@param taskId - ID of task to update
@param isDone - New done status
|
async updateTaskStatus(taskId: number, isDone: boolean): Promise<void> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const valueBucket: relationalStore.ValuesBucket = {
is_done: isDone ? 1 : 0
};
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_TASKS);
predicates.equalTo('id', taskId);
try {
await this.rdbStore.update(valueBucket, predicates);
console.info(`[RdbHelper] Task ${taskId} updated to ${isDone ? 'done' : 'undone'}`);
} catch (error) {
const err = error as BusinessError;
console.error(`[RdbHelper] Failed to update task. Code: ${err.code}, message: ${err.message}`);
throw new Error(`Failed to update task: ${err.message}`);
}
}
|
AST#method_declaration#Left async updateTaskStatus AST#parameter_list#Left ( AST#parameter#Left taskId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isDone : 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 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#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Database not initialized' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left valueBucket : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left is_done AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left isDone AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left predicates = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . TABLE_TASKS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . equalTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'id' AST#expression#Right , AST#expression#Left taskId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_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 . update AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left valueBucket AST#expression#Right , AST#expression#Left predicates AST#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 ` [RdbHelper] Task AST#template_substitution#Left $ { AST#expression#Left taskId AST#expression#Right } AST#template_substitution#Right updated to AST#template_substitution#Left $ { AST#expression#Left AST#conditional_expression#Left AST#expression#Left isDone AST#expression#Right ? AST#expression#Left 'done' AST#expression#Right : AST#expression#Left 'undone' AST#expression#Right AST#conditional_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] Failed to update task. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to update task: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async updateTaskStatus(taskId: number, isDone: boolean): Promise<void> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const valueBucket: relationalStore.ValuesBucket = {
is_done: isDone ? 1 : 0
};
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_TASKS);
predicates.equalTo('id', taskId);
try {
await this.rdbStore.update(valueBucket, predicates);
console.info(`[RdbHelper] Task ${taskId} updated to ${isDone ? 'done' : 'undone'}`);
} catch (error) {
const err = error as BusinessError;
console.error(`[RdbHelper] Failed to update task. Code: ${err.code}, message: ${err.message}`);
throw new Error(`Failed to update task: ${err.message}`);
}
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L274-L294
|
5cc9e87cf0c897509806a832f6d039f7339bc09b
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets
|
arkts
|
reminderTime
|
日程提醒时间菜单
|
@Builder
reminderTimeMenu() {
Column() {
ForEach(Constants.REMINDER_TIME_OPTION, (item: string, index: number) => {
Column() {
Flex({
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween,
alignItems: ItemAlign.Center
}) {
Text(item)
.fontSize($r('app.integer.calendar_switch_size_fifteen'))
Image($r('app.media.calendar_switch_ok'))
.visibility(this.reminderTimeIndex === index ? Visibility.Visible : Visibility.Hidden)
.width($r('app.integer.calendar_switch_size_twenty'))
.height($r('app.integer.calendar_switch_size_twenty'))
}
.height($r('app.integer.calendar_switch_size_forty_eight'))
Divider()
.visibility(index !== Constants.REMINDER_TIME_OPTION.length - 1 ? Visibility.Visible : Visibility.Hidden)
.width($r('app.string.calendar_switch_full_size'))
}
.width($r('app.integer.calendar_switch_size_ninety'))
.onClick(() => {
this.reminderTimeIndex = index;
switch (item) {
case '准时':
this.reminderTimeArray = [0];
break;
case '1分钟前':
this.reminderTimeArray = [1];
break;
case '5分钟前':
this.reminderTimeArray = [5];
break;
case '30分钟前':
this.reminderTimeArray = [30];
break;
case '1小时前':
this.reminderTimeArray = [60];
break;
}
})
}, (item: string) => item)
}
.borderRadius($r('app.integer.calendar_switch_size_ten'))
.width($r('app.integer.calendar_switch_size_hundred'))
.backgroundColor(Color.White)
.focusable(false)
}
/**
* 提醒时间设置项
*/
@Builder
reminderTime() {
Row() {
Text($r('app.string.calendar_switch_reminder_time'))
.fontSize($r('app.integer.calendar_switch_size_sixteen'))
.fontColor(Color.Gray)
Blank()
Row() {
Text(Constants.REMINDER_TIME_OPTION[this.reminderTimeIndex])
.fontSize($r('app.integer.calendar_switch_size_fifteen'))
Image($r('app.media.calendar_switch_spinner'))
.width($r('app.integer.calendar_switch_size_twenty_two'))
.height($r('app.integer.calendar_switch_size_sixteen'))
.margin({
left: $r('app.integer.calendar_switch_size_eight'),
right: $r('app.integer.calendar_switch_size_eight')
})
}
.bindMenu(this.reminderTimeMenu(), { placement: Placement.Top })
}
.width($r('app.string.calendar_switch_full_size'))
.height($r('app.integer.calendar_switch_size_forty_eight'))
.borderRadius($r('app.integer.calendar_switch_size_ten'))
.backgroundColor(Color.White)
.padding({
left: $r('app.integer.calendar_switch_size_sixteen'),
right: $r('app.integer.calendar_switch_size_sixteen')
})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AST#ERROR#Left reminderTimeMenu AST#parameter_list#Left ( ) AST#parameter_list#Right { Column ( ) { ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . REMINDER_TIME_OPTION AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 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_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 item AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_fifteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.calendar_switch_ok' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reminderTimeIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_twenty' 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 . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_forty_eight' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . REMINDER_TIME_OPTION AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.calendar_switch_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_ninety' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick AST#ERROR#Left ( AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#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 . reminderTimeIndex AST#member_expression#Right = AST#expression#Left index AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Right AST#property_assignment#Left AST#property_name#Left '准时' AST#property_name#Right : AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reminderTimeArray AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_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 '1分钟前' AST#expression#Right AST#expression_statement#Right AST#statement#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . reminderTimeArray AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = [ 1 ] ; break ; case '5分钟前' : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . reminderTimeArray AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = [ 5 ] ; break ; case '30分钟前' : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . reminderTimeArray AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = [ 30 ] ; break ; case '1小时前' AST#ERROR#Right : AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . reminderTimeArray AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = [ 60 ] ; break ; } } ) } , AST#ERROR#Right AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left item AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ) } AST#ERROR#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_ten' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_hundred' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . focusable ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#ERROR#Right /**
* 提醒时间设置项
*/ AST#decorator#Left @ Builder AST#decorator#Right reminderTime AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.calendar_switch_reminder_time' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_sixteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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 Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . REMINDER_TIME_OPTION AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reminderTimeIndex AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_fifteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.calendar_switch_spinner' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_twenty_two' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_sixteen' 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.integer.calendar_switch_size_eight' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_eight' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . bindMenu ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reminderTimeMenu AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left placement AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Placement AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.calendar_switch_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_forty_eight' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_ten' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_sixteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.calendar_switch_size_sixteen' 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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
reminderTimeMenu() {
Column() {
ForEach(Constants.REMINDER_TIME_OPTION, (item: string, index: number) => {
Column() {
Flex({
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween,
alignItems: ItemAlign.Center
}) {
Text(item)
.fontSize($r('app.integer.calendar_switch_size_fifteen'))
Image($r('app.media.calendar_switch_ok'))
.visibility(this.reminderTimeIndex === index ? Visibility.Visible : Visibility.Hidden)
.width($r('app.integer.calendar_switch_size_twenty'))
.height($r('app.integer.calendar_switch_size_twenty'))
}
.height($r('app.integer.calendar_switch_size_forty_eight'))
Divider()
.visibility(index !== Constants.REMINDER_TIME_OPTION.length - 1 ? Visibility.Visible : Visibility.Hidden)
.width($r('app.string.calendar_switch_full_size'))
}
.width($r('app.integer.calendar_switch_size_ninety'))
.onClick(() => {
this.reminderTimeIndex = index;
switch (item) {
case '准时':
this.reminderTimeArray = [0];
break;
case '1分钟前':
this.reminderTimeArray = [1];
break;
case '5分钟前':
this.reminderTimeArray = [5];
break;
case '30分钟前':
this.reminderTimeArray = [30];
break;
case '1小时前':
this.reminderTimeArray = [60];
break;
}
})
}, (item: string) => item)
}
.borderRadius($r('app.integer.calendar_switch_size_ten'))
.width($r('app.integer.calendar_switch_size_hundred'))
.backgroundColor(Color.White)
.focusable(false)
}
@Builder
reminderTime() {
Row() {
Text($r('app.string.calendar_switch_reminder_time'))
.fontSize($r('app.integer.calendar_switch_size_sixteen'))
.fontColor(Color.Gray)
Blank()
Row() {
Text(Constants.REMINDER_TIME_OPTION[this.reminderTimeIndex])
.fontSize($r('app.integer.calendar_switch_size_fifteen'))
Image($r('app.media.calendar_switch_spinner'))
.width($r('app.integer.calendar_switch_size_twenty_two'))
.height($r('app.integer.calendar_switch_size_sixteen'))
.margin({
left: $r('app.integer.calendar_switch_size_eight'),
right: $r('app.integer.calendar_switch_size_eight')
})
}
.bindMenu(this.reminderTimeMenu(), { placement: Placement.Top })
}
.width($r('app.string.calendar_switch_full_size'))
.height($r('app.integer.calendar_switch_size_forty_eight'))
.borderRadius($r('app.integer.calendar_switch_size_ten'))
.backgroundColor(Color.White)
.padding({
left: $r('app.integer.calendar_switch_size_sixteen'),
right: $r('app.integer.calendar_switch_size_sixteen')
})
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets#L159-L242
|
e02fecf2b0cfe2c4728de13aefb48659f3976bfd
|
gitee
|
AlatusLee/HarmonyOS-Next-Weather-Assistant.git
|
d3c7060a8ff7f7656175e83fa32536b11e136556
|
alatus/src/main/ets/view/cityView.ets
|
arkts
|
展示数据
|
build() {
Column(){
// 当天天气数据
ForEach(this.casts,(cast:cast)=>{
if(this.casts[0] === cast){
// 图片渲染
this.weatherImage(cast.dayweather,260,200)
Column(){
// 日期,气温,天气
Text(`${cast.dayweather} ${cast.daytemp}° 至 ${cast.nighttemp}°`).fontSize(30)
.fontColor(Color.White).fontWeight(FontWeight.Bold);
Text(`${cast.daywind}风${cast.daypower}级`).fontSize(30)
.fontColor(Color.White).fontWeight(FontWeight.Bold);
}.margin({top:15});
Column(){
Text("近期天气").fontSize(26).margin({top:10});
Row(){
// 遍历天气
ForEach(this.casts,(cast:cast)=>{
Column(){
Text(cast.date.substring(5));
this.weatherImage(cast.dayweather,20,20);
Text(cast.dayweather);
Text(cast.daytemp.toString());
Line().width(20).height(80).startPoint([10,0]).endPoint([10,70])
.stroke(Color.Black).strokeWidth(3).strokeDashArray([10,3]);
Text(cast.nighttemp.toString());
this.weatherImage(cast.nightweather,20,20);
Text(cast.nightweather);
}.width("20%").height("90%");
});
}.width("80%").height("60%")
.backgroundColor("#ffbab8b8")
.opacity(0.5)
.justifyContent(FlexAlign.SpaceAround);
}.width("100%").height("55%");
}
});
}.width("100%").height("100%");
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 当天天气数据 AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . casts AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left cast : AST#type_annotation#Left AST#primary_type#Left cast AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . casts AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left cast AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // 图片渲染 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weatherImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left cast AST#expression#Right . dayweather AST#member_expression#Right AST#expression#Right , AST#expression#Left 260 AST#expression#Right , AST#expression#Left 200 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left cast AST#expression#Right . dayweather 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 cast AST#expression#Right . daytemp 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 cast AST#expression#Right . nighttemp 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 30 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#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 cast AST#expression#Right . daywind 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 cast AST#expression#Right . daypower 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 30 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "近期天气" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 26 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 遍历天气 AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . casts AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left cast : AST#type_annotation#Left AST#primary_type#Left cast AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cast AST#expression#Right . date AST#member_expression#Right AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weatherImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left cast AST#expression#Right . dayweather AST#member_expression#Right AST#expression#Right , AST#expression#Left 20 AST#expression#Right , AST#expression#Left 20 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left cast AST#expression#Right . dayweather AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cast AST#expression#Right . daytemp AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Line ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Left . startPoint ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 10 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . endPoint ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 10 AST#expression#Right , AST#expression#Left 70 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . stroke ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 3 AST#expression#Right ) AST#modifier_chain_expression#Left . strokeDashArray ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 10 AST#expression#Right , AST#expression#Left 3 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cast AST#expression#Right . nighttemp AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weatherImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left cast AST#expression#Right . nightweather AST#member_expression#Right AST#expression#Right , AST#expression#Left 20 AST#expression#Right , AST#expression#Left 20 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left cast AST#expression#Right . nightweather AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "20%" AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left "90%" AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "80%" 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 "#ffbab8b8" AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.5 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left "55%" AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column(){
ForEach(this.casts,(cast:cast)=>{
if(this.casts[0] === cast){
this.weatherImage(cast.dayweather,260,200)
Column(){
Text(`${cast.dayweather} ${cast.daytemp}° 至 ${cast.nighttemp}°`).fontSize(30)
.fontColor(Color.White).fontWeight(FontWeight.Bold);
Text(`${cast.daywind}风${cast.daypower}级`).fontSize(30)
.fontColor(Color.White).fontWeight(FontWeight.Bold);
}.margin({top:15});
Column(){
Text("近期天气").fontSize(26).margin({top:10});
Row(){
ForEach(this.casts,(cast:cast)=>{
Column(){
Text(cast.date.substring(5));
this.weatherImage(cast.dayweather,20,20);
Text(cast.dayweather);
Text(cast.daytemp.toString());
Line().width(20).height(80).startPoint([10,0]).endPoint([10,70])
.stroke(Color.Black).strokeWidth(3).strokeDashArray([10,3]);
Text(cast.nighttemp.toString());
this.weatherImage(cast.nightweather,20,20);
Text(cast.nightweather);
}.width("20%").height("90%");
});
}.width("80%").height("60%")
.backgroundColor("#ffbab8b8")
.opacity(0.5)
.justifyContent(FlexAlign.SpaceAround);
}.width("100%").height("55%");
}
});
}.width("100%").height("100%");
}
|
https://github.com/AlatusLee/HarmonyOS-Next-Weather-Assistant.git/blob/d3c7060a8ff7f7656175e83fa32536b11e136556/alatus/src/main/ets/view/cityView.ets#L26-L65
|
82cd20325042aa09e41ed6ebd2ba0e02df441aa3
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets
|
arkts
|
键盘按键类型枚举
|
export enum EKeyType {
INPUT, // 输入类型,输入具体的值
DELETE, // 删除一个输入字符
NUMERIC, // 切换数字键盘
CAPSLOCK, // 切换大小写键盘
SPECIAL, // 切换特殊字符键盘
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum EKeyType AST#enum_body#Left { AST#enum_member#Left INPUT AST#enum_member#Right , // 输入类型,输入具体的值 AST#enum_member#Left DELETE AST#enum_member#Right , // 删除一个输入字符 AST#enum_member#Left NUMERIC AST#enum_member#Right , // 切换数字键盘 AST#enum_member#Left CAPSLOCK AST#enum_member#Right , // 切换大小写键盘 AST#enum_member#Left SPECIAL AST#enum_member#Right , // 切换特殊字符键盘 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum EKeyType {
INPUT,
DELETE,
NUMERIC,
CAPSLOCK,
SPECIAL,
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets#L29-L35
|
9482fb82bce574adc558c784d58b2dce06dcf086
|
gitee
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
|
arkts
|
getMockExamManager
|
获取模拟考试考卷,每次获得一个新对象
@param name
@returns
|
getMockExamManager(name: string | Resource) {
let examManager = new ExamManager(name, this.generateExamDetail());
examManager.timeLimit = 1;
return examManager;
}
|
AST#method_declaration#Left getMockExamManager AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left examManager = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ExamManager AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . generateExamDetail AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left examManager AST#expression#Right . timeLimit 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#return_statement#Left return AST#expression#Left examManager AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getMockExamManager(name: string | Resource) {
let examManager = new ExamManager(name, this.generateExamDetail());
examManager.timeLimit = 1;
return examManager;
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L111-L115
|
3125795ad22cca1fb78c88dae266e6519e10db4f
|
github
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbilityForResult/entry/src/main/ets/pages/Index.ets
|
arkts
|
startAccountAbilityForResult
|
TODO 启动AccountAbility
|
async startAccountAbilityForResult() {
if (this.isLogin == false) { //尚未登录
let context: common.UIAbilityContext =
this.getUIContext().getHostContext() as common.UIAbilityContext; // UIAbilityContext
let want: Want = {
deviceId: '', // deviceId为空表示本设备
bundleName: 'com.example.startabilityforresult',
moduleName: 'entry', // moduleName非必选
abilityName: 'AccountAbility', //目标Ability
}
let data = await context.startAbilityForResult(want)
if (data?.resultCode === 1001) {
// 解析被调用方UIAbility返回的信息
let info = data.want?.parameters?.info;
this.userInfo = JSON.parse(JSON.stringify(info))
this.userInfoIntro = '已登录1天'
this.isLogin = true // 设置为已登录状态
}
} else {
promptAction.showToast({
message: '您已登录!!!',
duration: 2000
});
}
}
|
AST#method_declaration#Left async startAccountAbilityForResult 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 . isLogin AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { //尚未登录 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // UIAbilityContext AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left deviceId AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , // deviceId为空表示本设备 AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left 'com.example.startabilityforresult' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left moduleName AST#property_name#Right : AST#expression#Left 'entry' AST#expression#Right AST#property_assignment#Right , // moduleName非必选 AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left 'AccountAbility' AST#expression#Right AST#property_assignment#Right , //目标Ability } 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 data = 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 context AST#expression#Right AST#await_expression#Right AST#expression#Right . startAbilityForResult AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left want AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 data AST#expression#Right ?. resultCode AST#member_expression#Right AST#expression#Right === AST#expression#Left 1001 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 解析被调用方UIAbility返回的信息 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left info = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . want AST#member_expression#Right AST#expression#Right ?. parameters AST#member_expression#Right AST#expression#Right ?. info AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userInfo AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left info AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userInfoIntro 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLogin AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 设置为已登录状态 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '您已登录!!!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async startAccountAbilityForResult() {
if (this.isLogin == false) {
let context: common.UIAbilityContext =
this.getUIContext().getHostContext() as common.UIAbilityContext;
let want: Want = {
deviceId: '',
bundleName: 'com.example.startabilityforresult',
moduleName: 'entry',
abilityName: 'AccountAbility',
}
let data = await context.startAbilityForResult(want)
if (data?.resultCode === 1001) {
let info = data.want?.parameters?.info;
this.userInfo = JSON.parse(JSON.stringify(info))
this.userInfoIntro = '已登录1天'
this.isLogin = true
}
} else {
promptAction.showToast({
message: '您已登录!!!',
duration: 2000
});
}
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbilityForResult/entry/src/main/ets/pages/Index.ets#L130-L154
|
5b7ba8015c1fa152b1762b9923fdfca053519b7f
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/RSA.ets
|
arkts
|
signSegmentSync
|
对数据进行分段签名,同步
@param data 待签名数据
@param priKey 私钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、、等)。
@param len 自定义的数据拆分长度,此处取64
@returns
|
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256', len: number = 64): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, algName, len);
}
|
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#expression#Left 'RSA1024|PKCS1|SHA256' 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 64 AST#expression#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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . signSegmentSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left algName AST#expression#Right , AST#expression#Left len 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 signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256', len: number = 64): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, algName, len);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L299-L301
|
8145f956b00d5516ed7421358ed764cde6a4e1dd
|
gitee
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/core/proxy/ImageDialogBuilderProxy.ets
|
arkts
|
isClearCacheAfterShow
|
是否在关闭弹窗后清理缓存图片
@param isClearCacheAfterShow 默认false
@returns
|
isClearCacheAfterShow(isClearCacheAfterShow: boolean) {
this.builderOptions.isClearCacheAfterShow = isClearCacheAfterShow
return this
}
|
AST#method_declaration#Left isClearCacheAfterShow AST#parameter_list#Left ( AST#parameter#Left isClearCacheAfterShow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . isClearCacheAfterShow AST#member_expression#Right = AST#expression#Left isClearCacheAfterShow 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 this AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
isClearCacheAfterShow(isClearCacheAfterShow: boolean) {
this.builderOptions.isClearCacheAfterShow = isClearCacheAfterShow
return this
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ImageDialogBuilderProxy.ets#L56-L59
|
3e13ab7f53b2536f8562ff48f815e36eb5363573
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/pageflip/src/main/ets/components/mainpage/PageFlip.ets
|
arkts
|
deleteEmitter
|
取消事件订阅
|
deleteEmitter() {
emitter.off(1);
}
|
AST#method_declaration#Left deleteEmitter AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left emitter AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
deleteEmitter() {
emitter.off(1);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/components/mainpage/PageFlip.ets#L119-L121
|
6b693bb72a77d16974935909599c15b9fb93933b
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
|
arkts
|
disconnectInner
|
断开与蓝牙设备的连接
|
private disconnectInner(gattClientDevice: ble.GattClientDevice) {
Log.showInfo(TAG, `disconnectInner`);
try {
if (!gattClientDevice) {
Log.showWarn(TAG, `disconnectInner: mGattClientDevice is null`);
return;
}
this.offBLEConnectionStateChange();
this.offBLECharacteristicChange();
if (this.getConnectionState() === ConnectionState.STATE_CONNECTING) {
Log.showWarn(TAG, `disconnectInner: mConnectionState is ConnectionState.STATE_CONNECTING`);
this.close();
} else if (this.getConnectionState() === ConnectionState.STATE_CONNECTED) {
Log.showWarn(TAG, `disconnectInner: mConnectionState is ConnectionState.STATE_CONNECTED`);
gattClientDevice.disconnect();
this.mConnectBluetoothDevice.connectionState = ConnectionState.STATE_DISCONNECTING;
AppStorage.setOrCreate('connectBluetoothDevice', this.mConnectBluetoothDevice);
this.close();
}
} catch (err) {
Log.showError(TAG, `disconnectInner: err = ${err}`);
}
}
|
AST#method_declaration#Left private disconnectInner AST#parameter_list#Left ( AST#parameter#Left gattClientDevice : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left ble . GattClientDevice AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . showInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` disconnectInner ` 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left gattClientDevice AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . showWarn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` disconnectInner: mGattClientDevice is null ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offBLEConnectionStateChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offBLECharacteristicChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getConnectionState 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 ConnectionState AST#expression#Right AST#binary_expression#Right AST#expression#Right . STATE_CONNECTING 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 Log AST#expression#Right . showWarn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` disconnectInner: mConnectionState is ConnectionState.STATE_CONNECTING ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getConnectionState 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 ConnectionState AST#expression#Right AST#binary_expression#Right AST#expression#Right . STATE_CONNECTED 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 Log AST#expression#Right . showWarn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` disconnectInner: mConnectionState is ConnectionState.STATE_CONNECTED ` 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 gattClientDevice AST#expression#Right . disconnect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mConnectBluetoothDevice AST#member_expression#Right AST#expression#Right . connectionState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left ConnectionState AST#expression#Right . STATE_DISCONNECTING 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 AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'connectBluetoothDevice' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mConnectBluetoothDevice 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 this AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_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 Log AST#expression#Right . showError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` disconnectInner: err = AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private disconnectInner(gattClientDevice: ble.GattClientDevice) {
Log.showInfo(TAG, `disconnectInner`);
try {
if (!gattClientDevice) {
Log.showWarn(TAG, `disconnectInner: mGattClientDevice is null`);
return;
}
this.offBLEConnectionStateChange();
this.offBLECharacteristicChange();
if (this.getConnectionState() === ConnectionState.STATE_CONNECTING) {
Log.showWarn(TAG, `disconnectInner: mConnectionState is ConnectionState.STATE_CONNECTING`);
this.close();
} else if (this.getConnectionState() === ConnectionState.STATE_CONNECTED) {
Log.showWarn(TAG, `disconnectInner: mConnectionState is ConnectionState.STATE_CONNECTED`);
gattClientDevice.disconnect();
this.mConnectBluetoothDevice.connectionState = ConnectionState.STATE_DISCONNECTING;
AppStorage.setOrCreate('connectBluetoothDevice', this.mConnectBluetoothDevice);
this.close();
}
} catch (err) {
Log.showError(TAG, `disconnectInner: err = ${err}`);
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L417-L440
|
d8e664197e65999e62bf693bc07ba9845801656b
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/charts/RadarChartModel.ets
|
arkts
|
getYRange
|
Returns the range of y-values this chart can display.
@return
|
public getYRange(): number {
return this.mYAxis.mAxisRange;
}
|
AST#method_declaration#Left public getYRange AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mYAxis AST#member_expression#Right AST#expression#Right . mAxisRange AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getYRange(): number {
return this.mYAxis.mAxisRange;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L374-L376
|
c25775c9479310a6a3d46184e584988a9dc25cb7
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets
|
arkts
|
pixelsToValue
|
Transforms the given array of touch positions (pixels) (x, y, x, y, ...)
into values on the chart.
@param pixels
|
public pixelsToValue(pixels: number[]) {
var tmp: Matrix = this.mPixelToValueMatrixBuffer;
tmp.reset();
// invert all matrixes to convert back to the original value
this.mMatrixOffset.invert(tmp);
tmp.mapPoints(pixels);
this.mViewPortHandler.getMatrixTouch().invert(tmp);
tmp.mapPoints(pixels);
this.mMatrixValueToPx.invert(tmp);
tmp.mapPoints(pixels);
}
|
AST#method_declaration#Left public pixelsToValue AST#parameter_list#Left ( AST#parameter#Left pixels : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left tmp : AST#type_annotation#Left AST#primary_type#Left Matrix AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mPixelToValueMatrixBuffer 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 tmp AST#expression#Right . reset 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 // invert all matrixes to convert back to the original value 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 . mMatrixOffset AST#member_expression#Right AST#expression#Right . invert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tmp AST#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 tmp AST#expression#Right . mapPoints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixels AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . getMatrixTouch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . invert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tmp AST#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 tmp AST#expression#Right . mapPoints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixels AST#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 . mMatrixValueToPx AST#member_expression#Right AST#expression#Right . invert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tmp AST#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 tmp AST#expression#Right . mapPoints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixels AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public pixelsToValue(pixels: number[]) {
var tmp: Matrix = this.mPixelToValueMatrixBuffer;
tmp.reset();
this.mMatrixOffset.invert(tmp);
tmp.mapPoints(pixels);
this.mViewPortHandler.getMatrixTouch().invert(tmp);
tmp.mapPoints(pixels);
this.mMatrixValueToPx.invert(tmp);
tmp.mapPoints(pixels);
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets#L346-L359
|
be518e59bc79a8dae5699bfd95d97c4a37030a2c
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets
|
arkts
|
getHardwareIcon
|
获取硬件对应图标
|
getHardwareIcon(type: batteryStats.ConsumptionType) {
if (this.hardwareIcons.size === 0) {
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_INVALID, $r("app.media.ic_battery_invalid"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH, $r("app.media.ic_battery_bluetooth"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_IDLE, $r("app.media.ic_battery_idle"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_PHONE, $r("app.media.ic_battery_phone"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_SCREEN, $r("app.media.ic_battery_screen"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_RADIO, $r("app.media.ic_battery_radio"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_USER, $r("app.media.ic_battery_user"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_WIFI, $r("app.media.ic_battery_wifi"));
}
return this.hardwareIcons.get(type);
}
|
AST#method_declaration#Left getHardwareIcon AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left batteryStats . ConsumptionType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left batteryStats AST#expression#Right . ConsumptionType AST#member_expression#Right AST#expression#Right . CONSUMPTION_TYPE_INVALID AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_battery_invalid" 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left batteryStats AST#expression#Right . ConsumptionType AST#member_expression#Right AST#expression#Right . CONSUMPTION_TYPE_BLUETOOTH AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_battery_bluetooth" 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left batteryStats AST#expression#Right . ConsumptionType AST#member_expression#Right AST#expression#Right . CONSUMPTION_TYPE_IDLE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_battery_idle" 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left batteryStats AST#expression#Right . ConsumptionType AST#member_expression#Right AST#expression#Right . CONSUMPTION_TYPE_PHONE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_battery_phone" 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left batteryStats AST#expression#Right . ConsumptionType AST#member_expression#Right AST#expression#Right . CONSUMPTION_TYPE_SCREEN AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_battery_screen" 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left batteryStats AST#expression#Right . ConsumptionType AST#member_expression#Right AST#expression#Right . CONSUMPTION_TYPE_RADIO AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_battery_radio" 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left batteryStats AST#expression#Right . ConsumptionType AST#member_expression#Right AST#expression#Right . CONSUMPTION_TYPE_USER AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_battery_user" 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left batteryStats AST#expression#Right . ConsumptionType AST#member_expression#Right AST#expression#Right . CONSUMPTION_TYPE_WIFI AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_battery_wifi" 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hardwareIcons AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
getHardwareIcon(type: batteryStats.ConsumptionType) {
if (this.hardwareIcons.size === 0) {
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_INVALID, $r("app.media.ic_battery_invalid"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH, $r("app.media.ic_battery_bluetooth"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_IDLE, $r("app.media.ic_battery_idle"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_PHONE, $r("app.media.ic_battery_phone"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_SCREEN, $r("app.media.ic_battery_screen"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_RADIO, $r("app.media.ic_battery_radio"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_USER, $r("app.media.ic_battery_user"));
this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_WIFI, $r("app.media.ic_battery_wifi"));
}
return this.hardwareIcons.get(type);
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets#L244-L256
|
a61e580b486a9111eb81ccea1b6d1fe0b11297cf
|
gitee
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/interface_class/simple_class/simple_class_004_F.ets
|
arkts
|
Introduction 简单类字段
|
export function simple_class_004_F(taint_src : string) : void {
let _t = taint_src;
let _clean = new A("clean");
taint.Sink(_clean.data);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function simple_class_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left _t = AST#expression#Left taint_src 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 _clean = 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 "clean" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left _clean AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function simple_class_004_F(taint_src : string) : void {
let _t = taint_src;
let _clean = new A("clean");
taint.Sink(_clean.data);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/interface_class/simple_class/simple_class_004_F.ets#L5-L9
|
4e7cc4cec03a1231230ea185fe6cda0118f7262e
|
github
|
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets
|
arkts
|
decryptGCMSegment
|
解密(GCM模式)分段,异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param len 自定义的数据拆分长度。
@returns
|
static async decryptGCMSegment(dataBlob: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec, len: number = 128): Promise<cryptoFramework.DataBlob> {
let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let decryptData = new Uint8Array();
for (let i = 0; i < dataBlob.data.length; i += len) {
let updateData = dataBlob.data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
let updateOutput = await decoder.update(updateDataBlob); //分段update
//把update的结果拼接起来,得到明文
let mergeTData = new Uint8Array(decryptData.length + updateOutput.data.length);
mergeTData.set(decryptData);
mergeTData.set(updateOutput.data, decryptData.length);
decryptData = mergeTData;
}
await decoder.doFinal(null);
let decryptBlob: cryptoFramework.DataBlob = { data: decryptData };
return decryptBlob;
}
|
AST#method_declaration#Left static async decryptGCMSegment 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 symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left gcmParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . GcmParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left 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 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 'SM4_128|GCM|PKCS7' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . DECRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left gcmParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decryptData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left dataBlob AST#expression#Right AST#binary_expression#Right AST#expression#Right . data AST#member_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 AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right 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#variable_declaration#Left let AST#variable_declarator#Left updateOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . update AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateDataBlob AST#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 //把update的结果拼接起来,得到明文 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mergeTData = 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decryptData AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left updateOutput AST#expression#Right AST#binary_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 mergeTData AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left decryptData AST#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 mergeTData 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 updateOutput AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left decryptData 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left decryptData = AST#expression#Left mergeTData AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decryptBlob : 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 decryptData 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 decryptBlob AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async decryptGCMSegment(dataBlob: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec, len: number = 128): Promise<cryptoFramework.DataBlob> {
let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let decryptData = new Uint8Array();
for (let i = 0; i < dataBlob.data.length; i += len) {
let updateData = dataBlob.data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
let updateOutput = await decoder.update(updateDataBlob);
let mergeTData = new Uint8Array(decryptData.length + updateOutput.data.length);
mergeTData.set(decryptData);
mergeTData.set(updateOutput.data, decryptData.length);
decryptData = mergeTData;
}
await decoder.doFinal(null);
let decryptBlob: cryptoFramework.DataBlob = { data: decryptData };
return decryptBlob;
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L308-L326
|
0a4f7ed73bae6fc725c751e6f3baf5db71b165aa
|
github
|
IceYuanyyy/OxHornCampus.git
|
bb5686f77fa36db89687502e35898cda218d601f
|
entry/src/main/ets/controller/MapController.ets
|
arkts
|
tapAction
|
Double-click the map.
|
tapAction(callBack: Function): void {
let isMaxTime: boolean = false;
if (++this.pinchCount > Const.ZOOM_MAX_TIMES) {
this.pinchCount = Const.ZOOM_MAX_TIMES;
isMaxTime = true;
}
this.leftTop = callBack(isMaxTime);
}
|
AST#method_declaration#Left tapAction AST#parameter_list#Left ( AST#parameter#Left callBack : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isMaxTime : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#update_expression#Left ++ AST#expression#Left this AST#expression#Right AST#update_expression#Right AST#expression#Right . pinchCount AST#member_expression#Right AST#expression#Right > AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . ZOOM_MAX_TIMES 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 . pinchCount AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ZOOM_MAX_TIMES AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left isMaxTime = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftTop AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left callBack AST#expression#Right AST#argument_list#Left ( AST#expression#Left isMaxTime AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
tapAction(callBack: Function): void {
let isMaxTime: boolean = false;
if (++this.pinchCount > Const.ZOOM_MAX_TIMES) {
this.pinchCount = Const.ZOOM_MAX_TIMES;
isMaxTime = true;
}
this.leftTop = callBack(isMaxTime);
}
|
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/controller/MapController.ets#L84-L91
|
84815b0ded2351cb3370eb714d52f44630bca8e0
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
|
arkts
|
getPemKeyPair
|
获取指定数据生成非对称密钥。
@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;
}
|
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
|
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;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L217-L223
|
c4176f26667e74e4fa75b4c4308d7b5399eda473
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/clickanimation/Index.ets
|
arkts
|
ClickAnimationComponent
|
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 { ClickAnimationComponent } from './src/main/ets/components/ClickAnimationComponent';
|
AST#export_declaration#Left export { ClickAnimationComponent } from './src/main/ets/components/ClickAnimationComponent' ; AST#export_declaration#Right
|
export { ClickAnimationComponent } from './src/main/ets/components/ClickAnimationComponent';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/Index.ets#L16-L16
|
c0f2fabf9afabe7d1b4885702d8f3d50b6770bf3
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets
|
arkts
|
registerDataChangeListener
|
Register a controller that changes data.
@param {DataChangeListener} listener Data change listener
|
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
}
|
AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets#L63-L67
|
ad9f40e14e87930208e624672f10527b4739a254
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/utils/Utils.ets
|
arkts
|
getNormalizedAngle
|
returns an angle between 0.f < 360.f (not less than zero, less than 360)
|
public static getNormalizedAngle(angle: number): number {
while (angle < 0)
angle += 360;
return angle % 360;
}
|
AST#method_declaration#Left public static getNormalizedAngle AST#parameter_list#Left ( AST#parameter#Left angle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left angle AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left angle += AST#expression#Left 360 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#while_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left angle AST#expression#Right % AST#expression#Left 360 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
|
public static getNormalizedAngle(angle: number): number {
while (angle < 0)
angle += 360;
return angle % 360;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Utils.ets#L243-L248
|
6a93837f63864596a27c0053999088e1131304d7
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets
|
arkts
|
CommentDataSource
|
评论数据源
|
@Observed
export class CommentDataSource extends BasicDataSource {
private commentArray: Comment[] = [];
public totalCount(): number {
return this.commentArray.length;
}
/**
* 获取指定索引数据
* @param index
* @returns
*/
public getData(index: number): Comment {
return this.commentArray[index];
}
/**
* 改变单个数据
* @param index
* @param data
*/
public addData(index: number, data: Comment): void {
this.commentArray.splice(index, 0, data);
this.notifyDataAdd(index);
}
/**
* 添加数据
* @param data
*/
public pushData(data: Comment): void {
this.commentArray.push(data);
this.notifyDataAdd(this.commentArray.length - 1);
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class CommentDataSource extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private commentArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取指定索引数据
* @param index
* @returns
*/ AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 改变单个数据
* @param index
* @param data
*/ AST#method_declaration#Left public addData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 添加数据
* @param data
*/ AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentArray AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 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 . commentArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
|
@Observed
export class CommentDataSource extends BasicDataSource {
private commentArray: Comment[] = [];
public totalCount(): number {
return this.commentArray.length;
}
public getData(index: number): Comment {
return this.commentArray[index];
}
public addData(index: number, data: Comment): void {
this.commentArray.splice(index, 0, data);
this.notifyDataAdd(index);
}
public pushData(data: Comment): void {
this.commentArray.push(data);
this.notifyDataAdd(this.commentArray.length - 1);
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets#L103-L138
|
b6c4ca06d1c33c65fb89e44e63d38ad3fe96045d
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/servercfg/AppCfgManager.ets
|
arkts
|
应用配置枚举 - 所有配置项定义
|
export enum AppCfg {
// 通用配置
Dictation_Detect_Merged_Api_GeneralOrHandwriting = "Dictation_Detect_Merged_Api_GeneralOrHandwriting", // [通用] 听写合并检测Api使用通用还是手写
InAppBooks_Show_In_SaveToBooks = "InAppBooks_Show_In_SaveToBooks", // [通用] 内置课本 在SaveToBooks(CopyTo,ImportCsv)时是否显示
InAppBooks_Can_ShareOnline = "InAppBooks_Can_ShareOnline", // [通用] 内置课本 可否分享到 在线课本
CreatedUserCards_Can_ShareOnline = "CreatedUserCards_Can_ShareOnline", // [通用] 用户卡片 可否分享到 在线课本
BookOnline_Download_is_ON = "BookOnline_Download_is_ON", // [通用] 在线课本是否可查看或下载
BookOnline_Publish_is_ON = "BookOnline_Publish_is_ON", // [通用] 在线课本是否可以发布
Android_HowTo_CreateCSV_idx_in_Instruction = "Android_HowTo_CreateCSV_idx_in_Instruction", // [通用] 如何制作csv并发布到手机 在Instruction中对应的idx
Android_HowTo_Imort_SharedData_idx_in_Instruction = "Android_HowTo_Imort_SharedData_idx_in_Instruction",// [通用] 如何导入他人分享的数据? 在Instruction中对应的idx
Android_ShareAppLink_idx_in_Instruction = "Android_ShareAppLink_idx_in_Instruction", // [通用] 分享应用link 在Instruction中对应的idx
Android_Home_Notice_idx_in_Instruction = "Android_Home_Notice_idx_in_Instruction", // [通用] 首页滚动公告在Instruction中对应的idx
AutoRefreshSubscriptionInfo_is_ON = "AutoRefreshSubscriptionInfo_is_ON", // [通用] 是否启用 自动刷新会员订阅时间
AutoRefreshSubscriptionInfo_Interval_Minutes = "AutoRefreshSubscriptionInfo_Interval_Minutes", // [通用] 自动刷新 服务器上的会员订阅的 时间间隔
CosAuditCheckForSignup_is_ON = "CosAuditCheckForSignup_is_ON", // [通用] 是否启用 注册审核
CosAuditCheckForLogin_is_ON = "CosAuditCheckForLogin_is_ON", // [通用] 是否启用 登录审核
CBook_Useable_is_ON = "CBook_Useable_is_ON", // [通用] 是否启用 CBook[总开关]
CBook_AutoUpdateCheck_is_ON = "CBook_AutoUpdateCheck_is_ON", // [通用] 是否启用 CBook自动更新检查
CBook_AutoUpdateCheck_Interval_Minutes = "CBook_AutoUpdateCheck_Interval_Minutes", // [通用] CBook自动更新检查 时间间隔
CBookList_AutoUpdateCheck_is_ON = "CBookList_AutoUpdateCheck_is_ON", // [通用] 是否启用 CBookList自动更新检查
CBookIcon_AutoUpdateCheck_is_ON = "CBookIcon_AutoUpdateCheck_is_ON", // [通用] 是否启用 CBookIcon自动更新检查
// 会员配置
M_Dictation_Detect_OneByOne_Total_Cnt = "M_Dictation_Detect_OneByOne_Total_Cnt", // [会员]听写检测使用oneByone的总行数
// 非会员配置
N_Dictation_ScanTimes_Total_Cnt = "N_Dictation_ScanTimes_Total_Cnt", // [非会员]可以执行文字识别的次数(总共)
// 非会员(订阅描述)配置
N_P_maxBookCount = "N_P_maxBookCount", // 非会员(订阅) 最大学习集个数
N_P_maxGroupCountPerBook = "N_P_maxGroupCountPerBook", // 非会员(订阅) 每个学习集中的最大组数
N_P_maxUnitCountInAppBook = "N_P_maxUnitCountInAppBook", // 非会员(订阅) 内置课本中可使用的最大单元数
N_P_maxWordPronCountDaily = "N_P_maxWordPronCountDaily", // 非会员(订阅) 每日 查看汉字发音 个数
N_P_maxWordStrokeCountDaily = "N_P_maxWordStrokeCountDaily",// 非会员(订阅) 每日 查看汉字笔画 个数
N_P_maxPhrasePronCountDaily = "N_P_maxPhrasePronCountDaily",// 非会员(订阅) 每日 查看词语/成语发音 个数
N_P_maxDictationTimesDaily = "N_P_maxDictationTimesDaily", // 非会员(订阅) 每日 可以使用听写 次数
N_P_maxPlanCount = "N_P_maxPlanCount", // 非会员(订阅) 可以创建的计划个数
N_P_maxPlanDayOfsCount = "N_P_maxPlanDayOfsCount", // 非会员(订阅) 可以使用的DayOf数
N_P_maxEBookCount = "N_P_maxEBookCount", // 非会员(订阅) 可以创建的"我的课本"最大个数
N_P_maxEPartCountPerBook = "N_P_maxEPartCountPerBook", // 非会员(订阅) 每个课本中可以新增的"字表"最大个数
N_P_maxELessonCountPerPart = "N_P_maxELessonCountPerPart", // 非会员(订阅) 每个字表中可以添加的"汉字组"最大个数
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum AppCfg AST#enum_body#Left { // 通用配置 AST#enum_member#Left Dictation_Detect_Merged_Api_GeneralOrHandwriting = AST#expression#Left "Dictation_Detect_Merged_Api_GeneralOrHandwriting" AST#expression#Right AST#enum_member#Right , // [通用] 听写合并检测Api使用通用还是手写 AST#enum_member#Left InAppBooks_Show_In_SaveToBooks = AST#expression#Left "InAppBooks_Show_In_SaveToBooks" AST#expression#Right AST#enum_member#Right , // [通用] 内置课本 在SaveToBooks(CopyTo,ImportCsv)时是否显示 AST#enum_member#Left InAppBooks_Can_ShareOnline = AST#expression#Left "InAppBooks_Can_ShareOnline" AST#expression#Right AST#enum_member#Right , // [通用] 内置课本 可否分享到 在线课本 AST#enum_member#Left CreatedUserCards_Can_ShareOnline = AST#expression#Left "CreatedUserCards_Can_ShareOnline" AST#expression#Right AST#enum_member#Right , // [通用] 用户卡片 可否分享到 在线课本 AST#enum_member#Left BookOnline_Download_is_ON = AST#expression#Left "BookOnline_Download_is_ON" AST#expression#Right AST#enum_member#Right , // [通用] 在线课本是否可查看或下载 AST#enum_member#Left BookOnline_Publish_is_ON = AST#expression#Left "BookOnline_Publish_is_ON" AST#expression#Right AST#enum_member#Right , // [通用] 在线课本是否可以发布 AST#enum_member#Left Android_HowTo_CreateCSV_idx_in_Instruction = AST#expression#Left "Android_HowTo_CreateCSV_idx_in_Instruction" AST#expression#Right AST#enum_member#Right , // [通用] 如何制作csv并发布到手机 在Instruction中对应的idx AST#enum_member#Left Android_HowTo_Imort_SharedData_idx_in_Instruction = AST#expression#Left "Android_HowTo_Imort_SharedData_idx_in_Instruction" AST#expression#Right AST#enum_member#Right , // [通用] 如何导入他人分享的数据? 在Instruction中对应的idx AST#enum_member#Left Android_ShareAppLink_idx_in_Instruction = AST#expression#Left "Android_ShareAppLink_idx_in_Instruction" AST#expression#Right AST#enum_member#Right , // [通用] 分享应用link 在Instruction中对应的idx AST#enum_member#Left Android_Home_Notice_idx_in_Instruction = AST#expression#Left "Android_Home_Notice_idx_in_Instruction" AST#expression#Right AST#enum_member#Right , // [通用] 首页滚动公告在Instruction中对应的idx AST#enum_member#Left AutoRefreshSubscriptionInfo_is_ON = AST#expression#Left "AutoRefreshSubscriptionInfo_is_ON" AST#expression#Right AST#enum_member#Right , // [通用] 是否启用 自动刷新会员订阅时间 AST#enum_member#Left AutoRefreshSubscriptionInfo_Interval_Minutes = AST#expression#Left "AutoRefreshSubscriptionInfo_Interval_Minutes" AST#expression#Right AST#enum_member#Right , // [通用] 自动刷新 服务器上的会员订阅的 时间间隔 AST#enum_member#Left CosAuditCheckForSignup_is_ON = AST#expression#Left "CosAuditCheckForSignup_is_ON" AST#expression#Right AST#enum_member#Right , // [通用] 是否启用 注册审核 AST#enum_member#Left CosAuditCheckForLogin_is_ON = AST#expression#Left "CosAuditCheckForLogin_is_ON" AST#expression#Right AST#enum_member#Right , // [通用] 是否启用 登录审核 AST#enum_member#Left CBook_Useable_is_ON = AST#expression#Left "CBook_Useable_is_ON" AST#expression#Right AST#enum_member#Right , // [通用] 是否启用 CBook[总开关] AST#enum_member#Left CBook_AutoUpdateCheck_is_ON = AST#expression#Left "CBook_AutoUpdateCheck_is_ON" AST#expression#Right AST#enum_member#Right , // [通用] 是否启用 CBook自动更新检查 AST#enum_member#Left CBook_AutoUpdateCheck_Interval_Minutes = AST#expression#Left "CBook_AutoUpdateCheck_Interval_Minutes" AST#expression#Right AST#enum_member#Right , // [通用] CBook自动更新检查 时间间隔 AST#enum_member#Left CBookList_AutoUpdateCheck_is_ON = AST#expression#Left "CBookList_AutoUpdateCheck_is_ON" AST#expression#Right AST#enum_member#Right , // [通用] 是否启用 CBookList自动更新检查 AST#enum_member#Left CBookIcon_AutoUpdateCheck_is_ON = AST#expression#Left "CBookIcon_AutoUpdateCheck_is_ON" AST#expression#Right AST#enum_member#Right , // [通用] 是否启用 CBookIcon自动更新检查 // 会员配置 AST#enum_member#Left M_Dictation_Detect_OneByOne_Total_Cnt = AST#expression#Left "M_Dictation_Detect_OneByOne_Total_Cnt" AST#expression#Right AST#enum_member#Right , // [会员]听写检测使用oneByone的总行数 // 非会员配置 AST#enum_member#Left N_Dictation_ScanTimes_Total_Cnt = AST#expression#Left "N_Dictation_ScanTimes_Total_Cnt" AST#expression#Right AST#enum_member#Right , // [非会员]可以执行文字识别的次数(总共) // 非会员(订阅描述)配置 AST#enum_member#Left N_P_maxBookCount = AST#expression#Left "N_P_maxBookCount" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 最大学习集个数 AST#enum_member#Left N_P_maxGroupCountPerBook = AST#expression#Left "N_P_maxGroupCountPerBook" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 每个学习集中的最大组数 AST#enum_member#Left N_P_maxUnitCountInAppBook = AST#expression#Left "N_P_maxUnitCountInAppBook" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 内置课本中可使用的最大单元数 AST#enum_member#Left N_P_maxWordPronCountDaily = AST#expression#Left "N_P_maxWordPronCountDaily" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 每日 查看汉字发音 个数 AST#enum_member#Left N_P_maxWordStrokeCountDaily = AST#expression#Left "N_P_maxWordStrokeCountDaily" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 每日 查看汉字笔画 个数 AST#enum_member#Left N_P_maxPhrasePronCountDaily = AST#expression#Left "N_P_maxPhrasePronCountDaily" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 每日 查看词语/成语发音 个数 AST#enum_member#Left N_P_maxDictationTimesDaily = AST#expression#Left "N_P_maxDictationTimesDaily" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 每日 可以使用听写 次数 AST#enum_member#Left N_P_maxPlanCount = AST#expression#Left "N_P_maxPlanCount" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 可以创建的计划个数 AST#enum_member#Left N_P_maxPlanDayOfsCount = AST#expression#Left "N_P_maxPlanDayOfsCount" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 可以使用的DayOf数 AST#enum_member#Left N_P_maxEBookCount = AST#expression#Left "N_P_maxEBookCount" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 可以创建的"我的课本"最大个数 AST#enum_member#Left N_P_maxEPartCountPerBook = AST#expression#Left "N_P_maxEPartCountPerBook" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 每个课本中可以新增的"字表"最大个数 AST#enum_member#Left N_P_maxELessonCountPerPart = AST#expression#Left "N_P_maxELessonCountPerPart" AST#expression#Right AST#enum_member#Right , // 非会员(订阅) 每个字表中可以添加的"汉字组"最大个数 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum AppCfg {
Dictation_Detect_Merged_Api_GeneralOrHandwriting = "Dictation_Detect_Merged_Api_GeneralOrHandwriting",
InAppBooks_Show_In_SaveToBooks = "InAppBooks_Show_In_SaveToBooks",
InAppBooks_Can_ShareOnline = "InAppBooks_Can_ShareOnline",
CreatedUserCards_Can_ShareOnline = "CreatedUserCards_Can_ShareOnline",
BookOnline_Download_is_ON = "BookOnline_Download_is_ON",
BookOnline_Publish_is_ON = "BookOnline_Publish_is_ON",
Android_HowTo_CreateCSV_idx_in_Instruction = "Android_HowTo_CreateCSV_idx_in_Instruction",
Android_HowTo_Imort_SharedData_idx_in_Instruction = "Android_HowTo_Imort_SharedData_idx_in_Instruction",
Android_ShareAppLink_idx_in_Instruction = "Android_ShareAppLink_idx_in_Instruction",
Android_Home_Notice_idx_in_Instruction = "Android_Home_Notice_idx_in_Instruction",
AutoRefreshSubscriptionInfo_is_ON = "AutoRefreshSubscriptionInfo_is_ON",
AutoRefreshSubscriptionInfo_Interval_Minutes = "AutoRefreshSubscriptionInfo_Interval_Minutes",
CosAuditCheckForSignup_is_ON = "CosAuditCheckForSignup_is_ON",
CosAuditCheckForLogin_is_ON = "CosAuditCheckForLogin_is_ON",
CBook_Useable_is_ON = "CBook_Useable_is_ON",
CBook_AutoUpdateCheck_is_ON = "CBook_AutoUpdateCheck_is_ON",
CBook_AutoUpdateCheck_Interval_Minutes = "CBook_AutoUpdateCheck_Interval_Minutes",
CBookList_AutoUpdateCheck_is_ON = "CBookList_AutoUpdateCheck_is_ON",
CBookIcon_AutoUpdateCheck_is_ON = "CBookIcon_AutoUpdateCheck_is_ON",
M_Dictation_Detect_OneByOne_Total_Cnt = "M_Dictation_Detect_OneByOne_Total_Cnt",
N_Dictation_ScanTimes_Total_Cnt = "N_Dictation_ScanTimes_Total_Cnt",
N_P_maxBookCount = "N_P_maxBookCount",
N_P_maxGroupCountPerBook = "N_P_maxGroupCountPerBook",
N_P_maxUnitCountInAppBook = "N_P_maxUnitCountInAppBook",
N_P_maxWordPronCountDaily = "N_P_maxWordPronCountDaily",
N_P_maxWordStrokeCountDaily = "N_P_maxWordStrokeCountDaily",
N_P_maxPhrasePronCountDaily = "N_P_maxPhrasePronCountDaily",
N_P_maxDictationTimesDaily = "N_P_maxDictationTimesDaily",
N_P_maxPlanCount = "N_P_maxPlanCount",
N_P_maxPlanDayOfsCount = "N_P_maxPlanDayOfsCount",
N_P_maxEBookCount = "N_P_maxEBookCount",
N_P_maxEPartCountPerBook = "N_P_maxEPartCountPerBook",
N_P_maxELessonCountPerPart = "N_P_maxELessonCountPerPart",
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/servercfg/AppCfgManager.ets#L20-L67
|
2254f2c683d41ee54982e620c11cc28913925186
|
github
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/model/src/main/ets/network/NetworkResponse.ets
|
arkts
|
@file 网络通用响应模型
@author Joker.X
|
export class NetworkResponse<T> {
/**
* 真实数据
*/
data: T | null;
/**
* 状态码,等于1000表示成功
*/
code: number;
/**
* 错误提示信息
*/
message: string | null;
/**
* 构造函数,对接口返回做空值兜底
* @param {Partial<NetworkResponse<T>>} payload - 接口原始数据
*/
constructor(payload?: Partial<NetworkResponse<T>>) {
this.data = payload?.data ?? null;
this.code = payload?.code !== undefined ? Number(payload.code) : 1000;
this.message = payload?.message ?? null;
}
/**
* 是否成功
* @returns {boolean} 是否请求成功
*/
get isSucceeded(): boolean {
// 状态码为1000表示成功
return this.code === 1000;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class NetworkResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { /**
* 真实数据
*/ AST#property_declaration#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 状态码,等于1000表示成功
*/ AST#property_declaration#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 错误提示信息
*/ AST#property_declaration#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 构造函数,对接口返回做空值兜底
* @param {Partial<NetworkResponse<T>>} payload - 接口原始数据
*/ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left payload ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 . data AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left payload AST#expression#Right ?. data 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#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 . code AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left payload AST#expression#Right ?. code AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left payload AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 1000 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left payload AST#expression#Right ?. message 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /**
* 是否成功
* @returns {boolean} 是否请求成功
*/ AST#method_declaration#Left get AST#ERROR#Left isSucceeded AST#ERROR#Right 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 { // 状态码为1000表示成功 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . code AST#member_expression#Right AST#expression#Right === AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class NetworkResponse<T> {
data: T | null;
code: number;
message: string | null;
constructor(payload?: Partial<NetworkResponse<T>>) {
this.data = payload?.data ?? null;
this.code = payload?.code !== undefined ? Number(payload.code) : 1000;
this.message = payload?.message ?? null;
}
get isSucceeded(): boolean {
return this.code === 1000;
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/network/NetworkResponse.ets#L5-L37
|
64c9c1e723f5965acf600cf17594995343ba885e
|
github
|
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/function_call/library_function/string_lib_func_005_T.ets
|
arkts
|
Introduction 库函数-string_valueOf
|
export function string_lib_func_005_T(taint_src : string) {
let t = taint_src.valueOf();
taint.Sink(t);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_005_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left t = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint_src AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left t AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function string_lib_func_005_T(taint_src : string) {
let t = taint_src.valueOf();
taint.Sink(t);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_005_T.ets#L7-L10
|
9d435a440765c287638c6d87367010c1c08b60a9
|
github
|
|
Rayawa/dashboard.git
|
9107efe7fb69a58d799a378b79ea8ffa4041cec8
|
entry/src/main/ets/pages/user/settings.ets
|
arkts
|
saveHoldCheckEnabled
|
保存智感握持设置
|
private async saveHoldCheckEnabled(enabled: boolean) {
try {
await setHoldCheckEnabled(enabled);
this.holdCheckON = enabled;
} catch (error) {
console.error("保存智感握持设置失败:", error);
}
}
|
AST#method_declaration#Left private async saveHoldCheckEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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#await_expression#Left await AST#expression#Left setHoldCheckEnabled AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left enabled AST#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 . holdCheckON AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 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 saveHoldCheckEnabled(enabled: boolean) {
try {
await setHoldCheckEnabled(enabled);
this.holdCheckON = enabled;
} catch (error) {
console.error("保存智感握持设置失败:", error);
}
}
|
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/pages/user/settings.ets#L158-L165
|
564b69a95efc2c57da1f37a27faf64fa64b5490a
|
github
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets
|
arkts
|
getTransactions
|
按照指定条件获取交易报表
|
public async getTransactions(
conditions: UserTablePredicateParams[],
): Promise<TransactionReportRsp> {
try {
return this.transaction<TransactionReportRsp>(async () => {
const orderBy: TableOrderByParams = {
field: TransactionTableFields.TRANSACTION_ID,
desc: true,
};
const transactions = await this.query<TransactionTableBasis>(
AccountingDBConstants.TRANSACTION_TABLE_NAME,
conditions,
orderBy,
);
const dateCon = conditions.find(
(item) => item.field === TransactionTableFields.DATE,
);
const resourceCon = conditions.find(
(item) => item.field === TransactionTableFields.RESOURCE,
);
const sql = `
SELECT
SUM(CASE WHEN type = 'income' THEN amount ELSE 0 END) as totalIncome,
SUM(CASE WHEN type = 'expense' THEN amount ELSE 0 END) as totalExpense
FROM transactions
WHERE date like '${dateCon ? dateCon.value : ''}%'
${resourceCon ? 'AND resource = ' + resourceCon.value : ''}`;
const summary = await this.querySql<AmountSummary>(sql);
const res: TransactionReportRsp = {
transactions,
totalIncome: summary[0]?.totalIncome ?? 0,
totalExpense: summary[0]?.totalExpense ?? 0,
};
return res;
});
} catch (err) {
Logger.error(
TAG,
'get transactions failed. error:' + JSON.stringify(err),
);
const res: TransactionReportRsp = {
transactions: [],
totalIncome: 0,
totalExpense: 0,
};
return res;
}
}
|
AST#method_declaration#Left public async getTransactions AST#parameter_list#Left ( AST#parameter#Left conditions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left UserTablePredicateParams [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left , AST#ERROR#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TransactionReportRsp 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . transaction AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TransactionReportRsp AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left orderBy : AST#type_annotation#Left AST#primary_type#Left TableOrderByParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left field AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TransactionTableFields AST#expression#Right . TRANSACTION_ID AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left desc AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left transactions = 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 . query AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TransactionTableBasis AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AccountingDBConstants AST#expression#Right . TRANSACTION_TABLE_NAME AST#member_expression#Right AST#expression#Right , AST#expression#Left conditions AST#expression#Right , AST#expression#Left orderBy AST#expression#Right , 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 dateCon = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left conditions 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#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 item AST#expression#Right . field AST#member_expression#Right AST#expression#Right === AST#expression#Left TransactionTableFields AST#expression#Right AST#binary_expression#Right AST#expression#Right . DATE AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#ERROR#Left , AST#ERROR#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 resourceCon = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left conditions 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#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 item AST#expression#Right . field AST#member_expression#Right AST#expression#Right === AST#expression#Left TransactionTableFields AST#expression#Right AST#binary_expression#Right AST#expression#Right . RESOURCE AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#ERROR#Left , AST#ERROR#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 sql = AST#expression#Left AST#template_literal#Left `
SELECT
SUM(CASE WHEN type = 'income' THEN amount ELSE 0 END) as totalIncome,
SUM(CASE WHEN type = 'expense' THEN amount ELSE 0 END) as totalExpense
FROM transactions
WHERE date like ' AST#template_substitution#Left $ { AST#expression#Left AST#conditional_expression#Left AST#expression#Left dateCon AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left dateCon AST#expression#Right . value AST#member_expression#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right } AST#template_substitution#Right %'
AST#template_substitution#Left $ { AST#expression#Left AST#conditional_expression#Left AST#expression#Left resourceCon AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'AND resource = ' AST#expression#Right + AST#expression#Left resourceCon AST#expression#Right AST#binary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left summary = 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 . querySql AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AmountSummary AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left sql AST#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 res : AST#type_annotation#Left AST#primary_type#Left TransactionReportRsp AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left transactions AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalIncome AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left summary AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ?. totalIncome AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalExpense AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left summary AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ?. totalExpense AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left res AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'get transactions failed. error:' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , 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#variable_declaration#Left const AST#variable_declarator#Left res : AST#type_annotation#Left AST#primary_type#Left TransactionReportRsp AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left transactions 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 totalIncome AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalExpense AST#property_name#Right : AST#expression#Left 0 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 res 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
|
public async getTransactions(
conditions: UserTablePredicateParams[],
): Promise<TransactionReportRsp> {
try {
return this.transaction<TransactionReportRsp>(async () => {
const orderBy: TableOrderByParams = {
field: TransactionTableFields.TRANSACTION_ID,
desc: true,
};
const transactions = await this.query<TransactionTableBasis>(
AccountingDBConstants.TRANSACTION_TABLE_NAME,
conditions,
orderBy,
);
const dateCon = conditions.find(
(item) => item.field === TransactionTableFields.DATE,
);
const resourceCon = conditions.find(
(item) => item.field === TransactionTableFields.RESOURCE,
);
const sql = `
SELECT
SUM(CASE WHEN type = 'income' THEN amount ELSE 0 END) as totalIncome,
SUM(CASE WHEN type = 'expense' THEN amount ELSE 0 END) as totalExpense
FROM transactions
WHERE date like '${dateCon ? dateCon.value : ''}%'
${resourceCon ? 'AND resource = ' + resourceCon.value : ''}`;
const summary = await this.querySql<AmountSummary>(sql);
const res: TransactionReportRsp = {
transactions,
totalIncome: summary[0]?.totalIncome ?? 0,
totalExpense: summary[0]?.totalExpense ?? 0,
};
return res;
});
} catch (err) {
Logger.error(
TAG,
'get transactions failed. error:' + JSON.stringify(err),
);
const res: TransactionReportRsp = {
transactions: [],
totalIncome: 0,
totalExpense: 0,
};
return res;
}
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets#L221-L268
|
064737228413f603ec7bb956a22cfba7f7f9b8bb
|
github
|
JinnyWang-Space/guanlanwenjuan.git
|
601c4aa6c427e643d7bf42bc21945f658738e38c
|
entry/src/main/ets/views/AgreementView.ets
|
arkts
|
navBar
|
导航栏
|
@Builder
navBar() {
Row() {
Button() {
SymbolGlyph($r('sys.symbol.chevron_left'))
.fontSize(24)
.fontColor([$r('sys.color.ohos_id_color_titlebar_icon')])
}
.width(40)
.height(40)
.backgroundColor($r('sys.color.ohos_id_color_button_normal'))
.onClick(() => {
this.loginInfos.pop();
})
}
.width('100%')
.height(40 + 16 + 12)
.justifyContent(FlexAlign.Start)
.zIndex(1)
.padding({ left: 16, right: 16 })
.backgroundColor($r('sys.color.comp_background_primary'))
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right navBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SymbolGlyph ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.chevron_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_titlebar_icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_button_normal' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loginInfos AST#member_expression#Right AST#expression#Right . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 40 AST#expression#Right + AST#expression#Left 16 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 12 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( 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 left AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.comp_background_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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
navBar() {
Row() {
Button() {
SymbolGlyph($r('sys.symbol.chevron_left'))
.fontSize(24)
.fontColor([$r('sys.color.ohos_id_color_titlebar_icon')])
}
.width(40)
.height(40)
.backgroundColor($r('sys.color.ohos_id_color_button_normal'))
.onClick(() => {
this.loginInfos.pop();
})
}
.width('100%')
.height(40 + 16 + 12)
.justifyContent(FlexAlign.Start)
.zIndex(1)
.padding({ left: 16, right: 16 })
.backgroundColor($r('sys.color.comp_background_primary'))
}
|
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/AgreementView.ets#L21-L42
|
45e87b318a5b21f1397eeab22dcbb61bfc52fc3d
|
github
|
zhongte/TaoYao
|
80850f3800dd6037216d3f7c58a2bf34a881c93f
|
taoyao/src/main/ets/shijing/taoyao/IAccessControl.ets
|
arkts
|
处理权限和系统设置的总入口
|
export interface IAccessControl {
/**
* 跟申请权限相关
*
* @returns
*/
runtime(): RuntimeAccessControl
/**
* 跟系统设置相关
*
* @returns
*/
setting(): Setting
/**
* 通知权限
*
* @returns
*/
notification(): Notification
/**
* 联系人选择器
*
* @returns
*/
contact(): Contact
/**
* 相机选择器
*
* @returns
*/
camera(): Camera
/**
* 图片、视频选择器
*
* @returns
*/
media(): Media
/**
* 文档选择器
*
* @returns
*/
document(): Document
/**
* 音频选择器
*
* @returns
*/
audio(): Audio
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface IAccessControl AST#object_type#Left { /**
* 跟申请权限相关
*
* @returns
*/ AST#type_member#Left runtime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RuntimeAccessControl AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* 跟系统设置相关
*
* @returns
*/ AST#type_member#Left setting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Setting AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* 通知权限
*
* @returns
*/ AST#type_member#Left notification AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Notification AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* 联系人选择器
*
* @returns
*/ AST#type_member#Left contact AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* 相机选择器
*
* @returns
*/ AST#type_member#Left camera AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Camera AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* 图片、视频选择器
*
* @returns
*/ AST#type_member#Left media AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Media AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* 文档选择器
*
* @returns
*/ AST#type_member#Left document AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Document AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* 音频选择器
*
* @returns
*/ AST#type_member#Left audio AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Audio 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 IAccessControl {
runtime(): RuntimeAccessControl
setting(): Setting
notification(): Notification
contact(): Contact
camera(): Camera
media(): Media
document(): Document
audio(): Audio
}
|
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/IAccessControl.ets#L13-L70
|
d52621e3456f572370eb827cb2bb665a855dc915
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/navigation/src/main/ets/auth/AuthNavigator.ets
|
arkts
|
toRegister
|
跳转到注册页面
@returns {void} 无返回值
|
static toRegister(): void {
navigateTo(AuthRoutes.Register);
}
|
AST#method_declaration#Left static toRegister AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_expression#Left AST#expression#Left AuthRoutes AST#expression#Right . Register AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static toRegister(): void {
navigateTo(AuthRoutes.Register);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/auth/AuthNavigator.ets#L37-L39
|
0bde5d847db8befdf6eb5832c2f326925a76ba7f
|
github
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/constants/LayoutPercent.ets
|
arkts
|
25% 百分比
|
export const P25: string = "25%";
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P25 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "25%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const P25: string = "25%";
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L34-L34
|
511efd39951d1973cf8b895682320a078e56420f
|
github
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.atomicservice.AtomicServiceTabs.d.ets
|
arkts
|
Callback for OnContentWillChange
@typedef { function } OnContentWillChange
@param { number } currentIndex - the index value of the current tab.
@param { number } comingIndex - the index value of the tab that will change.
@returns { boolean }
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12
|
export type OnContentWillChangeCallback = (currentIndex: number, comingIndex: number) => boolean;
|
AST#export_declaration#Left export AST#type_declaration#Left type OnContentWillChangeCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left comingIndex : 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#function_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
|
export type OnContentWillChangeCallback = (currentIndex: number, comingIndex: number) => boolean;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceTabs.d.ets#L224-L224
|
d91ebad3715a5b03f33f411b0603282bd78af1b3
|
gitee
|
|
iotjin/JhHarmonyDemo.git
|
819e6c3b1db9984c042a181967784550e171b2e8
|
JhCommon/Index.ets
|
arkts
|
/ utils
|
export * from '../JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils'
|
AST#export_declaration#Left export * from '../JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils' AST#export_declaration#Right
|
export * from '../JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils'
|
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/Index.ets#L48-L48
|
4a608ed52b90f441ba16d0d74596977efb53bdc3
|
github
|
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/theme/ThemeManager.ets
|
arkts
|
loadTheme
|
加载主题设置
|
private async loadTheme(): Promise<void> {
try {
const theme = await StorageManager.getString(this.THEME_KEY, 'light') as ThemeMode;
this.currentTheme = theme;
Logger.info('ThemeManager', `Theme loaded: ${theme}`);
} catch (error) {
Logger.error('ThemeManager', `Failed to load theme: ${String(error)}`);
}
}
|
AST#method_declaration#Left private async loadTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left theme = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left StorageManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getString 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 . THEME_KEY AST#member_expression#Right AST#expression#Right , AST#expression#Left 'light' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ThemeMode 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTheme AST#member_expression#Right = AST#expression#Left theme AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 'ThemeManager' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Theme loaded: AST#template_substitution#Left $ { AST#expression#Left theme AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#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 'ThemeManager' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to load theme: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async loadTheme(): Promise<void> {
try {
const theme = await StorageManager.getString(this.THEME_KEY, 'light') as ThemeMode;
this.currentTheme = theme;
Logger.info('ThemeManager', `Theme loaded: ${theme}`);
} catch (error) {
Logger.error('ThemeManager', `Failed to load theme: ${String(error)}`);
}
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/theme/ThemeManager.ets#L69-L77
|
c61de102c239cbc7e083c59d0c41259f6dd9dfc7
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/home/Swiper.ets
|
arkts
|
getOffSetX
|
Get the image offset.
@param index
@returns offset
|
getOffSetX(index: number): number {
let offsetIndex: number = this.getImgCoefficients(index);
let tempOffset: number = Math.abs(offsetIndex);
let offsetX: number = 0;
if (tempOffset === 1) {
offsetX = -40 * offsetIndex;
}
return offsetX;
}
|
AST#method_declaration#Left getOffSetX AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offsetIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getImgCoefficients AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tempOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetIndex AST#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 offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left tempOffset 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 offsetX = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left 40 AST#expression#Right AST#unary_expression#Right AST#expression#Right * AST#expression#Left offsetIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left offsetX AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getOffSetX(index: number): number {
let offsetIndex: number = this.getImgCoefficients(index);
let tempOffset: number = Math.abs(offsetIndex);
let offsetX: number = 0;
if (tempOffset === 1) {
offsetX = -40 * offsetIndex;
}
return offsetX;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/home/Swiper.ets#L56-L64
|
1f67c5eaed0f200d87405f3a43be678e07ab52a6
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DataPreferencesUtils.ets
|
arkts
|
get
|
获取数据
|
get(key: string): dataPreferences.ValueType | null | undefined {
if (!this.preferences) {
this.initPreferences();
}
let value = this.preferences?.getSync(key, null);;
return value;
}
|
AST#method_declaration#Left get AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left dataPreferences . ValueType AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#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 value = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right ?. getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key 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 AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left value AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
get(key: string): dataPreferences.ValueType | null | undefined {
if (!this.preferences) {
this.initPreferences();
}
let value = this.preferences?.getSync(key, null);;
return value;
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DataPreferencesUtils.ets#L28-L34
|
a1c8cd5b9dc5b5ccb40c092a6eb9af26e14f55a9
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets
|
arkts
|
getPrice
|
When a constant is declared as a base type, its content cannot be changed
|
function getPrice() {
return PRICE;
}
|
AST#function_declaration#Left function getPrice AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left PRICE AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function getPrice() {
return PRICE;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets#L11-L13
|
5dadd976469a73af3a92a077fa08f0156d8f6076
|
gitee
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets
|
arkts
|
uploadAvatar
|
上传头像到服务器
|
async uploadAvatar(imageUri: string) {
this.isUploadingAvatar = true;
try {
const toastOpts: ToastOptions = {
message: '正在上传头像...',
duration: 2000
};
promptAction.showToast(toastOpts);
console.info(`准备上传头像: ${imageUri}`);
// 将图片转为Base64
const base64String = await this.convertImageToBase64(imageUri);
if (!base64String) {
throw new Error('图片转Base64失败');
}
// 获取文件名
const fileName = imageUri.substring(imageUri.lastIndexOf('/') + 1) || `avatar_${new Date().getTime()}.jpg`;
// 上传图片数据
const uploadData: UploadImageParams = {
base64Image: base64String,
fileName: fileName
};
// 调用API上传图片
const response = await ApiService.uploadImage(uploadData);
// 更新用户头像
if (response && response.url) {
this.userInfo.avatar = response.url;
promptAction.showToast({
message: '头像上传成功',
duration: 2000
});
} else {
throw new Error('上传失败:服务器返回的URL为空');
}
} catch (error) {
console.error(`上传头像失败: ${error instanceof Error ? error.message : String(error)}`);
promptAction.showToast({
message: `上传头像失败: ${error instanceof Error ? error.message : '未知错误'}`,
duration: 3000
});
} finally {
this.isUploadingAvatar = false;
}
}
|
AST#method_declaration#Left async uploadAvatar AST#parameter_list#Left ( AST#parameter#Left imageUri : 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 . isUploadingAvatar 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toastOpts : AST#type_annotation#Left AST#primary_type#Left ToastOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '正在上传头像...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOpts AST#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 ` 准备上传头像: AST#template_substitution#Left $ { AST#expression#Left imageUri 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 // 将图片转为Base64 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64String = 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 . convertImageToBase64 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left imageUri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left base64String AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '图片转Base64失败' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 获取文件名 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fileName = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageUri AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageUri AST#expression#Right . lastIndexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '/' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left AST#template_literal#Left ` avatar_ 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 . getTime 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 .jpg ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 上传图片数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uploadData : AST#type_annotation#Left AST#primary_type#Left UploadImageParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left base64Image AST#property_name#Right : AST#expression#Left base64String AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fileName AST#property_name#Right : AST#expression#Left fileName 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 // 调用API上传图片 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left response = 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 ApiService AST#expression#Right AST#await_expression#Right AST#expression#Right . uploadImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uploadData AST#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 response AST#expression#Right && AST#expression#Left response AST#expression#Right AST#binary_expression#Right AST#expression#Right . url AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . avatar AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . url 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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '头像上传成功' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '上传失败:服务器返回的URL为空' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 上传头像失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left '未知错误' AST#expression#Right AST#conditional_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 3000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally 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 . isUploadingAvatar 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#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async uploadAvatar(imageUri: string) {
this.isUploadingAvatar = true;
try {
const toastOpts: ToastOptions = {
message: '正在上传头像...',
duration: 2000
};
promptAction.showToast(toastOpts);
console.info(`准备上传头像: ${imageUri}`);
const base64String = await this.convertImageToBase64(imageUri);
if (!base64String) {
throw new Error('图片转Base64失败');
}
const fileName = imageUri.substring(imageUri.lastIndexOf('/') + 1) || `avatar_${new Date().getTime()}.jpg`;
const uploadData: UploadImageParams = {
base64Image: base64String,
fileName: fileName
};
const response = await ApiService.uploadImage(uploadData);
if (response && response.url) {
this.userInfo.avatar = response.url;
promptAction.showToast({
message: '头像上传成功',
duration: 2000
});
} else {
throw new Error('上传失败:服务器返回的URL为空');
}
} catch (error) {
console.error(`上传头像失败: ${error instanceof Error ? error.message : String(error)}`);
promptAction.showToast({
message: `上传头像失败: ${error instanceof Error ? error.message : '未知错误'}`,
duration: 3000
});
} finally {
this.isUploadingAvatar = false;
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets#L214-L261
|
ab44719b098e2c8f74da430dcab5003a9dccf594
|
github
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
|
arkts
|
arrayBufferToBase64
|
ArrayBuffer转Base64工具函数
|
private arrayBufferToBase64(buffer: Uint8Array): string {
// 创建Base64Helper实例后再调用方法
const base64Helper: util.Base64Helper = new util.Base64Helper();
return base64Helper.encodeToStringSync(buffer);
}
|
AST#method_declaration#Left private arrayBufferToBase64 AST#parameter_list#Left ( AST#parameter#Left buffer : 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 创建Base64Helper实例后再调用方法 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64Helper : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . Base64Helper AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 base64Helper AST#expression#Right . encodeToStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left buffer AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private arrayBufferToBase64(buffer: Uint8Array): string {
const base64Helper: util.Base64Helper = new util.Base64Helper();
return base64Helper.encodeToStringSync(buffer);
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L865-L869
|
42cfbece32be929df987d652d624508bd370bef0
|
github
|
openharmony-tpc/ImageKnife
|
bc55de9e2edd79ed4646ce37177ad94b432874f7
|
library/src/main/ets/downsampling/DownsampleStartegy.ets
|
arkts
|
宽高进行等比缩放宽高里面最大的比例先放进去
然后再更据原图的缩放比去适配另一边
|
export class CenterInside implements BaseDownsampling {
getName() {
return 'CenterInside'
}
getScaleFactor(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number,
downsampType: DownsampleStrategy
): number {
let outSize: Size = {
width: round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceWidth),
height:round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceHeight)
}
//将整型的缩放因子转换为2的次幂采样大小
let scaleFactor = this.getSampleSizeType(sourceWidth, sourceHeight, requestedWidth, requestedHeight,
downsampType) == SampleSizeRounding.QUALITY ?
Math.max(1, highestOneBit(Math.max(sourceWidth / outSize.width, sourceHeight / outSize.height))) :
Math.max(1, highestOneBit(Math.min(sourceWidth / outSize.width, sourceHeight / outSize.height)))
if (this.getSampleSizeType(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)
== SampleSizeRounding.MEMORY && (scaleFactor < (1 / Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType))))) {
scaleFactor = scaleFactor << 1;
}
return scaleFactor
}
getSampleSizeType(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number,
downsampType: DownsampleStrategy
): SampleSizeRounding {
//如果缩放因子为 1,表示没有缩放,优先选择质量
if (Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) === 1) {
return SampleSizeRounding.QUALITY
}
//否则,使用 FIL_CENTER 的 SampleSizeRounding 值
return downsampType === DownsampleStrategy.CENTER_INSIDE_MEMORY?SampleSizeRounding.MEMORY:SampleSizeRounding.QUALITY
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CenterInside AST#implements_clause#Left implements BaseDownsampling AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left getName AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 'CenterInside' AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getScaleFactor AST#parameter_list#Left ( AST#parameter#Left sourceWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sourceHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left requestedWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left requestedHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left downsampType : AST#type_annotation#Left AST#primary_type#Left DownsampleStrategy AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left outSize : AST#type_annotation#Left AST#primary_type#Left Size AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left round 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 Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left getScale AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourceWidth AST#expression#Right , AST#expression#Left sourceHeight AST#expression#Right , AST#expression#Left requestedWidth AST#expression#Right , AST#expression#Left requestedHeight AST#expression#Right , AST#expression#Left downsampType 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#Left sourceWidth AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left round 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 Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left getScale AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourceWidth AST#expression#Right , AST#expression#Left sourceHeight AST#expression#Right , AST#expression#Left requestedWidth AST#expression#Right , AST#expression#Left requestedHeight AST#expression#Right , AST#expression#Left downsampType 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#Left sourceHeight AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //将整型的缩放因子转换为2的次幂采样大小 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left scaleFactor = AST#expression#Left AST#call_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getSampleSizeType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourceWidth AST#expression#Right , AST#expression#Left sourceHeight AST#expression#Right , AST#expression#Left requestedWidth AST#expression#Right , AST#expression#Left requestedHeight AST#expression#Right , AST#expression#Left downsampType AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left SampleSizeRounding AST#expression#Right AST#binary_expression#Right AST#expression#Right . QUALITY AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . max AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left highestOneBit AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . max AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sourceWidth AST#expression#Right / AST#expression#Left outSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sourceHeight AST#expression#Right / AST#expression#Left outSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left Math AST#expression#Right AST#conditional_expression#Right AST#expression#Right . max AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left highestOneBit AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sourceWidth AST#expression#Right / AST#expression#Left outSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sourceHeight AST#expression#Right / AST#expression#Left outSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getSampleSizeType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourceWidth AST#expression#Right , AST#expression#Left sourceHeight AST#expression#Right , AST#expression#Left requestedWidth AST#expression#Right , AST#expression#Left requestedHeight AST#expression#Right , AST#expression#Left downsampType AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left SampleSizeRounding AST#expression#Right AST#binary_expression#Right AST#expression#Right . MEMORY AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left scaleFactor 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 1 AST#expression#Right / AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left getScale AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourceWidth AST#expression#Right , AST#expression#Left sourceHeight AST#expression#Right , AST#expression#Left requestedWidth AST#expression#Right , AST#expression#Left requestedHeight AST#expression#Right , AST#expression#Left downsampType 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#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left scaleFactor = AST#expression#Left AST#binary_expression#Left AST#expression#Left scaleFactor 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#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left scaleFactor AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getSampleSizeType AST#parameter_list#Left ( AST#parameter#Left sourceWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sourceHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left requestedWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left requestedHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left downsampType : AST#type_annotation#Left AST#primary_type#Left DownsampleStrategy AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SampleSizeRounding AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //如果缩放因子为 1,表示没有缩放,优先选择质量 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 Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left getScale AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourceWidth AST#expression#Right , AST#expression#Left sourceHeight AST#expression#Right , AST#expression#Left requestedWidth AST#expression#Right , AST#expression#Left requestedHeight AST#expression#Right , AST#expression#Left downsampType 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#Left 1 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 SampleSizeRounding AST#expression#Right . QUALITY 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 //否则,使用 FIL_CENTER 的 SampleSizeRounding 值 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 AST#binary_expression#Left AST#expression#Left downsampType AST#expression#Right === AST#expression#Left DownsampleStrategy AST#expression#Right AST#binary_expression#Right AST#expression#Right . CENTER_INSIDE_MEMORY AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left SampleSizeRounding AST#expression#Right . MEMORY AST#member_expression#Right AST#expression#Right : AST#expression#Left SampleSizeRounding AST#expression#Right AST#conditional_expression#Right AST#expression#Right . QUALITY AST#member_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 CenterInside implements BaseDownsampling {
getName() {
return 'CenterInside'
}
getScaleFactor(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number,
downsampType: DownsampleStrategy
): number {
let outSize: Size = {
width: round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceWidth),
height:round(Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) * sourceHeight)
}
let scaleFactor = this.getSampleSizeType(sourceWidth, sourceHeight, requestedWidth, requestedHeight,
downsampType) == SampleSizeRounding.QUALITY ?
Math.max(1, highestOneBit(Math.max(sourceWidth / outSize.width, sourceHeight / outSize.height))) :
Math.max(1, highestOneBit(Math.min(sourceWidth / outSize.width, sourceHeight / outSize.height)))
if (this.getSampleSizeType(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)
== SampleSizeRounding.MEMORY && (scaleFactor < (1 / Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType))))) {
scaleFactor = scaleFactor << 1;
}
return scaleFactor
}
getSampleSizeType(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number,
downsampType: DownsampleStrategy
): SampleSizeRounding {
if (Math.min(1, getScale(sourceWidth, sourceHeight, requestedWidth, requestedHeight, downsampType)) === 1) {
return SampleSizeRounding.QUALITY
}
return downsampType === DownsampleStrategy.CENTER_INSIDE_MEMORY?SampleSizeRounding.MEMORY:SampleSizeRounding.QUALITY
}
}
|
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/downsampling/DownsampleStartegy.ets#L97-L131
|
e5af9c813682eab4f05cd948e168912d799a8873
|
gitee
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.