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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets
|
arkts
|
MARK: - DayOf 类定义
日份
|
export class DayOf {
// MARK: - 私有属性
/**
* 第几天 (start from 0)
*/
private _num: number;
/**
* 每天的Box的List
*/
private _boxes: Box[];
// MARK: - Getter 方法
/**
* 获取天数编号
*/
get num(): number {
return this._num;
}
/**
* 获取boxes数组
*/
get boxes(): Box[] {
return this._boxes;
}
// MARK: - 构造函数
/**
* 构造函数
* @param num - 天数编号
* @param boxes - boxes数组
*/
constructor(num: number, boxes: Box[]) {
this._num = num;
this._boxes = boxes;
}
// MARK: - 计算属性(days相关)
/**
* 当前(今天)是第几天, 如:第1天
*/
get numString(): string {
// return "第\(num + 1)天";
return getStringF($r("app.string.dayof_num_string") ,this.num + 1)
}
// MARK: - 内存操作(Operation in memo)
/**
* 添加box到内存
* @param box - 要添加的box
*/
appendMemBox(box: Box): void {
this._boxes.push(box);
}
/**
* 从内存中添加多个boxes
* @param boxes - 要添加的boxes数组
*/
appendMemBoxes(boxes: Box[]): void {
this._boxes.push(...boxes);
}
/**
* 从内存中删除box
* @param box - 要删除的box
*/
removeMemBox(box: Box): void {
const index = this._boxes.findIndex(b => b.equals(box));
if (index !== -1) {
this._boxes.splice(index, 1);
}
}
// MARK: - 等价比较(Equatable)
/**
* 判断两个DayOf对象是否相等
* @param other - 另一个DayOf对象
*/
equals(other: DayOf): boolean {
return this.num === other.num;
}
// MARK: - 比较(Comparable)
/**
* 比较两个DayOf对象的大小
* @param other - 另一个DayOf对象
*/
compareTo(other: DayOf): number {
return this.num - other.num;
}
/**
* 判断是否小于另一个DayOf对象
* @param other - 另一个DayOf对象
*/
lessThan(other: DayOf): boolean {
return this.compareTo(other) < 0;
}
// MARK: - 工具函数(Utils functions)
/**
* 获取distances
* @param forReview - true: 只取复习, false: 只取学习, null: 全部
*/
distances(forReview: boolean | null = null): DistanceFromBase[] {
const distances = this._boxes.map(box => box.distance);
if (forReview !== null) {
if (forReview) {
// 只取复习(距离不为0)
return distances.filter(distance => distance !== 0);
} else {
// 只取学习(距离为0)
return distances.filter(distance => distance === 0);
}
}
// 返回全部
return distances;
}
/**
* 获取pieceNos
* @param distances - 可选的distances数组,用于过滤
*/
pieceNos(distances: DistanceFromBase[] | null = null): number[] {
if (distances) { // && distances.length > 0
const distanceSet = new Set(distances);
return this._boxes
.filter(box => distanceSet.has(box.distance))
.map(box => box.pieceNo);
} else {
return this._boxes.map(box => box.pieceNo);
}
}
// MARK: - 调试描述(CustomDebugStringConvertible)
/**
* 获取调试描述信息
*/
toString(): string {
let s = `第${this.num}天: `;
this._boxes.forEach(box => {
s += `(pieceNo: ${box.pieceNo}, distance: ${box.distance}), `;
});
return s;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DayOf AST#class_body#Left { // MARK: - 私有属性 /**
* 第几天 (start from 0)
*/ AST#property_declaration#Left private _num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 每天的Box的List
*/ AST#property_declaration#Left private _boxes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Box [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // MARK: - Getter 方法 /**
* 获取天数编号
*/ AST#method_declaration#Left get AST#ERROR#Left num AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _num AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取boxes数组
*/ AST#method_declaration#Left get AST#ERROR#Left boxes AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Box [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 . _boxes AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 构造函数 /**
* 构造函数
* @param num - 天数编号
* @param boxes - boxes数组
*/ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left boxes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Box [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 . _num AST#member_expression#Right = AST#expression#Left num 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 . _boxes AST#member_expression#Right = AST#expression#Left boxes AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right // MARK: - 计算属性(days相关) /**
* 当前(今天)是第几天, 如:第1天
*/ AST#method_declaration#Left get AST#ERROR#Left numStr in g AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // return "第\(num + 1)天"; AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left getStringF AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.dayof_num_string" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . num 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 内存操作(Operation in memo) /**
* 添加box到内存
* @param box - 要添加的box
*/ AST#method_declaration#Left appendMemBox AST#parameter_list#Left ( AST#parameter#Left box : AST#type_annotation#Left AST#primary_type#Left Box 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 . _boxes AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left box 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 /**
* 从内存中添加多个boxes
* @param boxes - 要添加的boxes数组
*/ AST#method_declaration#Left appendMemBoxes AST#parameter_list#Left ( AST#parameter#Left boxes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Box [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 . _boxes AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#spread_element#Left ... AST#expression#Left boxes AST#expression#Right AST#spread_element#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 /**
* 从内存中删除box
* @param box - 要删除的box
*/ AST#method_declaration#Left removeMemBox AST#parameter_list#Left ( AST#parameter#Left box : AST#type_annotation#Left AST#primary_type#Left Box 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 index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _boxes AST#member_expression#Right AST#expression#Right . findIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left b => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . equals AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left box AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _boxes AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 等价比较(Equatable) /**
* 判断两个DayOf对象是否相等
* @param other - 另一个DayOf对象
*/ AST#method_declaration#Left equals AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left DayOf 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . num AST#member_expression#Right AST#expression#Right === AST#expression#Left other AST#expression#Right AST#binary_expression#Right AST#expression#Right . num AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 比较(Comparable) /**
* 比较两个DayOf对象的大小
* @param other - 另一个DayOf对象
*/ AST#method_declaration#Left compareTo AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . num AST#member_expression#Right AST#expression#Right - AST#expression#Left other AST#expression#Right AST#binary_expression#Right AST#expression#Right . num AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 判断是否小于另一个DayOf对象
* @param other - 另一个DayOf对象
*/ AST#method_declaration#Left lessThan AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left DayOf 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 . compareTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left other 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 工具函数(Utils functions) /**
* 获取distances
* @param forReview - true: 只取复习, false: 只取学习, null: 全部
*/ AST#method_declaration#Left distances AST#parameter_list#Left ( AST#parameter#Left forReview : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean 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#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DistanceFromBase [ ] AST#array_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 distances = 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 . _boxes AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left box => AST#expression#Left AST#member_expression#Left AST#expression#Left box AST#expression#Right . distance AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left forReview 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#if_statement#Left if ( AST#expression#Left forReview AST#expression#Right ) AST#block_statement#Left { // 只取复习(距离不为0) 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 distances AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left distance => AST#expression#Left AST#binary_expression#Left AST#expression#Left distance AST#expression#Right !== AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 只取学习(距离为0) 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 distances AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left distance => AST#expression#Left AST#binary_expression#Left AST#expression#Left distance AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 返回全部 AST#statement#Left AST#return_statement#Left return AST#expression#Left distances AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取pieceNos
* @param distances - 可选的distances数组,用于过滤
*/ AST#method_declaration#Left pieceNos AST#parameter_list#Left ( AST#parameter#Left distances : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left DistanceFromBase [ ] AST#array_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#parameter#Right ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left distances AST#expression#Right ) AST#block_statement#Left { // && distances.length > 0 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left distanceSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left distances AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _boxes AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left box => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left distanceSet AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left box AST#expression#Right . distance AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left box => AST#expression#Left AST#member_expression#Left AST#expression#Left box AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _boxes AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left box => AST#expression#Left AST#member_expression#Left AST#expression#Left box AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 调试描述(CustomDebugStringConvertible) /**
* 获取调试描述信息
*/ AST#method_declaration#Left toString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left s = AST#expression#Left AST#template_literal#Left ` 第 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . num AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 天: ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _boxes 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 box => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left s += AST#expression#Left AST#template_literal#Left ` (pieceNo: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left box AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , distance: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left box AST#expression#Right . distance AST#member_expression#Right 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#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 s 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 DayOf {
private _num: number;
private _boxes: Box[];
get num(): number {
return this._num;
}
get boxes(): Box[] {
return this._boxes;
}
constructor(num: number, boxes: Box[]) {
this._num = num;
this._boxes = boxes;
}
get numString(): string {
return getStringF($r("app.string.dayof_num_string") ,this.num + 1)
}
appendMemBox(box: Box): void {
this._boxes.push(box);
}
appendMemBoxes(boxes: Box[]): void {
this._boxes.push(...boxes);
}
removeMemBox(box: Box): void {
const index = this._boxes.findIndex(b => b.equals(box));
if (index !== -1) {
this._boxes.splice(index, 1);
}
}
equals(other: DayOf): boolean {
return this.num === other.num;
}
compareTo(other: DayOf): number {
return this.num - other.num;
}
lessThan(other: DayOf): boolean {
return this.compareTo(other) < 0;
}
distances(forReview: boolean | null = null): DistanceFromBase[] {
const distances = this._boxes.map(box => box.distance);
if (forReview !== null) {
if (forReview) {
return distances.filter(distance => distance !== 0);
} else {
return distances.filter(distance => distance === 0);
}
}
return distances;
}
pieceNos(distances: DistanceFromBase[] | null = null): number[] {
if (distances) {
const distanceSet = new Set(distances);
return this._boxes
.filter(box => distanceSet.has(box.distance))
.map(box => box.pieceNo);
} else {
return this._boxes.map(box => box.pieceNo);
}
}
toString(): string {
let s = `第${this.num}天: `;
this._boxes.forEach(box => {
s += `(pieceNo: ${box.pieceNo}, distance: ${box.distance}), `;
});
return s;
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets#L10-L168
|
50bc21120ff0696547cbf24aa12b24c271a206d5
|
github
|
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/entry/src/main/ets/pages/plan/plan.ets
|
arkts
|
测试 function test( beginDay:string){ promptAction.showToast({ message: beginDay }) } 获取每个周周一的日期
|
export function getMondayOfWeek(inputDate: Date | string): string {
// 处理日期参数,统一转换为Date对象
const targetDate: Date = typeof inputDate === 'string' ? new Date(inputDate) : new Date(inputDate);
// 验证日期有效性
if (isNaN(targetDate.getTime())) {
throw new Error('Invalid date input: 请提供有效的日期格式');
}
// 获取当前日期是一周中的第几天(0表示周日,1表示周一,...,6表示周六)
const day: number = targetDate.getDay();
// 计算与周一的差值
const diff: number = day === 0 ? -6 : 1 - day;
// 计算周一的日期
const monday: Date = new Date(targetDate);
monday.setDate(targetDate.getDate() + diff);
// 重置时间为00:00:00,避免时间部分影响
monday.setHours(0, 0, 0, 0);
// 格式化返回为YYYY-MM-DD,避免toString()带来的浏览器/环境差异
const year: number = monday.getFullYear();
const month: string = String(monday.getMonth() + 1).padStart(2, '0');
const date: string = String(monday.getDate()).padStart(2, '0');
return `${year}-${month}-${date}`;
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getMondayOfWeek AST#parameter_list#Left ( AST#parameter#Left inputDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 处理日期参数,统一转换为Date对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left targetDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left inputDate AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left inputDate AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left inputDate AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 验证日期有效性 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left isNaN AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left targetDate AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Invalid date input: 请提供有效的日期格式' 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 // 获取当前日期是一周中的第几天(0表示周日,1表示周一,...,6表示周六) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left targetDate AST#expression#Right . getDay 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#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left day AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#unary_expression#Left - AST#expression#Left 6 AST#expression#Right AST#unary_expression#Right AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right - AST#expression#Left day AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 计算周一的日期 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left monday : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left targetDate AST#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 monday AST#expression#Right . setDate 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 targetDate AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left diff 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 // 重置时间为00:00:00,避免时间部分影响 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monday AST#expression#Right . setHours 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 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 格式化返回为YYYY-MM-DD,避免toString()带来的浏览器/环境差异 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monday AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left month : AST#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 AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monday AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left date : 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 AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left monday AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left year AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left month AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left date AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function getMondayOfWeek(inputDate: Date | string): string {
const targetDate: Date = typeof inputDate === 'string' ? new Date(inputDate) : new Date(inputDate);
if (isNaN(targetDate.getTime())) {
throw new Error('Invalid date input: 请提供有效的日期格式');
}
const day: number = targetDate.getDay();
const diff: number = day === 0 ? -6 : 1 - day;
const monday: Date = new Date(targetDate);
monday.setDate(targetDate.getDate() + diff);
monday.setHours(0, 0, 0, 0);
const year: number = monday.getFullYear();
const month: string = String(monday.getMonth() + 1).padStart(2, '0');
const date: string = String(monday.getDate()).padStart(2, '0');
return `${year}-${month}-${date}`;
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L16-L44
|
bd0eb4193e939f8f86f7ba4003fc7d2e8ce8c0d3
|
github
|
|
2763981847/Clock-Alarm.git
|
8949bedddb7d011021848196735f30ffe2bd1daf
|
entry/src/main/ets/viewmodel/WorldClockViewModel.ets
|
arkts
|
batchRemoveCities
|
批量从城市列表中移除指定索引的城市。
@param indexesToRemove 要移除的城市索引数组
|
public batchRemoveCities(indexesToRemove: Array<number>) {
indexesToRemove.forEach(index => this.cities.splice(index, 1))
this.setCitiesToDatabase()
}
|
AST#method_declaration#Left public batchRemoveCities AST#parameter_list#Left ( AST#parameter#Left indexesToRemove : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 indexesToRemove AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left index => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cities AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setCitiesToDatabase 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
|
public batchRemoveCities(indexesToRemove: Array<number>) {
indexesToRemove.forEach(index => this.cities.splice(index, 1))
this.setCitiesToDatabase()
}
|
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/WorldClockViewModel.ets#L147-L150
|
7f405bf05f0b1003c0323572d3a55e98f3b99e0c
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/settings/LanguageSettingsPage.ets
|
arkts
|
updateUseSystemLocale
|
更新系统区域设置
|
private async updateUseSystemLocale(enabled: boolean): Promise<void> {
try {
await this.i18nManager.updateConfig({ useSystemLocale: enabled });
this.config.useSystemLocale = enabled;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to update system locale setting: ${error}`);
}
}
|
AST#method_declaration#Left private async updateUseSystemLocale AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . i18nManager AST#member_expression#Right AST#expression#Right . updateConfig 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 useSystemLocale AST#property_name#Right : AST#expression#Left enabled AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right . useSystemLocale 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 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 update system locale setting: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async updateUseSystemLocale(enabled: boolean): Promise<void> {
try {
await this.i18nManager.updateConfig({ useSystemLocale: enabled });
this.config.useSystemLocale = enabled;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to update system locale setting: ${error}`);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L612-L619
|
83d16b6360820fe87137f2c8d6d825d21ea61215
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/auth/src/main/ets/viewmodel/RegisterViewModel.ets
|
arkts
|
register
|
注册按钮点击
@returns {void} 无返回值
|
register(): void {
}
|
AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
|
register(): void {
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/RegisterViewModel.ets#L53-L54
|
21c522067e10d8a7057d30dc7946c4ef2b2965a0
|
github
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_tabs.ets
|
arkts
|
update_is_loading
|
Asks the tab to update its loading state, usually called when the tab starts loading or finishes loading.
|
update_is_loading(is_loading: boolean) {
this.is_loading = is_loading;
return this.is_loading;
}
|
AST#method_declaration#Left update_is_loading AST#parameter_list#Left ( AST#parameter#Left is_loading : 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 this AST#expression#Right . is_loading AST#member_expression#Right = AST#expression#Left is_loading 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#member_expression#Left AST#expression#Left this AST#expression#Right . is_loading AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
update_is_loading(is_loading: boolean) {
this.is_loading = is_loading;
return this.is_loading;
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L848-L851
|
6ddb5045d2a841446419fcc47a03d495a74eb1ed
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
picker_utils/src/main/ets/Utils.ets
|
arkts
|
closeSync
|
关闭文件,以同步方法。
@param file 已打开的File对象或已打开的文件描述符fd。
|
static closeSync(file: fs.File | number) {
fs.closeSync(file);
}
|
AST#method_declaration#Left static closeSync AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left fs . File AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 fs AST#expression#Right . closeSync 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#builder_function_body#Right AST#method_declaration#Right
|
static closeSync(file: fs.File | number) {
fs.closeSync(file);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L155-L157
|
4386716bb6d1c503772987d3e31704826914702b
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/ui/src/main/ets/component/navdestination/AppNavDestination.ets
|
arkts
|
AppNavDestination
|
@file 通用导航容器:统一 NavDestination 与 ViewModel 生命周期转发
@author Joker.X
|
@ComponentV2
export struct AppNavDestination {
/**
* 传入的视图模型实例(必传)
*/
@Param
@Require
viewModel: BaseViewModel;
/**
* 业务内容渲染
*/
@BuilderParam
content: CustomBuilder;
/**
* 是否启用安全区(默认开启)
*/
@Param
safeAreaEnabled: boolean = true;
/**
* 是否隐藏标题栏(默认不隐藏)
*/
@Param
hideTitleBar: boolean = false;
/**
* 标题内容(可选)
*/
@Param
title: string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle | Resource = "";
/**
* 标题栏配置
*/
@Param
titleOptions: NavigationTitleOptions = {
backgroundColor: $r("app.color.bg_grey")
};
/**
* 导航栏菜单内容(可选)
*/
@Param
menus: Array<NavigationMenuItem> | CustomBuilder = [];
/**
* 导航栏菜单配置(可选)
*/
@Param
menuOptions: NavigationMenuOptions | undefined = undefined;
/**
* 页面背景色
*/
@Param
pageBackgroundColor: ResourceColor | ColorMetrics = $r("app.color.bg_grey");
/**
* 当前窗口安全区状态(可外部传入,默认内部获取)
*/
@Param
windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
/**
* 自定义页面内边距(默认使用安全区)
*/
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
/**
* 页面出现时的生命周期回调
* @returns {void} 无返回值
*/
aboutToAppear(): void {
this.viewModel.aboutToAppear();
}
/**
* 页面隐藏时的生命周期回调
* @returns {void} 无返回值
*/
aboutToDisappear(): void {
this.viewModel.aboutToDisappear();
}
/**
* 页面销毁时的生命周期回调
* @returns {void} 无返回值
*/
aboutToBeDeleted(): void {
this.viewModel.aboutToBeDeleted();
}
/**
* 组件构建完成(API 12+)
* @returns {void} 无返回值
*/
onDidBuild(): void {
this.viewModel.onDidBuild();
}
/**
* 组件即将回收
* @returns {void} 无返回值
*/
aboutToRecycle(): void {
this.viewModel.aboutToRecycle();
}
/**
* 主题即将应用
* @param {Theme} theme - 主题对象
* @returns {void} 无返回值
*/
onWillApplyTheme(theme: Theme): void {
this.viewModel.onWillApplyTheme(theme);
}
/**
* 渲染通用 NavDestination
* @returns {void} 无返回值
*/
build() {
NavDestination() {
if (this.content) {
this.content();
}
}
.title(this.title, this.titleOptions)
.hideTitleBar(this.hideTitleBar)
.menus(this.menus, this.menuOptions)
.onShown((reason: VisibilityChangeReason) => {
this.viewModel.onShown(reason);
})
.onHidden((reason: VisibilityChangeReason) => {
this.viewModel.onHidden(reason);
})
.backgroundColor(this.pageBackgroundColor)
.padding(this.paddingValue ?? (this.safeAreaEnabled ? this.getSafeAreaPadding() : 0));
}
/**
* 获取安全区内边距
* @returns {Padding} 安全区内边距
*/
private getSafeAreaPadding(): Padding {
return {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
bottom: this.windowSafeAreaState.bottomInset,
right: this.windowSafeAreaState.rightInset
};
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct AppNavDestination AST#component_body#Left { /**
* 传入的视图模型实例(必传)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right viewModel : AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#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 /**
* 是否启用安全区(默认开启)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right safeAreaEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 是否隐藏标题栏(默认不隐藏)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right hideTitleBar : 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 title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left CustomBuilder AST#primary_type#Right | AST#primary_type#Left NavDestinationCommonTitle AST#primary_type#Right | AST#primary_type#Left NavDestinationCustomTitle AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right /**
* 标题栏配置
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right titleOptions : AST#type_annotation#Left AST#primary_type#Left NavigationTitleOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_grey" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 导航栏菜单内容(可选)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right menus : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NavigationMenuItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left CustomBuilder AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 导航栏菜单配置(可选)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right menuOptions : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left NavigationMenuOptions 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 pageBackgroundColor : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left ColorMetrics AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_grey" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 当前窗口安全区状态(可外部传入,默认内部获取)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right windowSafeAreaState : AST#type_annotation#Left AST#primary_type#Left WindowSafeAreaState AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getWindowSafeAreaState 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 @ 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 /**
* 页面出现时的生命周期回调
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewModel AST#member_expression#Right AST#expression#Right . aboutToAppear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 页面隐藏时的生命周期回调
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewModel AST#member_expression#Right AST#expression#Right . aboutToDisappear 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 /**
* 页面销毁时的生命周期回调
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToBeDeleted 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 . viewModel AST#member_expression#Right AST#expression#Right . aboutToBeDeleted 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 /**
* 组件构建完成(API 12+)
* @returns {void} 无返回值
*/ AST#method_declaration#Left onDidBuild 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 . viewModel AST#member_expression#Right AST#expression#Right . onDidBuild 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 /**
* 组件即将回收
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToRecycle 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 . viewModel AST#member_expression#Right AST#expression#Right . aboutToRecycle 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 {Theme} theme - 主题对象
* @returns {void} 无返回值
*/ AST#method_declaration#Left onWillApplyTheme AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left Theme 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 . viewModel AST#member_expression#Right AST#expression#Right . onWillApplyTheme AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left theme 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 /**
* 渲染通用 NavDestination
* @returns {void} 无返回值
*/ AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) 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 . content 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 . content 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 . title ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleOptions AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . hideTitleBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideTitleBar AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . menus ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . menus AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . menuOptions AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onShown ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left reason : AST#type_annotation#Left AST#primary_type#Left VisibilityChangeReason AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewModel AST#member_expression#Right AST#expression#Right . onShown AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reason AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onHidden ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left reason : AST#type_annotation#Left AST#primary_type#Left VisibilityChangeReason AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewModel AST#member_expression#Right AST#expression#Right . onHidden AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reason AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageBackgroundColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . safeAreaEnabled AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getSafeAreaPadding AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#build_body#Right AST#build_method#Right /**
* 获取安全区内边距
* @returns {Padding} 安全区内边距
*/ AST#method_declaration#Left private getSafeAreaPadding AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Padding AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . topInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . leftInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . bottomInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . rightInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct AppNavDestination {
@Param
@Require
viewModel: BaseViewModel;
@BuilderParam
content: CustomBuilder;
@Param
safeAreaEnabled: boolean = true;
@Param
hideTitleBar: boolean = false;
@Param
title: string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle | Resource = "";
@Param
titleOptions: NavigationTitleOptions = {
backgroundColor: $r("app.color.bg_grey")
};
@Param
menus: Array<NavigationMenuItem> | CustomBuilder = [];
@Param
menuOptions: NavigationMenuOptions | undefined = undefined;
@Param
pageBackgroundColor: ResourceColor | ColorMetrics = $r("app.color.bg_grey");
@Param
windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
aboutToAppear(): void {
this.viewModel.aboutToAppear();
}
aboutToDisappear(): void {
this.viewModel.aboutToDisappear();
}
aboutToBeDeleted(): void {
this.viewModel.aboutToBeDeleted();
}
onDidBuild(): void {
this.viewModel.onDidBuild();
}
aboutToRecycle(): void {
this.viewModel.aboutToRecycle();
}
onWillApplyTheme(theme: Theme): void {
this.viewModel.onWillApplyTheme(theme);
}
build() {
NavDestination() {
if (this.content) {
this.content();
}
}
.title(this.title, this.titleOptions)
.hideTitleBar(this.hideTitleBar)
.menus(this.menus, this.menuOptions)
.onShown((reason: VisibilityChangeReason) => {
this.viewModel.onShown(reason);
})
.onHidden((reason: VisibilityChangeReason) => {
this.viewModel.onHidden(reason);
})
.backgroundColor(this.pageBackgroundColor)
.padding(this.paddingValue ?? (this.safeAreaEnabled ? this.getSafeAreaPadding() : 0));
}
private getSafeAreaPadding(): Padding {
return {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
bottom: this.windowSafeAreaState.bottomInset,
right: this.windowSafeAreaState.rightInset
};
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/navdestination/AppNavDestination.ets#L8-L153
|
32e06345b8618ec48d587200a2bd325d20e26978
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/notification/ReminderScheduler.ets
|
arkts
|
提醒类型枚举
|
export enum ReminderType {
BIRTHDAY_ALARM = 'birthday_alarm',
ANNIVERSARY_ALARM = 'anniversary_alarm',
PREPARATION_REMINDER = 'preparation_reminder',
WEEKLY_SUMMARY = 'weekly_summary'
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum ReminderType AST#enum_body#Left { AST#enum_member#Left BIRTHDAY_ALARM = AST#expression#Left 'birthday_alarm' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ANNIVERSARY_ALARM = AST#expression#Left 'anniversary_alarm' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left PREPARATION_REMINDER = AST#expression#Left 'preparation_reminder' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left WEEKLY_SUMMARY = AST#expression#Left 'weekly_summary' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum ReminderType {
BIRTHDAY_ALARM = 'birthday_alarm',
ANNIVERSARY_ALARM = 'anniversary_alarm',
PREPARATION_REMINDER = 'preparation_reminder',
WEEKLY_SUMMARY = 'weekly_summary'
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L19-L24
|
76f830bc2111b27557cb020d3ce5ec9cec1d72d1
|
github
|
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/jobs/ViewPortJob.ets
|
arkts
|
Runnable that is used for viewport modifications since they cannot be
executed at any time. This can be used to delay the execution of viewport
modifications until the onSizeChanged(...) method of the chart-view is called.
This is especially important if viewport modifying methods are called on the chart
directly after initialization.
@author Philipp Jahoda
|
export default abstract class ViewPortJob extends Runnable {
protected pts: number[] = new Array(2);
protected mViewPortHandler: ViewPortHandler;
protected xValue: number = 0;
protected yValue: number = 0;
protected mTrans: Transformer;
protected view: Chart<any>;
constructor(viewPortHandler: ViewPortHandler, xValue: number, yValue: number, trans: Transformer, v: Chart<any>) {
super(null, null);
this.mViewPortHandler = viewPortHandler;
this.xValue = xValue;
this.yValue = yValue;
this.mTrans = trans;
this.view = v;
}
public getXValue(): number {
return this.xValue;
}
public getYValue(): number {
return this.yValue;
}
}
|
AST#export_declaration#Left export default AST#class_declaration#Left abstract class ViewPortJob extends AST#type_annotation#Left AST#primary_type#Left Runnable AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left protected pts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mViewPortHandler : AST#type_annotation#Left AST#primary_type#Left ViewPortHandler AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left protected xValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected yValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mTrans : AST#type_annotation#Left AST#primary_type#Left Transformer AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left protected view : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Chart AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left viewPortHandler : AST#type_annotation#Left AST#primary_type#Left ViewPortHandler AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left xValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left yValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left trans : AST#type_annotation#Left AST#primary_type#Left Transformer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left v : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Chart AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 . mViewPortHandler AST#member_expression#Right = AST#expression#Left viewPortHandler 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 . xValue AST#member_expression#Right = AST#expression#Left xValue 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 . yValue AST#member_expression#Right = AST#expression#Left yValue 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 . mTrans AST#member_expression#Right = AST#expression#Left trans 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 . view AST#member_expression#Right = AST#expression#Left v 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 public getXValue 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 . xValue AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public getYValue 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 . yValue 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 default abstract class ViewPortJob extends Runnable {
protected pts: number[] = new Array(2);
protected mViewPortHandler: ViewPortHandler;
protected xValue: number = 0;
protected yValue: number = 0;
protected mTrans: Transformer;
protected view: Chart<any>;
constructor(viewPortHandler: ViewPortHandler, xValue: number, yValue: number, trans: Transformer, v: Chart<any>) {
super(null, null);
this.mViewPortHandler = viewPortHandler;
this.xValue = xValue;
this.yValue = yValue;
this.mTrans = trans;
this.view = v;
}
public getXValue(): number {
return this.xValue;
}
public getYValue(): number {
return this.yValue;
}
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/jobs/ViewPortJob.ets#L30-L55
|
2e4eca8a22cfadc0d06b619e5454434bb28191aa
|
gitee
|
|
GikkiAres/todolist.git
|
3a7571832fd2985ffc1a4eb4673b370ef715fe8e
|
entry/src/main/ets/pages/ToDoListPage.ets
|
arkts
|
updateList
|
更新filterTodos
|
updateList() {
let todos = getApp().getAllTodo();
this.filteredTodos = todos.filter((item)=>(item.state == this.filterState));
}
|
AST#method_declaration#Left updateList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left todos = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getApp AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getAllTodo 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 this AST#expression#Right . filteredTodos AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left todos AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . state AST#member_expression#Right AST#expression#Right == AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . filterState AST#member_expression#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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
updateList() {
let todos = getApp().getAllTodo();
this.filteredTodos = todos.filter((item)=>(item.state == this.filterState));
}
|
https://github.com/GikkiAres/todolist.git/blob/3a7571832fd2985ffc1a4eb4673b370ef715fe8e/entry/src/main/ets/pages/ToDoListPage.ets#L160-L163
|
0d3e25cfb82062f692997ce0294070834aa75fde
|
github
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets
|
arkts
|
calcMinMaxY
|
Calc minimum and maximum y-values over all DataSets.
Tell DataSets to recalculate their min and max y-values, this is only needed for autoScaleMinMax.
@param fromX the x-value to start the calculation from
@param toX the x-value to which the calculation should be performed
|
public calcMinMaxY(fromX: number, toX: number): void {
for (let i = 0; i < this.mDataSets.listSize; i++) {
let data: T = this.mDataSets.at(i);
data.calcMinMaxY(fromX, toX);
}
// apply the new data
this.calcMinMax();
}
|
AST#method_declaration#Left public calcMinMaxY AST#parameter_list#Left ( AST#parameter#Left fromX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mDataSets AST#member_expression#Right AST#expression#Right . listSize 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 data : AST#type_annotation#Left AST#primary_type#Left T 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 . mDataSets AST#member_expression#Right AST#expression#Right . at AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . calcMinMaxY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fromX AST#expression#Right , AST#expression#Left toX AST#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 // apply the new data 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 . calcMinMax AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public calcMinMaxY(fromX: number, toX: number): void {
for (let i = 0; i < this.mDataSets.listSize; i++) {
let data: T = this.mDataSets.at(i);
data.calcMinMaxY(fromX, toX);
}
this.calcMinMax();
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L110-L117
|
bd22e2d54e282d145f8d787b94392f2a0fcfba1b
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
picker_utils/src/main/ets/PickerUtil.ets
|
arkts
|
TODO 拍照、文件(文件、图片、视频、音频)选择和保存,工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01
|
export class PickerUtil {
/**
* 调用系统相机,拍照、录视频
* @param options
* @returns
*/
static async cameraEasy(options: CameraOptions = new CameraOptions()): Promise<string> {
let pickerResult = await PickerUtil.camera(options);
return pickerResult.resultUri;
}
/**
* 调用系统相机,拍照、录视频
* @param options
* @returns
*/
static async camera(options: CameraOptions = new CameraOptions()): Promise<cameraPicker.PickerResult> {
const pickerProfile: cameraPicker.PickerProfile = {
cameraPosition: options.cameraPosition ? options.cameraPosition : camera.CameraPosition.CAMERA_POSITION_BACK,
videoDuration: options.videoDuration,
saveUri: options.saveUri
};
let pickerResult = await cameraPicker.pick(getContext(), options.mediaTypes, pickerProfile);
return pickerResult;
}
/**
* 通过选择模式拉起PhotoViewPicker界面,用户可以选择一个或多个图片/视频。(该方法系统已废弃,推荐使用PhotoHelper工具类)
* @param options
* MIMEType PhotoViewMIMETypes 可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。
* maxSelectNumber number 选择媒体文件数量的最大值(默认值为50,最大值为500)。
* @returns
*/
static async selectPhoto(options?: picker.PhotoSelectOptions): Promise<Array<string>> {
if (options === undefined) {
options = new picker.PhotoSelectOptions();
options.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; //可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。
options.maxSelectNumber = PICKER_DEFAULT_SELECT_NUMBER; //选择媒体文件数量的最大值,默认9。
}
const photoPicker = new picker.PhotoViewPicker(getContext());
let photoSelectResult: picker.PhotoSelectResult = await photoPicker.select(options);
return photoSelectResult.photoUris;
}
/**
* 通过保存模式拉起photoPicker进行保存图片或视频资源的文件名,若无此参数,则默认需要用户自行输入。(该方法系统已废弃,推荐使用PhotoHelper工具类)
* @param newFileNames 拉起photoPicker进行保存图片或视频资源的文件名,若无此参数,则默认需要用户自行输入。
* @returns 返回相册uris
*/
static async savePhoto(newFileNames?: Array<string>): Promise<Array<string>> {
const photoPicker = new picker.PhotoViewPicker(getContext());
const PhotoSaveOptions = new picker.PhotoSaveOptions();
if (newFileNames !== undefined && newFileNames.length > 0) {
PhotoSaveOptions.newFileNames = newFileNames;
}
return photoPicker.save(PhotoSaveOptions);
}
/**
* 通过选择模式拉起documentPicker界面,用户可以选择一个或多个文件。
* @param options
* maxSelectNumber number 选择文件最大个数,上限500,有效值范围1-500(选择目录仅对具有该系统能力的设备开放。且目录选择的最大个数为1)。默认值是1。系统能力: SystemCapability.FileManagement.UserFileService
* defaultFilePathUri string 指定选择的文件或者目录路径
* fileSuffixFilters Array<string> 选择文件的后缀类型,传入字符串数组,每一项代表一个后缀选项,每一项内部用"|"分为两部分,第一部分为描述,第二部分为过滤后缀。没有"|"则没有描述,该项整体是一个过滤后缀。每项过滤后缀可以存在多个后缀名,则每一个后缀名之间用英文逗号进行分隔,传入数组长度不能超过100。仅对具有该系统能力的设备开放。默认全部过滤,即显示所有文件。系统能力: SystemCapability.FileManagement.UserFileService
* selectMode DocumentSelectMode 支持选择的资源类型,比如:文件、文件夹和二者混合,仅对具有该系统能力的设备开放,默认值是文件类型。系统能力: SystemCapability.FileManagement.UserFileService.FolderSelection
* authMode boolean 拉起授权picker,默认为false(非授权模式)。当authMode为true时为授权模式,defaultFilePathUri必填,表明待授权uri。仅对具有该系统能力的设备开放,系统能力: SystemCapability.FileManagement.UserFileService.FolderSelection
* @returns
*/
static async selectDocument(options?: picker.DocumentSelectOptions): Promise<Array<string>> {
if (options === undefined) {
options = new picker.DocumentSelectOptions();
options.maxSelectNumber = PICKER_DEFAULT_SELECT_NUMBER; //选择媒体文件数量的最大值,默认9。
options.selectMode = picker.DocumentSelectMode.FILE; //支持选择的资源类型,默认文件
}
const documentPicker = new picker.DocumentViewPicker();
return documentPicker.select(options);
}
/**
* 通过保存模式拉起documentPicker界面,用户可以保存一个或多个文件。
* @param newFileNames Array<string> 拉起documentPicker进行保存的文件名,若无此参数,则默认需要用户自行输入。
* @returns 返回DOWNLOAD的文件夹下的文件path。
*/
static async saveDocumentEasy(newFileNames: Array<string>): Promise<Array<string>> {
const documentSaveOptions = new picker.DocumentSaveOptions();
documentSaveOptions.pickerMode = picker.DocumentPickerMode.DOWNLOAD;
if (newFileNames !== undefined && newFileNames.length > 0) {
documentSaveOptions.newFileNames = newFileNames;
}
let downloadUri = await PickerUtil.saveDocument(documentSaveOptions);
const path = Utils.getFileUri(downloadUri[0]).path;
let uris = new Array<string>();
for (let index = 0; index < newFileNames.length; index++) {
uris.push(`${path}/${newFileNames[index]}`);
}
return uris;
}
/**
* 通过保存模式拉起documentPicker界面,用户可以保存一个或多个文件。
* @param options
* newFileNames Array<string> 拉起documentPicker进行保存的文件名,若无此参数,则默认需要用户自行输入。
* defaultFilePathUri string 指定保存的文件或者目录路径。
* fileSuffixChoices Array<string> 保存文件的后缀类型。传入字符串数组,每一项代表一个后缀选项,每一项内部用"|"分为两部分,第一部分为描述,第二部分为要保存的后缀。没有"|"则没有描述,该项整体是一个保存的后缀。默认没有后缀类型。
* pickerMode DocumentPickerMode 拉起picker的类型, 默认为DEFAULT。当pickerMode设置为DOWNLOAD时,用户配置的参数newFileNames、defaultFilePathUri和fileSuffixChoices将不会生效。
* @returns
*/
static async saveDocument(options?: picker.DocumentSaveOptions): Promise<Array<string>> {
const documentPicker = new picker.DocumentViewPicker(getContext());
return documentPicker.save(options);
}
/**
* 通过选择模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以选择一个或多个音频文件。
* @param maxSelectNumber number 选择媒体文件数量的最大值(默认值为50,最大值为500)。
* @returns
*/
static async selectAudio(options?: picker.AudioSelectOptions): Promise<Array<string>> {
if (options === undefined) {
options = new picker.AudioSelectOptions();
options.maxSelectNumber = PICKER_DEFAULT_SELECT_NUMBER; //选择媒体文件数量的最大值,默认9
}
const audioPicker = new picker.AudioViewPicker(getContext());
return audioPicker.select(options);
}
/**
* 通过保存模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以保存一个或多个音频文件。
* @param newFileNames 拉起audioPicker进行保存音频资源的文件名,若无此参数,则默认需要用户自行输入。
* @returns 返回保存文件的uri数组。
*/
static async saveAudio(newFileNames?: Array<string>): Promise<Array<string>> {
const audioPicker = new picker.AudioViewPicker(getContext());
const audioSaveOptions = new picker.AudioSaveOptions();
if (newFileNames !== undefined && newFileNames.length > 0) {
audioSaveOptions.newFileNames = newFileNames;
}
return audioPicker.save(audioSaveOptions);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class PickerUtil AST#class_body#Left { /**
* 调用系统相机,拍照、录视频
* @param options
* @returns
*/ AST#method_declaration#Left static async cameraEasy AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left CameraOptions 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 CameraOptions AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pickerResult = 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 PickerUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . camera AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 pickerResult AST#expression#Right . resultUri AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 调用系统相机,拍照、录视频
* @param options
* @returns
*/ AST#method_declaration#Left static async camera AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left CameraOptions 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 CameraOptions AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 cameraPicker . PickerResult 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 const AST#variable_declarator#Left pickerProfile : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cameraPicker . PickerProfile 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 cameraPosition AST#property_name#Right : AST#expression#Left AST#member_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 options AST#expression#Right . cameraPosition AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . cameraPosition AST#member_expression#Right AST#expression#Right : AST#expression#Left camera AST#expression#Right AST#conditional_expression#Right AST#expression#Right . CameraPosition AST#member_expression#Right AST#expression#Right . CAMERA_POSITION_BACK AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left videoDuration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . videoDuration AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left saveUri AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . saveUri 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 pickerResult = 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 cameraPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . pick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . mediaTypes AST#member_expression#Right AST#expression#Right , AST#expression#Left pickerProfile AST#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 pickerResult AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 通过选择模式拉起PhotoViewPicker界面,用户可以选择一个或多个图片/视频。(该方法系统已废弃,推荐使用PhotoHelper工具类)
* @param options
* MIMEType PhotoViewMIMETypes 可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。
* maxSelectNumber number 选择媒体文件数量的最大值(默认值为50,最大值为500)。
* @returns
*/ AST#method_declaration#Left static async selectPhoto AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . PhotoSelectOptions 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#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left options AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left options = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoSelectOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . MIMEType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left picker AST#expression#Right . PhotoViewMIMETypes AST#member_expression#Right AST#expression#Right . IMAGE_TYPE 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 options AST#expression#Right . maxSelectNumber AST#member_expression#Right = AST#expression#Left PICKER_DEFAULT_SELECT_NUMBER AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //选择媒体文件数量的最大值,默认9。 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left photoPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoSelectResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . PhotoSelectResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left photoPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . select AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left photoSelectResult AST#expression#Right . photoUris AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 通过保存模式拉起photoPicker进行保存图片或视频资源的文件名,若无此参数,则默认需要用户自行输入。(该方法系统已废弃,推荐使用PhotoHelper工具类)
* @param newFileNames 拉起photoPicker进行保存图片或视频资源的文件名,若无此参数,则默认需要用户自行输入。
* @returns 返回相册uris
*/ AST#method_declaration#Left static async savePhoto AST#parameter_list#Left ( AST#parameter#Left newFileNames ? : 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left photoPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left PhotoSaveOptions = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoSaveOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left newFileNames AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left newFileNames 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 PhotoSaveOptions AST#expression#Right . newFileNames AST#member_expression#Right = AST#expression#Left newFileNames 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left photoPicker AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left PhotoSaveOptions 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 /**
* 通过选择模式拉起documentPicker界面,用户可以选择一个或多个文件。
* @param options
* maxSelectNumber number 选择文件最大个数,上限500,有效值范围1-500(选择目录仅对具有该系统能力的设备开放。且目录选择的最大个数为1)。默认值是1。系统能力: SystemCapability.FileManagement.UserFileService
* defaultFilePathUri string 指定选择的文件或者目录路径
* fileSuffixFilters Array<string> 选择文件的后缀类型,传入字符串数组,每一项代表一个后缀选项,每一项内部用"|"分为两部分,第一部分为描述,第二部分为过滤后缀。没有"|"则没有描述,该项整体是一个过滤后缀。每项过滤后缀可以存在多个后缀名,则每一个后缀名之间用英文逗号进行分隔,传入数组长度不能超过100。仅对具有该系统能力的设备开放。默认全部过滤,即显示所有文件。系统能力: SystemCapability.FileManagement.UserFileService
* selectMode DocumentSelectMode 支持选择的资源类型,比如:文件、文件夹和二者混合,仅对具有该系统能力的设备开放,默认值是文件类型。系统能力: SystemCapability.FileManagement.UserFileService.FolderSelection
* authMode boolean 拉起授权picker,默认为false(非授权模式)。当authMode为true时为授权模式,defaultFilePathUri必填,表明待授权uri。仅对具有该系统能力的设备开放,系统能力: SystemCapability.FileManagement.UserFileService.FolderSelection
* @returns
*/ AST#method_declaration#Left static async selectDocument AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . DocumentSelectOptions 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#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 options AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left options = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentSelectOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . maxSelectNumber AST#member_expression#Right = AST#expression#Left PICKER_DEFAULT_SELECT_NUMBER AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //选择媒体文件数量的最大值,默认9。 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . selectMode AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left picker AST#expression#Right . DocumentSelectMode AST#member_expression#Right AST#expression#Right . FILE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //支持选择的资源类型,默认文件 } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left documentPicker = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentViewPicker 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 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 documentPicker AST#expression#Right . select AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 通过保存模式拉起documentPicker界面,用户可以保存一个或多个文件。
* @param newFileNames Array<string> 拉起documentPicker进行保存的文件名,若无此参数,则默认需要用户自行输入。
* @returns 返回DOWNLOAD的文件夹下的文件path。
*/ AST#method_declaration#Left static async saveDocumentEasy AST#parameter_list#Left ( AST#parameter#Left newFileNames : 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left documentSaveOptions = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentSaveOptions 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 documentSaveOptions AST#expression#Right . pickerMode AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left picker AST#expression#Right . DocumentPickerMode AST#member_expression#Right AST#expression#Right . DOWNLOAD AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left newFileNames AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left newFileNames 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 documentSaveOptions AST#expression#Right . newFileNames AST#member_expression#Right = AST#expression#Left newFileNames 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 downloadUri = 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 PickerUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . saveDocument AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left documentSaveOptions AST#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 path = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . getFileUri AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left downloadUri AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . path 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 uris = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left newFileNames AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uris AST#expression#Right . push 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 path AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left newFileNames AST#expression#Right [ AST#expression#Left index 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#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left uris AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 通过保存模式拉起documentPicker界面,用户可以保存一个或多个文件。
* @param options
* newFileNames Array<string> 拉起documentPicker进行保存的文件名,若无此参数,则默认需要用户自行输入。
* defaultFilePathUri string 指定保存的文件或者目录路径。
* fileSuffixChoices Array<string> 保存文件的后缀类型。传入字符串数组,每一项代表一个后缀选项,每一项内部用"|"分为两部分,第一部分为描述,第二部分为要保存的后缀。没有"|"则没有描述,该项整体是一个保存的后缀。默认没有后缀类型。
* pickerMode DocumentPickerMode 拉起picker的类型, 默认为DEFAULT。当pickerMode设置为DOWNLOAD时,用户配置的参数newFileNames、defaultFilePathUri和fileSuffixChoices将不会生效。
* @returns
*/ AST#method_declaration#Left static async saveDocument AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . DocumentSaveOptions 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#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left documentPicker = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right 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 documentPicker AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 通过选择模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以选择一个或多个音频文件。
* @param maxSelectNumber number 选择媒体文件数量的最大值(默认值为50,最大值为500)。
* @returns
*/ AST#method_declaration#Left static async selectAudio AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . AudioSelectOptions 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#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 options AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left options = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . AudioSelectOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . maxSelectNumber AST#member_expression#Right = AST#expression#Left PICKER_DEFAULT_SELECT_NUMBER AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //选择媒体文件数量的最大值,默认9 } 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 audioPicker = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . AudioViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audioPicker AST#expression#Right . select AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 通过保存模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以保存一个或多个音频文件。
* @param newFileNames 拉起audioPicker进行保存音频资源的文件名,若无此参数,则默认需要用户自行输入。
* @returns 返回保存文件的uri数组。
*/ AST#method_declaration#Left static async saveAudio AST#parameter_list#Left ( AST#parameter#Left newFileNames ? : 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left audioPicker = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . AudioViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left audioSaveOptions = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . AudioSaveOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left newFileNames AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left newFileNames 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 audioSaveOptions AST#expression#Right . newFileNames AST#member_expression#Right = AST#expression#Left newFileNames 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audioPicker AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left audioSaveOptions 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 PickerUtil {
static async cameraEasy(options: CameraOptions = new CameraOptions()): Promise<string> {
let pickerResult = await PickerUtil.camera(options);
return pickerResult.resultUri;
}
static async camera(options: CameraOptions = new CameraOptions()): Promise<cameraPicker.PickerResult> {
const pickerProfile: cameraPicker.PickerProfile = {
cameraPosition: options.cameraPosition ? options.cameraPosition : camera.CameraPosition.CAMERA_POSITION_BACK,
videoDuration: options.videoDuration,
saveUri: options.saveUri
};
let pickerResult = await cameraPicker.pick(getContext(), options.mediaTypes, pickerProfile);
return pickerResult;
}
static async selectPhoto(options?: picker.PhotoSelectOptions): Promise<Array<string>> {
if (options === undefined) {
options = new picker.PhotoSelectOptions();
options.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
options.maxSelectNumber = PICKER_DEFAULT_SELECT_NUMBER;
}
const photoPicker = new picker.PhotoViewPicker(getContext());
let photoSelectResult: picker.PhotoSelectResult = await photoPicker.select(options);
return photoSelectResult.photoUris;
}
static async savePhoto(newFileNames?: Array<string>): Promise<Array<string>> {
const photoPicker = new picker.PhotoViewPicker(getContext());
const PhotoSaveOptions = new picker.PhotoSaveOptions();
if (newFileNames !== undefined && newFileNames.length > 0) {
PhotoSaveOptions.newFileNames = newFileNames;
}
return photoPicker.save(PhotoSaveOptions);
}
static async selectDocument(options?: picker.DocumentSelectOptions): Promise<Array<string>> {
if (options === undefined) {
options = new picker.DocumentSelectOptions();
options.maxSelectNumber = PICKER_DEFAULT_SELECT_NUMBER;
options.selectMode = picker.DocumentSelectMode.FILE;
}
const documentPicker = new picker.DocumentViewPicker();
return documentPicker.select(options);
}
static async saveDocumentEasy(newFileNames: Array<string>): Promise<Array<string>> {
const documentSaveOptions = new picker.DocumentSaveOptions();
documentSaveOptions.pickerMode = picker.DocumentPickerMode.DOWNLOAD;
if (newFileNames !== undefined && newFileNames.length > 0) {
documentSaveOptions.newFileNames = newFileNames;
}
let downloadUri = await PickerUtil.saveDocument(documentSaveOptions);
const path = Utils.getFileUri(downloadUri[0]).path;
let uris = new Array<string>();
for (let index = 0; index < newFileNames.length; index++) {
uris.push(`${path}/${newFileNames[index]}`);
}
return uris;
}
static async saveDocument(options?: picker.DocumentSaveOptions): Promise<Array<string>> {
const documentPicker = new picker.DocumentViewPicker(getContext());
return documentPicker.save(options);
}
static async selectAudio(options?: picker.AudioSelectOptions): Promise<Array<string>> {
if (options === undefined) {
options = new picker.AudioSelectOptions();
options.maxSelectNumber = PICKER_DEFAULT_SELECT_NUMBER;
}
const audioPicker = new picker.AudioViewPicker(getContext());
return audioPicker.select(options);
}
static async saveAudio(newFileNames?: Array<string>): Promise<Array<string>> {
const audioPicker = new picker.AudioViewPicker(getContext());
const audioSaveOptions = new picker.AudioSaveOptions();
if (newFileNames !== undefined && newFileNames.length > 0) {
audioSaveOptions.newFileNames = newFileNames;
}
return audioPicker.save(audioSaveOptions);
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PickerUtil.ets#L28-L179
|
4bf3c2fba9df74efde309370fd9b174cf2243d4f
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/navigation/src/main/ets/common/CommonNavigator.ets
|
arkts
|
toPrivacyPolicy
|
跳转到隐私政策
@returns {void} 无返回值
|
static toPrivacyPolicy(): void {
navigateTo(CommonRoutes.PrivacyPolicy);
}
|
AST#method_declaration#Left static toPrivacyPolicy 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 . PrivacyPolicy AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static toPrivacyPolicy(): void {
navigateTo(CommonRoutes.PrivacyPolicy);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/common/CommonNavigator.ets#L38-L40
|
ffd6553ad6f0ef2af7c43659780bfde68171630e
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
|
arkts
|
getNextId
|
Get component ID
|
public getNextId(): number {
this.idGen += 1;
return this.idGen;
}
|
AST#method_declaration#Left public getNextId 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . idGen 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . idGen AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getNextId(): number {
this.idGen += 1;
return this.idGen;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L83-L86
|
f3d6275b7598f26be62ea5d57bd03369c184b7bd
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/game/VirtualEconomyService.ets
|
arkts
|
虚拟货币类型枚举
|
export enum CurrencyType {
GOLD_COIN = 'gold_coin', // 金币
SILVER_COIN = 'silver_coin', // 银币
DIAMOND = 'diamond', // 钻石
ENERGY = 'energy', // 能量
EXPERIENCE = 'experience' // 经验值
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum CurrencyType AST#enum_body#Left { AST#enum_member#Left GOLD_COIN = AST#expression#Left 'gold_coin' AST#expression#Right AST#enum_member#Right , // 金币 AST#enum_member#Left SILVER_COIN = AST#expression#Left 'silver_coin' AST#expression#Right AST#enum_member#Right , // 银币 AST#enum_member#Left DIAMOND = AST#expression#Left 'diamond' AST#expression#Right AST#enum_member#Right , // 钻石 AST#enum_member#Left ENERGY = AST#expression#Left 'energy' AST#expression#Right AST#enum_member#Right , // 能量 AST#enum_member#Left EXPERIENCE = AST#expression#Left 'experience' AST#expression#Right AST#enum_member#Right // 经验值 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum CurrencyType {
GOLD_COIN = 'gold_coin',
SILVER_COIN = 'silver_coin',
DIAMOND = 'diamond',
ENERGY = 'energy',
EXPERIENCE = 'experience'
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L15-L21
|
e4fe9ca218ace4a7dcc67e240dab1123162f533c
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/lunar/LunarService.ets
|
arkts
|
isNetworkAvailable
|
检查网络连接是否可用
|
async isNetworkAvailable(): Promise<boolean> {
return await this.onlineLunarService.isNetworkAvailable();
}
|
AST#method_declaration#Left async isNetworkAvailable 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 . onlineLunarService AST#member_expression#Right AST#expression#Right . isNetworkAvailable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async isNetworkAvailable(): Promise<boolean> {
return await this.onlineLunarService.isNetworkAvailable();
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L417-L419
|
51b08be0cfa2c4753e8ba980e8c2f6a245bee166
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/common/utils/src/main/ets/utils/NWebUtils.ets
|
arkts
|
makeNode
|
必须要重写的方法,用于构建节点数、返回节点挂载在对应NodeContainer中
在对应NodeContainer创建的时候调用、或者通过rebuild方法调用刷新
|
makeNode(uiContext: UIContext): FrameNode | null {
if (this.rootNode) {
return this.rootNode.getFrameNode();
}
return null; // 返回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#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 . rootNode 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#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#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#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 返回null控制动态组件脱离绑定节点 } AST#block_statement#Right AST#method_declaration#Right
|
makeNode(uiContext: UIContext): FrameNode | null {
if (this.rootNode) {
return this.rootNode.getFrameNode();
}
return null;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/utils/src/main/ets/utils/NWebUtils.ets#L61-L66
|
7e28ee0555d8177d42d5ba616789698fe4da24c1
|
gitee
|
sedlei/Smart-park-system.git
|
253228f73e419e92fd83777f564889d202f7c699
|
@huaweicloud/iot-device-sdk/src/main/ets/client/DeviceClient.d.ets
|
arkts
|
set
|
设置设备影子监听器,用于接收设备侧请求平台下发的设备影子数据。
此监听器只能接收平台到直连设备的请求,子设备的请求由AbstractGateway处理
@param shadowListener 设备影子监听器
|
set shadowListener(value: ShadowListener | null);
|
AST#method_declaration#Left set AST#ERROR#Left shadow List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ShadowListener AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
|
set shadowListener(value: ShadowListener | null);
|
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/@huaweicloud/iot-device-sdk/src/main/ets/client/DeviceClient.d.ets#L55-L55
|
269ff0e8f425845682062ec770c797994be4cf8b
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/common/src/main/ets/view/UserAgreementPage.ets
|
arkts
|
UserAgreementContent
|
用户协议页面内容视图
@returns {void} 无返回值
|
@Builder
private UserAgreementContent() {
Text("用户协议页面内容视图")
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private UserAgreementContent 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 Text ( AST#expression#Left "用户协议页面内容视图" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private UserAgreementContent() {
Text("用户协议页面内容视图")
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/UserAgreementPage.ets#L33-L36
|
87d79035b921fdaaa0fe9d1e3a9be856e21b73fe
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets
|
arkts
|
[StartExclude audio_player_service] [StartExclude audio_player_service1] private constructor
|
private constructor() {
this.initAudioPlayer();
}
|
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initAudioPlayer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
private constructor() {
this.initAudioPlayer();
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets#L24-L26
|
7710b5d19c7bd9d048b12d7834a052eca465eac8
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/main/src/main/ets/component/HomeCategorySection.ets
|
arkts
|
categoryItem
|
分类项视图
@param {Category} category - 分类数据
@returns {void} 无返回值
|
@Builder
private categoryItem(category: Category): void {
Column() {
NetWorkImage({
model: category.pic ?? null,
sizeValue: this.getImageSize(),
cornerRadius: this.getImageRadius(),
showBackground: true,
backgroundColorValue: $r("app.color.bg_grey")
});
SpaceVerticalXSmall();
Text(category.name)
.fontSize($r("app.float.headline_medium"))
.fontColor($r("app.color.text_primary"))
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis });
}
.width(P100)
.padding({
top: $r("app.float.space_vertical_small_x"),
bottom: $r("app.float.space_vertical_small_x")
})
.alignItems(HorizontalAlign.Center)
.onClick((): void => this.onCategoryClick(category.id));
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private categoryItem AST#parameter_list#Left ( AST#parameter#Left category : AST#type_annotation#Left AST#primary_type#Left Category AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left NetWorkImage ( AST#component_parameters#Left { AST#component_parameter#Left model : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left category AST#expression#Right . pic 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#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getImageSize 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 cornerRadius : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getImageRadius 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 showBackground : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left backgroundColorValue : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_grey" 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#ui_custom_component_statement#Left SpaceVerticalXSmall ( ) ; AST#ui_custom_component_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left category AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.headline_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_primary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left P100 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_vertical_small_x" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_vertical_small_x" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#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 . onCategoryClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left category AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private categoryItem(category: Category): void {
Column() {
NetWorkImage({
model: category.pic ?? null,
sizeValue: this.getImageSize(),
cornerRadius: this.getImageRadius(),
showBackground: true,
backgroundColorValue: $r("app.color.bg_grey")
});
SpaceVerticalXSmall();
Text(category.name)
.fontSize($r("app.float.headline_medium"))
.fontColor($r("app.color.text_primary"))
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis });
}
.width(P100)
.padding({
top: $r("app.float.space_vertical_small_x"),
bottom: $r("app.float.space_vertical_small_x")
})
.alignItems(HorizontalAlign.Center)
.onClick((): void => this.onCategoryClick(category.id));
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCategorySection.ets#L51-L77
|
2a1d0bd104fd200e732d9e6359694e530e3151d6
|
github
|
ashcha0/line-inspection-terminal-frontend_arkts.git
|
c82616097e8a3b257b7b01e75b6b83ce428b518c
|
entry/src/main/ets/services/CameraService.ets
|
arkts
|
摄像头服务类
负责管理摄像头设备列表获取和视频流URL生成
|
export class CameraService {
// 摄像头服务认证头
private static readonly AUTH_HEADER = 'Basic YWRtaW4xMjM6QWRtaW5AMTIz';
/**
* 获取摄像头设备列表
* @returns Promise<CameraDevice[]> 摄像头设备列表
*/
static async getCameraDevices(): Promise<CameraDevice[]> {
try {
console.info('[CameraService] 📹 开始获取摄像头设备列表');
const url = `${AppConstants.CAMERA_BASE_URL}/devices?page=1&size=999&status=&id&name`;
console.info('[CameraService] 📹 请求URL:', url);
const response = await HttpUtil.request(url, {
method: http.RequestMethod.GET,
headers: {
'Authorization': CameraService.AUTH_HEADER,
'Content-Type': 'application/json'
},
timeout: AppConstants.REQUEST_TIMEOUT
});
console.info('[CameraService] 📹 摄像头服务响应:', JSON.stringify({
code: response.code,
dataType: typeof response.data,
hasData: response.data ? true : false
}));
if (response.code === 200) {
// 摄像头API直接返回数据,不是包装在HttpResponse中
let responseData: CameraResponseData;
if (response.data) {
// 如果data存在,说明是包装的响应
responseData = response.data as CameraResponseData;
} else {
// 如果data不存在,可能需要从原始响应中解析
console.warn('[CameraService] ⚠️ 响应数据为空,尝试其他解析方式');
return [];
}
if (responseData && responseData.items) {
const devices = responseData.items;
const logInfo: DeviceLogInfo = {
deviceCount: devices.length,
deviceIds: devices.map((d: CameraDevice) => d.id)
};
console.info('[CameraService] ✅ 成功获取摄像头设备列表:', JSON.stringify(logInfo));
return devices;
}
}
console.warn('[CameraService] ⚠️ 摄像头服务返回异常:', JSON.stringify({
code: response.code,
msg: response.msg,
data: response.data
}));
return [];
} catch (error) {
console.error('[CameraService] ❌ 获取摄像头设备列表失败:', error);
throw new Error(`获取摄像头设备列表失败: ${error}`);
}
}
/**
* 将摄像头设备转换为UI显示信息
* @param devices 摄像头设备列表
* @returns CameraInfo[] UI显示的摄像头信息列表
*/
static convertToCameraInfo(devices: CameraDevice[]): CameraInfo[] {
return devices.map((device, index) => {
const cameraInfo: CameraInfo = {
id: device.id,
name: device.name || `摄像头${index + 1}`,
url: CameraService.generateStreamUrl(device.id),
status: device.status || 'unknown'
};
const logInfo: CameraLogInfo = {
deviceId: device.id,
cameraName: cameraInfo.name,
streamUrl: cameraInfo.url
};
console.info('[CameraService] 🎥 生成摄像头信息:', JSON.stringify(logInfo));
return cameraInfo;
});
}
/**
* 生成视频流URL
* @param cameraId 摄像头ID
* @returns string 视频流URL
*/
static generateStreamUrl(cameraId: string): string {
const streamUrl = `${AppConstants.WEBRTC_BASE_URL}/live/${cameraId}_01.flv`;
const logInfo: StreamLogInfo = {
cameraId: cameraId,
streamUrl: streamUrl
};
console.info('[CameraService] 🔗 生成视频流URL:', JSON.stringify(logInfo));
return streamUrl;
}
/**
* 生成带时间戳的视频流URL(用于刷新)
* @param cameraId 摄像头ID
* @returns string 带时间戳的视频流URL
*/
static generateRefreshStreamUrl(cameraId: string): string {
const timestamp = Date.now();
const refreshUrl = `${CameraService.generateStreamUrl(cameraId)}?t=${timestamp}`;
const logInfo: RefreshLogInfo = {
cameraId: cameraId,
timestamp: timestamp,
refreshUrl: refreshUrl
};
console.info('[CameraService] 🔄 生成刷新视频流URL:', JSON.stringify(logInfo));
return refreshUrl;
}
/**
* 获取摄像头信息列表(设备列表 + 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}`);
}
}
/**
* 测试摄像头服务连接
* @returns Promise<boolean> 连接测试结果
*/
static async testConnection(): Promise<boolean> {
try {
console.info('[CameraService] 🔍 测试摄像头服务连接');
const devices = await CameraService.getCameraDevices();
const isConnected = devices.length >= 0; // 即使没有设备,能正常响应也算连接成功
const logInfo: ConnectionLogInfo = {
isConnected: isConnected,
deviceCount: devices.length
};
console.info('[CameraService] ✅ 摄像头服务连接测试结果:', JSON.stringify(logInfo));
return isConnected;
} catch (error) {
console.error('[CameraService] ❌ 摄像头服务连接测试失败:', error);
return false;
}
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CameraService AST#class_body#Left { // 摄像头服务认证头 AST#property_declaration#Left private static readonly AUTH_HEADER = AST#expression#Left 'Basic YWRtaW4xMjM6QWRtaW5AMTIz' AST#expression#Right ; AST#property_declaration#Right /**
* 获取摄像头设备列表
* @returns Promise<CameraDevice[]> 摄像头设备列表
*/ AST#method_declaration#Left static async getCameraDevices 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 CameraDevice [ ] 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 url = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . CAMERA_BASE_URL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /devices?page=1&size=999&status=&id&name ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[CameraService] 📹 请求URL:' AST#expression#Right , AST#expression#Left url AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 HttpUtil 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 url AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Authorization' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CameraService AST#expression#Right . AUTH_HEADER AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , 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#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . REQUEST_TIMEOUT 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#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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dataType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left response AST#expression#Right AST#unary_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left hasData AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 response AST#expression#Right . code AST#member_expression#Right AST#expression#Right === AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 摄像头API直接返回数据,不是包装在HttpResponse中 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left responseData : AST#type_annotation#Left AST#primary_type#Left CameraResponseData 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 response AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 如果data存在,说明是包装的响应 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left responseData = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left CameraResponseData AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 如果data不存在,可能需要从原始响应中解析 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[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#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 responseData AST#expression#Right && AST#expression#Left responseData AST#expression#Right AST#binary_expression#Right AST#expression#Right . items AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left devices = AST#expression#Left AST#member_expression#Left AST#expression#Left responseData AST#expression#Right . items 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 logInfo : AST#type_annotation#Left AST#primary_type#Left DeviceLogInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left deviceCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left devices AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left deviceIds AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left devices 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 d : AST#type_annotation#Left AST#primary_type#Left CameraDevice AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left d AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 devices AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . msg AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#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 /**
* 将摄像头设备转换为UI显示信息
* @param devices 摄像头设备列表
* @returns CameraInfo[] UI显示的摄像头信息列表
*/ AST#method_declaration#Left static convertToCameraInfo AST#parameter_list#Left ( AST#parameter#Left devices : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CameraDevice [ ] 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#array_type#Left CameraInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left devices 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 device AST#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cameraInfo : AST#type_annotation#Left AST#primary_type#Left CameraInfo AST#primary_type#Right AST#type_annotation#Right = 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 device 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left device AST#expression#Right . name AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#template_literal#Left ` 摄像头 AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CameraService AST#expression#Right . generateStreamUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left device AST#expression#Right . id 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 status AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left device AST#expression#Right . status AST#member_expression#Right AST#expression#Right || AST#expression#Left 'unknown' 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#variable_declaration#Left const AST#variable_declarator#Left logInfo : AST#type_annotation#Left AST#primary_type#Left CameraLogInfo 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#member_expression#Left AST#expression#Left device AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cameraName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left cameraInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left streamUrl AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left cameraInfo AST#expression#Right . url AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 cameraInfo AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成视频流URL
* @param cameraId 摄像头ID
* @returns string 视频流URL
*/ AST#method_declaration#Left static generateStreamUrl AST#parameter_list#Left ( AST#parameter#Left cameraId : 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 const AST#variable_declarator#Left streamUrl = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . WEBRTC_BASE_URL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /live/ AST#template_substitution#Left $ { AST#expression#Left cameraId AST#expression#Right } AST#template_substitution#Right _01.flv ` 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 logInfo : AST#type_annotation#Left AST#primary_type#Left StreamLogInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left cameraId AST#property_name#Right : AST#expression#Left cameraId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left streamUrl AST#property_name#Right : AST#expression#Left streamUrl 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] 🔗 生成视频流URL:' 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 streamUrl AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 生成带时间戳的视频流URL(用于刷新)
* @param cameraId 摄像头ID
* @returns string 带时间戳的视频流URL
*/ AST#method_declaration#Left static generateRefreshStreamUrl AST#parameter_list#Left ( AST#parameter#Left cameraId : 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 const AST#variable_declarator#Left timestamp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left refreshUrl = 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 CameraService AST#expression#Right . generateStreamUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cameraId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ?t= AST#template_substitution#Left $ { AST#expression#Left timestamp 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 logInfo : AST#type_annotation#Left AST#primary_type#Left RefreshLogInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left cameraId AST#property_name#Right : AST#expression#Left cameraId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timestamp AST#property_name#Right : AST#expression#Left timestamp AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left refreshUrl AST#property_name#Right : AST#expression#Left refreshUrl 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] 🔄 生成刷新视频流URL:' 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 refreshUrl AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取摄像头信息列表(设备列表 + UI信息转换的组合方法)
* @returns Promise<CameraInfo[]> 摄像头信息列表
*/ 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 /**
* 测试摄像头服务连接
* @returns Promise<boolean> 连接测试结果
*/ AST#method_declaration#Left static async testConnection 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[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 isConnected = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left devices 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#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 ConnectionLogInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left isConnected AST#property_name#Right : AST#expression#Left isConnected AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left deviceCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left devices AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 isConnected 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#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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class CameraService {
private static readonly AUTH_HEADER = 'Basic YWRtaW4xMjM6QWRtaW5AMTIz';
static async getCameraDevices(): Promise<CameraDevice[]> {
try {
console.info('[CameraService] 📹 开始获取摄像头设备列表');
const url = `${AppConstants.CAMERA_BASE_URL}/devices?page=1&size=999&status=&id&name`;
console.info('[CameraService] 📹 请求URL:', url);
const response = await HttpUtil.request(url, {
method: http.RequestMethod.GET,
headers: {
'Authorization': CameraService.AUTH_HEADER,
'Content-Type': 'application/json'
},
timeout: AppConstants.REQUEST_TIMEOUT
});
console.info('[CameraService] 📹 摄像头服务响应:', JSON.stringify({
code: response.code,
dataType: typeof response.data,
hasData: response.data ? true : false
}));
if (response.code === 200) {
let responseData: CameraResponseData;
if (response.data) {
responseData = response.data as CameraResponseData;
} else {
console.warn('[CameraService] ⚠️ 响应数据为空,尝试其他解析方式');
return [];
}
if (responseData && responseData.items) {
const devices = responseData.items;
const logInfo: DeviceLogInfo = {
deviceCount: devices.length,
deviceIds: devices.map((d: CameraDevice) => d.id)
};
console.info('[CameraService] ✅ 成功获取摄像头设备列表:', JSON.stringify(logInfo));
return devices;
}
}
console.warn('[CameraService] ⚠️ 摄像头服务返回异常:', JSON.stringify({
code: response.code,
msg: response.msg,
data: response.data
}));
return [];
} catch (error) {
console.error('[CameraService] ❌ 获取摄像头设备列表失败:', error);
throw new Error(`获取摄像头设备列表失败: ${error}`);
}
}
static convertToCameraInfo(devices: CameraDevice[]): CameraInfo[] {
return devices.map((device, index) => {
const cameraInfo: CameraInfo = {
id: device.id,
name: device.name || `摄像头${index + 1}`,
url: CameraService.generateStreamUrl(device.id),
status: device.status || 'unknown'
};
const logInfo: CameraLogInfo = {
deviceId: device.id,
cameraName: cameraInfo.name,
streamUrl: cameraInfo.url
};
console.info('[CameraService] 🎥 生成摄像头信息:', JSON.stringify(logInfo));
return cameraInfo;
});
}
static generateStreamUrl(cameraId: string): string {
const streamUrl = `${AppConstants.WEBRTC_BASE_URL}/live/${cameraId}_01.flv`;
const logInfo: StreamLogInfo = {
cameraId: cameraId,
streamUrl: streamUrl
};
console.info('[CameraService] 🔗 生成视频流URL:', JSON.stringify(logInfo));
return streamUrl;
}
static generateRefreshStreamUrl(cameraId: string): string {
const timestamp = Date.now();
const refreshUrl = `${CameraService.generateStreamUrl(cameraId)}?t=${timestamp}`;
const logInfo: RefreshLogInfo = {
cameraId: cameraId,
timestamp: timestamp,
refreshUrl: refreshUrl
};
console.info('[CameraService] 🔄 生成刷新视频流URL:', JSON.stringify(logInfo));
return refreshUrl;
}
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}`);
}
}
static async testConnection(): Promise<boolean> {
try {
console.info('[CameraService] 🔍 测试摄像头服务连接');
const devices = await CameraService.getCameraDevices();
const isConnected = devices.length >= 0;
const logInfo: ConnectionLogInfo = {
isConnected: isConnected,
deviceCount: devices.length
};
console.info('[CameraService] ✅ 摄像头服务连接测试结果:', JSON.stringify(logInfo));
return isConnected;
} catch (error) {
console.error('[CameraService] ❌ 摄像头服务连接测试失败:', error);
return false;
}
}
}
|
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/CameraService.ets#L90-L260
|
0d9c44b8dbcea5ea2037ba9b9e68367a04faa805
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/game/GameificationService.ets
|
arkts
|
getUserGameData
|
获取用户游戏数据
|
getUserGameData(): UserGameData | null {
return this.userGameData;
}
|
AST#method_declaration#Left getUserGameData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left UserGameData AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userGameData AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getUserGameData(): UserGameData | null {
return this.userGameData;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L433-L435
|
50205af5fc170611400ee0bffa695e721cfc076b
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets
|
arkts
|
get
|
MARK: - Getter 方法
获取天数编号
|
get num(): number {
return this._num;
}
|
AST#method_declaration#Left get AST#ERROR#Left num AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _num AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
get num(): number {
return this._num;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets#L28-L30
|
f4fa09cb6769f94b0b83701d2d49a631873a8229
|
github
|
XiangRui_FuZi/harmony-oscourse
|
da885f9a777a1eace7a07e1cd81137746687974b
|
class1/entry/src/main/ets/component/Community.ets
|
arkts
|
onSortOrderChange
|
切换排序顺序
|
private onSortOrderChange() {
this.sortOrder = this.sortOrder === 'newest' ? 'oldest' : 'newest'
this.filterAndSortPosts()
}
|
AST#method_declaration#Left private onSortOrderChange 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 . sortOrder 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 this AST#expression#Right . sortOrder AST#member_expression#Right AST#expression#Right === AST#expression#Left 'newest' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 'oldest' AST#expression#Right : AST#expression#Left 'newest' AST#expression#Right AST#conditional_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 this AST#expression#Right . filterAndSortPosts 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
|
private onSortOrderChange() {
this.sortOrder = this.sortOrder === 'newest' ? 'oldest' : 'newest'
this.filterAndSortPosts()
}
|
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/component/Community.ets#L95-L98
|
a76a56540f931f62204516880ae7820c9e57961c
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets
|
arkts
|
pointInArea
|
区域判断
|
pointInArea(x: number, y: number, area: Array<number>): boolean {
logger.info(TAG, ' x=' + x + " y=" + y + " area =" + area)
if (area.length == 4) {
if (x >= area[0] && x <= area[2]) {
return true;
} else {
return false;
}
} else {
return false;
}
}
|
AST#method_declaration#Left pointInArea AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left area : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ' x=' AST#expression#Right + AST#expression#Left x AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left " y=" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left y AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left " area =" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left area 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 area AST#expression#Right . length AST#member_expression#Right AST#expression#Right == AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left x AST#expression#Right >= AST#expression#Left AST#subscript_expression#Left AST#expression#Left area 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 AST#binary_expression#Left AST#expression#Left x AST#expression#Right <= AST#expression#Left AST#subscript_expression#Left AST#expression#Left area AST#expression#Right [ AST#expression#Left 2 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#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } else { AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#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
|
pointInArea(x: number, y: number, area: Array<number>): boolean {
logger.info(TAG, ' x=' + x + " y=" + y + " area =" + area)
if (area.length == 4) {
if (x >= area[0] && x <= area[2]) {
return true;
} else {
return false;
}
} else {
return false;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L459-L471
|
6e0e063606759510467b804f2f8afaa09fc49092
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets
|
arkts
|
onCastPlayDuration
|
投屏播放时长。
@param duration:number 播放总时长 ,单位ms
|
onCastPlayDuration(duration: number) {
}
|
AST#method_declaration#Left onCastPlayDuration AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
|
onCastPlayDuration(duration: number) {
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets#L305-L307
|
22548e36778df15f95318df79c78303d64ee7425
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/networks/HttpUtils.ets
|
arkts
|
Http Header中的参数名
|
export class Header {
// 每次发起Http请求 都需要在Header中 加入下面这4个参数
static readonly appKey: string = "appkey";
static readonly timestamp: string = "timestamp";
static readonly sign: string = "sign"; // MD5
static readonly sign2: string = "sign2"; // SHA256
static readonly device: string = "device";
}
|
AST#export_declaration#Left export AST#class_declaration#Left class Header AST#class_body#Left { // 每次发起Http请求 都需要在Header中 加入下面这4个参数 AST#property_declaration#Left static readonly appKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "appkey" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly timestamp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "timestamp" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly sign : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "sign" AST#expression#Right ; AST#property_declaration#Right // MD5 AST#property_declaration#Left static readonly sign2 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "sign2" AST#expression#Right ; AST#property_declaration#Right // SHA256 AST#property_declaration#Left static readonly device : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "device" AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class Header {
static readonly appKey: string = "appkey";
static readonly timestamp: string = "timestamp";
static readonly sign: string = "sign";
static readonly sign2: string = "sign2";
static readonly device: string = "device";
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/HttpUtils.ets#L37-L44
|
fa0ceaf7c9f39c934e08e77e84b453bb3bc172fd
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/Index_backup.ets
|
arkts
|
buildGreetingsContent
|
构建祝福语内容占位符
|
@Builder
buildGreetingsContent() {
Text('祝福语页面')
.fontSize(18)
.fontColor('#333333')
.textAlign(TextAlign.Center)
.width('100%')
.height('100%')
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingsContent 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 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 '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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#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
buildGreetingsContent() {
Text('祝福语页面')
.fontSize(18)
.fontColor('#333333')
.textAlign(TextAlign.Center)
.width('100%')
.height('100%')
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L750-L758
|
bb033089a43ead85f5c037bead3fef36d7f258e6
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets
|
arkts
|
runVersionUpdateIfNeeded
|
/ 如果需要更新,则执行更新逻辑
|
public async runVersionUpdateIfNeeded(updateProcess: (oldVersion: string, newVersion: string) => void): Promise<void> {
// 仅在首次启动且当前版本未执行过更新时,才执行更新逻辑
if (!await this.isFirstLaunchOfCurrentVersion()) {
return;
}
// 执行更新
updateProcess(this._oldVersion, this._newVersion);
// 更新版本历史
await this.markVersionAsUpdated();
}
|
AST#method_declaration#Left public async runVersionUpdateIfNeeded AST#parameter_list#Left ( AST#parameter#Left updateProcess : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left oldVersion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newVersion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . isFirstLaunchOfCurrentVersion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#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 updateProcess AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _oldVersion AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _newVersion AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 更新版本历史 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . markVersionAsUpdated AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public async runVersionUpdateIfNeeded(updateProcess: (oldVersion: string, newVersion: string) => void): Promise<void> {
if (!await this.isFirstLaunchOfCurrentVersion()) {
return;
}
updateProcess(this._oldVersion, this._newVersion);
await this.markVersionAsUpdated();
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets#L61-L72
|
3a52ff07c7c1e983cfb9731571d71d1df7891273
|
github
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/utils/data_operation_tools.ets
|
arkts
|
Determines if a label-link pair (label, link) matches the key word.
@param label The label.
@param link The link.
@param key The key to be searched.
@param filter The filter mode. 0 = Label, 1 = Link, 2 = Both.
@returns True if matches and False if doesn't meet requirement.
|
export function label_link_match_key(label: string, link: string, key: string[], filter: number, match_coefficient: number): boolean {
if (filter == 0) {
return match_with_coefficient(label, key, match_coefficient);
}
if (filter == 1) {
return match_with_coefficient(link, key, match_coefficient);
}
return match_with_coefficient(label, key, match_coefficient) || match_with_coefficient(link, key, match_coefficient);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function label_link_match_key AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left link : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#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#Left filter : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left match_coefficient : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left filter AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left match_with_coefficient AST#expression#Right AST#argument_list#Left ( AST#expression#Left label AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left match_coefficient 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left filter 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#call_expression#Left AST#expression#Left match_with_coefficient AST#expression#Right AST#argument_list#Left ( AST#expression#Left link AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left match_coefficient 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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left match_with_coefficient AST#expression#Right AST#argument_list#Left ( AST#expression#Left label AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left match_coefficient AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left match_with_coefficient AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left link AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left match_coefficient 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 label_link_match_key(label: string, link: string, key: string[], filter: number, match_coefficient: number): boolean {
if (filter == 0) {
return match_with_coefficient(label, key, match_coefficient);
}
if (filter == 1) {
return match_with_coefficient(link, key, match_coefficient);
}
return match_with_coefficient(label, key, match_coefficient) || match_with_coefficient(link, key, match_coefficient);
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/data_operation_tools.ets#L40-L48
|
459bdb6b05c69ef74f574447e4fa53fd323ead97
|
gitee
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/member/MemberManager.ets
|
arkts
|
checkAutoPronUsable
|
============================================================ MARK: - Check Lock functions / 检查 是否可以使用自动发音
|
public checkAutoPronUsable(showMessage: boolean = true): boolean {
if (!this.nonMember.isLockedAutoPron) { return true } // 非会员 锁定自动发音 功能是否启用
if (this.isActive) { return true } // 非会员才做检查
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_auto_pron'))
}
return false
}
|
AST#method_declaration#Left public checkAutoPronUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . nonMember AST#member_expression#Right AST#expression#Right . isLockedAutoPron AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 非会员 锁定自动发音 功能是否启用 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isActive AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 非会员才做检查 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left showMessage 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 Toast AST#expression#Right . showMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.member_manager_msg_limit_auto_pron' 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#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public checkAutoPronUsable(showMessage: boolean = true): boolean {
if (!this.nonMember.isLockedAutoPron) { return true }
if (this.isActive) { return true }
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_auto_pron'))
}
return false
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L290-L299
|
c79f8c861f4d1b7a74274186528f7f1999006d25
|
github
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/utils/PromptUtils.ets
|
arkts
|
显示成功提示
@param message 消息内容
|
export function showSuccess(message: string) {
try {
promptAction.showToast({
message: message,
duration: 2000
});
} catch (error) {
console.error('显示成功提示失败:', error);
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function showSuccess AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left message AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( 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#function_declaration#Right AST#export_declaration#Right
|
export function showSuccess(message: string) {
try {
promptAction.showToast({
message: message,
duration: 2000
});
} catch (error) {
console.error('显示成功提示失败:', error);
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/PromptUtils.ets#L93-L102
|
348b0d5377327d55e8589a4c0f9f22b055ff840f
|
github
|
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/encryption/SHA1.ets
|
arkts
|
sha1_kt
|
Determine the appropriate additive constant for the current iteration
返回对应的Kt值
|
sha1_kt(t: number) {
return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : (t < 60) ? -1894007588 : -899497514;
}
|
AST#method_declaration#Left sha1_kt AST#parameter_list#Left ( AST#parameter#Left t : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left t AST#expression#Right < AST#expression#Left 20 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 1518500249 AST#expression#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left t AST#expression#Right < AST#expression#Left 40 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 1859775393 AST#expression#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left t AST#expression#Right < AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1894007588 AST#expression#Right AST#unary_expression#Right AST#expression#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 899497514 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
sha1_kt(t: number) {
return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : (t < 60) ? -1894007588 : -899497514;
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHA1.ets#L146-L150
|
9854d73a9b9d532e6cfd4a326246068ed3ffba5c
|
gitee
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/modules/live/LiveManager.ets
|
arkts
|
play
|
播放直播
|
async play(): Promise<boolean> {
try {
if (!this.currentRoom) {
return false;
}
Logger.info('LiveManager', 'Playing live stream');
this.liveStatus.isPlaying = true;
EventBus.emit('LIVE_PLAYING');
return true;
} catch (error) {
Logger.error('LiveManager', `Failed to play: ${String(error)}`);
return false;
}
}
|
AST#method_declaration#Left async play 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#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 . currentRoom AST#member_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#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 'LiveManager' AST#expression#Right , AST#expression#Left 'Playing live stream' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . liveStatus AST#member_expression#Right AST#expression#Right . isPlaying AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBus AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'LIVE_PLAYING' AST#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 ( 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 'LiveManager' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to play: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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
|
async play(): Promise<boolean> {
try {
if (!this.currentRoom) {
return false;
}
Logger.info('LiveManager', 'Playing live stream');
this.liveStatus.isPlaying = true;
EventBus.emit('LIVE_PLAYING');
return true;
} catch (error) {
Logger.error('LiveManager', `Failed to play: ${String(error)}`);
return false;
}
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/live/LiveManager.ets#L105-L118
|
20ed5dee087cd2c2d853654e598987dcd7e53a4c
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/arkweb/ArkJsObject.ets
|
arkts
|
getName
|
接口注册用到
|
getName(): string {
return this.name;
}
|
AST#method_declaration#Left getName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . name AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getName(): string {
return this.name;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkJsObject.ets#L25-L27
|
a5464aef91578a66ee103a56c51f91bb51e1bcd4
|
gitee
|
lulululing/calendar.git
|
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
|
entry/src/main/ets/utils/LunarUtil.ets
|
arkts
|
getSolarFestival
|
获取阳历节日
|
static getSolarFestival(date: Date): string {
const month = date.getMonth() + 1
const day = date.getDate()
const key = `${month}-${day}`
return LunarUtil.solarFestivals.get(key) || ''
}
|
AST#method_declaration#Left static getSolarFestival AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left month = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 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 day = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left month AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left day AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LunarUtil AST#expression#Right . solarFestivals AST#member_expression#Right 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#expression#Right AST#binary_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getSolarFestival(date: Date): string {
const month = date.getMonth() + 1
const day = date.getDate()
const key = `${month}-${day}`
return LunarUtil.solarFestivals.get(key) || ''
}
|
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/LunarUtil.ets#L203-L208
|
ab1b87e2712e4772b12e0f27d450147a45b4c81a
|
github
|
lime-zz/Ark-ui_RubbishRecycleApp.git
|
c2a9bff8fbb5bc46d922934afad0327cc1696969
|
rubbish/rubbish/entry/src/main/ets/pages/Shangpingsousuoyoujieguo.ets
|
arkts
|
highlightFanText
|
高亮"风扇"文字为粉色
|
private highlightFanText(name: string): string {
return name.replace('风扇', '风扇');
}
|
AST#method_declaration#Left private highlightFanText AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left name AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '风扇' AST#expression#Right , AST#expression#Left '风扇' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private highlightFanText(name: string): string {
return name.replace('风扇', '风扇');
}
|
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Shangpingsousuoyoujieguo.ets#L132-L134
|
756513a0722ea6c5ea00e889bc4712de3ff30d52
|
github
|
didi/dimina.git
|
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
|
harmony/dimina/src/main/ets/DApp/DMPAppLifecycle.ets
|
arkts
|
onShow
|
框架接口 / 小程序 App / App https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onHide
|
static onShow() {
DMPAppLifecycle.onAppShow()
}
|
AST#method_declaration#Left static onShow 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 DMPAppLifecycle AST#expression#Right . onAppShow 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
|
static onShow() {
DMPAppLifecycle.onAppShow()
}
|
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/DApp/DMPAppLifecycle.ets#L23-L25
|
78d00d478fc431b2dd7a19ed4dd046038e3ab5cb
|
github
|
openharmony/update_update_app
|
0157b7917e2f48e914b5585991e8b2f4bc25108a
|
feature/ota/src/main/ets/dialog/DialogHelper.ets
|
arkts
|
defaultNoTitleDialog
|
默认无标题弹框
@param message 内容
@param operator 回调
|
function defaultNoTitleDialog(message: string | Resource, operator ?: DialogOperator): void {
showDialog(null, message, $r('app.string.button_know'), operator);
}
|
AST#function_declaration#Left function defaultNoTitleDialog AST#parameter_list#Left ( AST#parameter#Left message : 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#Left operator ? : AST#type_annotation#Left AST#primary_type#Left DialogOperator 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 showDialog AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left message AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.button_know' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left operator AST#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
|
function defaultNoTitleDialog(message: string | Resource, operator ?: DialogOperator): void {
showDialog(null, message, $r('app.string.button_know'), operator);
}
|
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/DialogHelper.ets#L154-L156
|
813994b7e04667723a0c03e9df9e6df92698c511
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_json/src/main/ets/json/JSONObject.ets
|
arkts
|
@Author csx
@DateTime 2024/4/25 19:25:04
@TODO JSONObject 定义json对象
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_json
|
export class JSONObject extends HashMap<string, JSONValue> {
/**
* json字符串转换为JSONObject对象
* @param jsonStr json字符串
* @returns JSONObject 对象
*/
public static parse(jsonStr: string): JSONObject {
let json = new JSONObject();
//去除字符串中的换行符
const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n');
//转换成json对象
let jVal: Record<string, JSONValue> = JSON.parse(replaceStr);
//循环赋值
Object.entries(jVal).forEach((item) => {
if (item[1] instanceof JSONObject) {
json.set(item[0], JSONObject.from(item[1]));
} else if (item[1] instanceof Array) {
json.set(item[0], JSONArray.from(item[1]));
} else if (item[1] instanceof JSONArray) {
json.set(item[0], JSONArray.from(item[1]));
} else if (item[1] instanceof JSONArrayList) {
json.set(item[0], JSONArrayList.from(item[1]));
} else if (item[1] instanceof Date) {
json.set(item[0], DateUtil.format(item[1], DateConst.YMD_HLINE_HMS));
} else if (item[1] instanceof Object) {
json.set(item[0], JSONObject.from(item[1]));
} else {
json.set(item[0], item[1]);
}
})
return json;
}
/**
* 递归解析字符串
* @param nestedJson 待解析的json
* @param convertDateStr 是否将日期字符串转换为日期对象
* @returns 解析后的结果
*/
private static parseNestedObject<U>(nestedJson: Record<string, JSONValue>, convertDateStr: boolean = true): U {
let nestedData: Record<string, JSONValue> = {};
for (let key of Object.entries(nestedJson)) {
if (typeof nestedJson[key[0]] === 'object' && nestedJson[key[0]] !== null) {
if (nestedJson[key[0]] instanceof Date && convertDateStr == true) {
nestedData[key[0]] = new Date(nestedJson[key[0]] as string);
} else if (Array.isArray(nestedJson[key[0]])) {
nestedData[key[0]] =
(nestedJson[key[0]] as Array<Record<string, JSONValue>>).map(item => JSONObject.parseNestedObject(item,
convertDateStr));
} else {
nestedData[key[0]] =
JSONObject.parseNestedObject(nestedJson[key[0]] as Record<string, JSONValue>, convertDateStr);
}
} else if (typeof nestedJson[key[0]] === 'string') {
if (DateUtil.isDate(nestedJson[key[0]] as string) && convertDateStr == true) {
nestedData[key[0]] = new Date(nestedJson[key[0]] as string);
} else {
nestedData[key[0]] = nestedJson[key[0]];
}
} else {
nestedData[key[0]] = nestedJson[key[0]];
}
}
return nestedData as U;
}
/**
* json字符串转换为实体对象
* @param jsonStr json字符串
* @param convertDateStr 是否将日期字符串转换成日期对象 - 默认为true
* @returns T 对象
*/
public static parseObject<T>(jsonStr: string, convertDateStr: boolean = true): T {
//处理如果带有转义符号的
const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n');
//转换
let json: Record<string, JSONValue> = JSON.parse(replaceStr);
let data: T = JSONObject.parseNestedObject<T>(json, convertDateStr);
return data;
}
/**
* Object对象换为json字符串
* @param object object对象
* @returns JSON字符串
*/
public static toJSONString(object: Object): string {
if (object instanceof Map) {
let map = new HashMap<string, JSONValue>();
(object as Map<string, JSONValue>).forEach((val, key) => {
map.set(key, val);
})
//获取key迭代器
let iter: IterableIterator<string> = map.keys();
return new JSONObject().convertString(iter, map);
}
//转换成字符串
let str = JSON.stringify(object);
//转换成json对象
let jVal: Record<string, JSONValue> = JSON.parse(str);
//如果是数组直接转换返回
if (Array.isArray(jVal)) {
return JSONArray.toJSONString(jVal);
}
let map = new HashMap<string, JSONValue>();
//转换成map
Object.entries(jVal).forEach(item => {
map.set(item[0], item[1]);
})
//获取key迭代器
let iter: IterableIterator<string> = map.keys();
return new JSONObject().convertString(iter, map);
}
/**
* 实体对象转换为JSONObject对象
* @param bean 实体对象
* @returns JSONObject 对象
*/
public static from<T>(bean: T): JSONObject {
let json = new JSONObject();
//转换成字符串
let str = JSON.stringify(bean);
//转换成json对象
let jVal: Record<string, JSONValue> = JSON.parse(str);
//循环赋值
Object.entries(jVal).forEach((item) => {
if (item[1] instanceof JSONObject) {
json.set(item[0], JSONObject.from(item[1]));
} else if (item[1] instanceof Array) {
json.set(item[0], JSONArray.from(item[1]));
} else if (item[1] instanceof JSONArray) {
json.set(item[0], JSONArray.from(item[1]));
} else if (item[1] instanceof JSONArrayList) {
json.set(item[0], JSONArrayList.from(item[1]));
} else if (item[1] instanceof Date) {
json.set(item[0], DateUtil.format(item[1], DateConst.YMD_HLINE_HMS));
} else if (item[1] instanceof Object) {
json.set(item[0], JSONObject.from(item[1]));
} else if (typeof item[1] === 'string') {
if (DateUtil.isDate(item[1])) {
json.set(item[0], DateUtil.formatDate(item[1], DateConst.YMD_HLINE_HMS));
} else {
json.set(item[0], item[1]);
}
} else {
json.set(item[0], item[1]);
}
})
return json;
}
/**
* 迭代转换json
* @param iter 迭代器
* @returns json字符串
*/
private convertString(iter: IterableIterator<string>, map?: HashMap<string, JSONValue>): string {
//转换的字符串
let sb: StringBuilder = new StringBuilder();
//拼接左括号
sb.append(Const.zkh);
// 是否为第一个字符
let isFirst: boolean = true;
//迭代获取值转换成字符串
for (const key of iter) {
if (!isFirst) {
//拼接逗号
sb.append(Const.dh);
}
isFirst = false;
//获取值
let val: JSONValue = '';
if (map && map.length > 0) {
val = map.get(key);
}
//判断类型
if (val instanceof JSONObject) {
sb.append(Const.quot + key + Const.quot + Const.mh + (val as JSONObject).toString());
} else if (val instanceof Array) {
let jArr = new JSONArray();
(val as Array<JSONValue>).forEach(item => {
jArr.push(item);
});
sb.append(Const.quot + key + Const.quot + Const.mh + jArr.toString());
} else if (val instanceof JSONArray) {
sb.append(Const.quot + key + Const.quot + Const.mh + (val as JSONArray).toString());
} else if (val instanceof JSONArrayList) {
sb.append(Const.quot + key + Const.quot + Const.mh + (val as JSONArrayList).toString());
} else if (val instanceof Date) {
sb.append(Const.quot + key + Const.quot + Const.mh + Const.quot +
DateUtil.format((val as Date), DateConst.YMD_HLINE_HMS) + Const.quot);
} else if (val instanceof Object) {
//转换成字符串
let str = JSON.stringify(val);
//转换成json对象
let jVal: Record<string, JSONValue> = JSON.parse(str);
//接收
let jo = new JSONObject();
//循环赋值
Object.entries(jVal).forEach((item) => {
jo.set(item[0], item[1]);
})
sb.append(Const.quot + key + Const.quot + Const.mh + jo.toString());
} else if (typeof val === 'string') {
// if (DateUtil.isDate(val)) {
// sb.append(Const.quot + key + Const.quot + Const.mh + Const.quot +
// DateUtil.formatDate(val, DateConst.YMD_HLINE_HMS) + Const.quot);
// } else {
// sb.append(Const.quot + key + Const.quot + Const.mh + Const.quot + val + Const.quot);
// }
sb.append(Const.quot + key + Const.quot + Const.mh + Const.quot + val + Const.quot);
} else if (typeof val === 'number' || typeof val === 'boolean') {
sb.append(Const.quot + key + Const.quot + Const.mh + val);
} else {
sb.append(Const.quot + key + Const.quot + Const.mh + null);
}
}
//拼接右括号
sb.append(Const.ykh);
return sb.toString();
}
/**
* 将本对象转换成json字符串
* @returns
*/
public toString(): string {
//获取key的迭代器
let iter: IterableIterator<string> = this.keys();
//转换数据
return new JSONObject().convertString(iter, this);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class JSONObject extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HashMap AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue 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#class_body#Left { /**
* json字符串转换为JSONObject对象
* @param jsonStr json字符串
* @returns JSONObject 对象
*/ AST#method_declaration#Left public static parse AST#parameter_list#Left ( AST#parameter#Left jsonStr : 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 JSONObject AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#ERROR#Left AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left json = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JSONObject 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 //去除字符串中的换行符 const AST#variable_declarator#Left replaceStr = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left jsonStr AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / \r\n AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right , '\\r\\n' ) AST#modifier_chain_expression#Left . replace ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#expression#Right AST#ERROR#Left / \r AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '\\r' AST#expression#Right ) AST#modifier_chain_expression#Left . replace ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#expression#Right AST#ERROR#Left / \n AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '\\n' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right ; AST#ERROR#Right //转换成json对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left jVal : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left replaceStr AST#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left jVal AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item 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#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left JSONObject 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONObject AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left Array AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONArray AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left JSONArray 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONArray AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left JSONArrayList 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONArrayList AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left Date 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . format AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left DateConst AST#expression#Right . YMD_HLINE_HMS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left Object 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONObject AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left json AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 递归解析字符串
* @param nestedJson 待解析的json
* @param convertDateStr 是否将日期字符串转换为日期对象
* @returns 解析后的结果
*/ AST#method_declaration#Left private static parseNestedObject AST#type_parameters#Left < AST#type_parameter#Left U AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left nestedJson : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left convertDateStr : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left U AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left nestedData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let key of AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left nestedJson AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left nestedJson AST#expression#Right AST#unary_expression#Right AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left 'object' 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 nestedJson AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedJson AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left Date AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left convertDateStr AST#expression#Right == AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedData AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedJson AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Array AST#expression#Right . isArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedJson AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#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#call_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedData AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedJson AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as 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 AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue 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#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONObject AST#expression#Right . parseNestedObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right , AST#expression#Left convertDateStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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#subscript_expression#Left AST#expression#Left nestedData AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = JSONObject AST#ERROR#Right . parseNestedObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedJson AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left convertDateStr AST#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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left nestedJson AST#expression#Right AST#unary_expression#Right AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . isDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedJson AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left convertDateStr AST#expression#Right == AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedData AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedJson AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedData AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = nestedJson AST#ERROR#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#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#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left nestedData AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = nestedJson AST#ERROR#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left key AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#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#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left nestedData AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left U AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* json字符串转换为实体对象
* @param jsonStr json字符串
* @param convertDateStr 是否将日期字符串转换成日期对象 - 默认为true
* @returns T 对象
*/ AST#method_declaration#Left public static parseObject AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left jsonStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left convertDateStr : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //处理如果带有转义符号的 AST#ERROR#Left const AST#variable_declarator#Left replaceStr = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left jsonStr AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / \r\n AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right , '\\r\\n' ) AST#modifier_chain_expression#Left . replace ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#expression#Right AST#ERROR#Left / \r AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '\\r' AST#expression#Right ) AST#modifier_chain_expression#Left . replace ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#expression#Right AST#ERROR#Left / \n AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '\\n' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right ; AST#ERROR#Right //转换 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left json : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left replaceStr AST#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 data : AST#type_annotation#Left AST#primary_type#Left T 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 JSONObject AST#expression#Right . parseNestedObject AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left json AST#expression#Right , AST#expression#Left convertDateStr AST#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 data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Object对象换为json字符串
* @param object object对象
* @returns JSON字符串
*/ AST#method_declaration#Left public static toJSONString AST#parameter_list#Left ( AST#parameter#Left object : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left object AST#expression#Right instanceof AST#expression#Left Map AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left map = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left HashMap AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left object AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left val AST#parameter#Right , AST#parameter#Left key 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 map AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left val AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right //获取key迭代器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left iter : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left map AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JSONObject 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 . convertString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left iter AST#expression#Right , AST#expression#Left map 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#variable_declaration#Left let AST#variable_declarator#Left str = 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 object AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换成json对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left jVal : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 Array AST#expression#Right . isArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left jVal AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONArray AST#expression#Right . toJSONString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left jVal 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#variable_declaration#Left let AST#variable_declarator#Left map = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left HashMap AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换成map AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left jVal AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left map AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 //获取key迭代器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left iter : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left map AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JSONObject 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 . convertString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left iter AST#expression#Right , AST#expression#Left map 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 /**
* 实体对象转换为JSONObject对象
* @param bean 实体对象
* @returns JSONObject 对象
*/ AST#method_declaration#Left public static from AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left bean : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left JSONObject AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left json = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JSONObject AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换成字符串 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left str = 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 bean AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换成json对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left jVal : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //循环赋值 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left jVal AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item 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#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left JSONObject 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONObject AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left Array AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONArray AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left JSONArray 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONArray AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left JSONArrayList 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONArrayList AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left Date 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . format AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left DateConst AST#expression#Right . YMD_HLINE_HMS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right instanceof AST#expression#Left Object 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONObject AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left item AST#expression#Right AST#unary_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . isDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . formatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left DateConst AST#expression#Right . YMD_HLINE_HMS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 json AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left json AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 迭代转换json
* @param iter 迭代器
* @returns json字符串
*/ AST#method_declaration#Left private convertString AST#parameter_list#Left ( AST#parameter#Left iter : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left map ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HashMap AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue 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 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 sb : AST#type_annotation#Left AST#primary_type#Left StringBuilder 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 StringBuilder AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //拼接左括号 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sb AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . zkh 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#variable_declaration#Left let AST#variable_declarator#Left isFirst : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //迭代获取值转换成字符串 AST#statement#Left AST#for_statement#Left for ( const key of AST#expression#Left iter AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isFirst 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 sb AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . dh AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left isFirst = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //获取值 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left val : AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left map AST#expression#Right && AST#expression#Left map 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 val = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left map 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#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 val AST#expression#Right instanceof AST#expression#Left JSONObject 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 sb AST#expression#Right . append 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . mh AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left val AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left JSONObject AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left val AST#expression#Right instanceof AST#expression#Left Array AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left jArr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JSONArray AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left val AST#expression#Right as 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 JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left jArr AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sb AST#expression#Right . append 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . mh AST#member_expression#Right AST#expression#Right + AST#expression#Left jArr 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#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left val AST#expression#Right instanceof AST#expression#Left JSONArray 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 sb AST#expression#Right . append 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . mh AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left val AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left JSONArray AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left val AST#expression#Right instanceof AST#expression#Left JSONArrayList 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 sb AST#expression#Right . append 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . mh AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left val AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left JSONArrayList AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left val AST#expression#Right instanceof AST#expression#Left Date 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 sb AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . mh AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left DateUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . format AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left val AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left DateConst AST#expression#Right . YMD_HLINE_HMS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left val AST#expression#Right instanceof AST#expression#Left Object AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { //转换成字符串 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left str = 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 val AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换成json对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left jVal : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left JSONValue AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //接收 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left jo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JSONObject AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //循环赋值 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left jVal AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item 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 jo AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sb AST#expression#Right . append 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . mh AST#member_expression#Right AST#expression#Right + AST#expression#Left jo 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#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left val AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // if (DateUtil.isDate(val)) { // sb.append(Const.quot + key + Const.quot + Const.mh + Const.quot + // DateUtil.formatDate(val, DateConst.YMD_HLINE_HMS) + Const.quot); // } else { // sb.append(Const.quot + key + Const.quot + Const.mh + Const.quot + val + Const.quot); // } AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sb AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . mh AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left val AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left val AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'number' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left val AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'boolean' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sb AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . mh AST#member_expression#Right AST#expression#Right + AST#expression#Left val 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 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 sb AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . quot AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . mh 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sb AST#expression#Right . append AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ykh AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left sb AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 将本对象转换成json字符串
* @returns
*/ AST#method_declaration#Left public toString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //获取key的迭代器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left iter : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换数据 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JSONObject 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 . convertString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left iter AST#expression#Right , AST#expression#Left this 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 JSONObject extends HashMap<string, JSONValue> {
public static parse(jsonStr: string): JSONObject {
let json = new JSONObject();
const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n');
let jVal: Record<string, JSONValue> = JSON.parse(replaceStr);
Object.entries(jVal).forEach((item) => {
if (item[1] instanceof JSONObject) {
json.set(item[0], JSONObject.from(item[1]));
} else if (item[1] instanceof Array) {
json.set(item[0], JSONArray.from(item[1]));
} else if (item[1] instanceof JSONArray) {
json.set(item[0], JSONArray.from(item[1]));
} else if (item[1] instanceof JSONArrayList) {
json.set(item[0], JSONArrayList.from(item[1]));
} else if (item[1] instanceof Date) {
json.set(item[0], DateUtil.format(item[1], DateConst.YMD_HLINE_HMS));
} else if (item[1] instanceof Object) {
json.set(item[0], JSONObject.from(item[1]));
} else {
json.set(item[0], item[1]);
}
})
return json;
}
private static parseNestedObject<U>(nestedJson: Record<string, JSONValue>, convertDateStr: boolean = true): U {
let nestedData: Record<string, JSONValue> = {};
for (let key of Object.entries(nestedJson)) {
if (typeof nestedJson[key[0]] === 'object' && nestedJson[key[0]] !== null) {
if (nestedJson[key[0]] instanceof Date && convertDateStr == true) {
nestedData[key[0]] = new Date(nestedJson[key[0]] as string);
} else if (Array.isArray(nestedJson[key[0]])) {
nestedData[key[0]] =
(nestedJson[key[0]] as Array<Record<string, JSONValue>>).map(item => JSONObject.parseNestedObject(item,
convertDateStr));
} else {
nestedData[key[0]] =
JSONObject.parseNestedObject(nestedJson[key[0]] as Record<string, JSONValue>, convertDateStr);
}
} else if (typeof nestedJson[key[0]] === 'string') {
if (DateUtil.isDate(nestedJson[key[0]] as string) && convertDateStr == true) {
nestedData[key[0]] = new Date(nestedJson[key[0]] as string);
} else {
nestedData[key[0]] = nestedJson[key[0]];
}
} else {
nestedData[key[0]] = nestedJson[key[0]];
}
}
return nestedData as U;
}
public static parseObject<T>(jsonStr: string, convertDateStr: boolean = true): T {
const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n');
let json: Record<string, JSONValue> = JSON.parse(replaceStr);
let data: T = JSONObject.parseNestedObject<T>(json, convertDateStr);
return data;
}
public static toJSONString(object: Object): string {
if (object instanceof Map) {
let map = new HashMap<string, JSONValue>();
(object as Map<string, JSONValue>).forEach((val, key) => {
map.set(key, val);
})
let iter: IterableIterator<string> = map.keys();
return new JSONObject().convertString(iter, map);
}
成字符串
let str = JSON.stringify(object);
let jVal: Record<string, JSONValue> = JSON.parse(str);
if (Array.isArray(jVal)) {
return JSONArray.toJSONString(jVal);
}
let map = new HashMap<string, JSONValue>();
成map
Object.entries(jVal).forEach(item => {
map.set(item[0], item[1]);
})
let iter: IterableIterator<string> = map.keys();
return new JSONObject().convertString(iter, map);
}
public static from<T>(bean: T): JSONObject {
let json = new JSONObject();
成字符串
let str = JSON.stringify(bean);
let jVal: Record<string, JSONValue> = JSON.parse(str);
Object.entries(jVal).forEach((item) => {
if (item[1] instanceof JSONObject) {
json.set(item[0], JSONObject.from(item[1]));
} else if (item[1] instanceof Array) {
json.set(item[0], JSONArray.from(item[1]));
} else if (item[1] instanceof JSONArray) {
json.set(item[0], JSONArray.from(item[1]));
} else if (item[1] instanceof JSONArrayList) {
json.set(item[0], JSONArrayList.from(item[1]));
} else if (item[1] instanceof Date) {
json.set(item[0], DateUtil.format(item[1], DateConst.YMD_HLINE_HMS));
} else if (item[1] instanceof Object) {
json.set(item[0], JSONObject.from(item[1]));
} else if (typeof item[1] === 'string') {
if (DateUtil.isDate(item[1])) {
json.set(item[0], DateUtil.formatDate(item[1], DateConst.YMD_HLINE_HMS));
} else {
json.set(item[0], item[1]);
}
} else {
json.set(item[0], item[1]);
}
})
return json;
}
private convertString(iter: IterableIterator<string>, map?: HashMap<string, JSONValue>): string {
的字符串
let sb: StringBuilder = new StringBuilder();
sb.append(Const.zkh);
let isFirst: boolean = true;
for (const key of iter) {
if (!isFirst) {
sb.append(Const.dh);
}
isFirst = false;
let val: JSONValue = '';
if (map && map.length > 0) {
val = map.get(key);
}
if (val instanceof JSONObject) {
sb.append(Const.quot + key + Const.quot + Const.mh + (val as JSONObject).toString());
} else if (val instanceof Array) {
let jArr = new JSONArray();
(val as Array<JSONValue>).forEach(item => {
jArr.push(item);
});
sb.append(Const.quot + key + Const.quot + Const.mh + jArr.toString());
} else if (val instanceof JSONArray) {
sb.append(Const.quot + key + Const.quot + Const.mh + (val as JSONArray).toString());
} else if (val instanceof JSONArrayList) {
sb.append(Const.quot + key + Const.quot + Const.mh + (val as JSONArrayList).toString());
} else if (val instanceof Date) {
sb.append(Const.quot + key + Const.quot + Const.mh + Const.quot +
DateUtil.format((val as Date), DateConst.YMD_HLINE_HMS) + Const.quot);
} else if (val instanceof Object) {
成字符串
let str = JSON.stringify(val);
let jVal: Record<string, JSONValue> = JSON.parse(str);
let jo = new JSONObject();
Object.entries(jVal).forEach((item) => {
jo.set(item[0], item[1]);
})
sb.append(Const.quot + key + Const.quot + Const.mh + jo.toString());
} else if (typeof val === 'string') {
val + Const.quot);
sb.append(Const.quot + key + Const.quot + Const.mh + Const.quot + val + Const.quot);
} else if (typeof val === 'number' || typeof val === 'boolean') {
sb.append(Const.quot + key + Const.quot + Const.mh + val);
} else {
sb.append(Const.quot + key + Const.quot + Const.mh + null);
}
}
sb.append(Const.ykh);
return sb.toString();
}
public toString(): string {
let iter: IterableIterator<string> = this.keys();
数据
return new JSONObject().convertString(iter, this);
}
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONObject.ets#L30-L263
|
86cda44e4eec44d3a305939c82a37316a3b2dd06
|
gitee
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/array/ArrayStringUtils.ets
|
arkts
|
字符串数组扩展
|
export class ArrayWords {
/**
* 如果有词语,需要用空格连接,全部是单字汉字时,直接连接
* 如:
* 有词语: [中国, 今天,大,家里, 人口] -> "中国 今天 大 家里 人口"
* 全部是单字: [中,国,人] -> "中国人"
* @param seperator 默认是半角空格
*/
static joinedWordsString(arr: string[], seperator: string = " "): string {
// 如果只有一个词语时
if (arr.length === 1 && arr.filter(item => item.trim().length > 1).length > 0) {
// 如果只有一个词语时,因为不会有空格连接,所以会被当成单个的字显示如:[中国] → [中] [国]
// 所以,需要在后面添加空格再返回:如:"中国" -> "中国 "
return arr.join('') + seperator;
}
return arr.filter(item => item.trim().length > 1).length > 0
? arr.join(seperator)
: arr.join('');
}
/**
* 判断是否含有词语
*/
static containsWords(arr: string[]): boolean {
return arr.filter(item => item.trim().length > 1).length > 0;
}
/**
* 根据indexInArray计算出,此页的第一个字在text字中的index
* @param indexInArray 数组中的索引
*/
static getFirstCharIndex(arr: string[], indexInArray: number): number {
if (indexInArray >= arr.length) {
return -1;
}
let index = 0;
for (let i = 0; i < indexInArray; i++) {
index += arr[i].length;
}
return index;
}
/**
* 根据 texts 数组计算全局字符索引
*
* - texts: 每个元素是一段文本(例如每页或每条)
* - textIndex: 指定属于 texts 的第几个元素(0-based)
* - charIndexInAText: 在该文本内的字符索引(0-based)
*
* 返回值:
* - 成功:返回全局索引(从 0 开始计数)
* - 参数非法或越界:返回 -1
*/
static getCharIndexInAllTexts(texts: string[], textIndex: number, charIndexInAText: number): number {
// 参数基本校验
if (!Array.isArray(texts)) return -1;
if (texts.length === 0) return -1;
if (!Number.isInteger(textIndex) || !Number.isInteger(charIndexInAText)) return -1;
if (textIndex < 0 || textIndex >= texts.length) return -1;
const targetText = texts[textIndex] ?? "";
const targetLen = targetText.length;
// charIndexInAText 必须在目标文本范围内
if (charIndexInAText < 0 || charIndexInAText >= targetLen) return -1;
// 先把目标文本内的索引作为初值,然后累加此前所有文本的长度
let globalIndex = charIndexInAText;
for (let i = 0; i < textIndex; i++) {
globalIndex += (texts[i] ?? "").length;
}
return globalIndex;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ArrayWords AST#class_body#Left { /**
* 如果有词语,需要用空格连接,全部是单字汉字时,直接连接
* 如:
* 有词语: [中国, 今天,大,家里, 人口] -> "中国 今天 大 家里 人口"
* 全部是单字: [中,国,人] -> "中国人"
* @param seperator 默认是半角空格
*/ AST#method_declaration#Left static joinedWordsString AST#parameter_list#Left ( AST#parameter#Left arr : 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#Left seperator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left " " AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 如果只有一个词语时 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr 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 arr AST#expression#Right AST#binary_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr 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#expression#Left seperator AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left seperator AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left arr AST#expression#Right AST#conditional_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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 判断是否含有词语
*/ AST#method_declaration#Left static containsWords AST#parameter_list#Left ( AST#parameter#Left arr : 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 boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 根据indexInArray计算出,此页的第一个字在text字中的index
* @param indexInArray 数组中的索引
*/ AST#method_declaration#Left static getFirstCharIndex AST#parameter_list#Left ( AST#parameter#Left arr : 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#Left indexInArray : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left indexInArray AST#expression#Right >= AST#expression#Left arr 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#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left indexInArray AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left index AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 根据 texts 数组计算全局字符索引
*
* - texts: 每个元素是一段文本(例如每页或每条)
* - textIndex: 指定属于 texts 的第几个元素(0-based)
* - charIndexInAText: 在该文本内的字符索引(0-based)
*
* 返回值:
* - 成功:返回全局索引(从 0 开始计数)
* - 参数非法或越界:返回 -1
*/ AST#method_declaration#Left static getCharIndexInAllTexts AST#parameter_list#Left ( AST#parameter#Left texts : 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#Left textIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left charIndexInAText : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 参数基本校验 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left Array AST#expression#Right AST#unary_expression#Right AST#expression#Right . isArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left texts AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#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 texts 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#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left Number AST#expression#Right AST#unary_expression#Right AST#expression#Right . isInteger AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left textIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left Number AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . isInteger AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left charIndexInAText AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left textIndex AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left textIndex AST#expression#Right >= AST#expression#Left texts AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left targetText = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left texts AST#expression#Right [ AST#expression#Left textIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left targetLen = AST#expression#Left AST#member_expression#Left AST#expression#Left targetText AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // charIndexInAText 必须在目标文本范围内 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left charIndexInAText AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left charIndexInAText AST#expression#Right >= AST#expression#Left targetLen AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 先把目标文本内的索引作为初值,然后累加此前所有文本的长度 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left globalIndex = AST#expression#Left charIndexInAText 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 textIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left globalIndex += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left texts AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left globalIndex 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 ArrayWords {
static joinedWordsString(arr: string[], seperator: string = " "): string {
if (arr.length === 1 && arr.filter(item => item.trim().length > 1).length > 0) {
,因为不会有空格连接,所以会被当成单个的字显示如:[中国] → [中] [国]
return arr.join('') + seperator;
}
return arr.filter(item => item.trim().length > 1).length > 0
? arr.join(seperator)
: arr.join('');
}
static containsWords(arr: string[]): boolean {
return arr.filter(item => item.trim().length > 1).length > 0;
}
static getFirstCharIndex(arr: string[], indexInArray: number): number {
if (indexInArray >= arr.length) {
return -1;
}
let index = 0;
for (let i = 0; i < indexInArray; i++) {
index += arr[i].length;
}
return index;
}
static getCharIndexInAllTexts(texts: string[], textIndex: number, charIndexInAText: number): number {
if (!Array.isArray(texts)) return -1;
if (texts.length === 0) return -1;
if (!Number.isInteger(textIndex) || !Number.isInteger(charIndexInAText)) return -1;
if (textIndex < 0 || textIndex >= texts.length) return -1;
const targetText = texts[textIndex] ?? "";
const targetLen = targetText.length;
if (charIndexInAText < 0 || charIndexInAText >= targetLen) return -1;
let globalIndex = charIndexInAText;
for (let i = 0; i < textIndex; i++) {
globalIndex += (texts[i] ?? "").length;
}
return globalIndex;
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/ArrayStringUtils.ets#L2-L80
|
2006a0f3144a266026ee56322354f306e0ef1206
|
github
|
|
azhuge233/ASFShortcut-HN.git
|
d1669c920c56317611b5b0375aa5315c1b91211b
|
entry/src/main/ets/common/utils/ASF.ets
|
arkts
|
sendRequest
|
发送请求
|
private async sendRequest(address: string, password: string, command: string) {
Logger.debug(this.LOG_TAG, `sendRequest() ASF 服务器地址:${address}`);
Logger.debug(this.LOG_TAG, `sendRequest() ASF 密码:${password}`);
Logger.debug(this.LOG_TAG, `sendRequest() ASF 指令:${command}`);
const httpRequest = http.createHttp();
// 设置指令参数和 ASF 密码请求头
const requestOptions: http.HttpRequestOptions = {
method: http.RequestMethod.POST,
extraData: `{"Command":"${command}"}`,
expectDataType: http.HttpDataType.STRING,
usingCache: false,
header: {
"Content-Type": this.ContentTypeJson,
"User-Agent": this.UserAgent,
"Authentication": password
},
readTimeout: 10000,
connectTimeout: 3000,
};
try {
const response = await httpRequest.request(address, requestOptions);
Logger.debug(this.LOG_TAG, `sendRequest() 响应代码:${response.responseCode}`);
Logger.debug(this.LOG_TAG, `sendRequest() 响应结果:${response.result}`);
return response;
} catch (err) {
Logger.error(this.LOG_TAG, `sendRequest() 发送请求失败, ${JSON.stringify(err)}`);
throw err as Error;
} finally {
httpRequest.destroy();
}
}
|
AST#method_declaration#Left private async sendRequest AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left command : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` sendRequest() ASF 服务器地址: AST#template_substitution#Left $ { AST#expression#Left address 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` sendRequest() ASF 密码: AST#template_substitution#Left $ { AST#expression#Left password 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` sendRequest() ASF 指令: AST#template_substitution#Left $ { AST#expression#Left command AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const 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 // 设置指令参数和 ASF 密码请求头 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left requestOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpRequestOptions 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 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#template_literal#Left ` {"Command":" AST#template_substitution#Left $ { AST#expression#Left command 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 expectDataType 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 . HttpDataType AST#member_expression#Right AST#expression#Right . STRING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left usingCache 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 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . ContentTypeJson AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "User-Agent" AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . UserAgent AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "Authentication" AST#property_name#Right : AST#expression#Left password AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left 10000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left 3000 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#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 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 address AST#expression#Right , AST#expression#Left requestOptions AST#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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` sendRequest() 响应代码: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` sendRequest() 响应结果: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . result 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 response 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` sendRequest() 发送请求失败, AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#as_expression#Left AST#expression#Left err 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#throw_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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
|
private async sendRequest(address: string, password: string, command: string) {
Logger.debug(this.LOG_TAG, `sendRequest() ASF 服务器地址:${address}`);
Logger.debug(this.LOG_TAG, `sendRequest() ASF 密码:${password}`);
Logger.debug(this.LOG_TAG, `sendRequest() ASF 指令:${command}`);
const httpRequest = http.createHttp();
const requestOptions: http.HttpRequestOptions = {
method: http.RequestMethod.POST,
extraData: `{"Command":"${command}"}`,
expectDataType: http.HttpDataType.STRING,
usingCache: false,
header: {
"Content-Type": this.ContentTypeJson,
"User-Agent": this.UserAgent,
"Authentication": password
},
readTimeout: 10000,
connectTimeout: 3000,
};
try {
const response = await httpRequest.request(address, requestOptions);
Logger.debug(this.LOG_TAG, `sendRequest() 响应代码:${response.responseCode}`);
Logger.debug(this.LOG_TAG, `sendRequest() 响应结果:${response.result}`);
return response;
} catch (err) {
Logger.error(this.LOG_TAG, `sendRequest() 发送请求失败, ${JSON.stringify(err)}`);
throw err as Error;
} finally {
httpRequest.destroy();
}
}
|
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/ASF.ets#L57-L92
|
f7f25a0ab36cfaa8b5240581d0e60509edbf8820
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/shortcut/ShortcutManager.ets
|
arkts
|
getShortcutTypeById
|
根据ID获取快捷方式类型
|
private getShortcutTypeById(shortcutId: string): ShortcutType {
if (shortcutId.includes('greeting')) return ShortcutType.QUICK_GREETING;
if (shortcutId.includes('calendar')) return ShortcutType.OPEN_CALENDAR;
if (shortcutId.includes('statistics')) return ShortcutType.VIEW_STATISTICS;
return ShortcutType.ADD_CONTACT;
}
|
AST#method_declaration#Left private getShortcutTypeById AST#parameter_list#Left ( AST#parameter#Left shortcutId : 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 ShortcutType AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left shortcutId AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'greeting' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left ShortcutType AST#expression#Right . QUICK_GREETING AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left shortcutId AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'calendar' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left ShortcutType AST#expression#Right . OPEN_CALENDAR AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left shortcutId AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'statistics' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left ShortcutType AST#expression#Right . VIEW_STATISTICS AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left ShortcutType AST#expression#Right . ADD_CONTACT AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private getShortcutTypeById(shortcutId: string): ShortcutType {
if (shortcutId.includes('greeting')) return ShortcutType.QUICK_GREETING;
if (shortcutId.includes('calendar')) return ShortcutType.OPEN_CALENDAR;
if (shortcutId.includes('statistics')) return ShortcutType.VIEW_STATISTICS;
return ShortcutType.ADD_CONTACT;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L452-L457
|
9efceb9fff1daab1865e78ba2a79143614f55771
|
github
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/Picker/Picker_Special_Cases/entry/src/main/ets/pages/MultiTextPicker.ets
|
arkts
|
Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export interface RegionNode {
name: string;
code: string;
children?: RegionNode[];
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface RegionNode AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left children ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left RegionNode [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface RegionNode {
name: string;
code: string;
children?: RegionNode[];
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Picker/Picker_Special_Cases/entry/src/main/ets/pages/MultiTextPicker.ets#L16-L20
|
7211d3d5d2065e2a3067a01fcbb8be1bb42e7d26
|
gitee
|
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets
|
arkts
|
根据名称获取图标资源 - 导航栏专用方法
由于ArkTS限制,不能使用动态字符串拼接资源路径,此方法专为导航栏设计
@param name 图标名称
@param selected 是否选中状态
@returns 图标资源
|
export function getNavIconByName(name: string, selected: boolean = false): ResourceStr {
if (name === '首页' || name === 'home') {
return selected ? AppIcons.home_selected : AppIcons.home;
} else if (name === '梦想' || name === 'dream') {
return selected ? AppIcons.dream_selected : AppIcons.dream;
} else if (name === '任务' || name === 'task') {
return selected ? AppIcons.task_selected : AppIcons.task;
} else if (name === '社区' || name === 'community') {
return selected ? AppIcons.community_selected : AppIcons.community;
} else if (name === '我的' || name === 'mine') {
return selected ? AppIcons.mine_selected : AppIcons.mine;
} else {
return AppIcons.default_icon;
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getNavIconByName 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 selected : 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 ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left '首页' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left 'home' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left selected AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AppIcons AST#expression#Right . home_selected AST#member_expression#Right AST#expression#Right : AST#expression#Left AppIcons AST#expression#Right AST#conditional_expression#Right AST#expression#Right . home AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left '梦想' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left 'dream' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left selected AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AppIcons AST#expression#Right . dream_selected AST#member_expression#Right AST#expression#Right : AST#expression#Left AppIcons AST#expression#Right AST#conditional_expression#Right AST#expression#Right . dream AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left '任务' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left 'task' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left selected AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AppIcons AST#expression#Right . task_selected AST#member_expression#Right AST#expression#Right : AST#expression#Left AppIcons AST#expression#Right AST#conditional_expression#Right AST#expression#Right . task AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left '社区' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left 'community' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left selected AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AppIcons AST#expression#Right . community_selected AST#member_expression#Right AST#expression#Right : AST#expression#Left AppIcons AST#expression#Right AST#conditional_expression#Right AST#expression#Right . community AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left '我的' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left 'mine' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left selected AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AppIcons AST#expression#Right . mine_selected AST#member_expression#Right AST#expression#Right : AST#expression#Left AppIcons AST#expression#Right AST#conditional_expression#Right AST#expression#Right . mine AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AppIcons AST#expression#Right . default_icon AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function getNavIconByName(name: string, selected: boolean = false): ResourceStr {
if (name === '首页' || name === 'home') {
return selected ? AppIcons.home_selected : AppIcons.home;
} else if (name === '梦想' || name === 'dream') {
return selected ? AppIcons.dream_selected : AppIcons.dream;
} else if (name === '任务' || name === 'task') {
return selected ? AppIcons.task_selected : AppIcons.task;
} else if (name === '社区' || name === 'community') {
return selected ? AppIcons.community_selected : AppIcons.community;
} else if (name === '我的' || name === 'mine') {
return selected ? AppIcons.mine_selected : AppIcons.mine;
} else {
return AppIcons.default_icon;
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets#L112-L126
|
a2df9681ac10e1ad30b5acac28b32a845c2fe0b9
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/ImageEdit/entry/src/main/ets/utils/CropUtil.ets
|
arkts
|
Common crop function.
@param pixelMap.
@param cropWidth.
@param cropHeight.
@param cropPosition.
|
export async function cropCommon(pixelMap: PixelMap, cropWidth: number, cropHeight: number, cropPosition: RegionItem) {
pixelMap.crop({
size: {
width: cropWidth,
height: cropHeight
},
x: cropPosition.x,
y: cropPosition.y
});
}
|
AST#export_declaration#Left export AST#function_declaration#Left async function cropCommon AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cropWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cropHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cropPosition : AST#type_annotation#Left AST#primary_type#Left RegionItem 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 pixelMap AST#expression#Right . crop 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 size AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left cropWidth AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left cropHeight AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left cropPosition AST#expression#Right . x AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left cropPosition AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export async function cropCommon(pixelMap: PixelMap, cropWidth: number, cropHeight: number, cropPosition: RegionItem) {
pixelMap.crop({
size: {
width: cropWidth,
height: cropHeight
},
x: cropPosition.x,
y: cropPosition.y
});
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/CropUtil.ets#L56-L65
|
b0fcd68b9bfb9da1dbe8ec9239e7b93145070cc4
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/order/src/main/ets/view/OrderListPage.ets
|
arkts
|
OrderListItem
|
渲染订单列表项
@param {Order} item - 订单数据
@returns {void} 无返回值
|
@Builder
private OrderListItem(item: Order): void {
OrderCard({
order: item,
toOrderDetail: (orderId: number): void => OrderNavigator.toDetail(orderId),
toPay: (): void => this.vm.toPay(item),
toGoodsDetail: (): void => this.vm.handleRebuy(item),
toLogistics: (): void => OrderNavigator.toLogistics(item.id),
toComment: (): void => this.vm.handleOrderComment(item),
toRefund: (): void => OrderNavigator.toRefund(item.id)
});
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderListItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left OrderCard ( AST#component_parameters#Left { AST#component_parameter#Left order : AST#expression#Left item AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toOrderDetail : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toDetail AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left orderId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toPay : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . toPay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toGoodsDetail : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . handleRebuy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toLogistics : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toLogistics AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toComment : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . handleOrderComment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toRefund : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toRefund AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private OrderListItem(item: Order): void {
OrderCard({
order: item,
toOrderDetail: (orderId: number): void => OrderNavigator.toDetail(orderId),
toPay: (): void => this.vm.toPay(item),
toGoodsDetail: (): void => this.vm.handleRebuy(item),
toLogistics: (): void => OrderNavigator.toLogistics(item.id),
toComment: (): void => this.vm.handleOrderComment(item),
toRefund: (): void => OrderNavigator.toRefund(item.id)
});
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderListPage.ets#L92-L103
|
657953f0e587c99892034e799a46f56e9aef2b09
|
github
|
euler1129/Cloud-flash-payment.git
|
dfb70c1c67b3b69447f4384661e16b60f40495de
|
entry/src/main/ets/pages/card/Index.ets
|
arkts
|
TabContentItem
|
tabContent的内容封装
|
@Builder TabContentItem (content, bg) {
Column() {
Text(content)
.fontColor('#fff')
.fontSize(40)
.fontWeight(FontWeight.Bold)
}.TabContentStyle(bg)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabContentItem AST#parameter_list#Left ( AST#parameter#Left content AST#parameter#Right , AST#parameter#Left bg AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left content AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#fff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 40 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . TabContentStyle ( AST#expression#Left bg 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 TabContentItem (content, bg) {
Column() {
Text(content)
.fontColor('#fff')
.fontSize(40)
.fontWeight(FontWeight.Bold)
}.TabContentStyle(bg)
}
|
https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/card/Index.ets#L33-L40
|
550b948e2dd45e9ab7a83ca5c6ebe3c7b26fbe79
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/ai/SimpleAIService.ets
|
arkts
|
generateGiftRecommendations
|
生成礼物推荐(使用真实AI API)
|
async generateGiftRecommendations(params: GiftRequestParams): Promise<string[]> {
if (!this.isConfigured) {
throw new Error('AI模型尚未配置,请先配置API密钥');
}
const modelName = this.currentConfig?.model || 'unknown';
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] Generating gift recommendations for contact: ${params.contactId} using model: ${modelName}`);
try {
// 构建礼物推荐提示词
const prompt = this.buildGiftRecommendationPrompt(params);
// 调用真实API
const response = await this.callRealAPI(prompt);
// 解析AI响应为礼物推荐列表
const recommendations = this.parseGiftRecommendations(response);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] Generated ${recommendations.length} gift recommendations`);
return recommendations;
} catch (error) {
const errorStr = String(error);
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[CRITICAL] Gift recommendation API call failed: ${errorStr}`);
// API调用失败时,抛出明确的错误给用户
const modelName = this.currentConfig?.name || '未知模型';
const errorMessage = `AI礼物推荐服务调用失败: ${modelName}。请检查网络连接和API配置。错误详情: ${errorStr}`;
throw new Error(errorMessage);
}
}
|
AST#method_declaration#Left async generateGiftRecommendations AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GiftRequestParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isConfigured 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 'AI模型尚未配置,请先配置API密钥' 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 modelName = 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 . currentConfig AST#member_expression#Right AST#expression#Right ?. model AST#member_expression#Right AST#expression#Right || AST#expression#Left 'unknown' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 ` [SimpleAIService] Generating gift recommendations for contact: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . contactId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right using model: AST#template_substitution#Left $ { AST#expression#Left modelName 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#try_statement#Left try AST#block_statement#Left { // 构建礼物推荐提示词 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left prompt = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildGiftRecommendationPrompt 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 // 调用真实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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . callRealAPI AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left prompt AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 解析AI响应为礼物推荐列表 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left recommendations = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parseGiftRecommendations AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left response AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [SimpleAIService] Generated AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left recommendations AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right gift recommendations ` 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 recommendations 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 errorStr = 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#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 ` [CRITICAL] Gift recommendation API call failed: AST#template_substitution#Left $ { AST#expression#Left errorStr 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 // API调用失败时,抛出明确的错误给用户 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left modelName = 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 . currentConfig AST#member_expression#Right AST#expression#Right ?. name AST#member_expression#Right AST#expression#Right || AST#expression#Left '未知模型' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errorMessage = AST#expression#Left AST#template_literal#Left ` AI礼物推荐服务调用失败: AST#template_substitution#Left $ { AST#expression#Left modelName AST#expression#Right } AST#template_substitution#Right 。请检查网络连接和API配置。错误详情: AST#template_substitution#Left $ { AST#expression#Left errorStr 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#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 errorMessage 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 generateGiftRecommendations(params: GiftRequestParams): Promise<string[]> {
if (!this.isConfigured) {
throw new Error('AI模型尚未配置,请先配置API密钥');
}
const modelName = this.currentConfig?.model || 'unknown';
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] Generating gift recommendations for contact: ${params.contactId} using model: ${modelName}`);
try {
const prompt = this.buildGiftRecommendationPrompt(params);
const response = await this.callRealAPI(prompt);
const recommendations = this.parseGiftRecommendations(response);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] Generated ${recommendations.length} gift recommendations`);
return recommendations;
} catch (error) {
const errorStr = String(error);
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[CRITICAL] Gift recommendation API call failed: ${errorStr}`);
const modelName = this.currentConfig?.name || '未知模型';
const errorMessage = `AI礼物推荐服务调用失败: ${modelName}。请检查网络连接和API配置。错误详情: ${errorStr}`;
throw new Error(errorMessage);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L170-L202
|
7e847c9f242463d922291dcf4ecac5a33b7eacf5
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/watermark/src/main/ets/utils/WaterMarkModel.ets
|
arkts
|
水印类
|
export class WaterMarkModel {
/**
* 图片添加水印。通过OffscreenCanvas绘制水印,并生成一个新的pixelMap对象进行保存
* @param {image.PixelMap} pixelMap - 原图pixelMap数据
* @param {Size} imageInfo - 图片尺寸
* @param {TextModify} textModify - 水印文本属性
* @returns {image.PixelMap} 返回带水印pixelMap数据
*/
async addImageWaterMark(pixelMap: image.PixelMap, imageInfo: Size, textModify: TextModify) {
// TODO:知识点:通过OffscreenCanvasRenderingContext2D绘制水印
const offScreenCanvas = new OffscreenCanvas(imageInfo.width, imageInfo.height);
const offScreenContext: OffscreenCanvasRenderingContext2D = offScreenCanvas.getContext('2d');
offScreenContext.drawImage(pixelMap, 0, 0, offScreenCanvas.width, offScreenCanvas.height);
offScreenContext.textAlign = textModify.textAlign;
offScreenContext.textBaseline = textModify.textBaseline;
offScreenContext.fillStyle = textModify.fontColor;
// 设置字体大小
offScreenContext.font = textModify.fontSize;
// 添加文字阴影
offScreenContext.shadowBlur = CommonConstants.TEXT_SHADOW_BLUE;
offScreenContext.shadowColor = CommonConstants.TEXT_SHADOW_COLOR;
// 绘制文本
offScreenContext.fillText(textModify.text, textModify.offsetX,
textModify.offsetY);
let lastPixelMap: image.PixelMap =
offScreenContext.getPixelMap(0, 0, offScreenCanvas.width, offScreenCanvas.height);
return lastPixelMap;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class WaterMarkModel AST#class_body#Left { /**
* 图片添加水印。通过OffscreenCanvas绘制水印,并生成一个新的pixelMap对象进行保存
* @param {image.PixelMap} pixelMap - 原图pixelMap数据
* @param {Size} imageInfo - 图片尺寸
* @param {TextModify} textModify - 水印文本属性
* @returns {image.PixelMap} 返回带水印pixelMap数据
*/ AST#method_declaration#Left async addImageWaterMark AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageInfo : AST#type_annotation#Left AST#primary_type#Left Size AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left textModify : AST#type_annotation#Left AST#primary_type#Left TextModify AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // TODO:知识点:通过OffscreenCanvasRenderingContext2D绘制水印 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left offScreenCanvas = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left OffscreenCanvas AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . height 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 offScreenContext : AST#type_annotation#Left AST#primary_type#Left OffscreenCanvasRenderingContext2D 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 offScreenCanvas AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '2d' AST#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 offScreenContext AST#expression#Right . drawImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixelMap AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left offScreenCanvas AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left offScreenCanvas AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left offScreenContext AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left textModify AST#expression#Right . textAlign 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 offScreenContext AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left textModify AST#expression#Right . textBaseline 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 offScreenContext AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left textModify AST#expression#Right . fontColor 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 offScreenContext AST#expression#Right . font AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left textModify AST#expression#Right . fontSize 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 offScreenContext AST#expression#Right . shadowBlur AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TEXT_SHADOW_BLUE 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 offScreenContext AST#expression#Right . shadowColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TEXT_SHADOW_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 绘制文本 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left offScreenContext AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left textModify AST#expression#Right . text AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left textModify AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left textModify AST#expression#Right . offsetY 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#variable_declaration#Left let AST#variable_declarator#Left lastPixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left offScreenContext AST#expression#Right . getPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left offScreenCanvas AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left offScreenCanvas AST#expression#Right . height 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 lastPixelMap 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 WaterMarkModel {
async addImageWaterMark(pixelMap: image.PixelMap, imageInfo: Size, textModify: TextModify) {
const offScreenCanvas = new OffscreenCanvas(imageInfo.width, imageInfo.height);
const offScreenContext: OffscreenCanvasRenderingContext2D = offScreenCanvas.getContext('2d');
offScreenContext.drawImage(pixelMap, 0, 0, offScreenCanvas.width, offScreenCanvas.height);
offScreenContext.textAlign = textModify.textAlign;
offScreenContext.textBaseline = textModify.textBaseline;
offScreenContext.fillStyle = textModify.fontColor;
offScreenContext.font = textModify.fontSize;
offScreenContext.shadowBlur = CommonConstants.TEXT_SHADOW_BLUE;
offScreenContext.shadowColor = CommonConstants.TEXT_SHADOW_COLOR;
offScreenContext.fillText(textModify.text, textModify.offsetX,
textModify.offsetY);
let lastPixelMap: image.PixelMap =
offScreenContext.getPixelMap(0, 0, offScreenCanvas.width, offScreenCanvas.height);
return lastPixelMap;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/utils/WaterMarkModel.ets#L23-L51
|
5d367c8b63d888b9a466a743e48a5142eacef1ea
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/LocalSocketWorker.ets
|
arkts
|
stringToArrayBuffer
|
字符串转 `ArrayBuffer`
|
function stringToArrayBuffer(str: string): ArrayBuffer {
const buf = new ArrayBuffer(str.length);
const bufView = new Uint8Array(buf);
for (let i = 0; i < str.length; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
|
AST#function_declaration#Left function stringToArrayBuffer AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const 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 str 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#variable_declaration#Left const AST#variable_declarator#Left bufView = 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 buf AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left str 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#subscript_expression#Left AST#expression#Left bufView AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = str AST#ERROR#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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left buf AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function stringToArrayBuffer(str: string): ArrayBuffer {
const buf = new ArrayBuffer(str.length);
const bufView = new Uint8Array(buf);
for (let i = 0; i < str.length; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/LocalSocketWorker.ets#L42-L49
|
c05e60d0be7ce382767ab4f215c924a1a33fac08
|
gitee
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_history.ets
|
arkts
|
A class holding a history_record[] array, in which there stores history_record objects.
@param no_init Will not open any data from disk nor do anything else.
Usually set true if this object is only created to sit the place of StorageLink initialization.
|
constructor(no_init?: boolean) {
let t0 = Date.now();
if (no_init == true) {
return;
}
let first_launch = false;
// Creates folders for history and index
try {
fs.mkdirSync(meowContext().filesDir + '/history', true);
} catch (e) {
// console.log('[Meow][bunch_of_history] Check disk of month: E: /history folder already exists.')
}
try {
fs.mkdirSync(meowContext().filesDir + '/history-index', true);
} catch (e) {
// console.log('[Meow][bunch_of_history] Check disk of month: E: /history folder already exists.')
}
// History
try {
if (fs.listFileSync(meowContext().filesDir + '/history-index', { recursion: false }).length == 0) {
// First launch of app
first_launch = true;
} else {
// Compatibility patch for older BrowserCats
this.patch_old_history_files();
this.patch_history_files_before_index_era();
}
} catch (e) {
console.error('[bunch_of_history][constructor] patch error: ' + e);
}
// Indexing
try {
if (fs.listFileSync(meowContext().filesDir + '/history-index', { recursion: false }).length == 0) {
if (first_launch) {
// No history. First launch of app.
console.log(bunch_of_history_index.log_head() + ' First launch of app. Skipping loading index.');
} else {
console.log(bunch_of_history_index.log_head() + ' No index found. Perhaps this is an upgrade from older BrowserCats?');
console.log(bunch_of_history_index.log_head() + ' Rebuilding... ');
history_index_full_rebuild_worker();
}
} else {
// Load index
history_index_load_from_disk_worker("normal");
}
} catch (e) {
console.error('[bunch_of_history][constructor] index error: ' + e);
}
// Ensure
try {
ensure_this_month_index_file();
ensure_this_month_history_file();
} catch (e) {
console.error('[bunch_of_history][constructor] ensure error: ' + e);
}
// Load today
try {
this.open_month_from_disk_sync(this.current_year, this.current_month);
} catch (e) {
console.error('[bunch_of_history][constructor] load today error: ' + e);
}
// Log
console.log('[Meow][bunch_of_history] bunch_of_history initialization finished! (Used ' + (Date.now() - t0) + ' ms)');
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left no_init ? : 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#variable_declaration#Left let AST#variable_declarator#Left t0 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 no_init AST#expression#Right == AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#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 first_launch = 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 // Creates folders for history and index 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 . mkdirSync 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#call_expression#Left AST#expression#Left meowContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/history' AST#expression#Right AST#binary_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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { // console.log('[Meow][bunch_of_history] Check disk of month: E: /history folder already exists.') } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . mkdirSync 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#call_expression#Left AST#expression#Left meowContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/history-index' AST#expression#Right AST#binary_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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { // console.log('[Meow][bunch_of_history] Check disk of month: E: /history folder already exists.') } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // History AST#statement#Left AST#try_statement#Left try 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . listFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left meowContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/history-index' AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left recursion AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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 { // First launch of app AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left first_launch = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // Compatibility patch for older BrowserCats 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 . patch_old_history_files 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 . patch_history_files_before_index_era 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#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 '[bunch_of_history][constructor] patch error: ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // Indexing AST#statement#Left AST#try_statement#Left try 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . listFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left meowContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/history-index' AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left recursion AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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#if_statement#Left if ( AST#expression#Left first_launch AST#expression#Right ) AST#block_statement#Left { // No history. First launch of app. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_history_index AST#expression#Right . log_head 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 ' First launch of app. Skipping loading index.' 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 else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_history_index AST#expression#Right . log_head 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 ' No index found. Perhaps this is an upgrade from older BrowserCats?' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_history_index AST#expression#Right . log_head 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 ' Rebuilding... ' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left history_index_full_rebuild_worker 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 else AST#block_statement#Left { // Load index AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left history_index_load_from_disk_worker AST#expression#Right AST#argument_list#Left ( AST#expression#Left "normal" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '[bunch_of_history][constructor] index error: ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // Ensure 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 ensure_this_month_index_file 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 ensure_this_month_history_file AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( 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 '[bunch_of_history][constructor] ensure error: ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // Load today 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 this AST#expression#Right . open_month_from_disk_sync 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 . current_year AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . current_month AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#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 '[bunch_of_history][constructor] load today error: ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // Log AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[Meow][bunch_of_history] bunch_of_history initialization finished! (Used ' AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left t0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ' ms)' 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#constructor_declaration#Right
|
constructor(no_init?: boolean) {
let t0 = Date.now();
if (no_init == true) {
return;
}
let first_launch = false;
try {
fs.mkdirSync(meowContext().filesDir + '/history', true);
} catch (e) {
}
try {
fs.mkdirSync(meowContext().filesDir + '/history-index', true);
} catch (e) {
}
try {
if (fs.listFileSync(meowContext().filesDir + '/history-index', { recursion: false }).length == 0) {
first_launch = true;
} else {
this.patch_old_history_files();
this.patch_history_files_before_index_era();
}
} catch (e) {
console.error('[bunch_of_history][constructor] patch error: ' + e);
}
try {
if (fs.listFileSync(meowContext().filesDir + '/history-index', { recursion: false }).length == 0) {
if (first_launch) {
console.log(bunch_of_history_index.log_head() + ' First launch of app. Skipping loading index.');
} else {
console.log(bunch_of_history_index.log_head() + ' No index found. Perhaps this is an upgrade from older BrowserCats?');
console.log(bunch_of_history_index.log_head() + ' Rebuilding... ');
history_index_full_rebuild_worker();
}
} else {
history_index_load_from_disk_worker("normal");
}
} catch (e) {
console.error('[bunch_of_history][constructor] index error: ' + e);
}
try {
ensure_this_month_index_file();
ensure_this_month_history_file();
} catch (e) {
console.error('[bunch_of_history][constructor] ensure error: ' + e);
}
try {
this.open_month_from_disk_sync(this.current_year, this.current_month);
} catch (e) {
console.error('[bunch_of_history][constructor] load today error: ' + e);
}
console.log('[Meow][bunch_of_history] bunch_of_history initialization finished! (Used ' + (Date.now() - t0) + ' ms)');
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L59-L130
|
2dd104fe4ff5a2e55a043ca16a0d0cef031d8572
|
gitee
|
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets
|
arkts
|
Default constructor.
|
constructor(dataSets?: JArrayList<T>) {
if (!dataSets) {
this.mDataSets = new JArrayList<T>();
} else {
this.mDataSets = new JArrayList<T>();
this.mDataSets.addAll(dataSets);
this.notifyDataChanged();
}
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left dataSets ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left dataSets 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 this AST#expression#Right . mDataSets AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . mDataSets AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDataSets AST#member_expression#Right AST#expression#Right . addAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataSets AST#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 . notifyDataChanged 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#constructor_declaration#Right
|
constructor(dataSets?: JArrayList<T>) {
if (!dataSets) {
this.mDataSets = new JArrayList<T>();
} else {
this.mDataSets = new JArrayList<T>();
this.mDataSets.addAll(dataSets);
this.notifyDataChanged();
}
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L67-L75
|
6af3b679471e58630b3593aab846ef6f3c2b202d
|
gitee
|
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets
|
arkts
|
onSelectItem
|
选择子菜单
@param item
@param hasInputText
|
async onSelectItem(item: TaskData, hasInputText: boolean = false): Promise<void> {
if (hasInputText || item.task !== Tasks.TEXT) {
// 只有hasInputText,才是图片素材模式,其他都是贴纸
this.isTextMaterial = hasInputText;
this.resourceIndex = 0;
this.isCancelQuit = false;
this.currentTask = item.task as number;
this.cancelOkText = item.text as Resource;
this.originBM = await copyPixelMap(this.pixelMap as PixelMap);
// 保存到队列
this.pixelMapQueue.push(this.originBM);
} else if (item.task === Tasks.TEXT) {
this.dialogController?.open();
}
}
|
AST#method_declaration#Left async onSelectItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TaskData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left hasInputText : 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 AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#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 hasInputText AST#expression#Right || AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . task AST#member_expression#Right AST#expression#Right !== AST#expression#Left Tasks AST#expression#Right AST#binary_expression#Right AST#expression#Right . TEXT AST#member_expression#Right AST#expression#Right ) { // 只有hasInputText,才是图片素材模式,其他都是贴纸 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isTextMaterial AST#member_expression#Right = AST#expression#Left hasInputText 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 . resourceIndex AST#member_expression#Right = AST#expression#Left 0 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 . isCancelQuit AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTask AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . task 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 this AST#expression#Right . cancelOkText AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . text AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Resource 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 this AST#expression#Right . originBM AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left copyPixelMap AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . pixelMapQueue AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originBM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . task AST#member_expression#Right AST#expression#Right === AST#expression#Left Tasks AST#expression#Right AST#binary_expression#Right AST#expression#Right . TEXT 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 . dialogController AST#member_expression#Right AST#expression#Right ?. open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async onSelectItem(item: TaskData, hasInputText: boolean = false): Promise<void> {
if (hasInputText || item.task !== Tasks.TEXT) {
this.isTextMaterial = hasInputText;
this.resourceIndex = 0;
this.isCancelQuit = false;
this.currentTask = item.task as number;
this.cancelOkText = item.text as Resource;
this.originBM = await copyPixelMap(this.pixelMap as PixelMap);
this.pixelMapQueue.push(this.originBM);
} else if (item.task === Tasks.TEXT) {
this.dialogController?.open();
}
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets#L154-L168
|
bc3aba6fccef284040d068e09035e1c0712ed483
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
spinkit/src/main/ets/components/SpinL.ets
|
arkts
|
SpinL
|
TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
|
@ComponentV2
export struct SpinL {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.16
@Local opacity1: number = 0;
@Local opacity2: number = 0;
@Local opacity3: number = 0;
@Local opacity4: number = 0;
@Local opacity5: number = 0;
@Local opacity6: number = 0;
@Local opacity7: number = 0;
@Local opacity8: number = 0;
@Local opacity9: number = 0;
aboutToAppear(): void {
this.round1 = this.spinSize * 0.16
}
build() {
Stack() {
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity1)
}
.frameStyle()
.rotate({ angle: 0 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity2)
}
.frameStyle()
.rotate({ angle: 40 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity3)
}
.frameStyle()
.rotate({ angle: 80 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity4)
}
.frameStyle()
.rotate({ angle: 120 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity5)
}
.frameStyle()
.rotate({ angle: 160 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity6)
}
.frameStyle()
.rotate({ angle: 200 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity7)
}
.frameStyle()
.rotate({ angle: 240 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity8)
}
.frameStyle()
.rotate({ angle: 280 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity9)
}
.frameStyle()
.rotate({ angle: 320 })
}
.renderFit(RenderFit.CENTER)
.width(this.spinSize)
.height(this.spinSize)
.onAppear(() => {
let keyframes1: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity1 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity1 = 0
}
}];
let keyframes2: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity2 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity2 = 0
}
}];
let keyframes3: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity3 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity3 = 0
}
}];
let keyframes4: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity4 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity4 = 0
}
}];
let keyframes5: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity5 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity5 = 0
}
}];
let keyframes6: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity6 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity6 = 0
}
}];
let keyframes7: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity7 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity7 = 0
}
}];
let keyframes8: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity8 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity8 = 0
}
}];
let keyframes9: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity9 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity9 = 0
}
}];
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1067 }, keyframes2);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -934 }, keyframes3);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -801 }, keyframes4);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -668 }, keyframes5);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -535 }, keyframes6);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -402 }, keyframes7);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -268 }, keyframes8);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -134 }, keyframes9);
})
}
@Styles
roundStyle(){
.width(this.round1)
.height(this.round1)
.borderRadius(this.round1)
.backgroundColor(this.spinColor)
.shadow(ShadowStyle.OUTER_DEFAULT_XS)
}
@Styles
frameStyle(){
.height('100%')
.width(this.round1)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinL AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 36 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right round1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.16 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity3 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity4 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity5 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity6 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity7 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity8 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity9 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . round1 AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.16 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity2 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity3 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 80 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity4 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 120 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity5 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 160 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity6 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 200 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity7 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity8 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 280 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity9 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 320 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . renderFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left RenderFit AST#expression#Right . CENTER AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes1 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity1 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity1 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes2 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity2 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity2 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes3 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity3 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity3 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes4 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity4 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity4 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes5 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity5 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity5 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes6 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity6 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity6 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes7 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity7 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity7 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes8 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity8 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity8 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes9 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity9 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity9 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1067 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 934 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes3 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 801 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes4 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 668 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 535 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes6 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 402 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes7 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 268 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes8 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 134 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes9 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right roundStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . round1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . round1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . round1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#member_expression#Left AST#expression#Left ShadowStyle AST#expression#Right . OUTER_DEFAULT_XS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right frameStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . round1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct SpinL {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.16
@Local opacity1: number = 0;
@Local opacity2: number = 0;
@Local opacity3: number = 0;
@Local opacity4: number = 0;
@Local opacity5: number = 0;
@Local opacity6: number = 0;
@Local opacity7: number = 0;
@Local opacity8: number = 0;
@Local opacity9: number = 0;
aboutToAppear(): void {
this.round1 = this.spinSize * 0.16
}
build() {
Stack() {
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity1)
}
.frameStyle()
.rotate({ angle: 0 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity2)
}
.frameStyle()
.rotate({ angle: 40 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity3)
}
.frameStyle()
.rotate({ angle: 80 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity4)
}
.frameStyle()
.rotate({ angle: 120 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity5)
}
.frameStyle()
.rotate({ angle: 160 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity6)
}
.frameStyle()
.rotate({ angle: 200 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity7)
}
.frameStyle()
.rotate({ angle: 240 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity8)
}
.frameStyle()
.rotate({ angle: 280 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity9)
}
.frameStyle()
.rotate({ angle: 320 })
}
.renderFit(RenderFit.CENTER)
.width(this.spinSize)
.height(this.spinSize)
.onAppear(() => {
let keyframes1: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity1 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity1 = 0
}
}];
let keyframes2: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity2 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity2 = 0
}
}];
let keyframes3: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity3 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity3 = 0
}
}];
let keyframes4: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity4 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity4 = 0
}
}];
let keyframes5: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity5 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity5 = 0
}
}];
let keyframes6: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity6 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity6 = 0
}
}];
let keyframes7: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity7 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity7 = 0
}
}];
let keyframes8: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity8 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity8 = 0
}
}];
let keyframes9: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity9 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity9 = 0
}
}];
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1067 }, keyframes2);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -934 }, keyframes3);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -801 }, keyframes4);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -668 }, keyframes5);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -535 }, keyframes6);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -402 }, keyframes7);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -268 }, keyframes8);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -134 }, keyframes9);
})
}
@Styles
roundStyle(){
.width(this.round1)
.height(this.round1)
.borderRadius(this.round1)
.backgroundColor(this.spinColor)
.shadow(ShadowStyle.OUTER_DEFAULT_XS)
}
@Styles
frameStyle(){
.height('100%')
.width(this.round1)
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinL.ets#L21-L281
|
96f4edcbf052941c101618275a39a0c27f233785
|
gitee
|
xinkai-hu/MyDay.git
|
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
|
entry/src/main/ets/pages/SearchSchedule.ets
|
arkts
|
aboutToAppear
|
初始化用户名、日程记录数据。
|
public aboutToAppear(): void {
if (router.getParams()?.['username']) {
this.username = router.getParams()['username'];
}
this.scheduleTable.getRdbStore(() => {
this.scheduleTable.queryData(SortRule.DEFAULT, (results: Array<Schedule>) => {
this.allSchedules = results;
});
});
}
|
AST#method_declaration#Left public 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . getParams AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. [ AST#expression#Left 'username' AST#expression#Right ] AST#subscript_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 . username AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . getParams AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 'username' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scheduleTable AST#member_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scheduleTable AST#member_expression#Right AST#expression#Right . queryData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left SortRule AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left results : 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 Schedule 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 . allSchedules AST#member_expression#Right = AST#expression#Left results 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
|
public aboutToAppear(): void {
if (router.getParams()?.['username']) {
this.username = router.getParams()['username'];
}
this.scheduleTable.getRdbStore(() => {
this.scheduleTable.queryData(SortRule.DEFAULT, (results: Array<Schedule>) => {
this.allSchedules = results;
});
});
}
|
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/SearchSchedule.ets#L65-L75
|
8a61c297a359a600dbaee1518499c55b2f868beb
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets
|
arkts
|
decodeGCM
|
解密-GCM模式
@param str 加密的字符串
@param aesKey AES密钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
|
static decodeGCM(str: string, aesKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
//转换密钥
let symKey = CryptoSyncUtil.convertKeyFromStr(aesKey, 'AES256', 256, keyCoding);
// 初始化加解密操作环境:开始解密
let mode = crypto.CryptoMode.DECRYPT_MODE;
//创建解密器
let cipher = crypto.createCipher('AES256|GCM|PKCS7');
//初始化加密
cipher.initSync(mode, symKey, AESSync.gcmParams);
//解密
let updateOutput = cipher.updateSync({ data: StrAndUintUtil.strContent2Uint8Array(str, dataCoding) });
//判断是否完成
let finalOutput = cipher.doFinalSync(null);
let decode = util.TextDecoder.create('utf-8', { ignoreBOM: true });
return OutDTO.OKByDataRow('AES解密成功~', decode.decodeWithStream(updateOutput.data));
}
|
AST#method_declaration#Left static decodeGCM AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //转换密钥 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . convertKeyFromStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left aesKey AST#expression#Right , AST#expression#Left 'AES256' AST#expression#Right , AST#expression#Left 256 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 初始化加解密操作环境:开始解密 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mode = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . DECRYPT_MODE 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 cipher = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES256|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 cipher AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mode AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AESSync AST#expression#Right . gcmParams 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#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 cipher AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . strContent2Uint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left dataCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //判断是否完成 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left finalOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cipher AST#expression#Right . doFinalSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . TextDecoder AST#member_expression#Right AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'utf-8' AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left ignoreBOM AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . OKByDataRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES解密成功~' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decode AST#expression#Right . decodeWithStream 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#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static decodeGCM(str: string, aesKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
let symKey = CryptoSyncUtil.convertKeyFromStr(aesKey, 'AES256', 256, keyCoding);
let mode = crypto.CryptoMode.DECRYPT_MODE;
let cipher = crypto.createCipher('AES256|GCM|PKCS7');
cipher.initSync(mode, symKey, AESSync.gcmParams);
let updateOutput = cipher.updateSync({ data: StrAndUintUtil.strContent2Uint8Array(str, dataCoding) });
let finalOutput = cipher.doFinalSync(null);
let decode = util.TextDecoder.create('utf-8', { ignoreBOM: true });
return OutDTO.OKByDataRow('AES解密成功~', decode.decodeWithStream(updateOutput.data));
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L205-L221
|
c6faa35d05891195c765c2e809d18068f4aaac38
|
gitee
|
JinnyWang-Space/guanlanwenjuan.git
|
601c4aa6c427e643d7bf42bc21945f658738e38c
|
setting/src/main/ets/viewmodel/TipsViewModel.ets
|
arkts
|
getGestureList
|
获取所有列表数据(返回副本防止外部修改)
|
getGestureList(): TipsListItemModel[] {
return [...this.gestureList];
}
|
AST#method_declaration#Left getGestureList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TipsListItemModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . gestureList AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getGestureList(): TipsListItemModel[] {
return [...this.gestureList];
}
|
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/viewmodel/TipsViewModel.ets#L29-L31
|
e66599bc1b3df274845b2f2847e8f68f28a88c30
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/h5cache/src/main/ets/common/ResponseDataType.ets
|
arkts
|
响应数据类型
|
export type ResponseDataType = ArrayBuffer | string;
|
AST#export_declaration#Left export AST#type_declaration#Left type ResponseDataType = AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
|
export type ResponseDataType = ArrayBuffer | string;
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/ResponseDataType.ets#L17-L17
|
b7c91c5161324c3fbfff4738042decf61cdc435c
|
gitee
|
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
|
arkts
|
getAnimParamBuilder
|
如果已经注册了路由动画,则获取动画参数构建器,没注册则返回空
@param modifier
|
getAnimParamBuilder(component: object): NavAnimParamBuilder | undefined {
const ctx = this.navContextMap.get(this.getKey(component))
if (ctx?.pageId) {
const callback = this.customTransitionMap.get(ctx?.pageId)
if (callback) {
return NavAnimParamBuilder.builder(callback)
}
}
return undefined
}
|
AST#method_declaration#Left getAnimParamBuilder AST#parameter_list#Left ( AST#parameter#Left component : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left NavAnimParamBuilder AST#primary_type#Right | AST#primary_type#Left undefined 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 ctx = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . navContextMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left component AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right 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 ctx AST#expression#Right ?. pageId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left callback = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customTransitionMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ctx AST#expression#Right ?. pageId 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 callback 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 NavAnimParamBuilder AST#expression#Right . builder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getAnimParamBuilder(component: object): NavAnimParamBuilder | undefined {
const ctx = this.navContextMap.get(this.getKey(component))
if (ctx?.pageId) {
const callback = this.customTransitionMap.get(ctx?.pageId)
if (callback) {
return NavAnimParamBuilder.builder(callback)
}
}
return undefined
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L342-L351
|
75211af44166c715e1e0e4ba5da477fe8f057211
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets
|
arkts
|
removeCriticalAsset
|
[Start remove_critical_asset]
|
async function removeCriticalAsset(): Promise<string> {
let result: string = '';
let attr: asset.AssetMap = new Map();
let query: asset.AssetMap = new Map();
query.set(asset.Tag.ALIAS, stringToArray('demo_alias')); // 此处指定别名删除单条数据,也可不指定别名删除多条数据
try {
await asset.remove(query).then(() => {
console.info(`Asset removed successfully.`);
result = 'Remove Critical Asset Success';
}).catch((err: BusinessError) => {
console.error(`Failed to remove Asset. Code is ${err.code}, message is ${err.message}`);
result = 'Remove Critical Asset Failed';
});
} catch (error) {
let err = error as BusinessError;
console.error(`Failed to remove Asset. Code is ${err.code}, message is ${err.message}`);
result = 'Remove Critical Asset Failed';
}
return result;
}
|
AST#function_declaration#Left async function removeCriticalAsset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : 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#variable_declaration#Left let AST#variable_declarator#Left attr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left asset . AssetMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left query : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left asset . AssetMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left query 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 asset AST#expression#Right . Tag AST#member_expression#Right AST#expression#Right . ALIAS AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left stringToArray AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'demo_alias' 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left asset AST#expression#Right AST#await_expression#Right AST#expression#Right . remove AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left query AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Asset removed successfully. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result = AST#expression#Left 'Remove Critical Asset Success' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to remove Asset. 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result = AST#expression#Left 'Remove Critical Asset Failed' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left 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 ` Failed to remove Asset. 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result = AST#expression#Left 'Remove Critical Asset Failed' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#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#function_declaration#Right
|
async function removeCriticalAsset(): Promise<string> {
let result: string = '';
let attr: asset.AssetMap = new Map();
let query: asset.AssetMap = new Map();
query.set(asset.Tag.ALIAS, stringToArray('demo_alias'));
try {
await asset.remove(query).then(() => {
console.info(`Asset removed successfully.`);
result = 'Remove Critical Asset Success';
}).catch((err: BusinessError) => {
console.error(`Failed to remove Asset. Code is ${err.code}, message is ${err.message}`);
result = 'Remove Critical Asset Failed';
});
} catch (error) {
let err = error as BusinessError;
console.error(`Failed to remove Asset. Code is ${err.code}, message is ${err.message}`);
result = 'Remove Critical Asset Failed';
}
return result;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets#L183-L202
|
c9d0fcdb05aed50aaa3bd89ad535a0f2741469b2
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/FileUtil.ets
|
arkts
|
fdatasync
|
实现文件内容数据同步,使用Promise异步回调。
@param fd number 已打开的文件描述符。
@returns
|
static fdatasync(fd: number): Promise<void> {
return fs.fdatasync(fd);
}
|
AST#method_declaration#Left static fdatasync AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . fdatasync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fd 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 fdatasync(fd: number): Promise<void> {
return fs.fdatasync(fd);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L754-L756
|
a24251805cdc5746559b2b7c279b2a92d63ed9d7
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Solutions/IM/Chat/features/chatlist/src/main/ets/pages/ChatDetailPage.ets
|
arkts
|
layoutWeight参数
|
export class WantModel {
srcImage: string = '';
textContent: string = '';
senderId: number = 0;
constructor(srcImage?: string, text?: string, senderId?: number) {
if (srcImage !== undefined) {
this.srcImage = srcImage;
}
if (text !== undefined) {
this.textContent = text;
}
if (senderId !== undefined) {
this.senderId = senderId;
}
}
toString(): string {
return this.srcImage + " " + this.textContent + " " + this.senderId;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class WantModel AST#class_body#Left { AST#property_declaration#Left srcImage : 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 textContent : 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 senderId : 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#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left srcImage ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 senderId ? : 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left srcImage AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . srcImage AST#member_expression#Right = AST#expression#Left srcImage 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 text AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textContent AST#member_expression#Right = AST#expression#Left text AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left senderId AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . senderId AST#member_expression#Right = AST#expression#Left senderId AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left toString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . srcImage AST#member_expression#Right AST#expression#Right + AST#expression#Left " " AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . textContent AST#member_expression#Right AST#expression#Right + AST#expression#Left " " AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . senderId 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 WantModel {
srcImage: string = '';
textContent: string = '';
senderId: number = 0;
constructor(srcImage?: string, text?: string, senderId?: number) {
if (srcImage !== undefined) {
this.srcImage = srcImage;
}
if (text !== undefined) {
this.textContent = text;
}
if (senderId !== undefined) {
this.senderId = senderId;
}
}
toString(): string {
return this.srcImage + " " + this.textContent + " " + this.senderId;
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/pages/ChatDetailPage.ets#L35-L55
|
f4fb5d009a61de364e35b98212c8399ed8ec4929
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/common/types/SettingsTypes.ets
|
arkts
|
隐私设置接口(为PrivacySettings别名)
|
export interface PrivacySettings extends PrivacyConfig {
// 继承PrivacyConfig的所有属性
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface PrivacySettings AST#extends_clause#Left extends PrivacyConfig AST#extends_clause#Right AST#object_type#Left { // 继承PrivacyConfig的所有属性 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface PrivacySettings extends PrivacyConfig {
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L172-L174
|
e90b7a52c2ed2883958505a277f4f035d49c4431
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/web/WebSearchService.ets
|
arkts
|
searchGifts
|
搜索礼物推荐
|
public async searchGifts(params: GiftSearchParams): Promise<SearchResult[]> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[WebSearchService] Searching gifts with keyword: ${params.keyword}`);
// 由于这是示例代码,我们返回模拟的搜索结果
// 在实际应用中,这里应该调用真实的搜索API
const mockResults = this.generateMockSearchResults(params);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[WebSearchService] Found ${mockResults.length} results`);
return mockResults;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[WebSearchService] Search failed: ${error}`);
throw new Error(`搜索失败: ${error}`);
}
}
|
AST#method_declaration#Left public async searchGifts AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GiftSearchParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SearchResult [ ] 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 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 ` [WebSearchService] Searching gifts with keyword: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . keyword 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 // 由于这是示例代码,我们返回模拟的搜索结果 // 在实际应用中,这里应该调用真实的搜索API AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mockResults = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . generateMockSearchResults 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#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 ` [WebSearchService] Found AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left mockResults AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right results ` 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 mockResults AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [WebSearchService] Search failed: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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
|
public async searchGifts(params: GiftSearchParams): Promise<SearchResult[]> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[WebSearchService] Searching gifts with keyword: ${params.keyword}`);
const mockResults = this.generateMockSearchResults(params);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[WebSearchService] Found ${mockResults.length} results`);
return mockResults;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[WebSearchService] Search failed: ${error}`);
throw new Error(`搜索失败: ${error}`);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/web/WebSearchService.ets#L101-L119
|
1a574d855174d227b9e84b6105d352d2d56df684
|
github
|
hqj201013136012/HarmonyMiliUiPro.git
|
0625e681e07b771998a0ac4430824627d0eb60ed
|
entry/src/main/ets/common/dialog/CommonDateAndTimeDialog.ets
|
arkts
|
CommonDateAndTimeDialog
|
Icon+Text自定义弹窗
|
@CustomDialog
export struct CommonDateAndTimeDialog {
controller?: CustomDialogController
@Link currentDate:string
@State config: DateTimePickerConfig = {
format: DateTimeFormat.YmdHm,
start: '1900-01-01 00:00',
end: '2099-12-31 23:59',
selected: (this.currentDate=='')?DateUtil.getTodayStr('yyyy-MM-dd HH:mm'):this.currentDate
}
@State suffixMode: SuffixMode = SuffixMode.Separated
// @State selectedTime: DateTime = new DateTime(this.config.format, this.config.selected)
build() {
Column() {
Text('时间设置')
.fontColor('#ffffff')
.fontSize(30)
.margin({ top: 38 })
DateTimePicker({
config: this.config,
suffixMode: this.suffixMode,
suffixes: {
// 后缀文字
year: '年',
month: '月',
day: '日',
hour: '时',
minute: '',
second: ''
},
selectedTextStyle: {
font: {
size: 34
},
color: '#2495ff'
},
textStyle: {
font: {
size: 22
},
color: '#ffffff'
},
disappearTextStyle: {
font: {
size: 18
},
color: '#ffffff'
},
suffixTextStyle: {
font: {
size: 24
},
color: '#484848'
},
onSelectedCallback: (selected) => {
// this.selectedTime = selected
this.currentDate=selected.format()
}
})
.width('100%')
.layoutWeight(1)
.align(Alignment.Center)
.padding({ left: 40, right: 40 })
Row() {
Button('取消')
.width(280)
.height(75)
.backgroundColor('#262626')
.fontColor('#ffffff')
.fontSize(28)
.borderRadius(20)
.onClick(()=>{
this.controller?.close()
})
Button('确定')
.width(280)
.height(75)
.backgroundColor('#2495ff')
.fontColor('#ffffff')
.fontSize(28)
.borderRadius(20)
.margin({left:30})
.onClick(()=>{
this.controller?.close()
})
}
.width('100%')
.height(75)
.margin({ bottom: 30 })
.justifyContent(FlexAlign.Center)
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.backgroundColor('#1A1A1A')
.borderRadius(20)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CommonDateAndTimeDialog AST#component_body#Left { AST#property_declaration#Left controller ? : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right currentDate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right config : AST#type_annotation#Left AST#primary_type#Left DateTimePickerConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left format AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DateTimeFormat AST#expression#Right . YmdHm AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left start AST#property_name#Right : AST#expression#Left '1900-01-01 00:00' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left end AST#property_name#Right : AST#expression#Left '2099-12-31 23:59' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentDate AST#member_expression#Right AST#expression#Right == AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . getTodayStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'yyyy-MM-dd HH:mm' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . currentDate AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right suffixMode : AST#type_annotation#Left AST#primary_type#Left SuffixMode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left SuffixMode AST#expression#Right . Separated AST#member_expression#Right AST#expression#Right // @State selectedTime: DateTime = new DateTime(this.config.format, this.config.selected) 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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 38 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 DateTimePicker ( AST#component_parameters#Left { AST#component_parameter#Left config : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left suffixMode : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . suffixMode AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left suffixes : AST#expression#Left AST#object_literal#Left { // 后缀文字 AST#property_assignment#Left AST#property_name#Left year AST#property_name#Right : AST#expression#Left '年' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left month AST#property_name#Right : AST#expression#Left '月' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left day AST#property_name#Right : AST#expression#Left '日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left hour AST#property_name#Right : AST#expression#Left '时' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left minute AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left second AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left selectedTextStyle : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left font AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 34 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#2495ff' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left textStyle : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left font AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 22 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#ffffff' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left disappearTextStyle : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left font AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 18 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#ffffff' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left suffixTextStyle : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left font AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#484848' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onSelectedCallback : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left selected AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // this.selectedTime = selected 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 . currentDate AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selected AST#expression#Right . format AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#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 . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center 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 40 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 Button ( AST#expression#Left '取消' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 280 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 75 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#262626' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 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 . controller AST#member_expression#Right AST#expression#Right ?. close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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#expression#Left '确定' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 280 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 75 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#2495ff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 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 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right ?. close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 75 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#1A1A1A' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@CustomDialog
export struct CommonDateAndTimeDialog {
controller?: CustomDialogController
@Link currentDate:string
@State config: DateTimePickerConfig = {
format: DateTimeFormat.YmdHm,
start: '1900-01-01 00:00',
end: '2099-12-31 23:59',
selected: (this.currentDate=='')?DateUtil.getTodayStr('yyyy-MM-dd HH:mm'):this.currentDate
}
@State suffixMode: SuffixMode = SuffixMode.Separated
build() {
Column() {
Text('时间设置')
.fontColor('#ffffff')
.fontSize(30)
.margin({ top: 38 })
DateTimePicker({
config: this.config,
suffixMode: this.suffixMode,
suffixes: {
year: '年',
month: '月',
day: '日',
hour: '时',
minute: '',
second: ''
},
selectedTextStyle: {
font: {
size: 34
},
color: '#2495ff'
},
textStyle: {
font: {
size: 22
},
color: '#ffffff'
},
disappearTextStyle: {
font: {
size: 18
},
color: '#ffffff'
},
suffixTextStyle: {
font: {
size: 24
},
color: '#484848'
},
onSelectedCallback: (selected) => {
this.currentDate=selected.format()
}
})
.width('100%')
.layoutWeight(1)
.align(Alignment.Center)
.padding({ left: 40, right: 40 })
Row() {
Button('取消')
.width(280)
.height(75)
.backgroundColor('#262626')
.fontColor('#ffffff')
.fontSize(28)
.borderRadius(20)
.onClick(()=>{
this.controller?.close()
})
Button('确定')
.width(280)
.height(75)
.backgroundColor('#2495ff')
.fontColor('#ffffff')
.fontSize(28)
.borderRadius(20)
.margin({left:30})
.onClick(()=>{
this.controller?.close()
})
}
.width('100%')
.height(75)
.margin({ bottom: 30 })
.justifyContent(FlexAlign.Center)
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.backgroundColor('#1A1A1A')
.borderRadius(20)
}
}
|
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/dialog/CommonDateAndTimeDialog.ets#L13-L116
|
dbc808c69b2d0f34e5740eacdb22a4dea1db16b8
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets
|
arkts
|
equals
|
MARK: - 等价比较(Equatable)
判断两个DayOf对象是否相等
@param other - 另一个DayOf对象
|
equals(other: DayOf): boolean {
return this.num === other.num;
}
|
AST#method_declaration#Left equals AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left DayOf 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . num AST#member_expression#Right AST#expression#Right === AST#expression#Left other AST#expression#Right AST#binary_expression#Right AST#expression#Right . num AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
equals(other: DayOf): boolean {
return this.num === other.num;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets#L96-L98
|
ada47dfd1b1449d3fc640bcf90a36f75758f2531
|
github
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets
|
arkts
|
loadTaskDetails
|
加载任务详情
|
async loadTaskDetails(): Promise<void> {
if (!this.taskId) return;
this.isLoading = true;
try {
const task = await getTaskById(this.taskId);
if (task) {
this.task = task;
} else {
const toastOptions: promptAction.ShowToastOptions = {
message: '无法找到任务信息',
duration: 2000
};
prompt.showToast(toastOptions);
router.back();
}
} catch (error) {
console.error(`加载任务详情失败: ${String(error)}`);
const toastOptions: promptAction.ShowToastOptions = {
message: '加载任务详情失败,请稍后重试',
duration: 2000
};
prompt.showToast(toastOptions);
router.back();
} finally {
this.isLoading = false;
}
}
|
AST#method_declaration#Left async loadTaskDetails AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . taskId AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading 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 task = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getTaskById AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskId 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 task 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 . task AST#member_expression#Right = AST#expression#Left task 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 toastOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowToastOptions 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 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 prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOptions AST#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 router AST#expression#Right . back AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 String AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toastOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowToastOptions 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 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 prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOptions AST#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 router AST#expression#Right . back AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 . isLoading 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 loadTaskDetails(): Promise<void> {
if (!this.taskId) return;
this.isLoading = true;
try {
const task = await getTaskById(this.taskId);
if (task) {
this.task = task;
} else {
const toastOptions: promptAction.ShowToastOptions = {
message: '无法找到任务信息',
duration: 2000
};
prompt.showToast(toastOptions);
router.back();
}
} catch (error) {
console.error(`加载任务详情失败: ${String(error)}`);
const toastOptions: promptAction.ShowToastOptions = {
message: '加载任务详情失败,请稍后重试',
duration: 2000
};
prompt.showToast(toastOptions);
router.back();
} finally {
this.isLoading = false;
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets#L54-L81
|
d98c29e4cab4b8d886dea04991d1369cc9e97d8e
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/onlinesearch/OnlineWordManager.ets
|
arkts
|
MARK: - OnlineWordManager 管理器
|
export class OnlineWordManager {
private static instance: OnlineWordManager | null = null
private constructor() {
// 私有构造函数
}
/// 获取单例实例
static get shared(): OnlineWordManager {
if (!OnlineWordManager.instance) {
OnlineWordManager.instance = new OnlineWordManager()
}
return OnlineWordManager.instance
}
/// 查询单词详情
loadWord(titleEn: string, completion: (success: boolean, msg: string | null, word: OnlineWord | null) => void): void {
const params: HttpUtils.HttpParams = {}
params[CodingKeys.TitleEn] = titleEn
const isCurCnt = LanguageManager.isTraditionalChinese()
const subRoute = isCurCnt ? "word_cnt" : "word_cns"
const url = `${Servers.getRouteUrl(Route.word)}/${subRoute}`
Http.request(url, HttpUtils.Method.GET, params, (succeed: boolean, msg: string | null, result: Object[] | null) => {
if (!succeed || !result) {
completion(false, msg, null)
return
}
try {
// 解析JSON数据
const list = OnlineWord.fromArray(result)
// 返回第一条数据
completion(true, msg, list.length > 0 ? list[0] : null)
} catch (error) {
completion(false, `JSON解析失败: ${error}`, null)
}
})
}
/// 中英文模糊查询
searchWords(text: string, pageIndex: number = 0, completion: (success: boolean, msg: string | null, words: OnlineWord[] | null) => void): void {
const params: HttpUtils.HttpParams = {}
params['text'] = text
params[HttpUtils.Param.page] = pageIndex // 页面索引
const isCurCnt = LanguageManager.isTraditionalChinese()
const subRoute = isCurCnt ? "word_cnt" : "word_cns"
const url = `${Servers.getRouteUrl(Route.search)}/${subRoute}`
Http.request(url, HttpUtils.Method.GET, params, (succeed: boolean, msg: string | null, result: Object[] | null) => {
if (!succeed || !result) {
completion(false, msg, null)
return
}
try {
// 解析JSON数据
const list = OnlineWord.fromArray(result)
completion(true, msg, list)
} catch (error) {
completion(false, `JSON解析失败: ${error}`, null)
}
})
}
//
// /// Promise版本的查询单词详情
// async loadWordPromise(titleEn: string): Promise<{ success: boolean; msg: string | null; word: OnlineWord | null }> {
// return new Promise((resolve) => {
// this.loadWord(titleEn, (success, msg, word) => {
// resolve({ success, msg, word })
// })
// })
// }
//
// /// Promise版本的中英文模糊查询
// async searchWordsPromise(text: string, pageIndex: number = 0): Promise<{ success: boolean; msg: string | null; words: OnlineWord[] | null }> {
// return new Promise((resolve) => {
// this.searchWords(text, pageIndex, (success, msg, words) => {
// resolve({ success, msg, words })
// })
// })
// }
}
|
AST#export_declaration#Left export AST#class_declaration#Left class OnlineWordManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left OnlineWordManager 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#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 私有构造函数 } AST#block_statement#Right AST#constructor_declaration#Right /// 获取单例实例 AST#method_declaration#Left static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left OnlineWordManager 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 OnlineWordManager 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 OnlineWordManager 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 OnlineWordManager 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 OnlineWordManager AST#expression#Right . instance AST#member_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /// 查询单词详情 AST#method_declaration#Left loadWord AST#parameter_list#Left ( AST#parameter#Left titleEn : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left completion : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left word : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left OnlineWord AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . HttpParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#ERROR#Left params AST#ERROR#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left CodingKeys AST#expression#Right . TitleEn AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Right = AST#expression#Left titleEn 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 isCurCnt = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LanguageManager AST#expression#Right . isTraditionalChinese 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 subRoute = AST#expression#Left AST#conditional_expression#Left AST#expression#Left isCurCnt AST#expression#Right ? AST#expression#Left "word_cnt" AST#expression#Right : AST#expression#Left "word_cns" AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left url = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#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 Servers AST#expression#Right . getRouteUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Route AST#expression#Right . word AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left subRoute AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#ERROR#Left Http AST#ERROR#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtils AST#expression#Right . Method AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left succeed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left result : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left Object [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left succeed AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left result 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 completion AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left msg 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 解析JSON数据 AST#ERROR#Left const AST#variable_declarator#Left list = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OnlineWord AST#expression#Right . fromArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 返回第一条数据 comp AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left letion AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left msg AST#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 list AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#subscript_expression#Left AST#expression#Left list AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#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 completion AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` JSON解析失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /// 中英文模糊查询 AST#method_declaration#Left searchWords 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 pageIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left completion : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left words : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left OnlineWord [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . HttpParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#ERROR#Left params AST#ERROR#Right [ AST#expression#Left 'text' 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#ERROR#Left params AST#ERROR#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtils AST#expression#Right . Param AST#member_expression#Right AST#expression#Right . page AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Right = AST#expression#Left pageIndex 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 isCurCnt = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LanguageManager AST#expression#Right . isTraditionalChinese 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 subRoute = AST#expression#Left AST#conditional_expression#Left AST#expression#Left isCurCnt AST#expression#Right ? AST#expression#Left "word_cnt" AST#expression#Right : AST#expression#Left "word_cns" AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left url = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#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 Servers AST#expression#Right . getRouteUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Route AST#expression#Right . search AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left subRoute AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#ERROR#Left Http AST#ERROR#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtils AST#expression#Right . Method AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left succeed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left result : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left Object [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left succeed AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left result 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 completion AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left msg 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 解析JSON数据 AST#ERROR#Left const AST#variable_declarator#Left list = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OnlineWord AST#expression#Right . fromArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right comp AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left letion AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left msg AST#expression#Right , AST#expression#Left list AST#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 completion AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` JSON解析失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // // /// Promise版本的查询单词详情 // async loadWordPromise(titleEn: string): Promise<{ success: boolean; msg: string | null; word: OnlineWord | null }> { // return new Promise((resolve) => { // this.loadWord(titleEn, (success, msg, word) => { // resolve({ success, msg, word }) // }) // }) // } // // /// Promise版本的中英文模糊查询 // async searchWordsPromise(text: string, pageIndex: number = 0): Promise<{ success: boolean; msg: string | null; words: OnlineWord[] | null }> { // return new Promise((resolve) => { // this.searchWords(text, pageIndex, (success, msg, words) => { // resolve({ success, msg, words }) // }) // }) // } } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class OnlineWordManager {
private static instance: OnlineWordManager | null = null
private constructor() {
}
static get shared(): OnlineWordManager {
if (!OnlineWordManager.instance) {
OnlineWordManager.instance = new OnlineWordManager()
}
return OnlineWordManager.instance
}
loadWord(titleEn: string, completion: (success: boolean, msg: string | null, word: OnlineWord | null) => void): void {
const params: HttpUtils.HttpParams = {}
params[CodingKeys.TitleEn] = titleEn
const isCurCnt = LanguageManager.isTraditionalChinese()
const subRoute = isCurCnt ? "word_cnt" : "word_cns"
const url = `${Servers.getRouteUrl(Route.word)}/${subRoute}`
Http.request(url, HttpUtils.Method.GET, params, (succeed: boolean, msg: string | null, result: Object[] | null) => {
if (!succeed || !result) {
completion(false, msg, null)
return
}
try {
const list = OnlineWord.fromArray(result)
completion(true, msg, list.length > 0 ? list[0] : null)
} catch (error) {
completion(false, `JSON解析失败: ${error}`, null)
}
})
}
searchWords(text: string, pageIndex: number = 0, completion: (success: boolean, msg: string | null, words: OnlineWord[] | null) => void): void {
const params: HttpUtils.HttpParams = {}
params['text'] = text
params[HttpUtils.Param.page] = pageIndex
const isCurCnt = LanguageManager.isTraditionalChinese()
const subRoute = isCurCnt ? "word_cnt" : "word_cns"
const url = `${Servers.getRouteUrl(Route.search)}/${subRoute}`
Http.request(url, HttpUtils.Method.GET, params, (succeed: boolean, msg: string | null, result: Object[] | null) => {
if (!succeed || !result) {
completion(false, msg, null)
return
}
try {
const list = OnlineWord.fromArray(result)
completion(true, msg, list)
} catch (error) {
completion(false, `JSON解析失败: ${error}`, null)
}
})
}
/ Promise版本的查询单词详情
async loadWordPromise(titleEn: string): Promise<{ success: boolean; msg: string | null; word: OnlineWord | null }> {
return new Promise((resolve) => {
this.loadWord(titleEn, (success, msg, word) => {
resolve({ success, msg, word })
})
})
}
/ Promise版本的中英文模糊查询
async searchWordsPromise(text: string, pageIndex: number = 0): Promise<{ success: boolean; msg: string | null; words: OnlineWord[] | null }> {
return new Promise((resolve) => {
this.searchWords(text, pageIndex, (success, msg, words) => {
resolve({ success, msg, words })
})
})
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/onlinesearch/OnlineWordManager.ets#L8-L92
|
3225b17b3b67b613e4760d0fc79b0135c8c03a6b
|
github
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.arkui.advanced.SegmentButtonV2.d.ets
|
arkts
|
SegmentButtonV2Item
|
Defines segmented button item.
@interface SegmentButtonV2Item
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18
|
@ObservedV2
export declare class SegmentButtonV2Item {
/**
* Sets the text of the segmented button item.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace text?: ResourceStr;
/**
* Sets the image icon of the segmented button item.
* This field will be useless if the symbol field is sets.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace icon?: ResourceStr;
/**
* Sets the symbol icon of the segmented button item.
*
* @type { ?Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace symbol?: Resource;
/**
* Sets whether segmented button item is enabled?
*
* @type { ?boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace enabled: boolean;
/**
* Sets modifier for the text of the segmented button item.
*
* @type { ?TextModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace textModifier?: TextModifier;
/**
* Sets modifier for the image icon of the segmented button item.
*
* @type { ?ImageModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace iconModifier?: ImageModifier;
/**
* Sets modifier for the symbol icon of the segmented button item.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace symbolModifier?: SymbolGlyphModifier;
/**
* Sets the accessibility text of the segmented button item.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace accessibilityText?: ResourceStr;
/**
* Sets the accessibility description of the segmented button item.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace accessibilityDescription?: ResourceStr;
/**
* Sets the accessibility level of the segmented button item.
*
* @type { ?string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace accessibilityLevel?: string;
/**
* The constructor of SegmentedButtonItem
*
* @param { SegmentedButtonItemOptions } options - the options of the segmented button item
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
constructor(options: SegmentButtonV2ItemOptions);
/**
* Is the segmented button item set with both text and icon?
*
* @type { boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
get isHybrid(): boolean;
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class SegmentButtonV2Item AST#class_body#Left { /**
* Sets the text of the segmented button item.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right text ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the image icon of the segmented button item.
* This field will be useless if the symbol field is sets.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right icon ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the symbol icon of the segmented button item.
*
* @type { ?Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right symbol ? : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets whether segmented button item is enabled?
*
* @type { ?boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets modifier for the text of the segmented button item.
*
* @type { ?TextModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right textModifier ? : AST#type_annotation#Left AST#primary_type#Left TextModifier AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets modifier for the image icon of the segmented button item.
*
* @type { ?ImageModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right iconModifier ? : AST#type_annotation#Left AST#primary_type#Left ImageModifier AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets modifier for the symbol icon of the segmented button item.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right symbolModifier ? : AST#type_annotation#Left AST#primary_type#Left SymbolGlyphModifier AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the accessibility text of the segmented button item.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right accessibilityText ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the accessibility description of the segmented button item.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right accessibilityDescription ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the accessibility level of the segmented button item.
*
* @type { ?string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right accessibilityLevel ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* The constructor of SegmentedButtonItem
*
* @param { SegmentedButtonItemOptions } options - the options of the segmented button item
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#ERROR#Left constructor AST#ERROR#Left AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left SegmentButtonV2ItemOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ; /**
* Is the segmented button item set with both text and icon?
*
* @type { boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ get isHybrid AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : boolean ; AST#ERROR#Right } AST#class_body#Right AST#decorated_export_declaration#Right
|
@ObservedV2
export declare class SegmentButtonV2Item {
@Trace text?: ResourceStr;
@Trace icon?: ResourceStr;
@Trace symbol?: Resource;
@Trace enabled: boolean;
@Trace textModifier?: TextModifier;
@Trace iconModifier?: ImageModifier;
@Trace symbolModifier?: SymbolGlyphModifier;
@Trace accessibilityText?: ResourceStr;
@Trace accessibilityDescription?: ResourceStr;
@Trace accessibilityLevel?: string;
constructor(options: SegmentButtonV2ItemOptions);
get isHybrid(): boolean;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButtonV2.d.ets#L180-L314
|
8bf8c4414043db047eb071eadf31dbdf435572e8
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/charts/ChartModel.ets
|
arkts
|
setData
|
Sets a new data object for the chart. The data object contains all values
and information needed for displaying.
@param data
|
public setData(data: T | null) {
this.mData = data;
this.mOffsetsCalculated = false;
if (data == null) {
return;
}
// calculate how many digits are needed
// 缺失方法
this.setupDefaultFormatter(data.getYMin(), data.getYMax());
if (this.mData) {
const dataSets = this.mData.getDataSets();
for (let i = 0; i < dataSets.size(); i++) {
const item = dataSets.get(i);
if (item.needsFormatter() || item.getValueFormatter() === this.mDefaultValueFormatter) {
item.setValueFormatter(this.mDefaultValueFormatter);
}
}
}
// let the chart know there is new data
this.notifyDataSetChanged();
this.invalidate();
if (this.mLogEnabled)
LogUtil.log(ChartModel.LOG_TAG + ":Data is set.")
}
|
AST#method_declaration#Left public setData AST#parameter_list#Left ( AST#parameter#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#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 . mData AST#member_expression#Right = AST#expression#Left data 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 . mOffsetsCalculated AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // calculate how many digits are needed // 缺失方法 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 . setupDefaultFormatter 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 data AST#expression#Right . getYMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . getYMax 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dataSets = 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 . mData AST#member_expression#Right AST#expression#Right . getDataSets AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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#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 dataSets AST#expression#Right AST#binary_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left item = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSets AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . needsFormatter 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 item AST#expression#Right AST#binary_expression#Right AST#expression#Right . getValueFormatter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mDefaultValueFormatter 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 item AST#expression#Right . setValueFormatter 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 . mDefaultValueFormatter AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // let the chart know there is new data 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 . notifyDataSetChanged 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 . invalidate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLogEnabled AST#member_expression#Right AST#expression#Right ) 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 . log 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 ChartModel AST#expression#Right . LOG_TAG AST#member_expression#Right AST#expression#Right + AST#expression#Left ":Data is set." 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public setData(data: T | null) {
this.mData = data;
this.mOffsetsCalculated = false;
if (data == null) {
return;
}
this.setupDefaultFormatter(data.getYMin(), data.getYMax());
if (this.mData) {
const dataSets = this.mData.getDataSets();
for (let i = 0; i < dataSets.size(); i++) {
const item = dataSets.get(i);
if (item.needsFormatter() || item.getValueFormatter() === this.mDefaultValueFormatter) {
item.setValueFormatter(this.mDefaultValueFormatter);
}
}
}
this.notifyDataSetChanged();
this.invalidate();
if (this.mLogEnabled)
LogUtil.log(ChartModel.LOG_TAG + ":Data is set.")
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L212-L243
|
b22ff6ea0969031ab561a77898887f5c303575c9
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Solutions/IM/Chat/features/chatlist/src/main/ets/pages/ChatListPage.ets
|
arkts
|
deleteAction
|
List的item左划时显示的删除按钮
|
@Builder
deleteAction(msg: ChatModel) {
Row() {
Image(($r('app.media.icon_delete')))
.onClick(() => {
animateTo({ duration: DELETE_ANIMATION_DURATION }, () => {
if (this.lazyForEach) {
this.chatListLazy.deleteData(msg);
} else {
let index = this.chatListArray.indexOf(msg);
this.chatListArray.splice(index, 1);
}
})
})
.width($r('app.integer.chat_list_delete_width'))
.height($r('app.integer.chat_list_delete_height'))
}
.width($r('app.integer.chat_list_page_delete_row_width'))
.height($r('app.string.layout_100'))
.justifyContent(FlexAlign.SpaceEvenly)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right deleteAction AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left ChatModel 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 Image ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon_delete' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right 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_list#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 duration AST#property_name#Right : AST#expression#Left DELETE_ANIMATION_DURATION 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lazyForEach AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . chatListLazy AST#member_expression#Right AST#expression#Right . deleteData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#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#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . chatListArray AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . chatListArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.chat_list_delete_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.integer.chat_list_delete_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#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.chat_list_page_delete_row_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.layout_100' 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 . SpaceEvenly AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
deleteAction(msg: ChatModel) {
Row() {
Image(($r('app.media.icon_delete')))
.onClick(() => {
animateTo({ duration: DELETE_ANIMATION_DURATION }, () => {
if (this.lazyForEach) {
this.chatListLazy.deleteData(msg);
} else {
let index = this.chatListArray.indexOf(msg);
this.chatListArray.splice(index, 1);
}
})
})
.width($r('app.integer.chat_list_delete_width'))
.height($r('app.integer.chat_list_delete_height'))
}
.width($r('app.integer.chat_list_page_delete_row_width'))
.height($r('app.string.layout_100'))
.justifyContent(FlexAlign.SpaceEvenly)
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/pages/ChatListPage.ets#L85-L105
|
3111ab40555f66dd65117d6b4a9f8758eb0422df
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets
|
arkts
|
组件工厂,可以注册TabInfo对象并使用
|
export class ComponentFactory {
// tabInfo对象集合
private tabsInfo: Map<string, TabInfo>;
// 注册标题集合
private keys: string[] = [];
/**
* 构造器
*/
public constructor() {
this.tabsInfo = new Map();
}
/**
* 设置tab项内容
* @param name - tab项标题
* @param content - tab项内容
*/
public set(name: string, tabInfo: TabInfo) {
this.tabsInfo.set(name, tabInfo);
}
/**
* 获取tab项内容
* @param name - tab项标题
* @returns: tab项内容
*/
public getContent(name: string): WrappedBuilder<[ESObject]> | undefined {
return this.tabsInfo.get(name)?.contentbuilder;
}
/**
* 获取tabBar
* @param name - tab项标题
* @returns: tabBar
*/
public getBar(name: string): WrappedBuilder<[TabBarItemInterface]> | undefined {
return this.tabsInfo.get(name)?.barBuilder;
}
/**
* 获取输入参数
* @param name - tab项标题
* @returns: 输入参数
*/
public getParams(name: string): ESObject {
return this.tabsInfo.get(name)?.params;
}
/**
* 删除tab项
* @param name - tab项标题
*/
public delete(name: string) {
this.keys = [];
this.tabsInfo.delete(name);
}
/**
* 获取注册标题集合
* @returns: 包含所有注册标题的数组
*/
public toArray(): string[] {
if (this.keys.length > 0) {
return this.keys;
}
let array: string[] = [];
let keys: IterableIterator<string> = this.tabsInfo.keys()
for (let keysElement of keys) {
array.push(keysElement);
}
return array;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ComponentFactory AST#class_body#Left { // tabInfo对象集合 AST#property_declaration#Left private tabsInfo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left TabInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 注册标题集合 AST#property_declaration#Left private keys : 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#property_declaration#Right /**
* 构造器
*/ AST#constructor_declaration#Left public constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabsInfo AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /**
* 设置tab项内容
* @param name - tab项标题
* @param content - tab项内容
*/ AST#method_declaration#Left public set 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 tabInfo : AST#type_annotation#Left AST#primary_type#Left TabInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabsInfo AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right , AST#expression#Left tabInfo 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 /**
* 获取tab项内容
* @param name - tab项标题
* @returns: tab项内容
*/ AST#method_declaration#Left public getContent AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . tabsInfo AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. contentbuilder AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取tabBar
* @param name - tab项标题
* @returns: tabBar
*/ AST#method_declaration#Left public getBar AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left TabBarItemInterface AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . tabsInfo AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. barBuilder AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取输入参数
* @param name - tab项标题
* @returns: 输入参数
*/ AST#method_declaration#Left public getParams AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ESObject 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabsInfo AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. params AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 删除tab项
* @param name - tab项标题
*/ AST#method_declaration#Left public delete AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 . keys 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#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 . tabsInfo AST#member_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取注册标题集合
* @returns: 包含所有注册标题的数组
*/ AST#method_declaration#Left public toArray AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keys AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keys 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#variable_declaration#Left let AST#variable_declarator#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keys : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabsInfo AST#member_expression#Right AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let keysElement of AST#expression#Left keys 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 array AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keysElement AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left array 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 ComponentFactory {
private tabsInfo: Map<string, TabInfo>;
private keys: string[] = [];
public constructor() {
this.tabsInfo = new Map();
}
public set(name: string, tabInfo: TabInfo) {
this.tabsInfo.set(name, tabInfo);
}
public getContent(name: string): WrappedBuilder<[ESObject]> | undefined {
return this.tabsInfo.get(name)?.contentbuilder;
}
public getBar(name: string): WrappedBuilder<[TabBarItemInterface]> | undefined {
return this.tabsInfo.get(name)?.barBuilder;
}
public getParams(name: string): ESObject {
return this.tabsInfo.get(name)?.params;
}
public delete(name: string) {
this.keys = [];
this.tabsInfo.delete(name);
}
public toArray(): string[] {
if (this.keys.length > 0) {
return this.keys;
}
let array: string[] = [];
let keys: IterableIterator<string> = this.tabsInfo.keys()
for (let keysElement of keys) {
array.push(keysElement);
}
return array;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets#L22-L96
|
14d0c62304c85ded700f2a772c1fea6dfd701aaa
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets
|
arkts
|
getInstance
|
获取WindowModel单例实例
@returns {WindowModel} WindowModel
|
static getInstance(): WindowModel {
if (!WindowModel.instance) {
WindowModel.instance = new WindowModel();
}
return WindowModel.instance;
}
|
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left WindowModel 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 WindowModel 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 WindowModel 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 WindowModel 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 WindowModel AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static getInstance(): WindowModel {
if (!WindowModel.instance) {
WindowModel.instance = new WindowModel();
}
return WindowModel.instance;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets#L35-L40
|
657e9390e41e705c680c3f993e41e0dfefb303bb
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_speech/src/main/ets/AudioCapturerHelper.ets
|
arkts
|
录音工具类
|
export class AudioCapturerHelper{
private static audioCapturer: audio.AudioCapturer | undefined = undefined;
private static file: fs.File | undefined = undefined;
/**
* 开始录音
* @returns
*/
static async startRecord(): Promise<string> {
let filePath = Helper.getCacheDirPath('audio', `audio_${Helper.getTodayStr('yyyyMMddHHmmssfff')}.pcm`); //pcm wav
await AudioCapturerHelper.createAudioCapturer();
AudioCapturerHelper.onReadDataCallback(filePath);
let start = await AudioCapturerHelper.start();
if (start) {
return filePath
}
return "";
}
/**
* 结束录音
*/
static async stopRecord() {
await AudioCapturerHelper.stop();
await AudioCapturerHelper.release();
AudioCapturerHelper.audioCapturer = undefined;
if (AudioCapturerHelper.file) {
Helper.close(AudioCapturerHelper.file);
}
}
/**
* 创建音频采集器
* @param options 配置音频采集器。
* @returns
*/
static async createAudioCapturer(options?: audio.AudioCapturerOptions): Promise<audio.AudioCapturer> {
if (options === undefined || options === null) {
const audioCapturerOptions: audio.AudioCapturerOptions = {
streamInfo: {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, //采样率,采样率为16000。
channels: audio.AudioChannel.CHANNEL_1, //通道,单声道。
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, //采样格式,带符号的16位整数,小尾数。
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW //编码格式,PCM编码。
},
capturerInfo: {
source: audio.SourceType.SOURCE_TYPE_MIC, //音源类型,Mic音频源
capturerFlags: 0 //音频采集器标志。 0代表音频采集器。
}
};
options = audioCapturerOptions;
}
AudioCapturerHelper.audioCapturer = await audio.createAudioCapturer(options);
return AudioCapturerHelper.audioCapturer;
}
/**
* 监听音频数据读取回调事件(当需要读取音频流数据时触发),使用callback方式返回结果.
* @param filePath 文件全路径
* @returns
*/
static onReadDataCallback(filePath: string) {
let bufferSize: number = 0;
AudioCapturerHelper.file = Helper.openSync(filePath);
let readDataCallback: Callback<ArrayBuffer> = (buffer: ArrayBuffer) => {
Helper.writeSync(AudioCapturerHelper.file!.fd, buffer, { offset: bufferSize, length: buffer.byteLength });
bufferSize += buffer.byteLength;
};
AudioCapturerHelper.audioCapturer?.on('readData', readDataCallback);
return filePath;
}
/**
* 开始音频采集
*/
static async start(): Promise<boolean> {
let blResult: boolean = false;
if (AudioCapturerHelper.audioCapturer !== undefined) {
const stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED];
const state = AudioCapturerHelper.audioCapturer.state.valueOf();
if (stateGroup.indexOf(state) === -1) { //当且仅当状态为STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一时才能启动采集
return false;
}
await AudioCapturerHelper.audioCapturer?.start().then(() => {
blResult = true;
}).catch((err: BusinessError) => {
console.error(`AudioCapturerHelper-start()异常信息,code:${err.code} - msg:${err.message}`);
blResult = false;
})
}
return blResult;
}
/**
* 停止采集
*/
static async stop(): Promise<boolean> {
let blResult: boolean = false;
if (AudioCapturerHelper.audioCapturer !== undefined) {
const state = AudioCapturerHelper.audioCapturer.state.valueOf();
//只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止
if (state !== audio.AudioState.STATE_RUNNING && state !== audio.AudioState.STATE_PAUSED) {
return false;
}
await AudioCapturerHelper.audioCapturer?.stop().then(() => {
blResult = true;
}).catch((err: BusinessError) => {
console.error(`AudioCapturerHelper-stop()异常信息,code:${err.code} - msg:${err.message}`);
blResult = false;
})
}
return blResult;
}
/**
* 销毁实例,释放资源
*/
static async release() {
let blResult: boolean = false;
if (AudioCapturerHelper.audioCapturer !== undefined) {
const state = AudioCapturerHelper.audioCapturer.state.valueOf();
//采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release
if (state === audio.AudioState.STATE_RELEASED || state === audio.AudioState.STATE_NEW) {
return false;
}
await AudioCapturerHelper.audioCapturer?.release().then(() => {
blResult = true;
}).catch((err: BusinessError) => {
console.error(`AudioCapturerHelper-release()异常信息,code:${err.code} - msg:${err.message}`);
blResult = false;
})
}
return blResult;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class AudioCapturerHelper AST#class_body#Left { AST#property_declaration#Left private static audioCapturer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left audio . AudioCapturer AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private static file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left fs . File AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 开始录音
* @returns
*/ AST#method_declaration#Left static async startRecord AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filePath = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . getCacheDirPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'audio' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` audio_ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . getTodayStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'yyyyMMddHHmmssfff' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right .pcm ` AST#template_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 //pcm wav 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 AudioCapturerHelper AST#expression#Right AST#await_expression#Right AST#expression#Right . createAudioCapturer 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 AudioCapturerHelper AST#expression#Right . onReadDataCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left start = 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 AudioCapturerHelper AST#expression#Right AST#await_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left start AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left filePath AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left "" AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 结束录音
*/ AST#method_declaration#Left static async stopRecord AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left AudioCapturerHelper AST#expression#Right AST#await_expression#Right AST#expression#Right . stop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 AudioCapturerHelper AST#expression#Right AST#await_expression#Right AST#expression#Right . release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AudioCapturerHelper AST#expression#Right . audioCapturer AST#member_expression#Right = AST#expression#Left undefined AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AudioCapturerHelper AST#expression#Right . file 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 Helper AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AudioCapturerHelper AST#expression#Right . file 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 /**
* 创建音频采集器
* @param options 配置音频采集器。
* @returns
*/ AST#method_declaration#Left static async createAudioCapturer AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left audio . AudioCapturerOptions 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 audio . AudioCapturer 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left options AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left options AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left audioCapturerOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left audio . AudioCapturerOptions 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 streamInfo AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left samplingRate AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audio AST#expression#Right . AudioSamplingRate AST#member_expression#Right AST#expression#Right . SAMPLE_RATE_16000 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , //采样率,采样率为16000。 AST#property_assignment#Left AST#property_name#Left channels AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audio AST#expression#Right . AudioChannel AST#member_expression#Right AST#expression#Right . CHANNEL_1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , //通道,单声道。 AST#property_assignment#Left AST#property_name#Left sampleFormat AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audio AST#expression#Right . AudioSampleFormat AST#member_expression#Right AST#expression#Right . SAMPLE_FORMAT_S16LE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , //采样格式,带符号的16位整数,小尾数。 AST#property_assignment#Left AST#property_name#Left encodingType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audio AST#expression#Right . AudioEncodingType AST#member_expression#Right AST#expression#Right . ENCODING_TYPE_RAW AST#member_expression#Right AST#expression#Right AST#property_assignment#Right //编码格式,PCM编码。 } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left capturerInfo AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left source AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audio AST#expression#Right . SourceType AST#member_expression#Right AST#expression#Right . SOURCE_TYPE_MIC AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , //音源类型,Mic音频源 AST#property_assignment#Left AST#property_name#Left capturerFlags AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right //音频采集器标志。 0代表音频采集器。 } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left options = AST#expression#Left audioCapturerOptions 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 AudioCapturerHelper AST#expression#Right . audioCapturer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left audio AST#expression#Right AST#await_expression#Right AST#expression#Right . createAudioCapturer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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#member_expression#Left AST#expression#Left AudioCapturerHelper AST#expression#Right . audioCapturer AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 监听音频数据读取回调事件(当需要读取音频流数据时触发),使用callback方式返回结果.
* @param filePath 文件全路径
* @returns
*/ AST#method_declaration#Left static onReadDataCallback AST#parameter_list#Left ( AST#parameter#Left filePath : 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 bufferSize : 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AudioCapturerHelper AST#expression#Right . file AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left readDataCallback : 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 ArrayBuffer 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#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 Helper AST#expression#Right . writeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AudioCapturerHelper AST#expression#Right . file AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left buffer AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left offset AST#property_name#Right : AST#expression#Left bufferSize AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left length AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left buffer AST#expression#Right . byteLength AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left bufferSize += AST#expression#Left AST#member_expression#Left AST#expression#Left buffer AST#expression#Right . byteLength 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#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 AudioCapturerHelper AST#expression#Right . audioCapturer AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'readData' AST#expression#Right , AST#expression#Left readDataCallback AST#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 filePath AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 开始音频采集
*/ AST#method_declaration#Left static async start 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left blResult : 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AudioCapturerHelper AST#expression#Right . audioCapturer 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#variable_declaration#Left const AST#variable_declarator#Left stateGroup = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audio AST#expression#Right . AudioState AST#member_expression#Right AST#expression#Right . STATE_PREPARED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audio AST#expression#Right . AudioState AST#member_expression#Right AST#expression#Right . STATE_PAUSED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audio AST#expression#Right . AudioState AST#member_expression#Right AST#expression#Right . STATE_STOPPED AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left state = 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 AudioCapturerHelper AST#expression#Right . audioCapturer AST#member_expression#Right AST#expression#Right . state AST#member_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stateGroup AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left state AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { //当且仅当状态为STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一时才能启动采集 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left AudioCapturerHelper AST#expression#Right AST#await_expression#Right AST#expression#Right . audioCapturer AST#member_expression#Right AST#expression#Right ?. start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blResult = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AudioCapturerHelper-start()异常信息,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 - msg: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blResult = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left blResult AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 停止采集
*/ AST#method_declaration#Left static async stop 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left blResult : 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AudioCapturerHelper AST#expression#Right . audioCapturer 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#variable_declaration#Left const AST#variable_declarator#Left state = 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 AudioCapturerHelper AST#expression#Right . audioCapturer AST#member_expression#Right AST#expression#Right . state AST#member_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left state AST#expression#Right !== AST#expression#Left audio AST#expression#Right AST#binary_expression#Right AST#expression#Right . AudioState AST#member_expression#Right AST#expression#Right . STATE_RUNNING AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left state AST#expression#Right !== AST#expression#Left audio AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . AudioState AST#member_expression#Right AST#expression#Right . STATE_PAUSED AST#member_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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left AudioCapturerHelper AST#expression#Right AST#await_expression#Right AST#expression#Right . audioCapturer AST#member_expression#Right AST#expression#Right ?. stop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blResult = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AudioCapturerHelper-stop()异常信息,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 - msg: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blResult = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left blResult AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 销毁实例,释放资源
*/ AST#method_declaration#Left static async release AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left blResult : 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AudioCapturerHelper AST#expression#Right . audioCapturer 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#variable_declaration#Left const AST#variable_declarator#Left state = 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 AudioCapturerHelper AST#expression#Right . audioCapturer AST#member_expression#Right AST#expression#Right . state AST#member_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left state AST#expression#Right === AST#expression#Left audio AST#expression#Right AST#binary_expression#Right AST#expression#Right . AudioState AST#member_expression#Right AST#expression#Right . STATE_RELEASED AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left state AST#expression#Right === AST#expression#Left audio AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . AudioState AST#member_expression#Right AST#expression#Right . STATE_NEW AST#member_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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left AudioCapturerHelper AST#expression#Right AST#await_expression#Right AST#expression#Right . audioCapturer AST#member_expression#Right AST#expression#Right ?. release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blResult = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AudioCapturerHelper-release()异常信息,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 - msg: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blResult = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left blResult 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 AudioCapturerHelper{
private static audioCapturer: audio.AudioCapturer | undefined = undefined;
private static file: fs.File | undefined = undefined;
static async startRecord(): Promise<string> {
let filePath = Helper.getCacheDirPath('audio', `audio_${Helper.getTodayStr('yyyyMMddHHmmssfff')}.pcm`);
await AudioCapturerHelper.createAudioCapturer();
AudioCapturerHelper.onReadDataCallback(filePath);
let start = await AudioCapturerHelper.start();
if (start) {
return filePath
}
return "";
}
static async stopRecord() {
await AudioCapturerHelper.stop();
await AudioCapturerHelper.release();
AudioCapturerHelper.audioCapturer = undefined;
if (AudioCapturerHelper.file) {
Helper.close(AudioCapturerHelper.file);
}
}
static async createAudioCapturer(options?: audio.AudioCapturerOptions): Promise<audio.AudioCapturer> {
if (options === undefined || options === null) {
const audioCapturerOptions: audio.AudioCapturerOptions = {
streamInfo: {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
},
capturerInfo: {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 0
}
};
options = audioCapturerOptions;
}
AudioCapturerHelper.audioCapturer = await audio.createAudioCapturer(options);
return AudioCapturerHelper.audioCapturer;
}
static onReadDataCallback(filePath: string) {
let bufferSize: number = 0;
AudioCapturerHelper.file = Helper.openSync(filePath);
let readDataCallback: Callback<ArrayBuffer> = (buffer: ArrayBuffer) => {
Helper.writeSync(AudioCapturerHelper.file!.fd, buffer, { offset: bufferSize, length: buffer.byteLength });
bufferSize += buffer.byteLength;
};
AudioCapturerHelper.audioCapturer?.on('readData', readDataCallback);
return filePath;
}
static async start(): Promise<boolean> {
let blResult: boolean = false;
if (AudioCapturerHelper.audioCapturer !== undefined) {
const stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED];
const state = AudioCapturerHelper.audioCapturer.state.valueOf();
if (stateGroup.indexOf(state) === -1) {
return false;
}
await AudioCapturerHelper.audioCapturer?.start().then(() => {
blResult = true;
}).catch((err: BusinessError) => {
console.error(`AudioCapturerHelper-start()异常信息,code:${err.code} - msg:${err.message}`);
blResult = false;
})
}
return blResult;
}
static async stop(): Promise<boolean> {
let blResult: boolean = false;
if (AudioCapturerHelper.audioCapturer !== undefined) {
const state = AudioCapturerHelper.audioCapturer.state.valueOf();
if (state !== audio.AudioState.STATE_RUNNING && state !== audio.AudioState.STATE_PAUSED) {
return false;
}
await AudioCapturerHelper.audioCapturer?.stop().then(() => {
blResult = true;
}).catch((err: BusinessError) => {
console.error(`AudioCapturerHelper-stop()异常信息,code:${err.code} - msg:${err.message}`);
blResult = false;
})
}
return blResult;
}
static async release() {
let blResult: boolean = false;
if (AudioCapturerHelper.audioCapturer !== undefined) {
const state = AudioCapturerHelper.audioCapturer.state.valueOf();
if (state === audio.AudioState.STATE_RELEASED || state === audio.AudioState.STATE_NEW) {
return false;
}
await AudioCapturerHelper.audioCapturer?.release().then(() => {
blResult = true;
}).catch((err: BusinessError) => {
console.error(`AudioCapturerHelper-release()异常信息,code:${err.code} - msg:${err.message}`);
blResult = false;
})
}
return blResult;
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/AudioCapturerHelper.ets#L10-L154
|
6aceda60122d818be06fc6ffce905e82a32def0b
|
gitee
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/ThreadUtils.ets
|
arkts
|
主线程检查工具类
|
export class ThreadUtils {
/**
* 判断当前是否为主线程
*/
static isMainThread(): boolean {
return process.tid === process.pid; // 主线程时两者相等
}
/**
* 打印完整线程信息
*/
/**
* 获取当前线程诊断信息
*/
static dumpThreadInfo(): string {
const pm = new process.ProcessManager();
const str = `
Process ID: ${process.pid}
Thread ID: ${process.tid}
Is Main: ${process.tid === process.pid}
Is 64Bit: ${process.is64Bit()}
Thread Priority: ${pm.getThreadPriority(process.tid)}
Uptime: ${process.uptime()}ms
`;
DebugLog.d(str)
return str
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ThreadUtils AST#class_body#Left { /**
* 判断当前是否为主线程
*/ AST#method_declaration#Left static isMainThread 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left process AST#expression#Right . tid AST#member_expression#Right AST#expression#Right === AST#expression#Left process AST#expression#Right AST#binary_expression#Right AST#expression#Right . pid 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 static dumpThreadInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pm = 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 process AST#expression#Right AST#new_expression#Right AST#expression#Right . ProcessManager 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 str = AST#expression#Left AST#template_literal#Left `
Process ID: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left process AST#expression#Right . pid AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
Thread ID: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left process AST#expression#Right . tid AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
Is Main: AST#template_substitution#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 process AST#expression#Right . tid AST#member_expression#Right AST#expression#Right === AST#expression#Left process AST#expression#Right AST#binary_expression#Right AST#expression#Right . pid AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
Is 64Bit: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left process AST#expression#Right . is64Bit 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
Thread Priority: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pm AST#expression#Right . getThreadPriority AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left process AST#expression#Right . tid AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right
Uptime: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left process AST#expression#Right . uptime 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 ms
` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left str 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 ThreadUtils {
static isMainThread(): boolean {
return process.tid === process.pid;
}
static dumpThreadInfo(): string {
const pm = new process.ProcessManager();
const str = `
Process ID: ${process.pid}
Thread ID: ${process.tid}
Is Main: ${process.tid === process.pid}
Is 64Bit: ${process.is64Bit()}
Thread Priority: ${pm.getThreadPriority(process.tid)}
Uptime: ${process.uptime()}ms
`;
DebugLog.d(str)
return str
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ThreadUtils.ets#L5-L34
|
6a70121431989c5cfba101e7f47498261a2662a8
|
github
|
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/viewmodel/WeatherManager.ets
|
arkts
|
isCacheValid
|
检查缓存是否有效
|
isCacheValid(): boolean {
const now = Date.now();
const cacheDuration = this.TEST_MODE ? 10 * 1000 : this.CACHE_DURATION;
return this.cachedWeatherData !== null && (now - this.lastUpdateTime) < cacheDuration;
}
|
AST#method_declaration#Left isCacheValid 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#variable_declaration#Left const AST#variable_declarator#Left now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cacheDuration = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . TEST_MODE AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left 10 AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . CACHE_DURATION AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cachedWeatherData AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left now AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lastUpdateTime AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left cacheDuration 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
|
isCacheValid(): boolean {
const now = Date.now();
const cacheDuration = this.TEST_MODE ? 10 * 1000 : this.CACHE_DURATION;
return this.cachedWeatherData !== null && (now - this.lastUpdateTime) < cacheDuration;
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/WeatherManager.ets#L194-L198
|
2f9a1c9bb66a9c1cc648c9fc88f5416e1778cc4a
|
github
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets
|
arkts
|
getData
|
获取数据函数
|
public getData(index: number) {
return this.originDataArray[index];
}
|
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#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 . originDataArray 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
|
public getData(index: number) {
return this.originDataArray[index];
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L53-L55
|
bb400a48db558043b28043581b9c6161f040a190
|
gitee
|
lime-zz/Ark-ui_RubbishRecycleApp.git
|
c2a9bff8fbb5bc46d922934afad0327cc1696969
|
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
|
arkts
|
UI
|
build() {
Stack() {
Column({ space: 10 }) {
// 顶部导航栏保持不变
Row() {
Image($r("app.media.img2_10"))
.width(12)
.height(24)
.zIndex(1)
.margin({ right: 10 })
.onClick(() => {
router.back();
})
Text('购物车')
.fontSize(30)
.fontWeight(600)
.fontColor($r('sys.color.white'))
}
.margin({ top: 25 })
.padding({
top: 20,
right: 10,
bottom: 20,
left: 10
})
.width('100%')
.justifyContent(FlexAlign.Start);
// 设置一个固定高度的容器用于滚动内容
Column() {
// 购物车列表区域 - 使用固定高度的Scroll
Scroll() {
Column() {
if (this.datas.length === 0) {
// 空购物车状态
Column() {
Image($r('app.media.img_16'))
.width(100)
.height(100)
.opacity(0.5)
Text('购物车为空')
.fontSize(18)
.fontColor('#666666')
.margin({ top: 20 })
Text('快去添加一些商品吧!')
.fontSize(14)
.fontColor('#999999')
.margin({ top: 10 })
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
} else {
// 商品列表
List() {
ForEach(this.datas, (item: Type1, index: number) => {
ListItem() {
this.hotItems(item, index)
}
})
}
}
}
.width('100%')
}
.scrollBar(BarState.Off)
.height('75%') // 关键:设置固定高度,留出空间给底部按钮
}
.width('100%')
// 全选和结算按钮区域 - 固定在底部
Row({}) {
Row() {
// 添加"全选"复选框
Checkbox()
.select(this.isSelectedAll) // 全选复选框的状态与是否全选同步
.padding({ left: 20 })
.onChange((checked: boolean) => {
this.toggleSelectAll(); // 当点击复选框时切换全选状态
})
Button(`${this.isSelectedAll ? '取消全选' : '全选'}`)
.width('37%')
.height(110)
.fontSize(16)
.fontColor('#000000')
.fontWeight(300)
.backgroundColor('#FFFFFF')
.onClick(() => {
this.toggleSelectAll(); // 切换全选状态
})
}
.backgroundColor('#FFFFFF')
.margin({ bottom: 20 })
Column() {
Button('立即结算')
.width('50%')
.height(110)
.backgroundColor('#00C9D6')
.fontColor('#FFFFFF')
.fontWeight(300)
.fontSize(16)
.onClick(() => {
// 检查是否有选中的商品
const selectedItems = this.datas.filter((item: Type1) => item.selected);
if (selectedItems.length === 0) {
promptAction.showToast({ message: '请先选择要结算的商品', duration: 2000 });
return;
} else {
// 显示支付弹窗
this.showPaymentDialog = true;
}
})
// 支付弹窗
if (this.showPaymentDialog) {
this.paymentDialog(); // 调用支付弹窗组件
}
}
.backgroundColor('#00C9D6')
.margin({ bottom: 20 })
}
.zIndex(1)
.width('100%')
.justifyContent(FlexAlign.Center)
// 支付弹窗
if (this.showPaymentDialog) {
this.paymentDialog(); // 调用支付弹窗组件
}
}
.width('100%')
.height('100%')
.backgroundColor('#EBFCF9')
.backgroundImage($r('app.media.bk'))
.backgroundImageSize({ width: '100%', height: '25%' })
// 支付弹窗
if (this.showPaymentDialog) {
this.paymentDialog(); // 调用支付弹窗组件
}
}
.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 Stack ( ) 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 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 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.img2_10" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . back AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '购物车' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 600 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.white' 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 25 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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 . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 Column ( ) AST#container_content_body#Left { // 购物车列表区域 - 使用固定高度的Scroll AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#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 . datas 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#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.img_16' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.5 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '购物车为空' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' 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#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 '#999999' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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#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 . datas 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 Type1 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hotItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#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#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#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '75%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 关键:设置固定高度,留出空间给底部按钮 } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 全选和结算按钮区域 - 固定在底部 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 添加"全选"复选框 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Checkbox ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . select ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectedAll 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 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left checked : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toggleSelectAll 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectedAll 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#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '37%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 110 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#000000' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 300 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFFFFF' 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 . toggleSelectAll 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '立即结算' 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 110 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#00C9D6' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 300 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 检查是否有选中的商品 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left selectedItems = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . datas AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Type1 AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . selected AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedItems AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 显示支付弹窗 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showPaymentDialog 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 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showPaymentDialog 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 . paymentDialog 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 . backgroundColor ( AST#expression#Left '#00C9D6' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showPaymentDialog 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 . paymentDialog 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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#EBFCF9' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundImage ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.bk' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundImageSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left '100%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left '25%' 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showPaymentDialog 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 . paymentDialog 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 . 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#build_body#Right AST#build_method#Right
|
build() {
Stack() {
Column({ space: 10 }) {
Row() {
Image($r("app.media.img2_10"))
.width(12)
.height(24)
.zIndex(1)
.margin({ right: 10 })
.onClick(() => {
router.back();
})
Text('购物车')
.fontSize(30)
.fontWeight(600)
.fontColor($r('sys.color.white'))
}
.margin({ top: 25 })
.padding({
top: 20,
right: 10,
bottom: 20,
left: 10
})
.width('100%')
.justifyContent(FlexAlign.Start);
Column() {
Scroll() {
Column() {
if (this.datas.length === 0) {
Column() {
Image($r('app.media.img_16'))
.width(100)
.height(100)
.opacity(0.5)
Text('购物车为空')
.fontSize(18)
.fontColor('#666666')
.margin({ top: 20 })
Text('快去添加一些商品吧!')
.fontSize(14)
.fontColor('#999999')
.margin({ top: 10 })
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
} else {
List() {
ForEach(this.datas, (item: Type1, index: number) => {
ListItem() {
this.hotItems(item, index)
}
})
}
}
}
.width('100%')
}
.scrollBar(BarState.Off)
.height('75%')
}
.width('100%')
Row({}) {
Row() {
Checkbox()
.select(this.isSelectedAll)
.padding({ left: 20 })
.onChange((checked: boolean) => {
this.toggleSelectAll();
})
Button(`${this.isSelectedAll ? '取消全选' : '全选'}`)
.width('37%')
.height(110)
.fontSize(16)
.fontColor('#000000')
.fontWeight(300)
.backgroundColor('#FFFFFF')
.onClick(() => {
this.toggleSelectAll();
})
}
.backgroundColor('#FFFFFF')
.margin({ bottom: 20 })
Column() {
Button('立即结算')
.width('50%')
.height(110)
.backgroundColor('#00C9D6')
.fontColor('#FFFFFF')
.fontWeight(300)
.fontSize(16)
.onClick(() => {
const selectedItems = this.datas.filter((item: Type1) => item.selected);
if (selectedItems.length === 0) {
promptAction.showToast({ message: '请先选择要结算的商品', duration: 2000 });
return;
} else {
this.showPaymentDialog = true;
}
})
if (this.showPaymentDialog) {
this.paymentDialog();
}
}
.backgroundColor('#00C9D6')
.margin({ bottom: 20 })
}
.zIndex(1)
.width('100%')
.justifyContent(FlexAlign.Center)
if (this.showPaymentDialog) {
this.paymentDialog();
}
}
.width('100%')
.height('100%')
.backgroundColor('#EBFCF9')
.backgroundImage($r('app.media.bk'))
.backgroundImageSize({ width: '100%', height: '25%' })
if (this.showPaymentDialog) {
this.paymentDialog();
}
}
.width('100%')
.height('100%')
}
|
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L444-L588
|
ec23cf6c35e02e5c11b8fde223ce47685f518895
|
github
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/views/main/sub/report/RadarView.ets
|
arkts
|
buildCanvas
|
========== Canvas 区域构建器 ==========
|
@Builder
buildCanvas() {
Column() {
Canvas(this.ctx)
.width(this.chartWidth)
.height(this.chartHeight)
.onReady(() => {
this.isCanvasReady = true;
this.drawCanvas();
})
}
.layoutWeight(1)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCanvas 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 Canvas ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . chartWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . chartHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onReady ( 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 . isCanvasReady AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . drawCanvas 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildCanvas() {
Column() {
Canvas(this.ctx)
.width(this.chartWidth)
.height(this.chartHeight)
.onReady(() => {
this.isCanvasReady = true;
this.drawCanvas();
})
}
.layoutWeight(1)
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/RadarView.ets#L61-L73
|
b00492a469c4423afc41809b5ed065e530f36ec1
|
github
|
pangpang20/wavecast.git
|
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
|
entry/src/main/ets/pages/MainPage.ets
|
arkts
|
buildPodcastItem
|
播客项
|
@Builder
buildPodcastItem(podcast: Podcast) {
Row() {
// 播客封面
Image(podcast.imageUrl)
.width(80)
.height(80)
.borderRadius(8)
.objectFit(ImageFit.Cover)
.alt($r('app.media.app_icon'))
// 播客信息
Column() {
Text(podcast.title)
.fontSize(16)
.fontWeight(FontWeight.Medium)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Text(podcast.author)
.fontSize(14)
.fontColor($r('app.color.text_secondary'))
.margin({ top: 4 })
Text(`${podcast.episodeCount} 集`)
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
.margin({ top: 4 })
}
.alignItems(HorizontalAlign.Start)
.margin({ left: 12 })
.layoutWeight(1)
}
.width('100%')
.padding(12)
.backgroundColor($r('app.color.background_card'))
.borderRadius(8)
.onClick(() => {
console.info(`[MainPage] Podcast: ${podcast.title}`);
// 跳转到播客详情页
const params = new RouteParams();
params.podcastId = podcast.id;
UIUtils.pushUrl('pages/PodcastDetailPage', params);
})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildPodcastItem AST#parameter_list#Left ( AST#parameter#Left podcast : AST#type_annotation#Left AST#primary_type#Left Podcast 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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . imageUrl AST#member_expression#Right AST#expression#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 80 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alt ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.app_icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 播客信息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . title 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#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . author AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . episodeCount 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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.background_card' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainPage] Podcast: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 跳转到播客详情页 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left RouteParams AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . podcastId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . id 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 UIUtils AST#expression#Right . pushUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pages/PodcastDetailPage' AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildPodcastItem(podcast: Podcast) {
Row() {
Image(podcast.imageUrl)
.width(80)
.height(80)
.borderRadius(8)
.objectFit(ImageFit.Cover)
.alt($r('app.media.app_icon'))
Column() {
Text(podcast.title)
.fontSize(16)
.fontWeight(FontWeight.Medium)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Text(podcast.author)
.fontSize(14)
.fontColor($r('app.color.text_secondary'))
.margin({ top: 4 })
Text(`${podcast.episodeCount} 集`)
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
.margin({ top: 4 })
}
.alignItems(HorizontalAlign.Start)
.margin({ left: 12 })
.layoutWeight(1)
}
.width('100%')
.padding(12)
.backgroundColor($r('app.color.background_card'))
.borderRadius(8)
.onClick(() => {
console.info(`[MainPage] Podcast: ${podcast.title}`);
const params = new RouteParams();
params.podcastId = podcast.id;
UIUtils.pushUrl('pages/PodcastDetailPage', params);
})
}
|
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L1017-L1061
|
10ca57e504388b77a612cc3ea9d2915fe101198b
|
github
|
texiwustion/chinese-herbal-shopping--arkts.git
|
3f71338f3c6d88bc74342e0322867f3a0c2c17d1
|
entry/src/main/ets/pages/LoginPage.ets
|
arkts
|
inputStyle
|
公共的样式函数
|
@Extend(TextInput) function inputStyle() {
.placeholderColor(ColorConstants.PLACEHOLDER)
.padding(StyleConstants.TEXT_INPUT_PADDING)
.margin(StyleConstants.TEXT_INPUT_MARGIN)
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left TextInput AST#expression#Right ) AST#decorator#Right function inputStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . placeholderColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left ColorConstants AST#expression#Right . PLACEHOLDER AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . TEXT_INPUT_PADDING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . TEXT_INPUT_MARGIN AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#decorated_function_declaration#Right
|
@Extend(TextInput) function inputStyle() {
.placeholderColor(ColorConstants.PLACEHOLDER)
.padding(StyleConstants.TEXT_INPUT_PADDING)
.margin(StyleConstants.TEXT_INPUT_MARGIN)
}
|
https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/pages/LoginPage.ets#L178-L182
|
91393a141dfcbac8402ded9450e36230fc52ddf2
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
|
arkts
|
verifySegmentSync
|
对数据进行分段验签,同步
@param data 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
@param len 自定义的数据拆分长度。
@returns
|
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
verifier.updateSync(updateDataBlob); //分段update
}
//已通过分段传入所有明文,故此处verify第一个参数传入null
let res = verifier.verifySync(null, signDataBlob);
return res;
}
|
AST#method_declaration#Left static verifySegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left verifier = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createVerify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifier AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateData AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifier AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateDataBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //分段update } AST#block_statement#Right AST#for_statement#Right AST#statement#Right //已通过分段传入所有明文,故此处verify第一个参数传入null AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifier AST#expression#Right . verifySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left signDataBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left res AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
verifier.updateSync(updateDataBlob);
}
let res = verifier.verifySync(null, signDataBlob);
return res;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L420-L432
|
be31f4a1ed06763ccdd4357a3a94d8af464e58d5
|
gitee
|
tobias910903/komue-harmonyapp.git
|
cd4dd4e7859ec5b33a5140bdd1d050377f13175b
|
entry/src/main/ets/utils/request.ets
|
arkts
|
getErrorMsg
|
错误信息处理(替换UI提示为console.log)
|
function getErrorMsg(error: AxiosError): string {
if (error.response) {
switch (error.response.status) {
case 400: return '请求参数错误';
case 403: return '没有权限访问';
case 404: return '请求资源不存在';
case 500: return '服务器内部错误';
default: return `请求失败: ${error.response.status}`;
}
}
|
AST#function_declaration#Left function getErrorMsg AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left AxiosError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . response 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 switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . response AST#member_expression#Right AST#expression#Right . status 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Left 400 AST#ERROR#Right : AST#expression#Left return 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#expression_statement#Left AST#expression#Left '请求参数错误' AST#expression#Right ; AST#expression_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 403 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '没有权限访问' AST#expression#Right ; AST#return_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 404 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '请求资源不存在' AST#expression#Right ; AST#return_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 500 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '服务器内部错误' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#template_literal#Left ` 请求失败: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . response AST#member_expression#Right AST#expression#Right . status AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#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#function_declaration#Right
|
function getErrorMsg(error: AxiosError): string {
if (error.response) {
switch (error.response.status) {
case 400: return '请求参数错误';
case 403: return '没有权限访问';
case 404: return '请求资源不存在';
case 500: return '服务器内部错误';
default: return `请求失败: ${error.response.status}`;
}
}
|
https://github.com/tobias910903/komue-harmonyapp.git/blob/cd4dd4e7859ec5b33a5140bdd1d050377f13175b/entry/src/main/ets/utils/request.ets#L72-L81
|
9dec869b3b1a8217e4205b49871301ad89325ef4
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/common/types/CommonTypes.ets
|
arkts
|
祝福语风格枚举
|
export enum GreetingStyle {
WARM = 'warm', // 温馨
FUNNY = 'funny', // 幽默
FORMAL = 'formal', // 正式
CREATIVE = 'creative' // 创意
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum GreetingStyle AST#enum_body#Left { AST#enum_member#Left WARM = AST#expression#Left 'warm' AST#expression#Right AST#enum_member#Right , // 温馨 AST#enum_member#Left FUNNY = AST#expression#Left 'funny' AST#expression#Right AST#enum_member#Right , // 幽默 AST#enum_member#Left FORMAL = AST#expression#Left 'formal' AST#expression#Right AST#enum_member#Right , // 正式 AST#enum_member#Left CREATIVE = AST#expression#Left 'creative' AST#expression#Right AST#enum_member#Right // 创意 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum GreetingStyle {
WARM = 'warm',
FUNNY = 'funny',
FORMAL = 'formal',
CREATIVE = 'creative'
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/CommonTypes.ets#L65-L70
|
a7026a4e0458ef1a2e8e593242439ec07e2876d1
|
github
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.arkui.advanced.InnerFullScreenLaunchComponent.d.ets
|
arkts
|
Declare type LaunchController
@syscap SystemCapability.ArkUI.ArkUI.Full
@systemapi
@since 12
|
export declare class LaunchController {
/**
* Function to launch atomicservice.
*
* @type { LaunchAtomicServiceCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @since 12
**/
public launchAtomicService: LaunchAtomicServiceCallback;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class LaunchController AST#class_body#Left { /**
* Function to launch atomicservice.
*
* @type { LaunchAtomicServiceCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @since 12
**/ AST#property_declaration#Left public launchAtomicService : AST#type_annotation#Left AST#primary_type#Left LaunchAtomicServiceCallback AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class LaunchController {
public launchAtomicService: LaunchAtomicServiceCallback;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.InnerFullScreenLaunchComponent.d.ets#L66-L77
|
bc796e10804b8d19e8187ce505b7535d4c43a470
|
gitee
|
|
ashcha0/line-inspection-terminal-frontend_arkts.git
|
c82616097e8a3b257b7b01e75b6b83ce428b518c
|
entry/src/main/ets/services/FlawService.ets
|
arkts
|
分页返回结果接口
|
export interface TableDataInfo<T> {
total: number;
rows: T[];
code: number;
msg: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface TableDataInfo AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left total : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left rows : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface TableDataInfo<T> {
total: number;
rows: T[];
code: number;
msg: string;
}
|
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L39-L44
|
63d10473a05cb2d459cd23007843bfdb1727aaed
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/entryability/EntryAbility.ets
|
arkts
|
checkAccessToken
|
获取当前应用的权限的授予状态:grantStatus(授予返回:0,未授予:-1)
|
async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
let atManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = -1;
//获取tokenId:
let tokenId: number = 0;
try {
let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
tokenId = appInfo.accessTokenId;
} catch (err) {
Logger.error(TAG, `Failed to get bundle info for self,cause ${JSON.stringify(err)}`);
}
// 检验应用是否被授予此权限,授予返回:PERMISSION_GRANTED = 0,未授予:PERMISSION_DENIED = -1
try {
grantStatus = await atManager.checkAccessToken(tokenId, permission);
} catch (err) {
Logger.error(TAG, `Failed to get bundle info for self,cause', ${JSON.stringify(err)}`);
}
return grantStatus;
}
|
AST#method_declaration#Left async checkAccessToken AST#parameter_list#Left ( AST#parameter#Left permission : AST#type_annotation#Left AST#primary_type#Left Permissions 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 abilityAccessCtrl . GrantStatus 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 atManager = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left abilityAccessCtrl AST#expression#Right . createAtManager AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left grantStatus : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left abilityAccessCtrl . GrantStatus AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //获取tokenId: AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tokenId : 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bundleInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left bundleManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getBundleInfoForSelf 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 bundleManager AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_APPLICATION AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left appInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . ApplicationInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left bundleInfo AST#expression#Right . appInfo 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 tokenId = AST#expression#Left AST#member_expression#Left AST#expression#Left appInfo AST#expression#Right . accessTokenId 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#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#template_literal#Left ` Failed to get bundle info for self,cause AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // 检验应用是否被授予此权限,授予返回:PERMISSION_GRANTED = 0,未授予:PERMISSION_DENIED = -1 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left grantStatus = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left atManager AST#expression#Right AST#await_expression#Right AST#expression#Right . checkAccessToken AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tokenId AST#expression#Right , AST#expression#Left permission AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( 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#template_literal#Left ` Failed to get bundle info for self,cause', AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left grantStatus AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
let atManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = -1;
let tokenId: number = 0;
try {
let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
tokenId = appInfo.accessTokenId;
} catch (err) {
Logger.error(TAG, `Failed to get bundle info for self,cause ${JSON.stringify(err)}`);
}
try {
grantStatus = await atManager.checkAccessToken(tokenId, permission);
} catch (err) {
Logger.error(TAG, `Failed to get bundle info for self,cause', ${JSON.stringify(err)}`);
}
return grantStatus;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/entryability/EntryAbility.ets#L55-L77
|
28e0470f1de18b6c3b9b1a20b015c35be350ed12
|
gitee
|
wustcat404/time-bar
|
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
|
time_bar/src/main/ets/components/interface/TimeBarOption.ets
|
arkts
|
Container options for the time bar host canvas.
|
export default interface
|
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
|
export default interface
|
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/interface/TimeBarOption.ets#L19-L19
|
82cc3fd4b3cdc112b71bde89fda80cf4a113423e
|
gitee
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/viewData/HelpInfo.ets
|
arkts
|
@author 2008
@datetime 2024/6/29 1:07
@className: HelpInfo
帮助信息
|
export class HelpInfo {
static readonly HELP_INFO_MESSAGE = '除本地阅读外,如需在线阅读,请先导入第三方书源后再使用,本应用提供粘贴导入和本地导入两种导入方式,将他人分享的书源链接复制后点击发现界面右上角加号,选择粘贴导入即可,若他人分享的书源为压缩包或是Json文件,可以将文件解压后点击选择用开源阅读打开,或记住文件下载保存的位置,点击发现界面右上角加号,选择本地导入。如何获取书源?用户可自行百度或微信搜索获取第三方书源或于其他任何途径获取,如QQ频道或酷安等社区。'
}
|
AST#export_declaration#Left export AST#class_declaration#Left class HelpInfo AST#class_body#Left { AST#property_declaration#Left static readonly HELP_INFO_MESSAGE = AST#expression#Left '除本地阅读外,如需在线阅读,请先导入第三方书源后再使用,本应用提供粘贴导入和本地导入两种导入方式,将他人分享的书源链接复制后点击发现界面右上角加号,选择粘贴导入即可,若他人分享的书源为压缩包或是Json文件,可以将文件解压后点击选择用开源阅读打开,或记住文件下载保存的位置,点击发现界面右上角加号,选择本地导入。如何获取书源?用户可自行百度或微信搜索获取第三方书源或于其他任何途径获取,如QQ频道或酷安等社区。' AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class HelpInfo {
static readonly HELP_INFO_MESSAGE = '除本地阅读外,如需在线阅读,请先导入第三方书源后再使用,本应用提供粘贴导入和本地导入两种导入方式,将他人分享的书源链接复制后点击发现界面右上角加号,选择粘贴导入即可,若他人分享的书源为压缩包或是Json文件,可以将文件解压后点击选择用开源阅读打开,或记住文件下载保存的位置,点击发现界面右上角加号,选择本地导入。如何获取书源?用户可自行百度或微信搜索获取第三方书源或于其他任何途径获取,如QQ频道或酷安等社区。'
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/viewData/HelpInfo.ets#L7-L9
|
1dc6b1818c9d2f36d3f85a482771c3a0eb7dc6b9
|
github
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ArkUI/StateManagement/entry/src/main/ets/segment/segment4.ets
|
arkts
|
Segment04Builder
|
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 Segment04Builder() {
NavDestination(){
Index()
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function Segment04Builder 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 NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Index ( ) 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#decorated_export_declaration#Right
|
@Builder
export function Segment04Builder() {
NavDestination(){
Index()
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment4.ets#L15-L20
|
e925d8f042b94df3d2b93f5f11e9dce8f692c37e
|
gitee
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
ETSUI/LoginSample/entry/src/main/ets/viewmodel/LoginViewMode.ets
|
arkts
|
getPersonalListItems
|
Get personal information of MainPage.
@return {Array<ListItemData>} personalListItems.
|
getPersonalListItems(): Array<ListItemData> {
let personalListItems: Array<ListItemData> = [];
for (let index = 1; index <= CommonConstants.LIST_SIZE; index++) {
let personalListItem = new ListItemData();
personalListItem.title = $r('app.string.component_list_item_text', index);
personalListItems.push(personalListItem);
}
return personalListItems;
}
|
AST#method_declaration#Left getPersonalListItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ListItemData 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 personalListItems : 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 ListItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right <= AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . LIST_SIZE AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left personalListItem = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListItemData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left personalListItem AST#expression#Right . title AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.component_list_item_text' AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left personalListItems AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left personalListItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left personalListItems AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getPersonalListItems(): Array<ListItemData> {
let personalListItems: Array<ListItemData> = [];
for (let index = 1; index <= CommonConstants.LIST_SIZE; index++) {
let personalListItem = new ListItemData();
personalListItem.title = $r('app.string.component_list_item_text', index);
personalListItems.push(personalListItem);
}
return personalListItems;
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/LoginSample/entry/src/main/ets/viewmodel/LoginViewMode.ets#L13-L21
|
8c6e4606ecd0727bc932e401319f1c3de1c2f2f0
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/UI/DragAndExchange/casesfeature/dragandexchange/src/main/ets/view/ListSceneView.ets
|
arkts
|
ListSceneView
|
列表默认间隔
实现List场景,拖拽交换子组件位置: 通过ListItem的onDragStart()方法指定拖拽开始时的行为,通过List的onTouch()指定拖拽释放时的行为。
|
@Component
export struct ListSceneView {
@State dataSource: DataSource = new DataSource();
@State dragIndex: number = 0;
aboutToAppear() {
for (let index = 0; index < ICON_NUM_IN_LIST; index++) {
this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_game${index + 1}`),
`Item${index + 1}`, true));
}
}
changeIndex(index1: number, index2: number) {
let temp: AppInfo = this.dataSource.getData(index1);
this.dataSource.setData(index1, this.dataSource.getData(index2));
this.dataSource.setData(index2, temp);
}
build() {
Column() {
Text($r('app.string.drag_and_exchange_list_drag_title'))
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.fontSize($r('app.string.drag_and_exchange_opt_title_font_size'))
Row() { // 仅靠List实现背景框,padding调整样式后,互换时可能错位
List({ space: LIST_SPACE }) {
// TODO: 性能知识点:图标一次性完全显示,且禁用滑动,无需懒加载。LazyForEach可以适用在动态添加数据的场景中,参考资料:
// https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/lazyforeach_optimization.md/
LazyForEach(this.dataSource, (item: AppInfo, index) => {
ListItem() {
Column() {
IconNoNameView({ app: item })
}
}
// TODO:知识点:在ListItem层,通过onDragStart实现拖拽开始时的回调行为
.onDragStart((event: DragEvent, extraParams: string) => {
item.visible = false; // 拖拽时,设置子组件原位置图标不可见
// 记录目标位置子组件index值
this.dragIndex = (JSON.parse(extraParams) as JsonObjType).selectedIndex;
})
.onDragEnd(() => {
item.visible = true;
})
}, (item: AppInfo) => item.name.toString())
}
.scrollBar(BarState.Off)
.height($r('app.string.drag_and_exchange_layout_90'))
.listDirection(Axis.Horizontal)
.alignListItem(ListItemAlign.Center)
.onDrop((event: DragEvent, extraParams: string) => { // TODO:知识点:在List层,通过onDrop实现拖拽结束后的回调行为
// 通过参数extraParams获取原位置子组件index值
let insertIndex: number = (JSON.parse(extraParams) as JsonObjType).insertIndex;
if (insertIndex >= this.dataSource.totalCount()) {
return;
}
this.changeIndex(this.dragIndex, insertIndex); // 互换子组件index值
this.dataSource.notifyDataReload();
})
.enableScrollInteraction(false) // 禁用滑动
.alignListItem(ListItemAlign.Center)
.padding({
top: $r('app.string.drag_and_exchange_layout_10'),
bottom: $r('app.string.drag_and_exchange_layout_10'),
left: $r('app.string.drag_and_exchange_layout_15'),
right: $r('app.string.drag_and_exchange_layout_15')
})
}
.justifyContent(FlexAlign.Center)
.height($r('app.string.drag_and_exchange_layout_90'))
.width($r('app.string.drag_and_exchange_layout_90_percent'))
.borderRadius($r('app.string.drag_and_exchange_layout_20'))
.opacity($r('app.string.drag_and_exchange_background_opacity'))
.backgroundColor($r('app.color.drag_and_exchange_background_color'))
}
.margin({ top: $r('app.string.drag_and_exchange_layout_20') })
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListSceneView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right dataSource : AST#type_annotation#Left AST#primary_type#Left DataSource 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 DataSource AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right dragIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left ICON_NUM_IN_LIST AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#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 . dataSource AST#member_expression#Right AST#expression#Right . pushData 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 AppInfo 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 AST#template_literal#Left ` app.media.drag_and_exchange_ic_public_game AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Item AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#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#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#method_declaration#Right AST#method_declaration#Left changeIndex AST#parameter_list#Left ( AST#parameter#Left index1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left temp : AST#type_annotation#Left AST#primary_type#Left AppInfo 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 . dataSource AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index1 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index2 AST#expression#Right , AST#expression#Left temp AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { 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.drag_and_exchange_list_drag_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.drag_and_exchange_opt_title_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 Row ( ) AST#container_content_body#Left { // 仅靠List实现背景框,padding调整样式后,互换时可能错位 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 LIST_SPACE AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // TODO: 性能知识点:图标一次性完全显示,且禁用滑动,无需懒加载。LazyForEach可以适用在动态添加数据的场景中,参考资料: // https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/lazyforeach_optimization.md/ AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource 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 AppInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index 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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IconNoNameView ( AST#component_parameters#Left { AST#component_parameter#Left app : AST#expression#Left item AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right // TODO:知识点:在ListItem层,通过onDragStart实现拖拽开始时的回调行为 AST#modifier_chain_expression#Left . onDragStart ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left DragEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left extraParams : 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 item AST#expression#Right . visible 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 // 拖拽时,设置子组件原位置图标不可见 // 记录目标位置子组件index值 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 . dragIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left extraParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left JsonObjType AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . selectedIndex AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onDragEnd ( 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 item AST#expression#Right . visible AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left AppInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name 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#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.drag_and_exchange_layout_90' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignListItem ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onDrop ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left DragEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left extraParams : 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 { // TODO:知识点:在List层,通过onDrop实现拖拽结束后的回调行为 // 通过参数extraParams获取原位置子组件index值 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left insertIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left extraParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left JsonObjType AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . insertIndex AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left insertIndex AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . totalCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . changeIndex 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 . dragIndex AST#member_expression#Right AST#expression#Right , AST#expression#Left insertIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 互换子组件index值 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 . dataSource AST#member_expression#Right 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#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enableScrollInteraction ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) // 禁用滑动 AST#modifier_chain_expression#Left . alignListItem ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.drag_and_exchange_layout_10' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.drag_and_exchange_layout_10' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.drag_and_exchange_layout_15' 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.string.drag_and_exchange_layout_15' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.drag_and_exchange_layout_90' 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.drag_and_exchange_layout_90_percent' 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.drag_and_exchange_layout_20' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.drag_and_exchange_background_opacity' 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.drag_and_exchange_background_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.drag_and_exchange_layout_20' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct ListSceneView {
@State dataSource: DataSource = new DataSource();
@State dragIndex: number = 0;
aboutToAppear() {
for (let index = 0; index < ICON_NUM_IN_LIST; index++) {
this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_game${index + 1}`),
`Item${index + 1}`, true));
}
}
changeIndex(index1: number, index2: number) {
let temp: AppInfo = this.dataSource.getData(index1);
this.dataSource.setData(index1, this.dataSource.getData(index2));
this.dataSource.setData(index2, temp);
}
build() {
Column() {
Text($r('app.string.drag_and_exchange_list_drag_title'))
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.fontSize($r('app.string.drag_and_exchange_opt_title_font_size'))
Row() {
List({ space: LIST_SPACE }) {
LazyForEach(this.dataSource, (item: AppInfo, index) => {
ListItem() {
Column() {
IconNoNameView({ app: item })
}
}
.onDragStart((event: DragEvent, extraParams: string) => {
item.visible = false;
this.dragIndex = (JSON.parse(extraParams) as JsonObjType).selectedIndex;
})
.onDragEnd(() => {
item.visible = true;
})
}, (item: AppInfo) => item.name.toString())
}
.scrollBar(BarState.Off)
.height($r('app.string.drag_and_exchange_layout_90'))
.listDirection(Axis.Horizontal)
.alignListItem(ListItemAlign.Center)
.onDrop((event: DragEvent, extraParams: string) => {
let insertIndex: number = (JSON.parse(extraParams) as JsonObjType).insertIndex;
if (insertIndex >= this.dataSource.totalCount()) {
return;
}
this.changeIndex(this.dragIndex, insertIndex);
this.dataSource.notifyDataReload();
})
.enableScrollInteraction(false)
.alignListItem(ListItemAlign.Center)
.padding({
top: $r('app.string.drag_and_exchange_layout_10'),
bottom: $r('app.string.drag_and_exchange_layout_10'),
left: $r('app.string.drag_and_exchange_layout_15'),
right: $r('app.string.drag_and_exchange_layout_15')
})
}
.justifyContent(FlexAlign.Center)
.height($r('app.string.drag_and_exchange_layout_90'))
.width($r('app.string.drag_and_exchange_layout_90_percent'))
.borderRadius($r('app.string.drag_and_exchange_layout_20'))
.opacity($r('app.string.drag_and_exchange_background_opacity'))
.backgroundColor($r('app.color.drag_and_exchange_background_color'))
}
.margin({ top: $r('app.string.drag_and_exchange_layout_20') })
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/DragAndExchange/casesfeature/dragandexchange/src/main/ets/view/ListSceneView.ets#L25-L101
|
8fd61d3d95ce97af0bcd084f00bb8223e56db959
|
gitee
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/websocket/WebSocketClient/entry/src/main/ets/pages/Index.ets
|
arkts
|
wsSocket
|
收到消息时的处理
|
wsSocket.on('message', (err, value) => {
this.msgHistory += "服务端:" + value + "\r\n"
this.scroller.scrollEdge(Edge.Bottom)
}
|
AST#method_declaration#Left wsSocket AST#ERROR#Left . on ( 'message' , AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left value AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left => AST#ERROR#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 . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "服务端:" AST#expression#Right + AST#expression#Left value AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right . scrollEdge AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Edge AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
wsSocket.on('message', (err, value) => {
this.msgHistory += "服务端:" + value + "\r\n"
this.scroller.scrollEdge(Edge.Bottom)
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/websocket/WebSocketClient/entry/src/main/ets/pages/Index.ets#L38-L41
|
f6c6bbc96c7d30c0bf219fb8eb0adc2c06833fd4
|
gitee
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/interface_class/simple_class/simple_class_003_T.ets
|
arkts
|
Introduction 简单类字段
|
export function simple_class_003_T(taint_src : string) : void {
let a = new A(taint_src);
taint.Sink(a.data);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function simple_class_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 a = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left A AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function simple_class_003_T(taint_src : string) : void {
let a = new A(taint_src);
taint.Sink(a.data);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/interface_class/simple_class/simple_class_003_T.ets#L5-L8
|
1bd78798c7246341db7b4a3d373b739657a88077
|
github
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/MoneyTrack-master/features/statistics/src/main/ets/commons/Constants.ets
|
arkts
|
argb
|
export const INCOME_BAR_INIT_COLOR: number = 0x80f2992c;
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left INCOME_BAR_INIT_COLOR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0x80f2992c AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const INCOME_BAR_INIT_COLOR: number = 0x80f2992c;
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/features/statistics/src/main/ets/commons/Constants.ets#L15-L15
|
bb09fc9eb9049ae885b06380c8d35a4022b8233f
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/notification/ReminderScheduler.ets
|
arkts
|
updateReminder
|
更新提醒配置
|
async updateReminder(reminderId: string, updates: Partial<ReminderConfig>): Promise<void> {
try {
const existingConfig = this.activeReminders.get(reminderId);
if (!existingConfig) {
throw new Error('提醒不存在');
}
const updatedConfig = { ...existingConfig, ...updates };
// 如果更新了时间或启用状态,需要重新发布提醒
if (updates.triggerTime || updates.enabled !== undefined) {
await this.cancelReminder(reminderId);
if (updatedConfig.enabled) {
// 重新创建提醒
if (updatedConfig.contactId) {
const contact = await this.contactService.getContact(updatedConfig.contactId);
if (contact) {
await this.createBirthdayReminder(contact, 1); // 默认提前1天
}
}
}
}
this.activeReminders.set(reminderId, updatedConfig);
await this.saveReminderConfig(updatedConfig);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Reminder updated: ${reminderId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Failed to update reminder: ${error}`);
throw error;
}
}
|
AST#method_declaration#Left async updateReminder AST#parameter_list#Left ( AST#parameter#Left reminderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ReminderConfig AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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 existingConfig = 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 . activeReminders AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reminderId AST#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 existingConfig 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 '提醒不存在' 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 updatedConfig = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left ... AST#expression#Left existingConfig AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left ... AST#expression#Left updates AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 如果更新了时间或启用状态,需要重新发布提醒 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . triggerTime AST#member_expression#Right AST#expression#Right || AST#expression#Left updates AST#expression#Right AST#binary_expression#Right AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . cancelReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reminderId AST#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 updatedConfig AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 重新创建提醒 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left updatedConfig AST#expression#Right . contactId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { 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 AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . contactService AST#member_expression#Right AST#expression#Right . getContact AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updatedConfig AST#expression#Right . contactId 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 contact AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . createBirthdayReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contact 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 // 默认提前1天 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeReminders AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reminderId AST#expression#Right , AST#expression#Left updatedConfig AST#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 . saveReminderConfig AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updatedConfig AST#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_NOTIFICATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Reminder updated: AST#template_substitution#Left $ { AST#expression#Left reminderId 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 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_NOTIFICATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to update reminder: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left error 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 updateReminder(reminderId: string, updates: Partial<ReminderConfig>): Promise<void> {
try {
const existingConfig = this.activeReminders.get(reminderId);
if (!existingConfig) {
throw new Error('提醒不存在');
}
const updatedConfig = { ...existingConfig, ...updates };
if (updates.triggerTime || updates.enabled !== undefined) {
await this.cancelReminder(reminderId);
if (updatedConfig.enabled) {
if (updatedConfig.contactId) {
const contact = await this.contactService.getContact(updatedConfig.contactId);
if (contact) {
await this.createBirthdayReminder(contact, 1);
}
}
}
}
this.activeReminders.set(reminderId, updatedConfig);
await this.saveReminderConfig(updatedConfig);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Reminder updated: ${reminderId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Failed to update reminder: ${error}`);
throw error;
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L318-L352
|
a741ca0ce83140c968272e0f33b358e6b200fe1e
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/SettingsPage.ets
|
arkts
|
buildContent
|
构建页面内容
|
@Builder
buildContent() {
Scroll() {
Column({ space: 16 }) {
// 用户信息卡片
this.buildUserInfoCard()
// 设置分组
ForEach(this.getSettingsGroups(), (group: SettingsGroup) => {
this.buildSettingsGroup(group)
})
// 底部信息
this.buildFooterInfo()
}
.padding(16)
}
.layoutWeight(1)
.scrollBar(BarState.Off)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContent 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 Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 用户信息卡片 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildUserInfoCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 设置分组 AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getSettingsGroups AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left group : AST#type_annotation#Left AST#primary_type#Left SettingsGroup AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildSettingsGroup AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left group AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right // 底部信息 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildFooterInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left 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 . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildContent() {
Scroll() {
Column({ space: 16 }) {
this.buildUserInfoCard()
ForEach(this.getSettingsGroups(), (group: SettingsGroup) => {
this.buildSettingsGroup(group)
})
this.buildFooterInfo()
}
.padding(16)
}
.layoutWeight(1)
.scrollBar(BarState.Off)
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L386-L405
|
e7b4fcdca506298b6240eeb950fb6b4188da3d40
|
github
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.