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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/dialog/DialogBuilder.ets
|
arkts
|
LoadingProgressBuilder
|
LoadingProgress
|
@Builder
export function LoadingProgressBuilder(options: LoadingProgressOptions) {
LoadingProgressView({ options: options });
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LoadingProgressBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left LoadingProgressOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left LoadingProgressView ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left options AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
|
@Builder
export function LoadingProgressBuilder(options: LoadingProgressOptions) {
LoadingProgressView({ options: options });
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L205-L208
|
ec1e267e50a02a15a547651ffd735ab4f6883c66
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets
|
arkts
|
This is the base dataset of all DataSets. It's purpose is to implement critical methods
provided by the IDataSet interface.
|
export default abstract class BaseDataSet<T extends EntryOhos> implements IDataSet<T> {
/**
* List representing all colors that are used for this DataSet
*/
protected mColors: JArrayList<Number>;
/**
* List representing all colors that are used for drawing the actual values for this DataSet
*/
protected mValueColors: JArrayList<Number> = null;
/**
* label that describes the DataSet or the data the DataSet represents
*/
private mLabel: string = 'DataSet';
/**
* this specifies which axis this DataSet should be plotted against
*/
protected mAxisDependency: AxisDependency = AxisDependency.LEFT;
/**
* if true, value highlightning is enabled
*/
protected mHighlightEnabled: boolean = true;
/**
* custom formatter that is used instead of the auto-formatter if set
*/
protected mValueFormatter: IValueFormatter;
/**
* the typeface used for the value text
*/
protected mValueTypeface: FontWeight; /*Typeface*/
private mForm: LegendForm = LegendForm.DEFAULT;
private mFormSize: number = Number.NaN;
private mFormLineWidth: number = Number.NaN;
private mFormLineDashEffect: DashPathEffect = null;
/**
* if true, y-values are drawn on the chart
*/
protected mDrawValues: boolean = true;
/**
* if true, y-icons are drawn on the chart
*/
protected mDrawIcons: boolean = true;
/**
* the offset for drawing icons (in dp)
*/
protected mIconsOffset: MPPointF = new MPPointF();
/**
* the size of the value-text labels
*/
protected mValueTextSize: number = 17;
/**
* flag that indicates if the DataSet is visible or not
*/
protected mVisible: boolean = true;
/**
* Default constructor.
*/
constructor(label?: string) {
this.mColors = new JArrayList<Number>();
this.mValueColors = new JArrayList<Number>();
// default color
this.mColors.add(0x8ceaff);
this.mValueColors.add(0x000000);
this.mLabel = label;
}
/**
* Use this method to tell the data set that the underlying data has changed.
*/
public notifyDataSetChanged(): void {
this.calcMinMax();
}
/**
* ###### ###### COLOR GETTING RELATED METHODS ##### ######
*/
public getColors(): JArrayList<Number> {
return this.mColors;
}
public getValueColors(): JArrayList<Number> {
return this.mValueColors;
}
public getColor(index?: number): number {
if (!index || index == null || index == undefined) {
index = 0;
}
return this.mColors.get(index % this.mColors.size()).valueOf();
}
/**
* ###### ###### COLOR SETTING RELATED METHODS ##### ######
*/
/**
* Sets the colors that should be used fore this DataSet. Colors are reused
* as soon as the number of Entries the DataSet represents is higher than
* the size of the colors array. If you are using colors from the resources,
* make sure that the colors are already prepared (by calling
* getResources().getColor(...)) before adding them to the DataSet.
*
* @param colors
*/
public setColorsByList(colors: JArrayList<Number>): void {
this.mColors = colors;
}
/**
* Sets the colors that should be used fore this DataSet. Colors are reused
* as soon as the number of Entries the DataSet represents is higher than
* the size of the colors array. If you are using colors from the resources,
* make sure that the colors are already prepared (by calling
* getResources().getColor(...)) before adding them to the DataSet.
*
* @param colors
*/
public setColorsByVariable(colors: number[]): void {
this.mColors = ColorTemplate.createColors(colors);
}
/**
* Sets the colors that should be used fore this DataSet. Colors are reused
* as soon as the number of Entries the DataSet represents is higher than
* the size of the colors array. You can use
* "new int[] { R.color.red, R.color.green, ... }" to provide colors for
* this method. Internally, the colors are resolved using
* getResources().getColor(...)
*
* @param colors
*/
public setColorsByArr(colors: number[]): void {
if (this.mColors == null) {
this.mColors = new JArrayList<Number>();
}
this.mColors.clear();
for (let color of colors) {
this.mColors.add(color);
}
}
/**
* Adds a new color to the colors array of the DataSet.
*
* @param color
*/
public addColor(color: number): void {
if (this.mColors == null) {
this.mColors = new JArrayList<Number>();
}
this.mColors.add(color);
}
/**
* Sets the one and ONLY color that should be used for this DataSet.
* Internally, this recreates the colors array and adds the specified color.
*
* @param color
*/
public setColorByColor(color: Number): void {
this.resetColors();
this.mColors.add(color);
}
/**
* Sets a color with a specific alpha value.
*
* @param color
* @param alpha from 0-255
*/
public setColorByAlpha(color: number, alpha: number): void {
var mColor: number = ColorTemplate.argb(
alpha,
ColorTemplate.red(color),
ColorTemplate.green(color),
ColorTemplate.blue(color)
);
this.setColorsByVariable([mColor]);
}
/**
* Sets colors with a specific alpha value.
*
* @param colors
* @param alpha
*/
public setColorsByArrAndAlpha(colors: number[], alpha: number): void {
this.resetColors();
for (let color of colors) {
this.addColor(
ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color))
);
}
}
/**
* Resets all colors of this DataSet and recreates the colors array.
*/
public resetColors(): void {
if (this.mColors == null) {
this.mColors = new JArrayList<Number>();
}
this.mColors.clear();
}
/**
* ###### ###### OTHER STYLING RELATED METHODS ##### ######
*/
public setLabel(label: string): void {
this.mLabel = label;
}
public getLabel(): string {
return this.mLabel;
}
public setHighlightEnabled(enabled: boolean): void {
this.mHighlightEnabled = enabled;
}
public isHighlightEnabled(): boolean {
return this.mHighlightEnabled;
}
public setValueFormatter(f: IValueFormatter): void {
if (f == null) {
return;
} else {
this.mValueFormatter = f;
}
}
public getValueFormatter(): IValueFormatter {
if (this.needsFormatter()) {
return Utils.getDefaultValueFormatter();
}
return this.mValueFormatter;
}
public needsFormatter(): boolean {
return this.mValueFormatter == null;
}
public setValueTextColor(color: number): void {
this.mValueColors.clear();
this.mValueColors.add(color);
}
public setValueTextColors(colors: JArrayList<Number>): void {
this.mValueColors = colors;
}
public setValueTypeface(tf: FontWeight /*Typeface*/): void {
this.mValueTypeface = tf;
}
public setValueTextSize(size: number): void {
this.mValueTextSize = size;
}
public getValueTextColor(index?: number): number {
if (!index) {
index = 0;
}
return this.mValueColors.get(index % this.mValueColors.size()).valueOf();
}
public getValueTypeface(): FontWeight /*Typeface*/ {
return this.mValueTypeface;
}
public getValueTextSize(): number {
return this.mValueTextSize;
}
public setForm(form: LegendForm): void {
this.mForm = form;
}
public getForm(): LegendForm {
return this.mForm;
}
public setFormSize(formSize: number): void {
this.mFormSize = formSize;
}
public getFormSize(): number {
return this.mFormSize;
}
public setFormLineWidth(formLineWidth: number): void {
this.mFormLineWidth = formLineWidth;
}
public getFormLineWidth(): number {
return this.mFormLineWidth;
}
public setFormLineDashEffect(dashPathEffect: DashPathEffect): void {
this.mFormLineDashEffect = dashPathEffect;
}
public getFormLineDashEffect(): DashPathEffect {
return this.mFormLineDashEffect;
}
public setDrawValues(enabled: boolean): void {
this.mDrawValues = enabled;
}
public isDrawValuesEnabled(): boolean {
return this.mDrawValues;
}
public setDrawIcons(enabled: boolean): void {
this.mDrawIcons = enabled;
}
public isDrawIconsEnabled(): boolean {
return this.mDrawIcons;
}
public setIconsOffset(offsetDp: MPPointF): void {
this.mIconsOffset.x = offsetDp.x;
this.mIconsOffset.y = offsetDp.y;
}
public getIconsOffset(): MPPointF {
return this.mIconsOffset;
}
public setVisible(visible: boolean): void {
this.mVisible = visible;
}
public isVisible(): boolean {
return this.mVisible;
}
public getAxisDependency(): AxisDependency {
return this.mAxisDependency;
}
public setAxisDependency(dependency: AxisDependency): void {
this.mAxisDependency = dependency;
}
/**
* ###### ###### DATA RELATED METHODS ###### ######
*/
public getIndexInEntries(xIndex: number): number {
for (let i = 0; i < this.getEntryCount(); i++) {
if (xIndex == this.getEntryForIndex(i).getX()) {
return i;
}
}
return -1;
}
public removeFirst(): boolean {
if (this.getEntryCount() > 0) {
var entry: T = this.getEntryForIndex(0);
return this.removeEntry(entry);
} else {
return false;
}
}
public removeLast(): boolean {
if (this.getEntryCount() > 0) {
var e: T = this.getEntryForIndex(this.getEntryCount() - 1);
return this.removeEntry(e);
} else return false;
}
public removeEntryByXValue(xValue: number): boolean {
var e: T = this.getEntryForXValue(xValue, Number.NaN);
return this.removeEntry(e);
}
public removeEntryByIndex(index: number): boolean {
var e: T = this.getEntryForIndex(index);
return this.removeEntry(e);
}
public contains(e: T): boolean {
for (let i = 0; i < this.getEntryCount(); i++) {
if (this.getEntryForIndex(i) == e) {
return true;
}
}
return false;
}
protected copyTo(baseDataSet: BaseDataSet<T>): void {
baseDataSet.mAxisDependency = this.mAxisDependency;
baseDataSet.mColors = this.mColors;
baseDataSet.mDrawIcons = this.mDrawIcons;
baseDataSet.mDrawValues = this.mDrawValues;
baseDataSet.mForm = this.mForm;
baseDataSet.mFormLineDashEffect = this.mFormLineDashEffect;
baseDataSet.mFormLineWidth = this.mFormLineWidth;
baseDataSet.mFormSize = this.mFormSize;
baseDataSet.mHighlightEnabled = this.mHighlightEnabled;
baseDataSet.mIconsOffset = this.mIconsOffset;
baseDataSet.mValueColors = this.mValueColors;
baseDataSet.mValueFormatter = this.mValueFormatter;
baseDataSet.mValueColors = this.mValueColors;
baseDataSet.mValueTextSize = this.mValueTextSize;
baseDataSet.mVisible = this.mVisible;
}
getYMin(): number {
return 0;
}
/**
* returns the maximum y-value this DataSet holds
*
* @return
*/
getYMax(): number {
return 0;
}
/**
* returns the minimum x-value this DataSet holds
*
* @return
*/
getXMin(): number {
return 0;
}
/**
* returns the maximum x-value this DataSet holds
*
* @return
*/
getXMax(): number {
return 0;
}
getEntryCount(): number {
return 0;
}
calcMinMax(e?: T): void {}
calcMinMaxY(fromX: number, toX: number): void {}
getEntryForXValue(xValue: number, closestToY: number, rounding?: Rounding): T {
return null;
}
getEntriesForXValue(xValue: number): JArrayList<T> {
return null;
}
getEntryForIndex(index: number): T {
return null;
}
getEntryIndex(xValue: number, closestToY: number, rounding: Rounding): number {
return 0;
}
getEntryIndexByEntry(e: T): number {
return 0;
}
addEntry(e: T): boolean {
return false;
}
addEntryOrdered(e: T): void {}
removeEntry(e: T): boolean {
return false;
}
clear(): void {}
}
|
AST#export_declaration#Left export default AST#class_declaration#Left abstract class BaseDataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements AST#generic_type#Left IDataSet 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#implements_clause#Right AST#class_body#Left { /**
* List representing all colors that are used for this DataSet
*/ AST#property_declaration#Left protected mColors : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* List representing all colors that are used for drawing the actual values for this DataSet
*/ AST#property_declaration#Left protected mValueColors : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* label that describes the DataSet or the data the DataSet represents
*/ AST#property_declaration#Left private mLabel : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'DataSet' AST#expression#Right ; AST#property_declaration#Right /**
* this specifies which axis this DataSet should be plotted against
*/ AST#property_declaration#Left protected mAxisDependency : AST#type_annotation#Left AST#primary_type#Left AxisDependency AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AxisDependency AST#expression#Right . LEFT AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* if true, value highlightning is enabled
*/ AST#property_declaration#Left protected mHighlightEnabled : 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 /**
* custom formatter that is used instead of the auto-formatter if set
*/ AST#property_declaration#Left protected mValueFormatter : AST#type_annotation#Left AST#primary_type#Left IValueFormatter AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* the typeface used for the value text
*/ AST#property_declaration#Left protected mValueTypeface : AST#type_annotation#Left AST#primary_type#Left FontWeight AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /*Typeface*/ AST#property_declaration#Left private mForm : AST#type_annotation#Left AST#primary_type#Left LegendForm AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left LegendForm AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mFormSize : 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 Number AST#expression#Right . NaN AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mFormLineWidth : 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 Number AST#expression#Right . NaN AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mFormLineDashEffect : AST#type_annotation#Left AST#primary_type#Left DashPathEffect AST#primary_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 /**
* if true, y-values are drawn on the chart
*/ AST#property_declaration#Left protected mDrawValues : 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 /**
* if true, y-icons are drawn on the chart
*/ AST#property_declaration#Left protected mDrawIcons : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* the offset for drawing icons (in dp)
*/ AST#property_declaration#Left protected mIconsOffset : AST#type_annotation#Left AST#primary_type#Left MPPointF AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left MPPointF 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 /**
* the size of the value-text labels
*/ AST#property_declaration#Left protected mValueTextSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 17 AST#expression#Right ; AST#property_declaration#Right /**
* flag that indicates if the DataSet is visible or not
*/ AST#property_declaration#Left protected mVisible : 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 /**
* Default constructor.
*/ AST#constructor_declaration#Left constructor 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_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 . mColors 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 Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . mValueColors 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 Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // default color 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 . mColors AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x8ceaff AST#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 . mValueColors AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x000000 AST#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 . mLabel AST#member_expression#Right = AST#expression#Left label 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 /**
* Use this method to tell the data set that the underlying data has changed.
*/ AST#method_declaration#Left public notifyDataSetChanged AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . 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#builder_function_body#Right AST#method_declaration#Right /**
* ###### ###### COLOR GETTING RELATED METHODS ##### ######
*/ AST#method_declaration#Left public getColors AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors 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 getValueColors AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValueColors 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 getColor AST#parameter_list#Left ( AST#parameter#Left index ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left index AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left 0 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#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 . mColors 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right % AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mColors AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* ###### ###### COLOR SETTING RELATED METHODS ##### ######
*/ /**
* Sets the colors that should be used fore this DataSet. Colors are reused
* as soon as the number of Entries the DataSet represents is higher than
* the size of the colors array. If you are using colors from the resources,
* make sure that the colors are already prepared (by calling
* getResources().getColor(...)) before adding them to the DataSet.
*
* @param colors
*/ AST#method_declaration#Left public setColorsByList AST#parameter_list#Left ( AST#parameter#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors AST#member_expression#Right = AST#expression#Left colors AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* Sets the colors that should be used fore this DataSet. Colors are reused
* as soon as the number of Entries the DataSet represents is higher than
* the size of the colors array. If you are using colors from the resources,
* make sure that the colors are already prepared (by calling
* getResources().getColor(...)) before adding them to the DataSet.
*
* @param colors
*/ AST#method_declaration#Left public setColorsByVariable AST#parameter_list#Left ( AST#parameter#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 . mColors AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . createColors AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left colors AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* Sets the colors that should be used fore this DataSet. Colors are reused
* as soon as the number of Entries the DataSet represents is higher than
* the size of the colors array. You can use
* "new int[] { R.color.red, R.color.green, ... }" to provide colors for
* this method. Internally, the colors are resolved using
* getResources().getColor(...)
*
* @param colors
*/ AST#method_declaration#Left public setColorsByArr AST#parameter_list#Left ( AST#parameter#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors 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 Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let color of AST#expression#Left colors 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 . mColors AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Adds a new color to the colors array of the DataSet.
*
* @param color
*/ AST#method_declaration#Left public addColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors 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 Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . mColors AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* Sets the one and ONLY color that should be used for this DataSet.
* Internally, this recreates the colors array and adds the specified color.
*
* @param color
*/ AST#method_declaration#Left public setColorByColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resetColors AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* Sets a color with a specific alpha value.
*
* @param color
* @param alpha from 0-255
*/ AST#method_declaration#Left public setColorByAlpha AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left alpha : 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#variable_declaration#Left var AST#variable_declarator#Left mColor : 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 ColorTemplate AST#expression#Right . argb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left alpha AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . red AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . green AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . blue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setColorsByVariable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left mColor AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Sets colors with a specific alpha value.
*
* @param colors
* @param alpha
*/ AST#method_declaration#Left public setColorsByArrAndAlpha AST#parameter_list#Left ( AST#parameter#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resetColors 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#for_statement#Left for ( let color of AST#expression#Left colors AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addColor 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 ColorTemplate AST#expression#Right . argb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left alpha AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . red AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . green AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ColorTemplate AST#expression#Right . blue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 /**
* Resets all colors of this DataSet and recreates the colors array.
*/ AST#method_declaration#Left public resetColors 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors 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 Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . mColors AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* ###### ###### OTHER STYLING RELATED METHODS ##### ######
*/ AST#method_declaration#Left public setLabel 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_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 . mLabel AST#member_expression#Right = AST#expression#Left label AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getLabel 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 . mLabel 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 setHighlightEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mHighlightEnabled AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public isHighlightEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mHighlightEnabled 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 setValueFormatter AST#parameter_list#Left ( AST#parameter#Left f : AST#type_annotation#Left AST#primary_type#Left IValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left f 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 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 . mValueFormatter AST#member_expression#Right = AST#expression#Left f AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public getValueFormatter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left IValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . needsFormatter 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . getDefaultValueFormatter 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#member_expression#Left AST#expression#Left this AST#expression#Right . mValueFormatter 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 needsFormatter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValueFormatter 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public setValueTextColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValueColors AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValueColors AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public setValueTextColors AST#parameter_list#Left ( AST#parameter#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValueColors AST#member_expression#Right = AST#expression#Left colors AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public setValueTypeface AST#parameter_list#Left ( AST#parameter#Left tf : AST#type_annotation#Left AST#primary_type#Left FontWeight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right /*Typeface*/ ) 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 . mValueTypeface AST#member_expression#Right = AST#expression#Left tf AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public setValueTextSize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 . mValueTextSize AST#member_expression#Right = AST#expression#Left size AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getValueTextColor AST#parameter_list#Left ( AST#parameter#Left index ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left index AST#expression#Right AST#unary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left 0 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#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 . mValueColors 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right % AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mValueColors AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getValueTypeface AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FontWeight AST#primary_type#Right AST#type_annotation#Right /*Typeface*/ 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 . mValueTypeface 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 getValueTextSize 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 . mValueTextSize 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 setForm AST#parameter_list#Left ( AST#parameter#Left form : AST#type_annotation#Left AST#primary_type#Left LegendForm AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mForm AST#member_expression#Right = AST#expression#Left form AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getForm AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LegendForm 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 . mForm 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 setFormSize AST#parameter_list#Left ( AST#parameter#Left formSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFormSize AST#member_expression#Right = AST#expression#Left formSize AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getFormSize 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 . mFormSize 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 setFormLineWidth AST#parameter_list#Left ( AST#parameter#Left formLineWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFormLineWidth AST#member_expression#Right = AST#expression#Left formLineWidth AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getFormLineWidth 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 . mFormLineWidth 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 setFormLineDashEffect AST#parameter_list#Left ( AST#parameter#Left dashPathEffect : AST#type_annotation#Left AST#primary_type#Left DashPathEffect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFormLineDashEffect AST#member_expression#Right = AST#expression#Left dashPathEffect AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getFormLineDashEffect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DashPathEffect 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 . mFormLineDashEffect 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 setDrawValues AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawValues AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public isDrawValuesEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawValues 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 setDrawIcons AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawIcons AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public isDrawIconsEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawIcons 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 setIconsOffset AST#parameter_list#Left ( AST#parameter#Left offsetDp : AST#type_annotation#Left AST#primary_type#Left MPPointF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIconsOffset AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left offsetDp AST#expression#Right . x AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIconsOffset AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left offsetDp AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getIconsOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MPPointF 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 . mIconsOffset 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 setVisible AST#parameter_list#Left ( AST#parameter#Left visible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mVisible AST#member_expression#Right = AST#expression#Left visible AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public isVisible AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mVisible 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 getAxisDependency AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AxisDependency 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 . mAxisDependency 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 setAxisDependency AST#parameter_list#Left ( AST#parameter#Left dependency : AST#type_annotation#Left AST#primary_type#Left AxisDependency AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisDependency AST#member_expression#Right = AST#expression#Left dependency AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* ###### ###### DATA RELATED METHODS ###### ######
*/ AST#method_declaration#Left public getIndexInEntries AST#parameter_list#Left ( AST#parameter#Left xIndex : 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#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 this AST#expression#Right AST#binary_expression#Right AST#expression#Right . getEntryCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left xIndex AST#expression#Right == AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getX 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#expression#Left i AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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#method_declaration#Right AST#method_declaration#Left public removeFirst AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getEntryCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left entry : 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 this AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 this AST#expression#Right . removeEntry AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left entry 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#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#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public removeLast AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getEntryCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left e : 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 this AST#expression#Right . getEntryForIndex 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 this AST#expression#Right . getEntryCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . removeEntry AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public removeEntryByXValue AST#parameter_list#Left ( 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_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 var AST#variable_declarator#Left e : 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 this AST#expression#Right . getEntryForXValue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left xValue AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . NaN AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . removeEntry AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public removeEntryByIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left e : 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 this AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . removeEntry AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public contains AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 this AST#expression#Right AST#binary_expression#Right AST#expression#Right . getEntryCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left protected copyTo AST#parameter_list#Left ( AST#parameter#Left baseDataSet : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 baseDataSet AST#expression#Right . mAxisDependency AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisDependency AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mColors AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mColors AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mDrawIcons AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawIcons AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mDrawValues AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawValues AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mForm AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mForm AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mFormLineDashEffect AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFormLineDashEffect AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mFormLineWidth AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFormLineWidth AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mFormSize AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFormSize AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mHighlightEnabled AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mHighlightEnabled AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mIconsOffset AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIconsOffset AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mValueColors AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValueColors AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mValueFormatter AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValueFormatter AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mValueColors AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValueColors AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mValueTextSize AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mValueTextSize AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left baseDataSet AST#expression#Right . mVisible AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mVisible AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left getYMin 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 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* returns the maximum y-value this DataSet holds
*
* @return
*/ AST#method_declaration#Left getYMax 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 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* returns the minimum x-value this DataSet holds
*
* @return
*/ AST#method_declaration#Left getXMin 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 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* returns the maximum x-value this DataSet holds
*
* @return
*/ AST#method_declaration#Left getXMax 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 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getEntryCount 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 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left calcMinMax AST#parameter_list#Left ( AST#parameter#Left e ? : 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 void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left 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#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left getEntryForXValue AST#parameter_list#Left ( 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 closestToY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rounding ? : AST#type_annotation#Left AST#primary_type#Left Rounding AST#primary_type#Right AST#type_annotation#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#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getEntriesForXValue AST#parameter_list#Left ( 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getEntryForIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getEntryIndex AST#parameter_list#Left ( 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 closestToY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rounding : AST#type_annotation#Left AST#primary_type#Left Rounding 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 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getEntryIndexByEntry AST#parameter_list#Left ( AST#parameter#Left e : 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 number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left addEntry AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left addEntryOrdered AST#parameter_list#Left ( AST#parameter#Left e : 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 void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left removeEntry AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default abstract class BaseDataSet<T extends EntryOhos> implements IDataSet<T> {
protected mColors: JArrayList<Number>;
protected mValueColors: JArrayList<Number> = null;
private mLabel: string = 'DataSet';
protected mAxisDependency: AxisDependency = AxisDependency.LEFT;
protected mHighlightEnabled: boolean = true;
protected mValueFormatter: IValueFormatter;
protected mValueTypeface: FontWeight;
private mForm: LegendForm = LegendForm.DEFAULT;
private mFormSize: number = Number.NaN;
private mFormLineWidth: number = Number.NaN;
private mFormLineDashEffect: DashPathEffect = null;
protected mDrawValues: boolean = true;
protected mDrawIcons: boolean = true;
protected mIconsOffset: MPPointF = new MPPointF();
protected mValueTextSize: number = 17;
protected mVisible: boolean = true;
constructor(label?: string) {
this.mColors = new JArrayList<Number>();
this.mValueColors = new JArrayList<Number>();
this.mColors.add(0x8ceaff);
this.mValueColors.add(0x000000);
this.mLabel = label;
}
public notifyDataSetChanged(): void {
this.calcMinMax();
}
public getColors(): JArrayList<Number> {
return this.mColors;
}
public getValueColors(): JArrayList<Number> {
return this.mValueColors;
}
public getColor(index?: number): number {
if (!index || index == null || index == undefined) {
index = 0;
}
return this.mColors.get(index % this.mColors.size()).valueOf();
}
public setColorsByList(colors: JArrayList<Number>): void {
this.mColors = colors;
}
public setColorsByVariable(colors: number[]): void {
this.mColors = ColorTemplate.createColors(colors);
}
public setColorsByArr(colors: number[]): void {
if (this.mColors == null) {
this.mColors = new JArrayList<Number>();
}
this.mColors.clear();
for (let color of colors) {
this.mColors.add(color);
}
}
public addColor(color: number): void {
if (this.mColors == null) {
this.mColors = new JArrayList<Number>();
}
this.mColors.add(color);
}
public setColorByColor(color: Number): void {
this.resetColors();
this.mColors.add(color);
}
public setColorByAlpha(color: number, alpha: number): void {
var mColor: number = ColorTemplate.argb(
alpha,
ColorTemplate.red(color),
ColorTemplate.green(color),
ColorTemplate.blue(color)
);
this.setColorsByVariable([mColor]);
}
public setColorsByArrAndAlpha(colors: number[], alpha: number): void {
this.resetColors();
for (let color of colors) {
this.addColor(
ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color))
);
}
}
public resetColors(): void {
if (this.mColors == null) {
this.mColors = new JArrayList<Number>();
}
this.mColors.clear();
}
public setLabel(label: string): void {
this.mLabel = label;
}
public getLabel(): string {
return this.mLabel;
}
public setHighlightEnabled(enabled: boolean): void {
this.mHighlightEnabled = enabled;
}
public isHighlightEnabled(): boolean {
return this.mHighlightEnabled;
}
public setValueFormatter(f: IValueFormatter): void {
if (f == null) {
return;
} else {
this.mValueFormatter = f;
}
}
public getValueFormatter(): IValueFormatter {
if (this.needsFormatter()) {
return Utils.getDefaultValueFormatter();
}
return this.mValueFormatter;
}
public needsFormatter(): boolean {
return this.mValueFormatter == null;
}
public setValueTextColor(color: number): void {
this.mValueColors.clear();
this.mValueColors.add(color);
}
public setValueTextColors(colors: JArrayList<Number>): void {
this.mValueColors = colors;
}
public setValueTypeface(tf: FontWeight ): void {
this.mValueTypeface = tf;
}
public setValueTextSize(size: number): void {
this.mValueTextSize = size;
}
public getValueTextColor(index?: number): number {
if (!index) {
index = 0;
}
return this.mValueColors.get(index % this.mValueColors.size()).valueOf();
}
public getValueTypeface(): FontWeight {
return this.mValueTypeface;
}
public getValueTextSize(): number {
return this.mValueTextSize;
}
public setForm(form: LegendForm): void {
this.mForm = form;
}
public getForm(): LegendForm {
return this.mForm;
}
public setFormSize(formSize: number): void {
this.mFormSize = formSize;
}
public getFormSize(): number {
return this.mFormSize;
}
public setFormLineWidth(formLineWidth: number): void {
this.mFormLineWidth = formLineWidth;
}
public getFormLineWidth(): number {
return this.mFormLineWidth;
}
public setFormLineDashEffect(dashPathEffect: DashPathEffect): void {
this.mFormLineDashEffect = dashPathEffect;
}
public getFormLineDashEffect(): DashPathEffect {
return this.mFormLineDashEffect;
}
public setDrawValues(enabled: boolean): void {
this.mDrawValues = enabled;
}
public isDrawValuesEnabled(): boolean {
return this.mDrawValues;
}
public setDrawIcons(enabled: boolean): void {
this.mDrawIcons = enabled;
}
public isDrawIconsEnabled(): boolean {
return this.mDrawIcons;
}
public setIconsOffset(offsetDp: MPPointF): void {
this.mIconsOffset.x = offsetDp.x;
this.mIconsOffset.y = offsetDp.y;
}
public getIconsOffset(): MPPointF {
return this.mIconsOffset;
}
public setVisible(visible: boolean): void {
this.mVisible = visible;
}
public isVisible(): boolean {
return this.mVisible;
}
public getAxisDependency(): AxisDependency {
return this.mAxisDependency;
}
public setAxisDependency(dependency: AxisDependency): void {
this.mAxisDependency = dependency;
}
public getIndexInEntries(xIndex: number): number {
for (let i = 0; i < this.getEntryCount(); i++) {
if (xIndex == this.getEntryForIndex(i).getX()) {
return i;
}
}
return -1;
}
public removeFirst(): boolean {
if (this.getEntryCount() > 0) {
var entry: T = this.getEntryForIndex(0);
return this.removeEntry(entry);
} else {
return false;
}
}
public removeLast(): boolean {
if (this.getEntryCount() > 0) {
var e: T = this.getEntryForIndex(this.getEntryCount() - 1);
return this.removeEntry(e);
} else return false;
}
public removeEntryByXValue(xValue: number): boolean {
var e: T = this.getEntryForXValue(xValue, Number.NaN);
return this.removeEntry(e);
}
public removeEntryByIndex(index: number): boolean {
var e: T = this.getEntryForIndex(index);
return this.removeEntry(e);
}
public contains(e: T): boolean {
for (let i = 0; i < this.getEntryCount(); i++) {
if (this.getEntryForIndex(i) == e) {
return true;
}
}
return false;
}
protected copyTo(baseDataSet: BaseDataSet<T>): void {
baseDataSet.mAxisDependency = this.mAxisDependency;
baseDataSet.mColors = this.mColors;
baseDataSet.mDrawIcons = this.mDrawIcons;
baseDataSet.mDrawValues = this.mDrawValues;
baseDataSet.mForm = this.mForm;
baseDataSet.mFormLineDashEffect = this.mFormLineDashEffect;
baseDataSet.mFormLineWidth = this.mFormLineWidth;
baseDataSet.mFormSize = this.mFormSize;
baseDataSet.mHighlightEnabled = this.mHighlightEnabled;
baseDataSet.mIconsOffset = this.mIconsOffset;
baseDataSet.mValueColors = this.mValueColors;
baseDataSet.mValueFormatter = this.mValueFormatter;
baseDataSet.mValueColors = this.mValueColors;
baseDataSet.mValueTextSize = this.mValueTextSize;
baseDataSet.mVisible = this.mVisible;
}
getYMin(): number {
return 0;
}
getYMax(): number {
return 0;
}
getXMin(): number {
return 0;
}
getXMax(): number {
return 0;
}
getEntryCount(): number {
return 0;
}
calcMinMax(e?: T): void {}
calcMinMaxY(fromX: number, toX: number): void {}
getEntryForXValue(xValue: number, closestToY: number, rounding?: Rounding): T {
return null;
}
getEntriesForXValue(xValue: number): JArrayList<T> {
return null;
}
getEntryForIndex(index: number): T {
return null;
}
getEntryIndex(xValue: number, closestToY: number, rounding: Rounding): number {
return 0;
}
getEntryIndexByEntry(e: T): number {
return 0;
}
addEntry(e: T): boolean {
return false;
}
addEntryOrdered(e: T): void {}
removeEntry(e: T): boolean {
return false;
}
clear(): void {}
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets#L33-L526
|
11fe152e02e7461ab33a58a7acdb697375f28976
|
gitee
|
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
|
arkts
|
更新梦想
@param id 梦想ID
@param dream 梦想数据
@returns 更新后的梦想
|
export function updateDream(id: number, dream: Dream): Promise<Dream> {
console.info(`开始更新梦想: ${dream.title}`);
try {
// 转换为符合请求数据类型的对象
const requestData: RequestData = {
userId: dream.userId,
title: dream.title,
description: dream.description,
category: dream.category,
priority: dream.priority,
status: dream.status,
completionRate: dream.completionRate,
deadline: dream.deadline,
imageUrl: dream.imageUrl,
isPublic: dream.isPublic,
expectedDays: dream.expectedDays,
// 确保后端不会因为tags为null而崩溃
tags: dream.tags || []
};
console.info(`请求数据: ${JSON.stringify(requestData)}`);
return request<Dream>(RequestMethod.PUT, `/dreams/${id}`, EmptyParams, requestData)
.then(updatedDream => {
// 处理图片URL
if (updatedDream && updatedDream.imageUrl) {
updatedDream.imageUrl = processImageUrl(updatedDream.imageUrl);
}
return updatedDream;
});
} catch (error) {
const errorMsg = `更新梦想失败: ${error instanceof Error ? error.message : String(error)}`;
console.error(errorMsg);
console.error(`梦想数据: ${JSON.stringify(dream)}`); // 记录失败时的梦想数据
// 检查是否是后端dreamTags相关错误
const errorString = String(error);
if (errorString.includes('NullPointerException') ||
errorString.includes('dreamTags') ||
errorString.includes('stream()')) {
throw new Error(`服务器处理标签时出错 (dreamTags为null): ${errorString}`);
}
throw new Error(errorMsg);
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function updateDream AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dream : AST#type_annotation#Left AST#primary_type#Left Dream 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 Dream 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 开始更新梦想: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left dream 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#try_statement#Left try AST#block_statement#Left { // 转换为符合请求数据类型的对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left requestData : AST#type_annotation#Left AST#primary_type#Left RequestData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left userId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . userId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . description AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left category AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . category AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left priority AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . priority AST#member_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#member_expression#Left AST#expression#Left dream AST#expression#Right . status AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left completionRate AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . completionRate AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left deadline AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . deadline AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left imageUrl AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . imageUrl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isPublic AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . isPublic AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expectedDays AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . expectedDays AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 确保后端不会因为tags为null而崩溃 AST#property_assignment#Left AST#property_name#Left tags AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . tags AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#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 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 JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left requestData 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Dream AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . PUT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` /dreams/ AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left EmptyParams AST#expression#Right , AST#expression#Left requestData 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 updatedDream => AST#block_statement#Left { // 处理图片URL 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 updatedDream AST#expression#Right && AST#expression#Left updatedDream AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageUrl AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left updatedDream AST#expression#Right . imageUrl AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left processImageUrl AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updatedDream AST#expression#Right . imageUrl AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left updatedDream AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errorMsg = AST#expression#Left AST#template_literal#Left ` 更新梦想失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#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 errorMsg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 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 JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dream 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 // 记录失败时的梦想数据 // 检查是否是后端dreamTags相关错误 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errorString = 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#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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left errorString AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NullPointerException' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left errorString AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'dreamTags' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left errorString AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stream()' 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 AST#template_literal#Left ` 服务器处理标签时出错 (dreamTags为null): AST#template_substitution#Left $ { AST#expression#Left errorString AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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 errorMsg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function updateDream(id: number, dream: Dream): Promise<Dream> {
console.info(`开始更新梦想: ${dream.title}`);
try {
const requestData: RequestData = {
userId: dream.userId,
title: dream.title,
description: dream.description,
category: dream.category,
priority: dream.priority,
status: dream.status,
completionRate: dream.completionRate,
deadline: dream.deadline,
imageUrl: dream.imageUrl,
isPublic: dream.isPublic,
expectedDays: dream.expectedDays,
tags: dream.tags || []
};
console.info(`请求数据: ${JSON.stringify(requestData)}`);
return request<Dream>(RequestMethod.PUT, `/dreams/${id}`, EmptyParams, requestData)
.then(updatedDream => {
if (updatedDream && updatedDream.imageUrl) {
updatedDream.imageUrl = processImageUrl(updatedDream.imageUrl);
}
return updatedDream;
});
} catch (error) {
const errorMsg = `更新梦想失败: ${error instanceof Error ? error.message : String(error)}`;
console.error(errorMsg);
console.error(`梦想数据: ${JSON.stringify(dream)}`);
const errorString = String(error);
if (errorString.includes('NullPointerException') ||
errorString.includes('dreamTags') ||
errorString.includes('stream()')) {
throw new Error(`服务器处理标签时出错 (dreamTags为null): ${errorString}`);
}
throw new Error(errorMsg);
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L548-L592
|
afb4ba6accc716ff0d5b08b444175f248d82e08c
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/imagegridlayout/src/main/ets/components/mainpage/ImageGridLayout.ets
|
arkts
|
ImageGridLayoutComponent
|
功能描述: 本示例介绍使用Flex组件实现图片在不同个数情况下的布局效果(默认布局和自定义布局)。
推荐场景: 社交类应用
核心组件:
1. MultiGrid - 图片布局视图
实现步骤:
1. 初始化数据。
private imageArray1: Resource[] = [$r("app.media.b")];
private imageArray3: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c")];
private imageArray4: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("app.media.d")];
private imageArray8: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c"),
$r("app.media.d"), $r("app.media.e"), $r("app.media.f"),$r("app.media.g"), $r("app.media.h")];
private imageArray9: Resource[] =[$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("app.media.d"),
$r("app.media.e"), $r("app.media.f"),$r("app.media.g"), $r("app.media.h"), $r("app.media.i")];
private imageSet: Resource[][] =[this.imageArray1, this.imageArray3, this.imageArray4, this.imageArray8, this.imageArray9];
2. 构建图片布局视图。开发者可以自定义图片的公用属性,也可以通过传递col值,来自定义图片排列的列数和行数(col值是可选参数)。
MultiGrid({
modifier: this.imageModifier,
imageSource: item,
clickImageHandle: (image: ResourceStr) => {
this.clickImageHandle(image)
}
})
|
@Component
export struct ImageGridLayoutComponent {
// 不同图片数量的图片集合
private imageArray1: Resource[] = [$r("app.media.b")];
private imageArray3: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c")];
private imageArray4: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("app.media.d")];
private imageArray8: Resource[] =
[$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("app.media.d"), $r("app.media.e"), $r("app.media.f"),
$r("app.media.g"), $r("app.media.h")];
private imageArray9: Resource[] =
[$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("app.media.d"), $r("app.media.e"), $r("app.media.f"),
$r("app.media.g"), $r("app.media.h"), $r("app.media.i")];
private imageSet: Resource[][] =
[this.imageArray1, this.imageArray3, this.imageArray4, this.imageArray8, this.imageArray9];
private textArray: string[] = ['一张图片场景:', '三张图片场景:', '四张图片场景:', '八张图片场景:', '九张图片场景:'];
// TODO:知识点:自定义组件中实现属性扩展
private imageModifier: ImageModifier = new ImageModifier().objectFit(ImageFit.Fill)
.renderMode(ImageRenderMode.Original)
clickImageHandle(image: ResourceStr) {
promptAction.showToast({ message: $r('app.string.imagegridlayout_image_toast') });
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageGridLayoutComponent AST#component_body#Left { // 不同图片数量的图片集合 AST#property_declaration#Left private imageArray1 : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.b" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private imageArray3 : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.a" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.b" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.c" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private imageArray4 : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.a" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.b" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.c" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.d" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private imageArray8 : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.a" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.b" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.c" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.d" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.e" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.f" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.g" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.h" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private imageArray9 : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.a" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.b" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.c" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.d" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.e" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.f" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.g" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.h" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.i" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private imageSet : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageArray1 AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageArray3 AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageArray4 AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageArray8 AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageArray9 AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private textArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '一张图片场景:' AST#expression#Right , AST#expression#Left '三张图片场景:' AST#expression#Right , AST#expression#Left '四张图片场景:' AST#expression#Right , AST#expression#Left '八张图片场景:' AST#expression#Right , AST#expression#Left '九张图片场景:' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // TODO:知识点:自定义组件中实现属性扩展 AST#property_declaration#Left private imageModifier : AST#type_annotation#Left AST#primary_type#Left ImageModifier AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 ImageModifier 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 . objectFit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Fill AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . renderMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageRenderMode AST#expression#Right . Original AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left click Image Handle ( AST#ERROR#Left image : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ) AST#ERROR#Right { AST#property_name#Left promptAction AST#property_name#Right AST#ERROR#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.imagegridlayout_image_toast' AST#expression#Right ) AST#resource_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#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct ImageGridLayoutComponent {
private imageArray1: Resource[] = [$r("app.media.b")];
private imageArray3: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c")];
private imageArray4: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("app.media.d")];
private imageArray8: Resource[] =
[$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("app.media.d"), $r("app.media.e"), $r("app.media.f"),
$r("app.media.g"), $r("app.media.h")];
private imageArray9: Resource[] =
[$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("app.media.d"), $r("app.media.e"), $r("app.media.f"),
$r("app.media.g"), $r("app.media.h"), $r("app.media.i")];
private imageSet: Resource[][] =
[this.imageArray1, this.imageArray3, this.imageArray4, this.imageArray8, this.imageArray9];
private textArray: string[] = ['一张图片场景:', '三张图片场景:', '四张图片场景:', '八张图片场景:', '九张图片场景:'];
private imageModifier: ImageModifier = new ImageModifier().objectFit(ImageFit.Fill)
.renderMode(ImageRenderMode.Original)
clickImageHandle(image: ResourceStr) {
promptAction.showToast({ message: $r('app.string.imagegridlayout_image_toast') });
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagegridlayout/src/main/ets/components/mainpage/ImageGridLayout.ets#L47-L68
|
ee83115b03db6782c80b6789b7a9446f1add7e55
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/xcomponentvsync/Index.ets
|
arkts
|
XcomponentVsyncComponent
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export { XcomponentVsyncComponent } from './src/main/ets/pages/XcomponentVsync';
|
AST#export_declaration#Left export { XcomponentVsyncComponent } from './src/main/ets/pages/XcomponentVsync' ; AST#export_declaration#Right
|
export { XcomponentVsyncComponent } from './src/main/ets/pages/XcomponentVsync';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/xcomponentvsync/Index.ets#L15-L15
|
1e767b3ef5b3f5f2681bfe9223d8cecf1426f57e
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialog.ets
|
arkts
|
CreateDialog
|
[Start click_event_pop_dialog] [Start create_custom_dialog_controller]
|
@Entry
@Component
export struct CreateDialog {
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample(),
})
// [StartExclude create_custom_dialog_controller]
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button('click me')
.onClick(() => {
this.dialogController.open();
})
}.width('100%').margin({ top: 5 })
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.CustomDialog_create'))
}
// [EndExclude create_custom_dialog_controller]
// [End create_custom_dialog_controller]
// [End click_event_pop_dialog]
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct CreateDialog AST#component_body#Left { AST#property_declaration#Left dialogController : AST#type_annotation#Left AST#primary_type#Left CustomDialogController 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 CustomDialogController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left builder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left CustomDialogExample AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right // [StartExclude create_custom_dialog_controller] AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 'click me' 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 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#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.CustomDialog_create' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right // [EndExclude create_custom_dialog_controller] // [End create_custom_dialog_controller] // [End click_event_pop_dialog] } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Entry
@Component
export struct CreateDialog {
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample(),
})
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button('click me')
.onClick(() => {
this.dialogController.open();
})
}.width('100%').margin({ top: 5 })
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.CustomDialog_create'))
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialog.ets#L42-L72
|
82697d0414b2eb3e161cd756f7e8baa589a56bd3
|
gitee
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/modules/auth/AuthService.ets
|
arkts
|
register
|
注册
|
async register(params: RegisterParams): Promise<boolean> {
try {
Logger.info('AuthService', `Register attempt: ${params.username}`);
// Mock 注册
// const response = await Http.post('/api/auth/register', params);
// Mock 响应
const mockUser: UserInfo = {
id: '1',
username: params.username,
email: params.email
};
const mockData: MockResponseData = {
token: 'mock_token_' + Date.now(),
user: mockUser
};
const mockResponse: MockResponse = {
code: 200,
data: mockData
};
if (mockResponse.code === 200) {
await StorageManager.setString(this.TOKEN_KEY, mockResponse.data.token);
await StorageManager.setString(this.USER_INFO_KEY, JSON.stringify(mockResponse.data.user));
this.currentUser = mockResponse.data.user;
const eventData: EventData = {
userId: this.currentUser.id,
username: this.currentUser.username
};
EventBus.emit('REGISTER_SUCCESS', eventData);
Logger.info('AuthService', 'Register successful');
return true;
}
return false;
} catch (error) {
Logger.error('AuthService', `Register failed: ${String(error)}`);
return false;
}
}
|
AST#method_declaration#Left async register AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left RegisterParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AuthService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Register attempt: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . username 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 // Mock 注册 // const response = await Http.post('/api/auth/register', params); // Mock 响应 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mockUser : AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '1' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left username AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . username AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . email 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 const AST#variable_declarator#Left mockData : AST#type_annotation#Left AST#primary_type#Left MockResponseData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left token AST#property_name#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 'mock_token_' AST#expression#Right + AST#expression#Left Date AST#expression#Right AST#binary_expression#Right 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left user AST#property_name#Right : AST#expression#Left mockUser 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 mockResponse : AST#type_annotation#Left AST#primary_type#Left MockResponse AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left 200 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left mockData 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 mockResponse 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 { 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 StorageManager AST#expression#Right AST#await_expression#Right AST#expression#Right . setString 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 . TOKEN_KEY AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mockResponse AST#expression#Right . data AST#member_expression#Right AST#expression#Right . token 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 StorageManager AST#expression#Right AST#await_expression#Right AST#expression#Right . setString 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 . USER_INFO_KEY AST#member_expression#Right 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mockResponse AST#expression#Right . data AST#member_expression#Right AST#expression#Right . user AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentUser AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mockResponse AST#expression#Right . data AST#member_expression#Right AST#expression#Right . user AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left eventData : AST#type_annotation#Left AST#primary_type#Left EventData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left userId 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 . currentUser AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left username 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 . currentUser AST#member_expression#Right AST#expression#Right . username 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 EventBus AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'REGISTER_SUCCESS' AST#expression#Right , AST#expression#Left eventData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AuthService' AST#expression#Right , AST#expression#Left 'Register successful' AST#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#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#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 'AuthService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Register failed: 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 register(params: RegisterParams): Promise<boolean> {
try {
Logger.info('AuthService', `Register attempt: ${params.username}`);
const mockUser: UserInfo = {
id: '1',
username: params.username,
email: params.email
};
const mockData: MockResponseData = {
token: 'mock_token_' + Date.now(),
user: mockUser
};
const mockResponse: MockResponse = {
code: 200,
data: mockData
};
if (mockResponse.code === 200) {
await StorageManager.setString(this.TOKEN_KEY, mockResponse.data.token);
await StorageManager.setString(this.USER_INFO_KEY, JSON.stringify(mockResponse.data.user));
this.currentUser = mockResponse.data.user;
const eventData: EventData = {
userId: this.currentUser.id,
username: this.currentUser.username
};
EventBus.emit('REGISTER_SUCCESS', eventData);
Logger.info('AuthService', 'Register successful');
return true;
}
return false;
} catch (error) {
Logger.error('AuthService', `Register failed: ${String(error)}`);
return false;
}
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L126-L170
|
6a8ec746beae416d7ff8aea56efa93135472b11f
|
github
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.arkui.advanced.FormMenu.d.ets
|
arkts
|
Defines the add form options.
@interface AddFormOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12
|
export interface AddFormOptions {
/**
* Indicates the form data.
*
* @type { ?formBindingData.FormBindingData }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
formBindingData?: formBindingData.FormBindingData;
/**
* The callback is used to return the form id.
*
* @type { ?AsyncCallback<string> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
callback?: AsyncCallback<string>;
/**
* The style of the menu item.
*
* @type { ?FormMenuItemStyle }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
style?: FormMenuItemStyle;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface AddFormOptions AST#object_type#Left { /**
* Indicates the form data.
*
* @type { ?formBindingData.FormBindingData }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left formBindingData ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left formBindingData . FormBindingData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The callback is used to return the form id.
*
* @type { ?AsyncCallback<string> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left callback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AsyncCallback 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_member#Right ; /**
* The style of the menu item.
*
* @type { ?FormMenuItemStyle }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left style ? : AST#type_annotation#Left AST#primary_type#Left FormMenuItemStyle 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 AddFormOptions {
formBindingData?: formBindingData.FormBindingData;
callback?: AsyncCallback<string>;
style?: FormMenuItemStyle;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FormMenu.d.ets#L53-L83
|
ec6fb78b518143689feae114634cdfa3097db679
|
gitee
|
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets
|
arkts
|
currentBmiColor
|
BMI 根据值查颜色
|
currentBmiColor(currentVal: number):BmiTable {
return DxinConstants.bmiTableArr.find((item:BmiTable) => currentVal >= item.min && currentVal <= item.max) as BmiTable
}
|
AST#method_declaration#Left currentBmiColor AST#parameter_list#Left ( AST#parameter#Left currentVal : 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 BmiTable AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DxinConstants AST#expression#Right . bmiTableArr AST#member_expression#Right AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left BmiTable 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left currentVal AST#expression#Right >= AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . min AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left currentVal AST#expression#Right <= AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . max 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 as AST#type_annotation#Left AST#primary_type#Left BmiTable 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
|
currentBmiColor(currentVal: number):BmiTable {
return DxinConstants.bmiTableArr.find((item:BmiTable) => currentVal >= item.min && currentVal <= item.max) as BmiTable
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets#L7-L9
|
d4dae6a9dcc64139c6b7d3a0204fafc55abe12b8
|
gitee
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets
|
arkts
|
获取当前星期几的中文表示
@returns 星期几的中文表示
|
export function getDayOfWeekChinese(): string {
const weekDays = ['日', '一', '二', '三', '四', '五', '六'];
const day = new Date().getDay();
return `星期${weekDays[day]}`;
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getDayOfWeekChinese 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 weekDays = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '日' AST#expression#Right , AST#expression#Left '一' AST#expression#Right , AST#expression#Left '二' AST#expression#Right , AST#expression#Left '三' AST#expression#Right , AST#expression#Left '四' AST#expression#Right , AST#expression#Left '五' AST#expression#Right , AST#expression#Left '六' AST#expression#Right ] AST#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 day = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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#return_statement#Left return AST#expression#Left AST#template_literal#Left ` 星期 AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left weekDays AST#expression#Right [ AST#expression#Left day AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function getDayOfWeekChinese(): string {
const weekDays = ['日', '一', '二', '三', '四', '五', '六'];
const day = new Date().getDay();
return `星期${weekDays[day]}`;
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets#L112-L116
|
3a1a0601c342aa67056c0d2f7d896934662a1597
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets
|
arkts
|
createRdbStore
|
Create rdb store
@param {context} Context
@return {globalThis.rdbStore} return rdbStore RDB database
|
async createRdbStore(context: Context) {
if (!GlobalContext.getContext().getObject('rdbStore')) {
await DataRdb.getRdbStore(context, CommonConstants.RDB_STORE_CONFIG)
.then((rdbStore: DataRdb.RdbStore) => {
if (rdbStore) {
rdbStore.executeSql(CommonConstants.CREATE_TABLE_FORM).catch((error: Error) => {
Logger.error(CommonConstants.DATABASE_TAG, 'executeSql Form error ' + JSON.stringify(error));
});
rdbStore.executeSql(CommonConstants.CREATE_TABLE_SENSOR_DATA).catch((error: Error) => {
Logger.error(CommonConstants.DATABASE_TAG, 'executeSql Sensor error ' + JSON.stringify(error));
});
GlobalContext.getContext().setObject('rdbStore', rdbStore);
}
}).catch((error: Error) => {
Logger.error(CommonConstants.DATABASE_TAG, 'createRdbStore error ' + JSON.stringify(error));
});
}
return GlobalContext.getContext().getObject('rdbStore');
}
|
AST#method_declaration#Left async createRdbStore AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left GlobalContext AST#expression#Right AST#unary_expression#Right AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'rdbStore' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 DataRdb AST#expression#Right AST#await_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . RDB_STORE_CONFIG AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DataRdb . RdbStore AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left rdbStore AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rdbStore AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . CREATE_TABLE_FORM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DATABASE_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'executeSql Form error ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 rdbStore AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . CREATE_TABLE_SENSOR_DATA AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DATABASE_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'executeSql Sensor error ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'rdbStore' AST#expression#Right , AST#expression#Left rdbStore AST#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 . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DATABASE_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'createRdbStore error ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'rdbStore' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async createRdbStore(context: Context) {
if (!GlobalContext.getContext().getObject('rdbStore')) {
await DataRdb.getRdbStore(context, CommonConstants.RDB_STORE_CONFIG)
.then((rdbStore: DataRdb.RdbStore) => {
if (rdbStore) {
rdbStore.executeSql(CommonConstants.CREATE_TABLE_FORM).catch((error: Error) => {
Logger.error(CommonConstants.DATABASE_TAG, 'executeSql Form error ' + JSON.stringify(error));
});
rdbStore.executeSql(CommonConstants.CREATE_TABLE_SENSOR_DATA).catch((error: Error) => {
Logger.error(CommonConstants.DATABASE_TAG, 'executeSql Sensor error ' + JSON.stringify(error));
});
GlobalContext.getContext().setObject('rdbStore', rdbStore);
}
}).catch((error: Error) => {
Logger.error(CommonConstants.DATABASE_TAG, 'createRdbStore error ' + JSON.stringify(error));
});
}
return GlobalContext.getContext().getObject('rdbStore');
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets#L41-L59
|
771eb702f07ac2aee8ac185a54b3226f54b7d29e
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/model/src/main/ets/request/DictDataRequest.ets
|
arkts
|
@file 字典数据请求
@author Joker.X
|
export class DictDataRequest {
/**
* 字典类型列表
*/
types: string[] = [];
/**
* @param {DictDataRequest} init - 初始化数据
*/
constructor(init?: DictDataRequest) {
if (init) {
this.types = init.types;
}
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DictDataRequest AST#class_body#Left { /**
* 字典类型列表
*/ AST#property_declaration#Left types : 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 /**
* @param {DictDataRequest} init - 初始化数据
*/ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left DictDataRequest 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 init 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 . types AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . types AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DictDataRequest {
types: string[] = [];
constructor(init?: DictDataRequest) {
if (init) {
this.types = init.types;
}
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/DictDataRequest.ets#L5-L19
|
e99c78ed82ef0e4d44ee24f3b7bcef8ee6170969
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/MultiColumnDisplayPage.ets
|
arkts
|
MultiColumnDisplayComponent
|
功能描述:本示例中,多段不同列数混合布局的数据在瀑布流容器中可以正常显示
推荐场景:购物APP展示商品时使用
核心组件:
1.WaterFlow
2.LazyForEach
实现步骤:
1.构造瀑布流中展示的所有数据
2.配置瀑布流组件sections属性,设置数据在一列或者两列时的列数,列间距等属性
3.使用WaterFlow组件展示数据
|
@Component
export struct MultiColumnDisplayComponent {
@State dataSource: WaterFlowDataSource = new WaterFlowDataSource(waterFlowData);
// 瀑布流分组信息
@State sections: WaterFlowSections = new WaterFlowSections();
// 瀑布流数据个数
dataCount: number = waterFlowData.length;
// 双列时,图片较小的瀑布流子组件高度
private shortDisplayHeight: number = 155;
// 双列时,图片较大的瀑布流子组件高度
private highDisplayHeight: number = 256;
// 瀑布流滚动控制器
private scroller: Scroller = new Scroller();
// 瀑布流容器里的图片元素组件的复用id和type
private imageFlowItemReuseId: string = 'onlyImage';
// 瀑布流容器里的图片混合文字元素组件的复用id和type
private reusableFlowItemReuseId: string = 'imageMixText';
// 瀑布流容器里底部最后一个元素的type
private bottomFlowItem: string = 'bottomImageMixText';
// 分组的margin信息
private sectionMargin: Margin = {
left: 4,
bottom: 15,
right: 4
}
// 瀑布流是一列的时候,分组配置信息
private oneColumnSection: SectionOptions = {
// 分组中FlowItem数量
itemsCount: 1,
// 列数
crossCount: 1,
// 分组的列间距
columnsGap: 5,
// 分组的行间距
rowsGap: 0,
// 分组的margin
margin: this.sectionMargin,
// FlowItem的高度
onGetItemMainSizeByIndex: (index: number) => {
// 如果是最后一个item,高度赋值200
if (index === this.dataCount - 1) {
return 200;
}
return 160;
}
};
// 瀑布流是两列的时候,分组配置信息
private twoColumnSection: SectionOptions = {
itemsCount: 8,
crossCount: 2,
columnsGap: 8,
rowsGap: 0,
onGetItemMainSizeByIndex: (index: number) => {
// 瀑布流数据中最大的index是9的倍数,通过index除9的余数可以确定哪些item的高度较矮
const newIndex = index % 9;
// index除9的余数在以下数组中的的,高度较矮
const longIndexArr = [1, 4, 5, 8];
return longIndexArr.includes(newIndex) ? this.shortDisplayHeight : this.highDisplayHeight;
}
}
aboutToAppear() {
let sectionOptions: SectionOptions[] = [];
// 通过商品数据类型初始化瀑布流分组信息
for (let index = 0; index < waterFlowData.length; index++) {
const productInfo: ProductInfo = waterFlowData[index];
if (productInfo.type === this.imageFlowItemReuseId) {
// 仅展示图片时瀑布流是一列
sectionOptions.push(this.oneColumnSection);
} else if(productInfo.type === this.bottomFlowItem){
// 瀑布流最后一个元素是一列
sectionOptions.push(this.oneColumnSection);
} else if (productInfo.type === this.reusableFlowItemReuseId) {
// 图片文字混合时瀑布流是两列
sectionOptions.push(this.twoColumnSection);
index += (this.twoColumnSection.itemsCount - 1);
}
}
this.sections.splice(0, 0, sectionOptions);
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MultiColumnDisplayComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right dataSource : AST#type_annotation#Left AST#primary_type#Left WaterFlowDataSource 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 WaterFlowDataSource AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left waterFlowData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 瀑布流分组信息 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right sections : AST#type_annotation#Left AST#primary_type#Left WaterFlowSections 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 WaterFlowSections 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 dataCount : 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 waterFlowData AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 双列时,图片较小的瀑布流子组件高度 AST#property_declaration#Left private shortDisplayHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 155 AST#expression#Right ; AST#property_declaration#Right // 双列时,图片较大的瀑布流子组件高度 AST#property_declaration#Left private highDisplayHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 256 AST#expression#Right ; AST#property_declaration#Right // 瀑布流滚动控制器 AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 瀑布流容器里的图片元素组件的复用id和type AST#property_declaration#Left private imageFlowItemReuseId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'onlyImage' AST#expression#Right ; AST#property_declaration#Right // 瀑布流容器里的图片混合文字元素组件的复用id和type AST#property_declaration#Left private reusableFlowItemReuseId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'imageMixText' AST#expression#Right ; AST#property_declaration#Right // 瀑布流容器里底部最后一个元素的type AST#property_declaration#Left private bottomFlowItem : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'bottomImageMixText' AST#expression#Right ; AST#property_declaration#Right // 分组的margin信息 AST#property_declaration#Left private sectionMargin : AST#type_annotation#Left AST#primary_type#Left Margin AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right // 瀑布流是一列的时候,分组配置信息 AST#property_declaration#Right AST#property_declaration#Left private oneColumnSection : AST#type_annotation#Left AST#primary_type#Left SectionOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { // 分组中FlowItem数量 AST#property_assignment#Left AST#property_name#Left itemsCount AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 列数 AST#property_assignment#Left AST#property_name#Left crossCount AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 分组的列间距 AST#property_assignment#Left AST#property_name#Left columnsGap AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , // 分组的行间距 AST#property_assignment#Left AST#property_name#Left rowsGap AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // 分组的margin AST#property_assignment#Left AST#property_name#Left margin AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sectionMargin AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // FlowItem的高度 AST#property_assignment#Left AST#property_name#Left onGetItemMainSizeByIndex AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 如果是最后一个item,高度赋值200 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 index AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . dataCount AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 200 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 160 AST#expression#Right ; AST#return_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#property_declaration#Right // 瀑布流是两列的时候,分组配置信息 AST#property_declaration#Left private twoColumnSection AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left SectionOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left itemsCount AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left crossCount AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left columnsGap AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left rowsGap AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onGetItemMainSizeByIndex AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 瀑布流数据中最大的index是9的倍数,通过index除9的余数可以确定哪些item的高度较矮 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newIndex = AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right % AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // index除9的余数在以下数组中的的,高度较矮 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left longIndexArr = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 1 AST#expression#Right , AST#expression#Left 4 AST#expression#Right , AST#expression#Left 5 AST#expression#Right , AST#expression#Left 8 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left longIndexArr AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shortDisplayHeight AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . highDisplayHeight AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left aboutToAppear AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right { let sectionOptions AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SectionOptions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 通过商品数据类型初始化瀑布流分组信息 AST#method_declaration#Left for AST#parameter_list#Left ( AST#parameter#Left let AST#ERROR#Left in dex AST#ERROR#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 0 AST#expression#Right AST#ERROR#Left ; AST#ERROR#Right in AST#expression#Left dex AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left < AST#qualified_type#Left waterFlowData . length AST#qualified_type#Right ; AST#ERROR#Right in AST#expression#Left AST#update_expression#Left AST#expression#Left dex AST#expression#Right ++ AST#update_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left productInfo : AST#type_annotation#Left AST#primary_type#Left ProductInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left waterFlowData AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left productInfo AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageFlowItemReuseId 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 sectionOptions 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 . oneColumnSection 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left productInfo AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . bottomFlowItem 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 sectionOptions 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 . oneColumnSection 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left productInfo AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . reusableFlowItemReuseId 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 sectionOptions 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 . twoColumnSection 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 index += AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . twoColumnSection AST#member_expression#Right AST#expression#Right . itemsCount AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left this AST#ERROR#Left . sections . splice AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left 0 , 0 , sectionOptions AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct MultiColumnDisplayComponent {
@State dataSource: WaterFlowDataSource = new WaterFlowDataSource(waterFlowData);
@State sections: WaterFlowSections = new WaterFlowSections();
dataCount: number = waterFlowData.length;
private shortDisplayHeight: number = 155;
private highDisplayHeight: number = 256;
private scroller: Scroller = new Scroller();
private imageFlowItemReuseId: string = 'onlyImage';
private reusableFlowItemReuseId: string = 'imageMixText';
private bottomFlowItem: string = 'bottomImageMixText';
private sectionMargin: Margin = {
left: 4,
bottom: 15,
right: 4
}
private oneColumnSection: SectionOptions = {
itemsCount: 1,
crossCount: 1,
columnsGap: 5,
rowsGap: 0,
margin: this.sectionMargin,
onGetItemMainSizeByIndex: (index: number) => {
if (index === this.dataCount - 1) {
return 200;
}
return 160;
}
};
private twoColumnSection: SectionOptions = {
itemsCount: 8,
crossCount: 2,
columnsGap: 8,
rowsGap: 0,
onGetItemMainSizeByIndex: (index: number) => {
const newIndex = index % 9;
const longIndexArr = [1, 4, 5, 8];
return longIndexArr.includes(newIndex) ? this.shortDisplayHeight : this.highDisplayHeight;
}
}
aboutToAppear() {
let sectionOptions: SectionOptions[] = [];
for (let index = 0; index < waterFlowData.length; index++) {
const productInfo: ProductInfo = waterFlowData[index];
if (productInfo.type === this.imageFlowItemReuseId) {
sectionOptions.push(this.oneColumnSection);
} else if(productInfo.type === this.bottomFlowItem){
sectionOptions.push(this.oneColumnSection);
} else if (productInfo.type === this.reusableFlowItemReuseId) {
sectionOptions.push(this.twoColumnSection);
index += (this.twoColumnSection.itemsCount - 1);
}
}
this.sections.splice(0, 0, sectionOptions);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/MultiColumnDisplayPage.ets#L34-L113
|
bf3496f75077bbc38a686b2774d9ff3dab01e4ee
|
gitee
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/TransitionAnimation/entry/src/main/ets/pages/CustomTransition.ets
|
arkts
|
pageTransition
|
Page transition parameters are configured using the global pageTransition method.
The transparency is set from 0.2 to 1 when entering the site. The x and y axes are scaled from 0 to 1.
The offset of the x and y axes at exit is 500.
|
pageTransition() {
PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.opacity(CUSTOM_TRANSITION_OPACITY)
.scale(CUSTOM_TRANSITION_SCALE)
PageTransitionExit({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.translate(CUSTOM_TRANSITION_TRANSLATE)
}
|
AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left TRANSITION_ANIMATION_DURATION AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left curve : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Smooth AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . opacity ( AST#expression#Left CUSTOM_TRANSITION_OPACITY AST#expression#Right ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left CUSTOM_TRANSITION_SCALE 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 PageTransitionExit ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left TRANSITION_ANIMATION_DURATION AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left curve : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Smooth AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . translate ( AST#expression#Left CUSTOM_TRANSITION_TRANSLATE 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
|
pageTransition() {
PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.opacity(CUSTOM_TRANSITION_OPACITY)
.scale(CUSTOM_TRANSITION_SCALE)
PageTransitionExit({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.translate(CUSTOM_TRANSITION_TRANSLATE)
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/pages/CustomTransition.ets#L39-L45
|
f3338e7b6c0b38c1265ef2af9465f04642101809
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/components/common/LoadingView.ets
|
arkts
|
LoadingView
|
通用加载视图组件
提供统一的加载状态展示
|
@Component
export struct LoadingView {
@Prop message: string = '加载中...';
@Prop sizeValue: number = 32;
@Prop textColorStr: string = '#666666';
@Prop backgroundColorStr: string = 'transparent';
@Prop showBackground: boolean = false;
build() {
Column({ space: 16 }) {
// 加载动画
LoadingProgress()
.width(this.sizeValue)
.height(this.sizeValue)
.color('#007AFF')
// 加载文字
Text(this.message)
.fontSize(14)
.fontColor(this.textColorStr)
.textAlign(TextAlign.Center)
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
.backgroundColor(this.showBackground ? this.backgroundColorStr : 'transparent')
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '加载中...' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right sizeValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 32 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right textColorStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#666666' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right backgroundColorStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'transparent' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right showBackground : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 加载动画 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue 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 . sizeValue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#007AFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 加载文字 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message 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#member_expression#Left AST#expression#Left this AST#expression#Right . textColorStr AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '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#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showBackground AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundColorStr AST#member_expression#Right AST#expression#Right : AST#expression#Left 'transparent' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct LoadingView {
@Prop message: string = '加载中...';
@Prop sizeValue: number = 32;
@Prop textColorStr: string = '#666666';
@Prop backgroundColorStr: string = 'transparent';
@Prop showBackground: boolean = false;
build() {
Column({ space: 16 }) {
LoadingProgress()
.width(this.sizeValue)
.height(this.sizeValue)
.color('#007AFF')
Text(this.message)
.fontSize(14)
.fontColor(this.textColorStr)
.textAlign(TextAlign.Center)
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
.backgroundColor(this.showBackground ? this.backgroundColorStr : 'transparent')
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/common/LoadingView.ets#L6-L34
|
ab984c12df9a9a698c1eaa8da61b48630b0bc30e
|
github
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
|
arkts
|
setNavBgColor
|
设置背景色
@param color 颜色
@returns
|
public setNavBgColor(color: ResourceColor) {
this._navBgColor = color
return this
}
|
AST#method_declaration#Left public setNavBgColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 . _navBgColor AST#member_expression#Right = AST#expression#Left color AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public setNavBgColor(color: ResourceColor) {
this._navBgColor = color
return this
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L228-L231
|
2b75866eb209e0caffc44d85bc1c3934f5d61534
|
gitee
|
IceYuanyyy/OxHornCampus.git
|
bb5686f77fa36db89687502e35898cda218d601f
|
entry/src/main/ets/view/ImageViewComponent.ets
|
arkts
|
detectBoundary
|
Detect boundary to keep the image in window.
|
detectBoundary(): void {
let maxOffsetX = this.imgScale * this.deviceWidth / 2 - this.deviceWidth / 2;
if (this.getUIContext().vp2px(this.imgOffsetX) > (maxOffsetX)) {
this.imgOffsetX = this.getUIContext().px2vp(maxOffsetX);
}
if (this.getUIContext().vp2px(this.imgOffsetX) < -(maxOffsetX)) {
this.imgOffsetX = -this.getUIContext().px2vp(maxOffsetX);
}
let maxOffsetY = this.imgScale * this.displayHeight / 2 - this.deviceHeight / 2;
if (this.imgScale * this.displayHeight >= this.deviceHeight) {
if (this.getUIContext().vp2px(this.imgOffsetY) > (maxOffsetY)) {
this.imgOffsetY = this.getUIContext().px2vp(maxOffsetY);
}
if (this.getUIContext().vp2px(this.imgOffsetY) < -(maxOffsetY)) {
this.imgOffsetY = -this.getUIContext().px2vp(maxOffsetY);
}
} else {
this.imgOffsetY = 0;
}
}
|
AST#method_declaration#Left detectBoundary AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left maxOffsetX = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imgScale AST#member_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . deviceWidth AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . deviceWidth AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 . vp2px 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 . imgOffsetX AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left maxOffsetX AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imgOffsetX AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 . px2vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left maxOffsetX 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 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 . vp2px 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 . imgOffsetX AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right < AST#expression#Left AST#unary_expression#Left - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left maxOffsetX AST#expression#Right ) AST#parenthesized_expression#Right 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imgOffsetX AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . px2vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left maxOffsetX AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left maxOffsetY = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imgScale AST#member_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . displayHeight AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . deviceHeight AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imgScale AST#member_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . displayHeight AST#member_expression#Right AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . deviceHeight AST#member_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 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 . vp2px 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 . imgOffsetY AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right > AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left maxOffsetY AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imgOffsetY AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 . px2vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left maxOffsetY 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 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 . vp2px 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 . imgOffsetY AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right < AST#expression#Left AST#unary_expression#Left - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left maxOffsetY AST#expression#Right ) AST#parenthesized_expression#Right 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imgOffsetY AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . px2vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left maxOffsetY AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right 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 . imgOffsetY AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
detectBoundary(): void {
let maxOffsetX = this.imgScale * this.deviceWidth / 2 - this.deviceWidth / 2;
if (this.getUIContext().vp2px(this.imgOffsetX) > (maxOffsetX)) {
this.imgOffsetX = this.getUIContext().px2vp(maxOffsetX);
}
if (this.getUIContext().vp2px(this.imgOffsetX) < -(maxOffsetX)) {
this.imgOffsetX = -this.getUIContext().px2vp(maxOffsetX);
}
let maxOffsetY = this.imgScale * this.displayHeight / 2 - this.deviceHeight / 2;
if (this.imgScale * this.displayHeight >= this.deviceHeight) {
if (this.getUIContext().vp2px(this.imgOffsetY) > (maxOffsetY)) {
this.imgOffsetY = this.getUIContext().px2vp(maxOffsetY);
}
if (this.getUIContext().vp2px(this.imgOffsetY) < -(maxOffsetY)) {
this.imgOffsetY = -this.getUIContext().px2vp(maxOffsetY);
}
} else {
this.imgOffsetY = 0;
}
}
|
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/ImageViewComponent.ets#L72-L91
|
269869c61e19beb081a7ea6808bfbf85e6c723ad
|
github
|
Musicys/ArktsShop.git
|
1e2f77b90766f9dfd5ad94063aad7684befbbc07
|
hwsc/entry/src/main/ets/store/user.ets
|
arkts
|
setUser
|
安全更新用户信息(Partial 更新)
|
setUser(partial: Partial<UserInfo>): void {
this.userInfo = {
id: partial.id !== undefined ? partial.id : this.userInfo.id,
username: partial.username !== undefined ? partial.username : this.userInfo.username,
name: partial.name !== undefined ? partial.name : this.userInfo.name,
url: partial.url !== undefined ? partial.url : this.userInfo.url,
wallet: partial.wallet !== undefined ? partial.wallet : this.userInfo.wallet,
introductory: partial.introductory !== undefined ? partial.introductory : this.userInfo.introductory,
gender: partial.gender !== undefined ? partial.gender : this.userInfo.gender
};
}
|
AST#method_declaration#Left setUser AST#parameter_list#Left ( AST#parameter#Left partial : 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 UserInfo 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 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 . userInfo AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#member_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 partial AST#expression#Right . id AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . id AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left username 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . username AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . username AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . username AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . name AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . name AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . name AST#member_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#member_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 partial AST#expression#Right . url AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . url AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . url AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wallet 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . wallet AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . wallet AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . wallet AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left introductory 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . introductory AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . introductory AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . introductory AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . gender AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left partial AST#expression#Right . gender AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . gender AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
setUser(partial: Partial<UserInfo>): void {
this.userInfo = {
id: partial.id !== undefined ? partial.id : this.userInfo.id,
username: partial.username !== undefined ? partial.username : this.userInfo.username,
name: partial.name !== undefined ? partial.name : this.userInfo.name,
url: partial.url !== undefined ? partial.url : this.userInfo.url,
wallet: partial.wallet !== undefined ? partial.wallet : this.userInfo.wallet,
introductory: partial.introductory !== undefined ? partial.introductory : this.userInfo.introductory,
gender: partial.gender !== undefined ? partial.gender : this.userInfo.gender
};
}
|
https://github.com/Musicys/ArktsShop.git/blob/1e2f77b90766f9dfd5ad94063aad7684befbbc07/hwsc/entry/src/main/ets/store/user.ets#L49-L59
|
e3979c15d5c7966cc18904af959316110da33e9a
|
github
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets
|
arkts
|
Declaration of the tab item.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the tab item.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
|
export declare class TabTitleBarTabItem {
/**
* Text description for this tab item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Text description for this tab item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
title: ResourceStr;
/**
* Icon resource for this tab item.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Icon resource for this tab item.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
icon?: ResourceStr;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TabTitleBarTabItem AST#class_body#Left { /**
* Text description for this tab item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Text description for this tab item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Icon resource for this tab item.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Icon resource for this tab item.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left icon ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr 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 TabTitleBarTabItem {
title: ResourceStr;
icon?: ResourceStr;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets#L93-L122
|
8f6ed7cc9a634bd16b9b248fc16d58c8030cb19e
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/IndicatorAniamtionInfo.ets
|
arkts
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export interface IndicatorAnimationInfo {
// 背景条左边距
left: number;
// 页签条便宜
offset: number;
// 背景条高度
height: number;
// 背景条宽度
width: number;
// 是否初始化(true: 已初始化, false: 未初始化)
flag: boolean;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface IndicatorAnimationInfo AST#object_type#Left { // 背景条左边距 AST#type_member#Left left : 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 offset : 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 height : 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 width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 是否初始化(true: 已初始化, false: 未初始化) AST#type_member#Left flag : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface IndicatorAnimationInfo {
left: number;
offset: number;
height: number;
width: number;
flag: boolean;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/IndicatorAniamtionInfo.ets#L16-L27
|
21b7bc43e35accb3f2791f9b306ea9345cc0c706
|
gitee
|
|
buqiuz/Account.git
|
b843a38c24a833a9a4386f63cffec5fa5dadc674
|
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/renderer/AxisRenderer.ets
|
arkts
|
computeAxis
|
Computes the axis values.
@param min - the minimum value in the data object for this axis
@param max - the maximum value in the data object for this axis
|
public computeAxis(min: number, max: number, inverted: boolean) {
// calculate the starting and entry point of the y-labels (depending on
// zoom / contentrect bounds)
if (this.mTrans && this.mViewPortHandler != null && this.mViewPortHandler.contentWidth() > 10 && !this.mViewPortHandler.isFullyZoomedOutY()) {
let p1: MPPointD | undefined = this.mTrans.getValuesByTouchPoint(this.mViewPortHandler.contentLeft(), this.mViewPortHandler.contentTop());
let p2: MPPointD | undefined = this.mTrans.getValuesByTouchPoint(this.mViewPortHandler.contentLeft(), this.mViewPortHandler.contentBottom());
if (!!p1 && !!p2) {
if (!inverted) {
min = p2.y;
max = p1.y;
} else {
min = p1.y;
max = p2.y;
}
MPPointD.recycleInstance(p1);
MPPointD.recycleInstance(p2);
}
}
this.computeAxisValues(min, max);
}
|
AST#method_declaration#Left public computeAxis AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left inverted : 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 { // calculate the starting and entry point of the y-labels (depending on // zoom / contentrect bounds) AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mTrans AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . contentWidth 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 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . isFullyZoomedOutY 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#variable_declaration#Left let AST#variable_declarator#Left p1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left MPPointD AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mTrans AST#member_expression#Right AST#expression#Right . getValuesByTouchPoint AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . contentLeft 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . contentTop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left p2 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left MPPointD AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mTrans AST#member_expression#Right AST#expression#Right . getValuesByTouchPoint AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . contentLeft 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . contentBottom AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#unary_expression#Left ! AST#expression#Left p1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AST#unary_expression#Left ! AST#expression#Left p2 AST#expression#Right AST#unary_expression#Right 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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left inverted 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 min = AST#expression#Left AST#member_expression#Left AST#expression#Left p2 AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left max = AST#expression#Left AST#member_expression#Left AST#expression#Left p1 AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left min = AST#expression#Left AST#member_expression#Left AST#expression#Left p1 AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left max = AST#expression#Left AST#member_expression#Left AST#expression#Left p2 AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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 MPPointD AST#expression#Right . recycleInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left p1 AST#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 MPPointD AST#expression#Right . recycleInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left p2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . computeAxisValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left min AST#expression#Right , AST#expression#Left max AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public computeAxis(min: number, max: number, inverted: boolean) {
if (this.mTrans && this.mViewPortHandler != null && this.mViewPortHandler.contentWidth() > 10 && !this.mViewPortHandler.isFullyZoomedOutY()) {
let p1: MPPointD | undefined = this.mTrans.getValuesByTouchPoint(this.mViewPortHandler.contentLeft(), this.mViewPortHandler.contentTop());
let p2: MPPointD | undefined = this.mTrans.getValuesByTouchPoint(this.mViewPortHandler.contentLeft(), this.mViewPortHandler.contentBottom());
if (!!p1 && !!p2) {
if (!inverted) {
min = p2.y;
max = p1.y;
} else {
min = p1.y;
max = p2.y;
}
MPPointD.recycleInstance(p1);
MPPointD.recycleInstance(p2);
}
}
this.computeAxisValues(min, max);
}
|
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/renderer/AxisRenderer.ets#L120-L146
|
b44da434d60720044fa8acf1e47618334c49a92f
|
github
|
yinxing2008/2048-hongmeng-ark-ts.git
|
fe0cb8e36e7456445464e18b39de2bd17eb27346
|
2048_hongmeng_ArkTS/entry/src/main/ets/MainAbility/model/GameDataSource.ets
|
arkts
|
厦门大学计算机专业 | 前华为工程师
专注《零基础学编程系列》 http://lblbc.cn/blog
包含:Java | 安卓 | 前端 | Flutter | iOS | 小程序 | 鸿蒙
公众号:蓝不蓝编程
|
export class GameDataSource implements IDataSource {
public dataArray: string[][] = []
constructor
|
AST#export_declaration#Left export AST#ERROR#Left class GameDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right { public dataArray : 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#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
|
export class GameDataSource implements IDataSource {
public dataArray: string[][] = []
constructor
|
https://github.com/yinxing2008/2048-hongmeng-ark-ts.git/blob/fe0cb8e36e7456445464e18b39de2bd17eb27346/2048_hongmeng_ArkTS/entry/src/main/ets/MainAbility/model/GameDataSource.ets#L7-L10
|
f3a18445d7f110decb8fbfc86b95548b8581c241
|
github
|
|
lime-zz/Ark-ui_RubbishRecycleApp.git
|
c2a9bff8fbb5bc46d922934afad0327cc1696969
|
rubbish/rubbish/entry/src/main/ets/pages/Search.ets
|
arkts
|
handleSearch
|
处理搜索逻辑
|
async handleSearch() {
if (!this.keyword.trim()) {
promptAction.showToast({ message: '请输入搜索内容' })
return
}
try {
let request = http.createHttp()
let url = `http://192.168.32.1:8080/api/search?keyword=${encodeURIComponent(this.keyword)}`
let response = await request.request(url, {
method: http.RequestMethod.GET,
// 增加请求头,避免格式问题
header: {
'Content-Type': 'application/json'
}
})
// 打印完整响应日志,便于排查
console.log('响应状态码:', response.responseCode)
console.log('响应结果:', response.result)
// 先判断响应是否存在且为字符串
if (response.responseCode === 200 && typeof response.result === 'string') {
let result = JSON.parse(response.result) as ServerResponseDataType;
console.log('解析后的数据:', result)
if (result.code === 0) {
// 新增判断:只有当data数组有数据时才跳转
if (result.data && result.data.length > 0) {
router.push({ url: 'pages/Sousuoyoujieguo' })
} else {
promptAction.showToast({ message: '搜索无结果,换个关键词试试看呢' })
}
} else {
promptAction.showToast({ message: result.message || '搜索无结果' })
}
} else {
// 处理非200状态或响应格式异常
promptAction.showToast({ message: `请求失败,状态码: ${response.responseCode}` })
}
// 关闭请求(重要:避免内存泄漏)
request.destroy()
} catch (error) {
// 将错误对象转为字符串,显示详细信息
console.error('搜索失败详情:', JSON.stringify(error));
promptAction.showToast({ message: '搜索失败,请重试' })
}
}
|
AST#method_declaration#Left async handleSearch AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . keyword AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { 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#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left request = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left url = AST#expression#Left AST#template_literal#Left ` http://192.168.32.1:8080/api/search?keyword= AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left encodeURIComponent AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keyword AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left response = 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 request 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 header AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Content-Type' AST#property_name#Right : AST#expression#Left 'application/json' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right // 打印完整响应日志,便于排查 AST#ERROR#Left console AST#ERROR#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '响应状态码:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '响应结果:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . result AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 先判断响应是否存在且为字符串 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right === AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left response AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . result AST#member_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = 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 AST#member_expression#Left AST#expression#Left response AST#expression#Right . result AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ServerResponseDataType 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 . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '解析后的数据:' AST#expression#Right , AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . code 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 { // 新增判断:只有当data数组有数据时才跳转 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . data AST#member_expression#Right AST#expression#Right && AST#expression#Left result AST#expression#Right AST#binary_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 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 router AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left 'pages/Sousuoyoujieguo' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#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#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#Right AST#expression#Right || AST#expression#Left '搜索无结果' AST#expression#Right AST#binary_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#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 处理非200状态或响应格式异常 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 请求失败,状态码: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#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 request 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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '搜索失败,请重试' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async handleSearch() {
if (!this.keyword.trim()) {
promptAction.showToast({ message: '请输入搜索内容' })
return
}
try {
let request = http.createHttp()
let url = `http://192.168.32.1:8080/api/search?keyword=${encodeURIComponent(this.keyword)}`
let response = await request.request(url, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json'
}
})
console.log('响应状态码:', response.responseCode)
console.log('响应结果:', response.result)
if (response.responseCode === 200 && typeof response.result === 'string') {
let result = JSON.parse(response.result) as ServerResponseDataType;
console.log('解析后的数据:', result)
if (result.code === 0) {
if (result.data && result.data.length > 0) {
router.push({ url: 'pages/Sousuoyoujieguo' })
} else {
promptAction.showToast({ message: '搜索无结果,换个关键词试试看呢' })
}
} else {
promptAction.showToast({ message: result.message || '搜索无结果' })
}
} else {
promptAction.showToast({ message: `请求失败,状态码: ${response.responseCode}` })
}
request.destroy()
} catch (error) {
console.error('搜索失败详情:', JSON.stringify(error));
promptAction.showToast({ message: '搜索失败,请重试' })
}
}
|
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Search.ets#L19-L68
|
8369a55e7c8bbb9c88fc55b009bcf2ed6003d054
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/action/DialogUtil.ets
|
arkts
|
initConfirmButton
|
一个按钮,初始化参数
@param options
|
private static initConfirmButton(options: ConfirmDialogOptions) {
options.confirm = options.confirm ?? DialogUtil.defaultConfig.secondaryButton;
if (TypeUtil.isResourceStr(options.confirm)) {
options.confirm = {
value: options.confirm as ResourceStr,
action: () => {
if (options.onAction) {
options.onAction(DialogAction.ONE);
}
}
}
} else {
let confirmButton = options.confirm as ButtonOptions;
let confirmAction = confirmButton.action;
confirmButton.action = () => {
if (options.onAction) {
options.onAction(DialogAction.ONE);
}
if (confirmAction) {
confirmAction();
}
}
}
}
|
AST#method_declaration#Left private static initConfirmButton AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ConfirmDialogOptions 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 options AST#expression#Right . confirm AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right ?? AST#expression#Left DialogUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . secondaryButton AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TypeUtil AST#expression#Right . isResourceStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#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 options AST#expression#Right . onAction 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 options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAction AST#expression#Right . ONE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left confirmButton = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ButtonOptions 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 let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left confirmAction = AST#expression#Left AST#member_expression#Left AST#expression#Left confirmButton AST#expression#Right . action AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left confirmButton AST#expression#Right . action AST#member_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 options AST#expression#Right . onAction 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 options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAction AST#expression#Right . ONE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left confirmAction AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left confirmAction AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private static initConfirmButton(options: ConfirmDialogOptions) {
options.confirm = options.confirm ?? DialogUtil.defaultConfig.secondaryButton;
if (TypeUtil.isResourceStr(options.confirm)) {
options.confirm = {
value: options.confirm as ResourceStr,
action: () => {
if (options.onAction) {
options.onAction(DialogAction.ONE);
}
}
}
} else {
let confirmButton = options.confirm as ButtonOptions;
let confirmAction = confirmButton.action;
confirmButton.action = () => {
if (options.onAction) {
options.onAction(DialogAction.ONE);
}
if (confirmAction) {
confirmAction();
}
}
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L272-L295
|
99ed2ece1cf8b4016305e6c00cd585760e678039
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineRadarDataSet.ets
|
arkts
|
setLineWidth
|
set the line width of the chart (min = 0.2f, max = 10f); default 1f NOTE:
thinner line == better performance, thicker line == worse performance
@param width
|
public setLineWidth(width: number): void {
if (width < 0.0) {
width = 0.0;
}
if (width > 10.0) {
width = 10.0;
}
this.mLineWidth = width;
}
|
AST#method_declaration#Left public setLineWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right < AST#expression#Left 0.0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left width = AST#expression#Left 0.0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right > AST#expression#Left 10.0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left width = AST#expression#Left 10.0 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLineWidth AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setLineWidth(width: number): void {
if (width < 0.0) {
width = 0.0;
}
if (width > 10.0) {
width = 10.0;
}
this.mLineWidth = width;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineRadarDataSet.ets#L120-L128
|
a8cfc053f1526cc1e262d5c35b3f7be9876a8957
|
gitee
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets
|
arkts
|
getPreferencesFromStorage
|
Read the specified Preferences persistence file and load the data into the Preferences instance.
|
async getPreferencesFromStorage() {
try {
preference = await dataPreferences.getPreferences(context, CommonConstants.PREFERENCES_NAME);
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to get preferences, Cause: ${err}`);
}
}
|
AST#method_declaration#Left async getPreferencesFromStorage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left preference = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PREFERENCES_NAME AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 CommonConstants AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to get preferences, Cause: AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getPreferencesFromStorage() {
try {
preference = await dataPreferences.getPreferences(context, CommonConstants.PREFERENCES_NAME);
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to get preferences, Cause: ${err}`);
}
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets#L37-L43
|
a2364ef07b5921a4e8191c953c2cea9861ddef79
|
gitee
|
openharmony/multimedia_camera_framework
|
9873dd191f59efda885bc06897acf9b0660de8f2
|
frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets
|
arkts
|
onChangeRecord
|
录制 暂停/开始
|
async onChangeRecord(): Promise<void> {
Logger.info(TAG, `onChangeRecord isRecording: ${this.isRecording}`);
if (this.isRecording) {
// 开始
await this.resumeVideo();
} else {
// 暂停
if (this.timer !== undefined) {
clearInterval(this.timer);
Logger.debug(TAG, `onChangeRecord clear timer success`);
}
await CameraService.pauseVideo();
}
this.isRecording = !this.isRecording;
}
|
AST#method_declaration#Left async onChangeRecord 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` onChangeRecord isRecording: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRecording AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRecording 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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . resumeVideo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 暂停 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timer 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 clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timer 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` onChangeRecord clear timer success ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#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 CameraService AST#expression#Right AST#await_expression#Right AST#expression#Right . pauseVideo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRecording AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isRecording 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#method_declaration#Right
|
async onChangeRecord(): Promise<void> {
Logger.info(TAG, `onChangeRecord isRecording: ${this.isRecording}`);
if (this.isRecording) {
await this.resumeVideo();
} else {
if (this.timer !== undefined) {
clearInterval(this.timer);
Logger.debug(TAG, `onChangeRecord clear timer success`);
}
await CameraService.pauseVideo();
}
this.isRecording = !this.isRecording;
}
|
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets#L99-L113
|
732a54dd1eb8df4779604c76852261feae6599cd
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/member/MemberManager.ets
|
arkts
|
checkDayOfUsable
|
/ 检查 dayOf 是否可用
|
public checkDayOfUsable(curDayOfNum: number, showMessage: boolean = true): boolean {
if (this.isActive) { return true } // 非会员才做检查
if (this.maxFreePlanDayOfsCount < curDayOfNum) {
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_use_all_plan_dayofs'))
}
return false
}
return true
}
|
AST#method_declaration#Left public checkDayOfUsable AST#parameter_list#Left ( AST#parameter#Left curDayOfNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxFreePlanDayOfsCount AST#member_expression#Right AST#expression#Right < AST#expression#Left curDayOfNum 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 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_use_all_plan_dayofs' 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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public checkDayOfUsable(curDayOfNum: number, showMessage: boolean = true): boolean {
if (this.isActive) { return true }
if (this.maxFreePlanDayOfsCount < curDayOfNum) {
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_use_all_plan_dayofs'))
}
return false
}
return true
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L273-L284
|
e706240f1f0192b4cec65854ba026057756a7517
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/component/TextInputDialogView.ets
|
arkts
|
getString
|
获取指定资源对应的字符串
@param res
|
private getString(res: Resource): string {
return ArkWebHelper.getContext().resourceManager.getStringSync(res);
}
|
AST#method_declaration#Left private getString AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left res AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private getString(res: Resource): string {
return ArkWebHelper.getContext().resourceManager.getStringSync(res);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/component/TextInputDialogView.ets#L257-L259
|
6b476221be206de2e8dcb1662cc9a2e098ac6daa
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto/src/main/ets/crypto/encryption/AES.ets
|
arkts
|
generateAESKey128
|
生成AES的对称密钥-128位
@returns AES密钥-128位
|
static async generateAESKey128(): Promise<string> {
return CryptoUtil.generateSymKey('AES128');
}
|
AST#method_declaration#Left static async generateAESKey128 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . generateSymKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES128' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async generateAESKey128(): Promise<string> {
return CryptoUtil.generateSymKey('AES128');
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AES.ets#L74-L76
|
ba8c20757d688ca421d885e1f6a8540721200264
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.util.d.ets
|
arkts
|
compare
|
Compares the current RationalNumber object to the given object.
@param { RationalNumber } another - An object of other rational numbers
@returns { number } Returns 0 or 1, or -1, depending on the comparison.
@throws { BusinessError } 401 - Parameter error. Possible causes:
1.Mandatory parameters are left unspecified;
2.Incorrect parameter types.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20
|
compare(another: RationalNumber): number;
|
AST#method_declaration#Left compare AST#parameter_list#Left ( AST#parameter#Left another : AST#type_annotation#Left AST#primary_type#Left RationalNumber 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#method_declaration#Right
|
compare(another: RationalNumber): number;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L930-L930
|
2a6814f55b062a37f42225f0c39b0ffd37d92598
|
gitee
|
Tianpei-Shi/MusicDash.git
|
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
|
src/model/UserModel.ets
|
arkts
|
播放历史记录模型
|
export class PlayHistory {
id: string;
userId: number;
songId: number;
songTitle: string;
songArtist: string;
playedTime: number;
constructor(userId: number, songId: number, songTitle: string, songArtist: string) {
this.id = `${userId}_${songId}_${Date.now()}`;
this.userId = userId;
this.songId = songId;
this.songTitle = songTitle;
this.songArtist = songArtist;
this.playedTime = Date.now();
}
// 转换为CloudDB对象格式
toCloudObject(): CloudDBZoneObject {
const cloudObject: CloudDBZoneObject = {
id: this.id,
userId: this.userId,
songId: this.songId,
songTitle: this.songTitle,
songArtist: this.songArtist,
playedTime: this.playedTime
};
return cloudObject;
}
// 从CloudDB对象创建PlayHistory
static fromCloudObject(obj: CloudDBZoneObject): PlayHistory {
const history = new PlayHistory(
obj.userId as number,
obj.songId as number,
obj.songTitle as string,
obj.songArtist as string
);
history.id = obj.id as string;
history.playedTime = obj.playedTime as number;
return history;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class PlayHistory AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left songId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left songTitle : 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 songArtist : 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 playedTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left songId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left songTitle : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left songArtist : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right _ AST#template_substitution#Left $ { AST#expression#Left songId AST#expression#Right } AST#template_substitution#Right _ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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#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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userId AST#member_expression#Right = AST#expression#Left userId 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 . songId AST#member_expression#Right = AST#expression#Left songId 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 . songTitle AST#member_expression#Right = AST#expression#Left songTitle 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 . songArtist AST#member_expression#Right = AST#expression#Left songArtist 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 . playedTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right // 转换为CloudDB对象格式 AST#method_declaration#Left toCloudObject AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CloudDBZoneObject AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cloudObject : AST#type_annotation#Left AST#primary_type#Left CloudDBZoneObject 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 this AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left userId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left songId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . songId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left songTitle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . songTitle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left songArtist AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . songArtist AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left playedTime AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . playedTime 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#return_statement#Left return AST#expression#Left cloudObject AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 从CloudDB对象创建PlayHistory AST#method_declaration#Left static fromCloudObject AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left CloudDBZoneObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PlayHistory AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left history = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PlayHistory 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#member_expression#Left AST#expression#Left obj AST#expression#Right . userId 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#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left obj AST#expression#Right . songId 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#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left obj AST#expression#Right . songTitle AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left obj AST#expression#Right . songArtist AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left history AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left obj AST#expression#Right . id AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left history AST#expression#Right . playedTime AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left obj AST#expression#Right . playedTime 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#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left history 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 PlayHistory {
id: string;
userId: number;
songId: number;
songTitle: string;
songArtist: string;
playedTime: number;
constructor(userId: number, songId: number, songTitle: string, songArtist: string) {
this.id = `${userId}_${songId}_${Date.now()}`;
this.userId = userId;
this.songId = songId;
this.songTitle = songTitle;
this.songArtist = songArtist;
this.playedTime = Date.now();
}
toCloudObject(): CloudDBZoneObject {
const cloudObject: CloudDBZoneObject = {
id: this.id,
userId: this.userId,
songId: this.songId,
songTitle: this.songTitle,
songArtist: this.songArtist,
playedTime: this.playedTime
};
return cloudObject;
}
static fromCloudObject(obj: CloudDBZoneObject): PlayHistory {
const history = new PlayHistory(
obj.userId as number,
obj.songId as number,
obj.songTitle as string,
obj.songArtist as string
);
history.id = obj.id as string;
history.playedTime = obj.playedTime as number;
return history;
}
}
|
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L99-L141
|
7046cd61c8fcfbf3d8c7860831c16f9c2673627d
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/pages/ContactsPage.ets
|
arkts
|
buildFilterMenu
|
构建筛选菜单
|
@Builder
buildFilterMenu() {
// 简化实现,实际应该是弹出菜单
Column() {
Text('筛选菜单占位符')
.fontSize(16)
.textAlign(TextAlign.Center)
.padding(20)
}
.width('100%')
.backgroundColor('#ffffff')
.onClick(() => {
this.showFilterMenu = false;
})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFilterMenu AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 简化实现,实际应该是弹出菜单 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '筛选菜单占位符' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 20 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 . 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showFilterMenu AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#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
buildFilterMenu() {
Column() {
Text('筛选菜单占位符')
.fontSize(16)
.textAlign(TextAlign.Center)
.padding(20)
}
.width('100%')
.backgroundColor('#ffffff')
.onClick(() => {
this.showFilterMenu = false;
})
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L453-L467
|
61d512f5738b9e8a0714d0fa6ee69e35701321f0
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/onlinesearch/OnlineWord.ets
|
arkts
|
MARK: - CodingKeys 编码键类
OnlineWord JSON 编码键定义
包含与服务器 API 交互时使用的键名
|
export class CodingKeys {
static readonly TitleEn = 'title_en'
static readonly PronEn = 'pron_en'
static readonly PronUs = 'pron_us'
static readonly TitleCn1 = 'title_cn1'
static readonly TitleCn2 = 'title_cn2'
static readonly TitleCn3 = 'title_cn3'
static readonly WordChange = 'word_change'
static readonly SynWords = 'syn_words'
static readonly AsynWords = 'asyn_words'
static readonly ExampleEn1 = 'example_en1'
static readonly ExampleCn1 = 'example_cn1'
static readonly ExampleEn2 = 'example_en2'
static readonly ExampleCn2 = 'example_cn2'
static readonly ExampleEn3 = 'example_en3'
static readonly ExampleCn3 = 'example_cn3'
static readonly UsedPhase = 'used_phase'
static readonly En2en = 'en2en'
static readonly Discriminate = 'discriminate'
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CodingKeys AST#class_body#Left { AST#property_declaration#Left static readonly TitleEn = AST#expression#Left 'title_en' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly PronEn = AST#expression#Left 'pron_en' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly PronUs = AST#expression#Left 'pron_us' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly TitleCn1 = AST#expression#Left 'title_cn1' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly TitleCn2 = AST#expression#Left 'title_cn2' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly TitleCn3 = AST#expression#Left 'title_cn3' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly WordChange = AST#expression#Left 'word_change' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly SynWords = AST#expression#Left 'syn_words' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly AsynWords = AST#expression#Left 'asyn_words' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly ExampleEn1 = AST#expression#Left 'example_en1' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly ExampleCn1 = AST#expression#Left 'example_cn1' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly ExampleEn2 = AST#expression#Left 'example_en2' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly ExampleCn2 = AST#expression#Left 'example_cn2' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly ExampleEn3 = AST#expression#Left 'example_en3' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly ExampleCn3 = AST#expression#Left 'example_cn3' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly UsedPhase = AST#expression#Left 'used_phase' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly En2en = AST#expression#Left 'en2en' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly Discriminate = AST#expression#Left 'discriminate' AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class CodingKeys {
static readonly TitleEn = 'title_en'
static readonly PronEn = 'pron_en'
static readonly PronUs = 'pron_us'
static readonly TitleCn1 = 'title_cn1'
static readonly TitleCn2 = 'title_cn2'
static readonly TitleCn3 = 'title_cn3'
static readonly WordChange = 'word_change'
static readonly SynWords = 'syn_words'
static readonly AsynWords = 'asyn_words'
static readonly ExampleEn1 = 'example_en1'
static readonly ExampleCn1 = 'example_cn1'
static readonly ExampleEn2 = 'example_en2'
static readonly ExampleCn2 = 'example_cn2'
static readonly ExampleEn3 = 'example_en3'
static readonly ExampleCn3 = 'example_cn3'
static readonly UsedPhase = 'used_phase'
static readonly En2en = 'en2en'
static readonly Discriminate = 'discriminate'
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/onlinesearch/OnlineWord.ets#L34-L53
|
d0a9e438b65138ee298e1ad9a0ec1d4dc69a7126
|
github
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookLists.ets
|
arkts
|
WorksBookLists
|
书单
|
@Component
export default struct WorksBookLists {
@Link checkGroup:Record<number, boolean>
@Prop EXHIBIT: string
@Prop currentIndex:number
@Prop worksLists:WorksLists[] =[]
@Prop isShowCheck:boolean = false
@State worksBook:WorksLists = new WorksLists()
@StorageLink('BOOK_IS_BOOK_WORKS_BOOK_LIST') @Watch('getWorkLists')isWorksBookListRefreshing: number = 0
onSelect:Function = () => {}
aboutToAppear(): void {
if (this.worksLists.length === 0) {
this.getWorkLists()
}
}
@State workBookListStatus:number = 1
getWorkLists() {
worksListsDao.search({
type:this.currentIndex
}).then((val)=>{
this.worksLists = val
})
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct WorksBookLists AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right checkGroup : 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 number AST#primary_type#Right AST#type_annotation#Right , 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#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right EXHIBIT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right worksLists : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WorksLists [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right isShowCheck : 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 @ State AST#decorator#Right worksBook : AST#type_annotation#Left AST#primary_type#Left WorksLists 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 WorksLists 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 @ StorageLink ( AST#expression#Left 'BOOK_IS_BOOK_WORKS_BOOK_LIST' AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'getWorkLists' AST#expression#Right ) AST#decorator#Right AST#ERROR#Left isWorksBookListRefreshing AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right onSelect AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#ERROR#Left aboutToAppear AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right : AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left void AST#ERROR#Left { AST#ERROR#Left AST#property_name#Left if AST#property_name#Right ( this . works List s . length === AST#ERROR#Right AST#property_name#Left 0 AST#property_name#Right ) AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . getWorkLists AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } } AST#ERROR#Right AST#decorator#Left @ State AST#decorator#Right workBookListStatus : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 1 AST#expression#Right AST#ERROR#Left getWork List s AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left worksListsDao AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . search AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left val 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 . worksLists AST#member_expression#Right = AST#expression#Left val 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#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export default struct WorksBookLists {
@Link checkGroup:Record<number, boolean>
@Prop EXHIBIT: string
@Prop currentIndex:number
@Prop worksLists:WorksLists[] =[]
@Prop isShowCheck:boolean = false
@State worksBook:WorksLists = new WorksLists()
@StorageLink('BOOK_IS_BOOK_WORKS_BOOK_LIST') @Watch('getWorkLists')isWorksBookListRefreshing: number = 0
onSelect:Function = () => {}
aboutToAppear(): void {
if (this.worksLists.length === 0) {
this.getWorkLists()
}
}
@State workBookListStatus:number = 1
getWorkLists() {
worksListsDao.search({
type:this.currentIndex
}).then((val)=>{
this.worksLists = val
})
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookLists.ets#L13-L36
|
b26475e0a2c1e69e590b5a5636e88e830ce88c2e
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityText.ets
|
arkts
|
AccessibilityText
|
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.
|
@Component
export struct AccessibilityText {
@Builder customAccessibilityNode() {
Column() {
Text(`virtual node`)
}
.width(10)
.height(10)
}
build() {
NavDestination() {
Row() {
Column() {
Text($r('app.string.UniversalAttributesAccessibility_text5'))
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text($r('app.string.UniversalAttributesAccessibility_text6'))
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.accessibilityGroup(true)
.accessibilityLevel('yes')
.accessibilityText($r('app.string.UniversalAttributesAccessibility_text7'))
.accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8'))
.accessibilityVirtualNode(this.customAccessibilityNode)
.accessibilityChecked(true)
.accessibilitySelected(undefined)
}
.height('100%')
}
.backgroundColor('#f1f2f3')
.title($r('app.string.UniversalAttributesAccessibility_title1'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AccessibilityText AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customAccessibilityNode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` virtual node ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 10 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 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.UniversalAttributesAccessibility_text5' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.UniversalAttributesAccessibility_text6' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . accessibilityGroup ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . accessibilityLevel ( AST#expression#Left 'yes' AST#expression#Right ) AST#modifier_chain_expression#Left . accessibilityText ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.UniversalAttributesAccessibility_text7' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . accessibilityDescription ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.UniversalAttributesAccessibility_text8' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . accessibilityVirtualNode ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customAccessibilityNode AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . accessibilityChecked ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . accessibilitySelected ( AST#expression#Left undefined 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 . height ( 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 . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.UniversalAttributesAccessibility_title1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct AccessibilityText {
@Builder customAccessibilityNode() {
Column() {
Text(`virtual node`)
}
.width(10)
.height(10)
}
build() {
NavDestination() {
Row() {
Column() {
Text($r('app.string.UniversalAttributesAccessibility_text5'))
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text($r('app.string.UniversalAttributesAccessibility_text6'))
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.accessibilityGroup(true)
.accessibilityLevel('yes')
.accessibilityText($r('app.string.UniversalAttributesAccessibility_text7'))
.accessibilityDescription($r('app.string.UniversalAttributesAccessibility_text8'))
.accessibilityVirtualNode(this.customAccessibilityNode)
.accessibilityChecked(true)
.accessibilitySelected(undefined)
}
.height('100%')
}
.backgroundColor('#f1f2f3')
.title($r('app.string.UniversalAttributesAccessibility_title1'))
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityText.ets#L16-L52
|
359115346bef8588a3d0afb295d782742d20b79e
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/component/LoadingProgressView.ets
|
arkts
|
LoadingProgressView
|
TODO LoadingProgress组件
author: 桃花镇童长老ᥫ᭡
since: 2024/08/01
|
@Component
export struct LoadingProgressView {
@Prop options: LoadingProgressOptions;
@State content: string = '';
aboutToAppear(): void {
if (this.options.content) {
this.content = Helper.getResourceStr(this.options.content) ?? "";
}
}
build() {
Column() {
Stack() {
Progress({ value: this.options.progress, total: 100, type: ProgressType.Ring })
.width('100%')
.height('100%')
.color(this.options.loadColor)
.backgroundColor("#66FFFFFF")
.style({ strokeWidth: 6, enableSmoothEffect: false })
Text(`${this.options.progress > 100 ? 100 : this.options.progress}%`)
.width('100%')
.height('100%')
.fontSize(15)
.fontWeight(FontWeight.Bold)
.fontColor(this.options.loadColor)
.textAlign(TextAlign.Center)
}
.height((this.options.loadSize))
.width((this.options.loadSize))
Text(this.options.content)
.textAlign(TextAlign.Center)
.margin({ top: 12 })
.fontSize(this.options.fontSize)
.fontColor(this.options.fontColor)
.visibility(this.content.length > 0 ? Visibility.Visible : Visibility.None)
}
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
.margin(5)
.padding(this.options.padding)
.backgroundColor(this.options.backgroundColor)
.borderRadius(this.options.borderRadius)
.shadow(this.options.shadow)
.constraintSize({
minWidth: (this.content.length > 0 ? 116 : 96),
minHeight: (this.content.length > 0 ? 116 : 96)
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingProgressView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right options : AST#type_annotation#Left AST#primary_type#Left LoadingProgressOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right content : 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#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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . getResourceStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right 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 Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Progress ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . progress AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left total : AST#expression#Left 100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ProgressType AST#expression#Right . Ring AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . loadColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left "#66FFFFFF" AST#expression#Right ) AST#modifier_chain_expression#Left . style ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enableSmoothEffect 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . progress AST#member_expression#Right AST#expression#Right > AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 100 AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . options AST#member_expression#Right AST#expression#Right . progress 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 . 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 . fontSize ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . loadColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . loadSize AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . loadSize AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . 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 . margin ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . padding AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . borderRadius AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . shadow AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . constraintSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left minWidth AST#property_name#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 116 AST#expression#Right : AST#expression#Left 96 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left minHeight AST#property_name#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 116 AST#expression#Right : AST#expression#Left 96 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct LoadingProgressView {
@Prop options: LoadingProgressOptions;
@State content: string = '';
aboutToAppear(): void {
if (this.options.content) {
this.content = Helper.getResourceStr(this.options.content) ?? "";
}
}
build() {
Column() {
Stack() {
Progress({ value: this.options.progress, total: 100, type: ProgressType.Ring })
.width('100%')
.height('100%')
.color(this.options.loadColor)
.backgroundColor("#66FFFFFF")
.style({ strokeWidth: 6, enableSmoothEffect: false })
Text(`${this.options.progress > 100 ? 100 : this.options.progress}%`)
.width('100%')
.height('100%')
.fontSize(15)
.fontWeight(FontWeight.Bold)
.fontColor(this.options.loadColor)
.textAlign(TextAlign.Center)
}
.height((this.options.loadSize))
.width((this.options.loadSize))
Text(this.options.content)
.textAlign(TextAlign.Center)
.margin({ top: 12 })
.fontSize(this.options.fontSize)
.fontColor(this.options.fontColor)
.visibility(this.content.length > 0 ? Visibility.Visible : Visibility.None)
}
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
.margin(5)
.padding(this.options.padding)
.backgroundColor(this.options.backgroundColor)
.borderRadius(this.options.borderRadius)
.shadow(this.options.shadow)
.constraintSize({
minWidth: (this.content.length > 0 ? 116 : 96),
minHeight: (this.content.length > 0 ? 116 : 96)
})
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/component/LoadingProgressView.ets#L24-L76
|
751b0a0087b011892d4e6a6d268053eaef6f3305
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/Media/AVMetadataExtractor/AVMetadataExtractorArkTS/entry/src/main/ets/pages/Index.ets
|
arkts
|
testFetchMetadataFromFdSrcByPromise
|
在以下demo中,使用资源管理接口获取打包在HAP内的媒体资源文件,通过设置fdSrc属性,获取音频元数据并打印。 获取音频专辑封面并通过Image控件显示在屏幕上。该demo以Promise形式进行异步接口调用。
|
async testFetchMetadataFromFdSrcByPromise() {
if (canIUse('SystemCapability.Multimedia.Media.AVMetadataExtractor')) {
try {
// 创建AVMetadataExtractor对象。
let avMetadataExtractor: media.AVMetadataExtractor = await media.createAVMetadataExtractor();
// 设置fdSrc。
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
avMetadataExtractor.fdSrc = await context.resourceManager.getRawFd('test.mp3');
// 获取元数据(promise模式)。
let metadata = await avMetadataExtractor.fetchMetadata();
console.info(TAG, `get meta data, hasAudio: ${metadata.hasAudio}`);
// 获取专辑封面(promise模式)。
this.pixelMap = await avMetadataExtractor.fetchAlbumCover();
// 释放资源(promise模式)。
avMetadataExtractor.release();
console.info(TAG, `release success.`);
} catch (e) {
console.error(TAG + `FetchMetadataFromFdSrcByPromise, code is ${e.code}, message is ${e.message}`);
}
}
}
|
AST#method_declaration#Left async testFetchMetadataFromFdSrcByPromise AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'SystemCapability.Multimedia.Media.AVMetadataExtractor' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 创建AVMetadataExtractor对象。 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left avMetadataExtractor : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVMetadataExtractor 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 media AST#expression#Right AST#await_expression#Right AST#expression#Right . createAVMetadataExtractor 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 // 设置fdSrc。 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left avMetadataExtractor AST#expression#Right . fdSrc AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getRawFd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'test.mp3' 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 // 获取元数据(promise模式)。 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left metadata = 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 avMetadataExtractor AST#expression#Right AST#await_expression#Right AST#expression#Right . fetchMetadata AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` get meta data, hasAudio: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left metadata AST#expression#Right . hasAudio 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 // 获取专辑封面(promise模式)。 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 . pixelMap 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 avMetadataExtractor AST#expression#Right AST#await_expression#Right AST#expression#Right . fetchAlbumCover 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 // 释放资源(promise模式)。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avMetadataExtractor 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#statement#Right 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 TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` release success. ` 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 ( 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 TAG AST#expression#Right + AST#expression#Left AST#template_literal#Left ` FetchMetadataFromFdSrcByPromise, code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e 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 e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async testFetchMetadataFromFdSrcByPromise() {
if (canIUse('SystemCapability.Multimedia.Media.AVMetadataExtractor')) {
try {
let avMetadataExtractor: media.AVMetadataExtractor = await media.createAVMetadataExtractor();
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
avMetadataExtractor.fdSrc = await context.resourceManager.getRawFd('test.mp3');
let metadata = await avMetadataExtractor.fetchMetadata();
console.info(TAG, `get meta data, hasAudio: ${metadata.hasAudio}`);
this.pixelMap = await avMetadataExtractor.fetchAlbumCover();
avMetadataExtractor.release();
console.info(TAG, `release success.`);
} catch (e) {
console.error(TAG + `FetchMetadataFromFdSrcByPromise, code is ${e.code}, message is ${e.message}`);
}
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVMetadataExtractor/AVMetadataExtractorArkTS/entry/src/main/ets/pages/Index.ets#L113-L137
|
71f548cb42bd8707745a3d574132332d70e04710
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/GreetingTypes.ets
|
arkts
|
礼物统计接口
|
export interface GiftStats {
totalRecommended: number;
totalSaved: number;
averageSuitability: number;
mostRecommendedType: GiftType;
typeDistribution: Record<GiftType, number>;
priceRangeDistribution: Record<PriceRange, number>;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface GiftStats AST#object_type#Left { AST#type_member#Left totalRecommended : 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 totalSaved : 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 averageSuitability : 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 mostRecommendedType : AST#type_annotation#Left AST#primary_type#Left GiftType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left typeDistribution : 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 GiftType AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left priceRangeDistribution : 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 PriceRange AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface GiftStats {
totalRecommended: number;
totalSaved: number;
averageSuitability: number;
mostRecommendedType: GiftType;
typeDistribution: Record<GiftType, number>;
priceRangeDistribution: Record<PriceRange, number>;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L628-L635
|
3a742f5fde56a8b678d5df09924ded09aeaf6be9
|
github
|
|
iotjin/JhHarmonyDemo.git
|
819e6c3b1db9984c042a181967784550e171b2e8
|
JhCommon/src/main/ets/JhForm/JhSetCell.ets
|
arkts
|
JhSetCell
|
底部线高
|
@Preview
@Component
export struct JhSetCell {
@Prop public leftIcon?: ResourceStr = '' // 左侧图标,不设置时不显示 eg: $rawfile("svg/ic_login_user.svg")
@BuilderParam leftWidget?: () => void // 左侧自定义组件,默认隐藏,优先级高于leftIcon
@Prop public title: ResourceStr = '' // 左侧标题
@Prop public titleWidth: number = _titleWidth // 标题宽度
@Prop public titleStyle: TextStyle = { fontSize: _titleFontSize, fontColor: _titleColor }
@Prop public text: ResourceStr = '' // 右侧文字
@Prop public textStyle: TextStyle = { fontSize: _textFontSize, fontColor: _textColor }
@Prop public textAlign: TextAlign = TextAlign.End // 右侧文字对齐方式,默认右对齐
@BuilderParam rightWidget?: () => void // 右侧自定义组件,默认隐藏
@Prop public hiddenArrow: boolean = false // 是否隐藏箭头,默认不隐藏
@Prop public hiddenLine: boolean = false // 隐藏底部下划线,默认false
@Prop public lineLeftEdge: number = _lineLeftEdge // 底部横线左侧距离 默认_leftEdge
@Prop public lineRightEdge: number = _lineRightEdge // 底部横线右侧距离 默认0
@Prop public cellHeight: number = _cellHeight //cell高度 默认_cellHeight
@Prop public bgColor: ResourceColor = _bgColor // 背景颜色,默认白色
@Prop public leftImgWH: number = _imgWH // 左侧图片宽高,默认_imgWH
@Prop public arrowImgWH: number = _cellHeight / 2 // 箭头图片宽高
public clickCallBack?: () => void // 点击回调
// private
@State private arrowIcon: ResourceStr = $rawfile("JhForm/ic_arrow_right.svg")
build() {
Column() {
Row() {
// left
if (this.isShowLeftWidget()) {
Row() {
if (this.leftWidget) {
this.leftWidget()
} else {
if (this.leftIcon) {
Image(this.leftIcon)
.width(this.leftImgWH)
.height(this.leftImgWH)
}
}
if ((this.leftIcon || this.leftWidget) && this.title) {
Blank().width(10)
}
if (this.title) {
Text(this.title)
.fontColor(this.titleStyle.fontColor)
.fontSize(this.titleStyle.fontSize)
.textAlign(TextAlign.Start)
}
}
.justifyContent(FlexAlign.Start)
.width(this.titleWidth)
.height('100%')
}
// center
Row() {
this.textBuilder()
}
.layoutWeight(1)
.enabled(false)
// right
Row() {
if (this.rightWidget) {
this.rightWidget()
}
if (!this.hiddenArrow) {
Image(this.arrowIcon)
.fillColor('#C8C8C8')
.width(this.arrowImgWH)
.height(this.arrowImgWH)
}
}
.height('100%')
}
.padding({ left: _leftEdge, right: _rightEdge })
.height(this.cellHeight - 1)
// bottom line
this.lineBuilder()
}
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start)
.size({ width: '100%', height: this.cellHeight })
.backgroundColor(this.bgColor)
.onClick(() => {
this.clickCallBack?.()
})
}
isShowLeftWidget() {
return this.leftIcon || this.leftWidget || this.title
}
@Builder
textBuilder() {
Text(this.text)
.fontSize(this.textStyle.fontSize)
.fontColor(this.textStyle.fontColor)
.textAlign(this.textAlign)
.width('100%')
.height('100%')
}
@Builder
lineBuilder() {
if (!this.hiddenLine) {
Row()
.width(`calc(100% - ${this.lineLeftEdge + this.lineRightEdge}vp)`)
.height(_lineHeight)
.margin({ left: this.lineLeftEdge, right: this.lineRightEdge })
.backgroundColor(_lineColor)
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct JhSetCell AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public leftIcon ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right // 左侧图标,不设置时不显示 eg: $rawfile("svg/ic_login_user.svg") AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right leftWidget ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right // 左侧自定义组件,默认隐藏,优先级高于leftIcon AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right // 左侧标题 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public titleWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left _titleWidth AST#expression#Right // 标题宽度 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public titleStyle : AST#type_annotation#Left AST#primary_type#Left TextStyle AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left fontSize AST#property_name#Right : AST#expression#Left _titleFontSize AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left _titleColor 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 @ Prop AST#decorator#Right public text : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right // 右侧文字 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public textStyle : AST#type_annotation#Left AST#primary_type#Left TextStyle AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left fontSize AST#property_name#Right : AST#expression#Left _textFontSize AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left _textColor 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 @ Prop AST#decorator#Right public textAlign : AST#type_annotation#Left AST#primary_type#Left TextAlign AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right // 右侧文字对齐方式,默认右对齐 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right rightWidget ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right // 右侧自定义组件,默认隐藏 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public hiddenArrow : 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 @ Prop AST#decorator#Right public hiddenLine : 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 // 隐藏底部下划线,默认false AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public lineLeftEdge : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left _lineLeftEdge AST#expression#Right // 底部横线左侧距离 默认_leftEdge AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public lineRightEdge : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left _lineRightEdge AST#expression#Right // 底部横线右侧距离 默认0 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public cellHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left _cellHeight AST#expression#Right //cell高度 默认_cellHeight AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public bgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left _bgColor AST#expression#Right // 背景颜色,默认白色 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public leftImgWH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left _imgWH AST#expression#Right // 左侧图片宽高,默认_imgWH AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public arrowImgWH : 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 _cellHeight AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right // 箭头图片宽高 AST#property_declaration#Right AST#property_declaration#Left public clickCallBack ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right // 点击回调 // private AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private arrowIcon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left "JhForm/ic_arrow_right.svg" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // left AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowLeftWidget AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftWidget 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 . leftWidget AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftIcon AST#member_expression#Right AST#expression#Right ) { 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 this AST#expression#Right . leftIcon 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 . leftImgWH 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 . leftImgWH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftIcon AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . leftWidget AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleStyle AST#member_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleStyle AST#member_expression#Right AST#expression#Right . fontSize 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 . Start 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_if_statement#Right AST#ui_control_flow#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 . Start 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 . titleWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // center AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textBuilder 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 . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rightWidget 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 . rightWidget 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . hiddenArrow AST#member_expression#Right AST#expression#Right ) { 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 this AST#expression#Right . arrowIcon AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left '#C8C8C8' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . arrowImgWH 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 . arrowImgWH 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_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left _leftEdge AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left _rightEdge AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cellHeight AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // bottom line 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 . lineBuilder 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 . 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 . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left '100%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cellHeight AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clickCallBack 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#build_body#Right AST#build_method#Right AST#method_declaration#Left isShowLeftWidget AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftIcon AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . leftWidget AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . title 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 AST#decorator#Left @ Builder AST#decorator#Right textBuilder 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#member_expression#Left AST#expression#Left this AST#expression#Right . text AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textStyle AST#member_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textStyle AST#member_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textAlign 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 AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right lineBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . hiddenLine AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#template_literal#Left ` calc(100% - 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 this AST#expression#Right . lineLeftEdge AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lineRightEdge AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right vp) ` AST#template_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left _lineHeight AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lineLeftEdge 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 this AST#expression#Right . lineRightEdge AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left _lineColor AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Preview
@Component
export struct JhSetCell {
@Prop public leftIcon?: ResourceStr = ''
@BuilderParam leftWidget?: () => void
@Prop public title: ResourceStr = ''
@Prop public titleWidth: number = _titleWidth
@Prop public titleStyle: TextStyle = { fontSize: _titleFontSize, fontColor: _titleColor }
@Prop public text: ResourceStr = ''
@Prop public textStyle: TextStyle = { fontSize: _textFontSize, fontColor: _textColor }
@Prop public textAlign: TextAlign = TextAlign.End 对齐方式,默认右对齐
@BuilderParam rightWidget?: () => void
@Prop public hiddenArrow: boolean = false
@Prop public hiddenLine: boolean = false
@Prop public lineLeftEdge: number = _lineLeftEdge
@Prop public lineRightEdge: number = _lineRightEdge
@Prop public cellHeight: number = _cellHeight
@Prop public bgColor: ResourceColor = _bgColor
@Prop public leftImgWH: number = _imgWH
@Prop public arrowImgWH: number = _cellHeight / 2
public clickCallBack?: () => void
@State private arrowIcon: ResourceStr = $rawfile("JhForm/ic_arrow_right.svg")
build() {
Column() {
Row() {
if (this.isShowLeftWidget()) {
Row() {
if (this.leftWidget) {
this.leftWidget()
} else {
if (this.leftIcon) {
Image(this.leftIcon)
.width(this.leftImgWH)
.height(this.leftImgWH)
}
}
if ((this.leftIcon || this.leftWidget) && this.title) {
Blank().width(10)
}
if (this.title) {
Text(this.title)
.fontColor(this.titleStyle.fontColor)
.fontSize(this.titleStyle.fontSize)
.textAlign(TextAlign.Start)
}
}
.justifyContent(FlexAlign.Start)
.width(this.titleWidth)
.height('100%')
}
Row() {
this.textBuilder()
}
.layoutWeight(1)
.enabled(false)
Row() {
if (this.rightWidget) {
this.rightWidget()
}
if (!this.hiddenArrow) {
Image(this.arrowIcon)
.fillColor('#C8C8C8')
.width(this.arrowImgWH)
.height(this.arrowImgWH)
}
}
.height('100%')
}
.padding({ left: _leftEdge, right: _rightEdge })
.height(this.cellHeight - 1)
this.lineBuilder()
}
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start)
.size({ width: '100%', height: this.cellHeight })
.backgroundColor(this.bgColor)
.onClick(() => {
this.clickCallBack?.()
})
}
isShowLeftWidget() {
return this.leftIcon || this.leftWidget || this.title
}
@Builder
textBuilder() {
Text(this.text)
.fontSize(this.textStyle.fontSize)
.fontColor(this.textStyle.fontColor)
.textAlign(this.textAlign)
.width('100%')
.height('100%')
}
@Builder
lineBuilder() {
if (!this.hiddenLine) {
Row()
.width(`calc(100% - ${this.lineLeftEdge + this.lineRightEdge}vp)`)
.height(_lineHeight)
.margin({ left: this.lineLeftEdge, right: this.lineRightEdge })
.backgroundColor(_lineColor)
}
}
}
|
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhForm/JhSetCell.ets#L26-L140
|
57954652ac2abc76fdb1c14ae9180aa775ce6678
|
github
|
Active-hue/ArkTS-Accounting.git
|
c432916d305b407557f08e35017c3fd70668e441
|
entry/src/main/ets/pages/AddBill.ets
|
arkts
|
KeyboardArea
|
金额输入和数字键盘区域
|
@Builder
KeyboardArea() {
Column() {
// 金额显示区域
Column() {
Text(this.amount || '0')
.fontSize(60)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
.width('100%')
.textAlign(TextAlign.End)
.padding({ right: 20, top: 20, bottom: 20 })
}
.width('100%')
.backgroundColor('#F5F5F5')
// 数字键盘
Column() {
// 第一行:7, 8, 9, 今天
Row() {
this.NumberButton('7')
this.NumberButton('8')
this.NumberButton('9')
this.NumberButton('今天')
}
.width('100%')
// 第二行:4, 5, 6, +
Row() {
this.NumberButton('4')
this.NumberButton('5')
this.NumberButton('6')
this.NumberButton('+')
}
.width('100%')
// 第三行:1, 2, 3, -
Row() {
this.NumberButton('1')
this.NumberButton('2')
this.NumberButton('3')
this.NumberButton('-')
}
.width('100%')
// 第四行:., 0, 删除, 完成
Row() {
this.NumberButton('.')
this.NumberButton('0')
this.DeleteButton()
Column() {
Text('完成')
.fontSize(16)
.fontColor('#FFFFFF')
.fontWeight(FontWeight.Bold)
}
.width('25%')
.height(55)
.backgroundColor('#5B7FFF')
.justifyContent(FlexAlign.Center)
.border({ width: { top: 1 }, color: '#D0D0D0' })
.onClick(() => {
this.saveBill();
})
}
.width('100%')
}
.width('100%')
.backgroundColor('#FFFFFF')
}
.width('100%')
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right KeyboardArea 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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . amount AST#member_expression#Right AST#expression#Right || AST#expression#Left '0' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . End 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 right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , 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 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#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 . backgroundColor ( AST#expression#Left '#F5F5F5' 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 { // 第一行:7, 8, 9, 今天 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '7' 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 . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '9' 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 . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '今天' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#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 // 第二行:4, 5, 6, + AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '4' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '5' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '6' 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 . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '+' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#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 // 第三行:1, 2, 3, - AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '1' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . NumberButton AST#member_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#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 . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '3' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '-' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#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 // 第四行:., 0, 删除, 完成 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . NumberButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . DeleteButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '完成' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 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 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 . width ( AST#expression#Left '25%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 55 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#5B7FFF' 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 . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 1 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 '#D0D0D0' 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 this AST#expression#Right . saveBill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . backgroundColor ( AST#expression#Left '#FFFFFF' 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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
KeyboardArea() {
Column() {
Column() {
Text(this.amount || '0')
.fontSize(60)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
.width('100%')
.textAlign(TextAlign.End)
.padding({ right: 20, top: 20, bottom: 20 })
}
.width('100%')
.backgroundColor('#F5F5F5')
Column() {
Row() {
this.NumberButton('7')
this.NumberButton('8')
this.NumberButton('9')
this.NumberButton('今天')
}
.width('100%')
Row() {
this.NumberButton('4')
this.NumberButton('5')
this.NumberButton('6')
this.NumberButton('+')
}
.width('100%')
Row() {
this.NumberButton('1')
this.NumberButton('2')
this.NumberButton('3')
this.NumberButton('-')
}
.width('100%')
Row() {
this.NumberButton('.')
this.NumberButton('0')
this.DeleteButton()
Column() {
Text('完成')
.fontSize(16)
.fontColor('#FFFFFF')
.fontWeight(FontWeight.Bold)
}
.width('25%')
.height(55)
.backgroundColor('#5B7FFF')
.justifyContent(FlexAlign.Center)
.border({ width: { top: 1 }, color: '#D0D0D0' })
.onClick(() => {
this.saveBill();
})
}
.width('100%')
}
.width('100%')
.backgroundColor('#FFFFFF')
}
.width('100%')
}
|
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddBill.ets#L233-L304
|
db1bbd8a905a93eb36021120bd48fa8e7cc7e7f3
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets
|
arkts
|
task info on selected day
|
constructor(currentDate: Date) {
this.currentDate = currentDate;
this.showDate = currentDate.getTime();
this.dateTitle = weekDateFormat(currentDate.getTime());
this.selectedDay = (new Date().getDay() + WEEK_DAY_NUM - 1) % WEEK_DAY_NUM;
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left currentDate : 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#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 . currentDate AST#member_expression#Right = AST#expression#Left currentDate 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 . showDate AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentDate 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#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 . dateTitle AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left weekDateFormat AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentDate 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#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 . selectedDay AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getDay 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 WEEK_DAY_NUM AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left WEEK_DAY_NUM AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor(currentDate: Date) {
this.currentDate = currentDate;
this.showDate = currentDate.getTime();
this.dateTitle = weekDateFormat(currentDate.getTime());
this.selectedDay = (new Date().getDay() + WEEK_DAY_NUM - 1) % WEEK_DAY_NUM;
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets#L41-L46
|
f5387b7b9172fcedfe7d889ae679c004049cbab6
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
|
arkts
|
onSideBarSelected
|
处理侧边栏选中事件
@param {number} index - 目标索引
@returns {number} 实际滚动目标索引
|
onSideBarSelected(index: number): number {
const targetIndex: number = this.clampIndex(index);
this.isSideBarScrolling = true;
this.selectedCategoryIndex = targetIndex;
this.startSideBarUnlockTimer(targetIndex);
return targetIndex;
}
|
AST#method_declaration#Left onSideBarSelected AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left targetIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clampIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSideBarScrolling AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedCategoryIndex AST#member_expression#Right = AST#expression#Left targetIndex AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startSideBarUnlockTimer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left targetIndex AST#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 targetIndex AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
onSideBarSelected(index: number): number {
const targetIndex: number = this.clampIndex(index);
this.isSideBarScrolling = true;
this.selectedCategoryIndex = targetIndex;
this.startSideBarUnlockTimer(targetIndex);
return targetIndex;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L80-L86
|
4b9d54413126ac095a46e4faffa3787c44423ffe
|
github
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
products/hapA/src/main/ets/pages/HapPageOne.ets
|
arkts
|
HapPageOne
|
@Route({name: RouterConstants.HAP_A_PAGE_ONE})
|
@Route({name: RouterMap.HapA.HAP_A_PAGE_ONE})
@Component
export struct HapPageOne {
build() {
NavDestination(){
Column({ space: 15 }) {
Text("hello, world!")
}
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterMap AST#expression#Right . HapA AST#member_expression#Right AST#expression#Right . HAP_A_PAGE_ONE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct HapPageOne AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 15 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "hello, world!" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Route({name: RouterMap.HapA.HAP_A_PAGE_ONE})
@Component
export struct HapPageOne {
build() {
NavDestination(){
Column({ space: 15 }) {
Text("hello, world!")
}
}
}
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/hapA/src/main/ets/pages/HapPageOne.ets#L5-L15
|
d5e8c277ab9cb0d6fa987eb37f2bd0771c45cc6a
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/fadingedge/Index.ets
|
arkts
|
FadingEdgeComponent
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export { FadingEdgeComponent } from "./src/main/ets/mainpage/MainPage";
|
AST#export_declaration#Left export { FadingEdgeComponent } from "./src/main/ets/mainpage/MainPage" ; AST#export_declaration#Right
|
export { FadingEdgeComponent } from "./src/main/ets/mainpage/MainPage";
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fadingedge/Index.ets#L15-L15
|
b06eb34cc844c832d1f0f0c7acc7c9bbfe2b9ec8
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/i18n/I18nManager.ets
|
arkts
|
getConfig
|
获取本地化配置
|
getConfig(): LocaleConfig {
return { ...this.config };
}
|
AST#method_declaration#Left getConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LocaleConfig 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#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config 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
|
getConfig(): LocaleConfig {
return { ...this.config };
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L467-L469
|
36c4e0d282c9cfaaa67ac911cbcb0f4f79f3b286
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/analytics/AnalyticsService.ets
|
arkts
|
getOverviewStats
|
获取总览统计
|
async getOverviewStats(): Promise<OverviewStats> {
const contactSearchParams: ContactSearchParams = { pageSize: 10000 };
const greetingSearchParams: GreetingSearchParams = { pageSize: 10000 };
const contacts = await this.contactService.searchContacts(contactSearchParams);
const greetings = await this.greetingService.searchGreetings(greetingSearchParams);
const now = new Date();
const todayBirthdays = this.filterBirthdaysByDays(contacts, 0);
const thisWeekBirthdays = this.filterBirthdaysByDays(contacts, 7);
const thisMonthBirthdays = this.filterBirthdaysByMonth(contacts, now.getMonth());
const upcomingBirthdays = this.filterBirthdaysByDays(contacts, 30);
// 计算平均年龄
const ages = contacts
.filter(c => c.birthday.date)
.map(c => this.calculateAge(c.birthday.date))
.filter(age => age > 0);
const averageAge = ages.length > 0 ? Math.round(ages.reduce((sum, age) => sum + age, 0) / ages.length) : 0;
// 找出最年长和最年轻的人
let oldestPerson = '';
let youngestPerson = '';
if (ages.length > 0) {
const maxAge = Math.max(...ages);
const minAge = Math.min(...ages);
const oldest = contacts.find(c => c.birthday.date && this.calculateAge(c.birthday.date) === maxAge);
const youngest = contacts.find(c => c.birthday.date && this.calculateAge(c.birthday.date) === minAge);
oldestPerson = oldest ? `${oldest.name} (${maxAge}岁)` : '';
youngestPerson = youngest ? `${youngest.name} (${minAge}岁)` : '';
}
return {
totalContacts: contacts.length,
totalGreetings: greetings.length,
upcomingBirthdays: upcomingBirthdays.length,
thisMonthBirthdays: thisMonthBirthdays.length,
thisWeekBirthdays: thisWeekBirthdays.length,
todayBirthdays: todayBirthdays.length,
averageAge,
oldestPerson,
youngestPerson
};
}
|
AST#method_declaration#Left async getOverviewStats 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 OverviewStats 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 contactSearchParams : AST#type_annotation#Left AST#primary_type#Left ContactSearchParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left pageSize AST#property_name#Right : AST#expression#Left 10000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left greetingSearchParams : AST#type_annotation#Left AST#primary_type#Left GreetingSearchParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left pageSize AST#property_name#Right : AST#expression#Left 10000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left contacts = 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 . searchContacts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contactSearchParams AST#expression#Right ) AST#argument_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 greetings = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . greetingService AST#member_expression#Right AST#expression#Right . searchGreetings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left greetingSearchParams AST#expression#Right ) AST#argument_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 now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left todayBirthdays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterBirthdaysByDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contacts 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 thisWeekBirthdays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterBirthdaysByDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contacts AST#expression#Right , AST#expression#Left 7 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left thisMonthBirthdays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterBirthdaysByMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contacts AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_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 upcomingBirthdays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterBirthdaysByDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contacts AST#expression#Right , AST#expression#Left 30 AST#expression#Right ) AST#argument_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 ages = 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 contacts AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left c => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left c AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . date 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 . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left c => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateAge 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 c AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left age => AST#expression#Left AST#binary_expression#Left AST#expression#Left age 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left averageAge = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ages 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 Math AST#expression#Right . round 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 ages AST#expression#Right . reduce AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left sum AST#parameter#Right , AST#parameter#Left age AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left sum AST#expression#Right + AST#expression#Left age AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left ages AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 找出最年长和最年轻的人 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left oldestPerson = 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 youngestPerson = 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 ages AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left maxAge = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . max AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#spread_element#Left ... AST#expression#Left ages AST#expression#Right AST#spread_element#Right ) AST#argument_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 minAge = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#spread_element#Left ... AST#expression#Left ages AST#expression#Right AST#spread_element#Right ) AST#argument_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 oldest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left c => 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#member_expression#Left AST#expression#Left c AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . calculateAge 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 c AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left maxAge AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left youngest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left c => 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#member_expression#Left AST#expression#Left c AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . calculateAge 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 c AST#expression#Right . birthday AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left minAge AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left oldestPerson = AST#expression#Left AST#conditional_expression#Left AST#expression#Left oldest AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left oldest AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ( AST#template_substitution#Left $ { AST#expression#Left maxAge AST#expression#Right } AST#template_substitution#Right 岁) ` AST#template_literal#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left youngestPerson = AST#expression#Left AST#conditional_expression#Left AST#expression#Left youngest AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left youngest AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ( AST#template_substitution#Left $ { AST#expression#Left minAge AST#expression#Right } AST#template_substitution#Right 岁) ` AST#template_literal#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalContacts AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalGreetings AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left greetings AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left upcomingBirthdays AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left upcomingBirthdays AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left thisMonthBirthdays AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left thisMonthBirthdays AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left thisWeekBirthdays AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left thisWeekBirthdays AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left todayBirthdays AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left todayBirthdays AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left averageAge AST#property_assignment#Right , AST#property_assignment#Left oldestPerson AST#property_assignment#Right , AST#property_assignment#Left youngestPerson AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getOverviewStats(): Promise<OverviewStats> {
const contactSearchParams: ContactSearchParams = { pageSize: 10000 };
const greetingSearchParams: GreetingSearchParams = { pageSize: 10000 };
const contacts = await this.contactService.searchContacts(contactSearchParams);
const greetings = await this.greetingService.searchGreetings(greetingSearchParams);
const now = new Date();
const todayBirthdays = this.filterBirthdaysByDays(contacts, 0);
const thisWeekBirthdays = this.filterBirthdaysByDays(contacts, 7);
const thisMonthBirthdays = this.filterBirthdaysByMonth(contacts, now.getMonth());
const upcomingBirthdays = this.filterBirthdaysByDays(contacts, 30);
const ages = contacts
.filter(c => c.birthday.date)
.map(c => this.calculateAge(c.birthday.date))
.filter(age => age > 0);
const averageAge = ages.length > 0 ? Math.round(ages.reduce((sum, age) => sum + age, 0) / ages.length) : 0;
let oldestPerson = '';
let youngestPerson = '';
if (ages.length > 0) {
const maxAge = Math.max(...ages);
const minAge = Math.min(...ages);
const oldest = contacts.find(c => c.birthday.date && this.calculateAge(c.birthday.date) === maxAge);
const youngest = contacts.find(c => c.birthday.date && this.calculateAge(c.birthday.date) === minAge);
oldestPerson = oldest ? `${oldest.name} (${maxAge}岁)` : '';
youngestPerson = youngest ? `${youngest.name} (${minAge}岁)` : '';
}
return {
totalContacts: contacts.length,
totalGreetings: greetings.length,
upcomingBirthdays: upcomingBirthdays.length,
thisMonthBirthdays: thisMonthBirthdays.length,
thisWeekBirthdays: thisWeekBirthdays.length,
todayBirthdays: todayBirthdays.length,
averageAge,
oldestPerson,
youngestPerson
};
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L376-L423
|
25498072851faa5f4dc0fda041124b60c8d9db58
|
github
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/base/src/main/ets/state/BaseNetWorkUiState.ets
|
arkts
|
网络请求 UI 状态枚举
@author Joker.X
|
export enum BaseNetWorkUiState {
/**
* 加载中
*/
LOADING = "loading",
/**
* 请求成功
*/
SUCCESS = "success",
/**
* 请求失败
*/
ERROR = "error"
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum BaseNetWorkUiState AST#enum_body#Left { /**
* 加载中
*/ AST#enum_member#Left LOADING = AST#expression#Left "loading" AST#expression#Right AST#enum_member#Right , /**
* 请求成功
*/ AST#enum_member#Left SUCCESS = AST#expression#Left "success" AST#expression#Right AST#enum_member#Right , /**
* 请求失败
*/ AST#enum_member#Left ERROR = AST#expression#Left "error" AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum BaseNetWorkUiState {
LOADING = "loading",
SUCCESS = "success",
ERROR = "error"
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/state/BaseNetWorkUiState.ets#L5-L18
|
459438f0d5d44fefe962e4c235f4e109b79f5e9c
|
github
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets
|
arkts
|
unregisterSessionListener
|
[End update_is_play] [Start init_session]
|
async unregisterSessionListener(): Promise<void> {
// [StartExclude init_session]
if (!this.avSession) {
return;
}
try {
this.avSession.off('play');
this.avSession.off('pause');
this.avSession.off('playNext');
this.avSession.off('playPrevious');
this.avSession.off('setLoopMode');
this.avSession.off('seek');
this.avSession.off('toggleFavorite');
} catch (err) {
Logger.error(TAG, `unregisterSessionListener failed: code: ${err.code}, message: ${err.message}`);
}
// [EndExclude init_session]
// Destroy background long-term tasks
BackgroundTaskManager.stopContinuousTask(this.context);
}
|
AST#method_declaration#Left async unregisterSessionListener 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 { // [StartExclude init_session] 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 . avSession AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avSession AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'play' AST#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 . avSession AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pause' AST#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 . avSession AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'playNext' AST#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 . avSession AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'playPrevious' AST#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 . avSession AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'setLoopMode' AST#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 . avSession AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'seek' AST#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 . avSession AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'toggleFavorite' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` unregisterSessionListener failed: code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // [EndExclude init_session] // Destroy background long-term tasks AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left BackgroundTaskManager AST#expression#Right . stopContinuousTask AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async unregisterSessionListener(): Promise<void> {
if (!this.avSession) {
return;
}
try {
this.avSession.off('play');
this.avSession.off('pause');
this.avSession.off('playNext');
this.avSession.off('playPrevious');
this.avSession.off('setLoopMode');
this.avSession.off('seek');
this.avSession.off('toggleFavorite');
} catch (err) {
Logger.error(TAG, `unregisterSessionListener failed: code: ${err.code}, message: ${err.message}`);
}
BackgroundTaskManager.stopContinuousTask(this.context);
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets#L162-L181
|
bf2e8b60215ad01bfc6f409e4d44ac8371e44ef3
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/database/DatabaseService.ets
|
arkts
|
数据库服务统一管理类
提供所有数据库操作的统一接口
|
export class DatabaseService {
private static instance: DatabaseService;
private dbManager: DatabaseManager;
private contactDAO: ContactDAO;
private commemorationDAO: CommemorationDAO;
private greetingHistoryDAO: GreetingHistoryDAO;
private isInitialized: boolean = false;
private constructor() {
this.dbManager = DatabaseManager.getInstance();
this.contactDAO = new ContactDAO();
this.commemorationDAO = new CommemorationDAO();
this.greetingHistoryDAO = new GreetingHistoryDAO();
}
/**
* 获取DatabaseService单例实例
*/
static getInstance(): DatabaseService {
if (!DatabaseService.instance) {
DatabaseService.instance = new DatabaseService();
}
return DatabaseService.instance;
}
/**
* 初始化数据库服务
* @param context 应用上下文
*/
async initializeDatabase(context: Context): Promise<void> {
if (this.isInitialized) {
console.info('[DatabaseService] Database already initialized');
return;
}
try {
await this.dbManager.initDatabase(context);
this.isInitialized = true;
console.info('[DatabaseService] Database service initialized successfully');
// 生产环境:不自动插入示例数据
// await this.insertSampleDataIfEmpty();
} catch (error) {
const err = error as Error;
console.error('[DatabaseService] Failed to initialize database service:', err.message);
throw new Error(`Failed to initialize database service: ${err.message}`);
}
}
/**
* 检查数据库是否已初始化
*/
isDbInitialized(): boolean {
return this.isInitialized;
}
// ==================== 联系人相关操作 ====================
/**
* 获取联系人DAO
*/
get contacts(): ContactDAO {
this.checkInitialization();
return this.contactDAO;
}
/**
* 添加联系人
* @param contact 联系人实体
*/
async addContact(contact: ContactEntity): Promise<number> {
this.checkInitialization();
return await this.contactDAO.insertContact(contact);
}
/**
* 获取所有联系人
*/
async getAllContacts(): Promise<ContactEntity[]> {
this.checkInitialization();
return await this.contactDAO.getAllContacts();
}
/**
* 根据ID获取联系人
* @param id 联系人ID
*/
async getContactById(id: number): Promise<ContactEntity | null> {
this.checkInitialization();
return await this.contactDAO.getContactById(id);
}
/**
* 搜索联系人
* @param keyword 搜索关键字
*/
async searchContacts(keyword: string): Promise<ContactEntity[]> {
this.checkInitialization();
return await this.contactDAO.searchContacts(keyword);
}
/**
* 更新联系人
* @param id 联系人ID
* @param contact 更新数据
*/
async updateContact(id: number, contact: Partial<ContactEntity>): Promise<number> {
this.checkInitialization();
return await this.contactDAO.updateContact(id, contact);
}
/**
* 删除联系人(同时删除相关的纪念日和祝福历史)
* @param id 联系人ID
*/
async deleteContact(id: number): Promise<boolean> {
this.checkInitialization();
try {
// 删除关联的纪念日和祝福历史(外键约束会自动处理,但为了安全起见手动删除)
await this.commemorationDAO.deleteCommemorationsByContactId(id);
await this.greetingHistoryDAO.deleteGreetingHistoryByContactId(id);
// 删除联系人
const result = await this.contactDAO.deleteContact(id);
return result > 0;
} catch (error) {
console.error(`[DatabaseService] Failed to delete contact ${id}:`, error);
return false;
}
}
// ==================== 纪念日相关操作 ====================
/**
* 获取纪念日DAO
*/
get commemorations(): CommemorationDAO {
this.checkInitialization();
return this.commemorationDAO;
}
/**
* 添加纪念日
* @param commemoration 纪念日实体
*/
async addCommemoration(commemoration: CommemorationEntity): Promise<number> {
this.checkInitialization();
return await this.commemorationDAO.insertCommemoration(commemoration);
}
/**
* 获取联系人的所有纪念日
* @param contactId 联系人ID
*/
async getCommemorationsByContact(contactId: number): Promise<CommemorationEntity[]> {
this.checkInitialization();
return await this.commemorationDAO.getCommemorationsByContactId(contactId);
}
/**
* 获取需要提醒的纪念日
*/
async getCommemorationsForReminder(): Promise<CommemorationWithContact[]> {
this.checkInitialization();
return await this.commemorationDAO.getCommemorationsForReminder();
}
/**
* 获取本月的纪念日
* @param month 月份
* @param year 年份(可选)
*/
async getCommemorationsInMonth(month: number, year?: number): Promise<CommemorationEntity[]> {
this.checkInitialization();
return await this.commemorationDAO.getCommemorationsInMonth(month, year);
}
// ==================== 祝福历史相关操作 ====================
/**
* 获取祝福历史DAO
*/
get greetingHistory(): GreetingHistoryDAO {
this.checkInitialization();
return this.greetingHistoryDAO;
}
/**
* 添加祝福记录
* @param greetingHistory 祝福历史实体
*/
async addGreetingHistory(greetingHistory: GreetingHistoryEntity): Promise<number> {
this.checkInitialization();
return await this.greetingHistoryDAO.insertGreetingHistory(greetingHistory);
}
/**
* 获取联系人的祝福历史
* @param contactId 联系人ID
*/
async getGreetingHistoryByContact(contactId: number): Promise<GreetingHistoryEntity[]> {
this.checkInitialization();
return await this.greetingHistoryDAO.getGreetingHistoryByContactId(contactId);
}
/**
* 获取最近的祝福记录
* @param limit 数量限制
*/
async getRecentGreetingHistory(limit: number = 10): Promise<GreetingHistoryWithContact[]> {
this.checkInitialization();
return await this.greetingHistoryDAO.getGreetingHistoryWithContactInfo(limit);
}
/**
* 记录发送的祝福语
* @param contactId 联系人ID
* @param greetingContent 祝福内容
* @param occasion 场合
*/
async recordSentGreeting(contactId: number, greetingContent: string, occasion: string): Promise<number> {
this.checkInitialization();
const greetingHistory: GreetingHistoryEntity = {
contact_id: contactId,
greeting_content: greetingContent,
occasion: occasion,
sent_at: new Date().toISOString(),
created_at: new Date().toISOString()
};
return await this.greetingHistoryDAO.insertGreetingHistory(greetingHistory);
}
// ==================== 数据统计相关操作 ====================
/**
* 获取数据库统计信息
*/
async getDatabaseStatistics(): Promise<DatabaseStatisticsResult> {
this.checkInitialization();
try {
const stats = await this.dbManager.getDatabaseStats();
const result: DatabaseStatisticsResult = {
contactCount: stats.contactCount,
commemorationCount: stats.commemorationCount,
greetingCount: stats.greetingCount,
totalRecords: stats.contactCount + stats.commemorationCount + stats.greetingCount
};
return result;
} catch (error) {
const err = error as Error;
console.error('[DatabaseService] Failed to get statistics:', err.message);
const defaultResult: DatabaseStatisticsResult = { contactCount: 0, commemorationCount: 0, greetingCount: 0, totalRecords: 0 };
return defaultResult;
}
}
/**
* 获取祝福统计(按场合分组)
*/
async getGreetingStatistics(): Promise<Map<string, number>> {
this.checkInitialization();
return await this.greetingHistoryDAO.getGreetingStatsByOccasion();
}
// ==================== 数据管理相关操作 ====================
/**
* 清空所有数据
*/
async clearAllData(): Promise<void> {
this.checkInitialization();
await this.dbManager.clearAllData();
console.info('[DatabaseService] All data cleared');
}
/**
* 重建数据库(生产环境不插入示例数据)
*/
async rebuildDatabase(): Promise<void> {
this.checkInitialization();
await this.dbManager.rebuildDatabase();
// 生产环境:不重新插入示例数据
// await this.insertSampleDataIfEmpty();
console.info('[DatabaseService] Database rebuilt (production mode - no sample data)');
}
/**
* 关闭数据库连接
*/
async closeDatabase(): Promise<void> {
if (this.isInitialized) {
await this.dbManager.closeDatabase();
this.isInitialized = false;
console.info('[DatabaseService] Database service closed');
}
}
// ==================== 私有方法 ====================
/**
* 检查数据库是否已初始化
*/
private checkInitialization(): void {
if (!this.isInitialized) {
throw new Error('Database service not initialized. Call initializeDatabase() first.');
}
}
/**
* 如果数据库为空,插入一些示例数据
*/
private async insertSampleDataIfEmpty(): Promise<void> {
try {
const contactCount = await this.contactDAO.getContactCount();
if (contactCount === 0) {
console.info('[DatabaseService] Inserting sample data...');
// 插入示例联系人(包含公历和农历生日)
const sampleContacts: ContactEntity[] = [
{
name: '张小红',
relation: '家人',
birthday: '1995-03-15',
is_lunar_birthday: false,
lunar_birthday_month: 3,
lunar_birthday_day: 15,
gender: '女',
preferences: '喜欢看电影和阅读',
phone: '13800138001',
email: 'xiaohong@example.com',
address: '北京市朝阳区',
notes: '妹妹,性格开朗,公历3月15日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '李大明',
relation: '朋友',
birthday: '1992-07-22',
is_lunar_birthday: false,
lunar_birthday_month: 7,
lunar_birthday_day: 22,
gender: '男',
preferences: '热爱运动和旅行',
phone: '13800138002',
email: 'daming@example.com',
address: '上海市浦东新区',
notes: '大学同学,现在上海工作,公历7月22日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '王美丽',
relation: '同事',
birthday: '1988-11-08',
is_lunar_birthday: false,
lunar_birthday_month: 11,
lunar_birthday_day: 8,
gender: '女',
preferences: '音乐和绘画',
phone: '13800138003',
email: 'meili@example.com',
address: '广州市天河区',
notes: '部门经理,艺术爱好者,公历11月8日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '陈小华',
relation: '家人',
birthday: '1990-12-25',
is_lunar_birthday: false,
lunar_birthday_month: 12,
lunar_birthday_day: 25,
gender: '男',
preferences: '烹饪和科技',
phone: '13800138004',
email: 'xiaohua@example.com',
address: '深圳市南山区',
notes: '表哥,程序员,公历12月25日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '刘晓芳',
relation: '朋友',
birthday: '1996-06-18',
is_lunar_birthday: false,
lunar_birthday_month: 6,
lunar_birthday_day: 18,
gender: '女',
preferences: '瑜伽和摄影',
phone: '13800138005',
email: 'xiaofang@example.com',
address: '成都市锦江区',
notes: '闺蜜,瑜伽教练,公历6月18日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '赵志强',
relation: '朋友',
birthday: '1985-09-30',
is_lunar_birthday: false,
lunar_birthday_month: 9,
lunar_birthday_day: 30,
gender: '男',
preferences: '读书和投资',
phone: '13800138006',
email: 'zhiqiang@example.com',
address: '杭州市西湖区',
notes: '创业朋友,投资顾问,公历9月30日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
// 以下是农历生日的联系人
{
name: '吴奶奶',
relation: '家人',
birthday: '1950-01-01',
is_lunar_birthday: true,
lunar_birthday_month: 8,
lunar_birthday_day: 15,
gender: '女',
preferences: '太极和广场舞',
phone: '13800138007',
email: '',
address: '天津市和平区',
notes: '奶奶,农历八月十五中秋节生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '刘老爷',
relation: '其他',
birthday: '1948-01-01',
is_lunar_birthday: true,
lunar_birthday_month: 1,
lunar_birthday_day: 1,
gender: '男',
preferences: '书法和太极',
phone: '13800138008',
email: '',
address: '西安市雁塔区',
notes: '邻居爷爷,农历正月初一春节生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '陈小玲',
relation: '朋友',
birthday: '1993-01-01',
is_lunar_birthday: true,
lunar_birthday_month: 3,
lunar_birthday_day: 3,
gender: '女',
preferences: '中医和养生',
phone: '13800138009',
email: 'xiaoling@example.com',
address: '南京市鼓楼区',
notes: '中医理疗师,农历三月初三生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '张大山',
relation: '同事',
birthday: '1987-01-01',
is_lunar_birthday: true,
lunar_birthday_month: 5,
lunar_birthday_day: 5,
gender: '男',
preferences: '登山和摄影',
phone: '13800138010',
email: 'dashan@example.com',
address: '重庆市渝中区',
notes: '摄影师,农历五月初五端午节生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
}
];
// 批量插入联系人
const insertedCount = await this.contactDAO.batchInsertContacts(sampleContacts);
console.info(`[DatabaseService] ${insertedCount} contacts inserted successfully`);
// 为联系人添加纪念日
await this.insertSampleCommemorations();
// 暂时跳过祝福历史记录插入,因为表结构不匹配
// await this.insertSampleGreetingHistory();
console.info('[DatabaseService] All sample data inserted successfully');
}
} catch (error) {
const err = error as Error;
console.warn('[DatabaseService] Failed to insert sample data:', err.message);
}
}
/**
* 插入示例纪念日数据
*/
private async insertSampleCommemorations(): Promise<void> {
try {
const sampleCommemorations: CommemorationEntity[] = [
{
contact_id: 1, // 张小红
title: '生日',
commemoration_date: '1995-03-15',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 3,
notes: '妹妹的生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 2, // 李大明
title: '生日',
commemoration_date: '1992-07-22',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 1,
notes: '大学同学的生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 3, // 王美丽
title: '生日',
commemoration_date: '1988-11-08',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 7,
notes: '同事的生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 4, // 陈小华
title: '生日',
commemoration_date: '1990-12-25',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 3,
notes: '哥哥的生日,圣诞节',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 1, // 张小红
title: '毕业纪念日',
commemoration_date: '2017-06-15',
type: '纪念日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 1,
notes: '大学毕业纪念日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 5, // 刘晓芳
title: '生日',
commemoration_date: '1996-06-18',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 3,
notes: '高中同学的生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
}
];
for (const commemoration of sampleCommemorations) {
await this.commemorationDAO.insertCommemoration(commemoration);
}
console.info('[DatabaseService] Sample commemorations inserted successfully');
} catch (error) {
const err = error as Error;
console.warn('[DatabaseService] Failed to insert sample commemorations:', err.message);
}
}
/**
* 插入示例祝福历史数据
*/
private async insertSampleGreetingHistory(): Promise<void> {
try {
const sampleGreetings: GreetingHistoryEntity[] = [
{
contact_id: 1,
greeting_content: '亲爱的妹妹,生日快乐!愿你永远年轻美丽,工作顺利,身体健康!',
occasion: '生日祝福',
sent_at: '2024-03-15T09:00:00.000Z',
created_at: '2024-03-15T09:00:00.000Z'
},
{
contact_id: 2,
greeting_content: '大明,生日快乐!希望你在新的一岁里事业蝤蝤日上,身体健康!',
occasion: '生日祝福',
sent_at: '2024-07-22T10:30:00.000Z',
created_at: '2024-07-22T10:30:00.000Z'
},
{
contact_id: 3,
greeting_content: '美丽,生日快乐!谢谢你在工作中的帮助和支持,愿你天天开心!',
occasion: '生日祝福',
sent_at: '2024-11-08T14:20:00.000Z',
created_at: '2024-11-08T14:20:00.000Z'
},
{
contact_id: 1,
greeting_content: '新年快乐!愿妹妹在新的一年里工作顺利,生活幸福!',
occasion: '新年祝福',
sent_at: '2024-02-10T08:00:00.000Z',
created_at: '2024-02-10T08:00:00.000Z'
},
{
contact_id: 5,
greeting_content: '晓芳,生日快乐!希望你在杭州一切都好,有时间回来聚聚!',
occasion: '生日祝福',
sent_at: '2024-06-18T11:15:00.000Z',
created_at: '2024-06-18T11:15:00.000Z'
}
];
for (const greeting of sampleGreetings) {
await this.greetingHistoryDAO.insertGreetingHistory(greeting);
}
console.info('[DatabaseService] Sample greeting history inserted successfully');
} catch (error) {
const err = error as Error;
console.warn('[DatabaseService] Failed to insert sample greeting history:', err.message);
}
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DatabaseService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left DatabaseService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private dbManager : AST#type_annotation#Left AST#primary_type#Left DatabaseManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private contactDAO : AST#type_annotation#Left AST#primary_type#Left ContactDAO AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private commemorationDAO : AST#type_annotation#Left AST#primary_type#Left CommemorationDAO AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private greetingHistoryDAO : AST#type_annotation#Left AST#primary_type#Left GreetingHistoryDAO AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private isInitialized : 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#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dbManager AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DatabaseManager AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right 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 . contactDAO AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ContactDAO AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commemorationDAO AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CommemorationDAO AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . greetingHistoryDAO AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GreetingHistoryDAO 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 /**
* 获取DatabaseService单例实例
*/ AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DatabaseService 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 DatabaseService 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 DatabaseService 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 DatabaseService 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 DatabaseService AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 初始化数据库服务
* @param context 应用上下文
*/ AST#method_declaration#Left async initializeDatabase AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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 this AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Database already initialized' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 . dbManager AST#member_expression#Right AST#expression#Right . initDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 . isInitialized 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Database service initialized successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 生产环境:不自动插入示例数据 // await this.insertSampleDataIfEmpty(); } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Failed to initialize database service:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to initialize database service: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 检查数据库是否已初始化
*/ AST#method_declaration#Left isDbInitialized AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // ==================== 联系人相关操作 ==================== /**
* 获取联系人DAO
*/ AST#method_declaration#Left get AST#ERROR#Left contacts AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ContactDAO AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contactDAO AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 添加联系人
* @param contact 联系人实体
*/ AST#method_declaration#Left async addContact AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left ContactEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . contactDAO AST#member_expression#Right AST#expression#Right . insertContact AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contact AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取所有联系人
*/ AST#method_declaration#Left async getAllContacts 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 ContactEntity [ ] 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . contactDAO AST#member_expression#Right AST#expression#Right . getAllContacts 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 /**
* 根据ID获取联系人
* @param id 联系人ID
*/ AST#method_declaration#Left async getContactById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ContactEntity AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . contactDAO AST#member_expression#Right AST#expression#Right . getContactById AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 搜索联系人
* @param keyword 搜索关键字
*/ AST#method_declaration#Left async searchContacts AST#parameter_list#Left ( AST#parameter#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContactEntity [ ] 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . contactDAO AST#member_expression#Right AST#expression#Right . searchContacts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 更新联系人
* @param id 联系人ID
* @param contact 更新数据
*/ AST#method_declaration#Left async updateContact AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contact : 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 ContactEntity 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . contactDAO AST#member_expression#Right AST#expression#Right . updateContact AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right , AST#expression#Left contact AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 删除联系人(同时删除相关的纪念日和祝福历史)
* @param id 联系人ID
*/ AST#method_declaration#Left async deleteContact AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization 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#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 . commemorationDAO AST#member_expression#Right AST#expression#Right . deleteCommemorationsByContactId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . greetingHistoryDAO AST#member_expression#Right AST#expression#Right . deleteGreetingHistoryByContactId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 删除联系人 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . contactDAO AST#member_expression#Right AST#expression#Right . deleteContact AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 result 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#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 ` [DatabaseService] Failed to delete contact AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right : ` AST#template_literal#Right AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 // ==================== 纪念日相关操作 ==================== /**
* 获取纪念日DAO
*/ AST#method_declaration#Left get AST#ERROR#Left commemorations AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CommemorationDAO AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commemorationDAO AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 添加纪念日
* @param commemoration 纪念日实体
*/ AST#method_declaration#Left async addCommemoration AST#parameter_list#Left ( AST#parameter#Left commemoration : AST#type_annotation#Left AST#primary_type#Left CommemorationEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . commemorationDAO AST#member_expression#Right AST#expression#Right . insertCommemoration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left commemoration AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取联系人的所有纪念日
* @param contactId 联系人ID
*/ AST#method_declaration#Left async getCommemorationsByContact AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommemorationEntity [ ] 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . commemorationDAO AST#member_expression#Right AST#expression#Right . getCommemorationsByContactId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contactId 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 async getCommemorationsForReminder 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 CommemorationWithContact [ ] 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . commemorationDAO AST#member_expression#Right AST#expression#Right . getCommemorationsForReminder 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 /**
* 获取本月的纪念日
* @param month 月份
* @param year 年份(可选)
*/ AST#method_declaration#Left async getCommemorationsInMonth AST#parameter_list#Left ( AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left year ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 CommemorationEntity [ ] 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . commemorationDAO AST#member_expression#Right AST#expression#Right . getCommemorationsInMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left month AST#expression#Right , AST#expression#Left year AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // ==================== 祝福历史相关操作 ==================== /**
* 获取祝福历史DAO
*/ AST#method_declaration#Left get AST#ERROR#Left greet in gHistory AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GreetingHistoryDAO AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . greetingHistoryDAO AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 添加祝福记录
* @param greetingHistory 祝福历史实体
*/ AST#method_declaration#Left async addGreetingHistory AST#parameter_list#Left ( AST#parameter#Left greetingHistory : AST#type_annotation#Left AST#primary_type#Left GreetingHistoryEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . greetingHistoryDAO AST#member_expression#Right AST#expression#Right . insertGreetingHistory AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left greetingHistory AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取联系人的祝福历史
* @param contactId 联系人ID
*/ AST#method_declaration#Left async getGreetingHistoryByContact AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GreetingHistoryEntity [ ] 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . greetingHistoryDAO AST#member_expression#Right AST#expression#Right . getGreetingHistoryByContactId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contactId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取最近的祝福记录
* @param limit 数量限制
*/ AST#method_declaration#Left async getRecentGreetingHistory AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right AST#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 GreetingHistoryWithContact [ ] 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . greetingHistoryDAO AST#member_expression#Right AST#expression#Right . getGreetingHistoryWithContactInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left limit AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 记录发送的祝福语
* @param contactId 联系人ID
* @param greetingContent 祝福内容
* @param occasion 场合
*/ AST#method_declaration#Left async recordSentGreeting AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left greetingContent : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left occasion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left greetingHistory : AST#type_annotation#Left AST#primary_type#Left GreetingHistoryEntity AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contact_id AST#property_name#Right : AST#expression#Left contactId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left greeting_content AST#property_name#Right : AST#expression#Left greetingContent AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left occasion AST#property_name#Right : AST#expression#Left occasion AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sent_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . greetingHistoryDAO AST#member_expression#Right AST#expression#Right . insertGreetingHistory AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left greetingHistory 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 async getDatabaseStatistics 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 DatabaseStatisticsResult 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left stats = 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 . dbManager AST#member_expression#Right AST#expression#Right . getDatabaseStats 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 result : AST#type_annotation#Left AST#primary_type#Left DatabaseStatisticsResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contactCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left stats AST#expression#Right . contactCount AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commemorationCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left stats AST#expression#Right . commemorationCount AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left greetingCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left stats AST#expression#Right . greetingCount AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stats AST#expression#Right . contactCount AST#member_expression#Right AST#expression#Right + AST#expression#Left stats AST#expression#Right AST#binary_expression#Right AST#expression#Right . commemorationCount AST#member_expression#Right AST#expression#Right + AST#expression#Left stats AST#expression#Right AST#binary_expression#Right AST#expression#Right . greetingCount 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#return_statement#Left return AST#expression#Left result 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 err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Failed to get statistics:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultResult : AST#type_annotation#Left AST#primary_type#Left DatabaseStatisticsResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contactCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commemorationCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left greetingCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left defaultResult 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#method_declaration#Left async getGreetingStatistics 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#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 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#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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 . greetingHistoryDAO AST#member_expression#Right AST#expression#Right . getGreetingStatsByOccasion 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 // ==================== 数据管理相关操作 ==================== /**
* 清空所有数据
*/ AST#method_declaration#Left async clearAllData 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbManager AST#member_expression#Right AST#expression#Right . clearAllData 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] All data cleared' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 重建数据库(生产环境不插入示例数据)
*/ AST#method_declaration#Left async rebuildDatabase 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialization AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbManager AST#member_expression#Right AST#expression#Right . rebuildDatabase 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 // 生产环境:不重新插入示例数据 // await this.insertSampleDataIfEmpty(); AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Database rebuilt (production mode - no sample data)' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 关闭数据库连接
*/ AST#method_declaration#Left async closeDatabase 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#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbManager AST#member_expression#Right AST#expression#Right . closeDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Database service closed' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right // ==================== 私有方法 ==================== /**
* 检查数据库是否已初始化
*/ AST#method_declaration#Left private checkInitialization AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Database service not initialized. Call initializeDatabase() first.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 如果数据库为空,插入一些示例数据
*/ AST#method_declaration#Left private async insertSampleDataIfEmpty AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left contactCount = 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 . contactDAO AST#member_expression#Right AST#expression#Right . getContactCount 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 contactCount 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Inserting sample data...' AST#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 sampleContacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContactEntity [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '张小红' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '家人' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1995-03-15' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday 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 lunar_birthday_month AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '女' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '喜欢看电影和阅读' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138001' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'xiaohong@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '北京市朝阳区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '妹妹,性格开朗,公历3月15日生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '李大明' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '朋友' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1992-07-22' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday 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 lunar_birthday_month AST#property_name#Right : AST#expression#Left 7 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 22 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '男' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '热爱运动和旅行' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138002' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'daming@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '上海市浦东新区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '大学同学,现在上海工作,公历7月22日生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '王美丽' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '同事' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1988-11-08' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday 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 lunar_birthday_month AST#property_name#Right : AST#expression#Left 11 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '女' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '音乐和绘画' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138003' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'meili@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '广州市天河区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '部门经理,艺术爱好者,公历11月8日生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '陈小华' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '家人' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1990-12-25' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday 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 lunar_birthday_month AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 25 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '男' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '烹饪和科技' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138004' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'xiaohua@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '深圳市南山区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '表哥,程序员,公历12月25日生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '刘晓芳' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '朋友' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1996-06-18' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday 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 lunar_birthday_month AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 18 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '女' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '瑜伽和摄影' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138005' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'xiaofang@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '成都市锦江区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '闺蜜,瑜伽教练,公历6月18日生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '赵志强' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '朋友' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1985-09-30' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday 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 lunar_birthday_month AST#property_name#Right : AST#expression#Left 9 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '男' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '读书和投资' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138006' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'zhiqiang@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '杭州市西湖区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '创业朋友,投资顾问,公历9月30日生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , // 以下是农历生日的联系人 AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '吴奶奶' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '家人' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1950-01-01' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_month AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '女' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '太极和广场舞' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138007' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '天津市和平区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '奶奶,农历八月十五中秋节生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '刘老爷' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '其他' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1948-01-01' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_month AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '男' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '书法和太极' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138008' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '西安市雁塔区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '邻居爷爷,农历正月初一春节生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '陈小玲' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '朋友' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1993-01-01' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_month AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '女' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '中医和养生' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138009' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'xiaoling@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '南京市鼓楼区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '中医理疗师,农历三月初三生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '张大山' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left '同事' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left '1987-01-01' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar_birthday AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_month AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunar_birthday_day AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left '男' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left '登山和摄影' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left phone AST#property_name#Right : AST#expression#Left '13800138010' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'dashan@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left '重庆市渝中区' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '摄影师,农历五月初五端午节生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#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 const AST#variable_declarator#Left insertedCount = 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 . contactDAO AST#member_expression#Right AST#expression#Right . batchInsertContacts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sampleContacts AST#expression#Right ) AST#argument_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 AST#template_literal#Left ` [DatabaseService] AST#template_substitution#Left $ { AST#expression#Left insertedCount AST#expression#Right } AST#template_substitution#Right contacts inserted 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#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 . insertSampleCommemorations 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 // 暂时跳过祝福历史记录插入,因为表结构不匹配 // await this.insertSampleGreetingHistory(); AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] All sample data inserted successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Failed to insert sample data:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 插入示例纪念日数据
*/ AST#method_declaration#Left private async insertSampleCommemorations AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sampleCommemorations : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommemorationEntity [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contact_id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 张小红 AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commemoration_date AST#property_name#Right : AST#expression#Left '1995-03-15' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar 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 reminder_enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reminder_days_advance AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '妹妹的生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contact_id AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , // 李大明 AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commemoration_date AST#property_name#Right : AST#expression#Left '1992-07-22' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar 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 reminder_enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reminder_days_advance AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '大学同学的生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contact_id AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , // 王美丽 AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commemoration_date AST#property_name#Right : AST#expression#Left '1988-11-08' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar 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 reminder_enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reminder_days_advance AST#property_name#Right : AST#expression#Left 7 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '同事的生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contact_id AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , // 陈小华 AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commemoration_date AST#property_name#Right : AST#expression#Left '1990-12-25' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar 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 reminder_enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reminder_days_advance AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '哥哥的生日,圣诞节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contact_id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 张小红 AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '毕业纪念日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commemoration_date AST#property_name#Right : AST#expression#Left '2017-06-15' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left '纪念日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar 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 reminder_enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reminder_days_advance AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '大学毕业纪念日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contact_id AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , // 刘晓芳 AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commemoration_date AST#property_name#Right : AST#expression#Left '1996-06-18' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left is_lunar 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 reminder_enabled AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reminder_days_advance AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '高中同学的生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updated_at AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#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#for_statement#Left for ( const commemoration of AST#expression#Left sampleCommemorations AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . commemorationDAO AST#member_expression#Right AST#expression#Right . insertCommemoration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left commemoration AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Sample commemorations inserted successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Failed to insert sample commemorations:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 插入示例祝福历史数据
*/ AST#method_declaration#Left private async insertSampleGreetingHistory AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sampleGreetings : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GreetingHistoryEntity [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left contact_id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left greeting_content AST#property_name#Right : AST#expression#Left '亲爱的妹妹,生日快乐!愿你永远年轻美丽,工作顺利,身体健康!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left occasion AST#property_name#Right : AST#expression#Left '生日祝福' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sent_at AST#property_name#Right : AST#expression#Left '2024-03-15T09:00:00.000Z' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left '2024-03-15T09:00:00.000Z' 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 contact_id AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left greeting_content AST#property_name#Right : AST#expression#Left '大明,生日快乐!希望你在新的一岁里事业蝤蝤日上,身体健康!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left occasion AST#property_name#Right : AST#expression#Left '生日祝福' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sent_at AST#property_name#Right : AST#expression#Left '2024-07-22T10:30:00.000Z' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left '2024-07-22T10:30:00.000Z' 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 contact_id AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left greeting_content AST#property_name#Right : AST#expression#Left '美丽,生日快乐!谢谢你在工作中的帮助和支持,愿你天天开心!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left occasion AST#property_name#Right : AST#expression#Left '生日祝福' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sent_at AST#property_name#Right : AST#expression#Left '2024-11-08T14:20:00.000Z' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left '2024-11-08T14:20:00.000Z' 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 contact_id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left greeting_content AST#property_name#Right : AST#expression#Left '新年快乐!愿妹妹在新的一年里工作顺利,生活幸福!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left occasion AST#property_name#Right : AST#expression#Left '新年祝福' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sent_at AST#property_name#Right : AST#expression#Left '2024-02-10T08:00:00.000Z' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left '2024-02-10T08:00:00.000Z' 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 contact_id AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left greeting_content AST#property_name#Right : AST#expression#Left '晓芳,生日快乐!希望你在杭州一切都好,有时间回来聚聚!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left occasion AST#property_name#Right : AST#expression#Left '生日祝福' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sent_at AST#property_name#Right : AST#expression#Left '2024-06-18T11:15:00.000Z' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left created_at AST#property_name#Right : AST#expression#Left '2024-06-18T11:15:00.000Z' 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#for_statement#Left for ( const greeting of AST#expression#Left sampleGreetings AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . greetingHistoryDAO AST#member_expression#Right AST#expression#Right . insertGreetingHistory 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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Sample greeting history inserted successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseService] Failed to insert sample greeting history:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DatabaseService {
private static instance: DatabaseService;
private dbManager: DatabaseManager;
private contactDAO: ContactDAO;
private commemorationDAO: CommemorationDAO;
private greetingHistoryDAO: GreetingHistoryDAO;
private isInitialized: boolean = false;
private constructor() {
this.dbManager = DatabaseManager.getInstance();
this.contactDAO = new ContactDAO();
this.commemorationDAO = new CommemorationDAO();
this.greetingHistoryDAO = new GreetingHistoryDAO();
}
static getInstance(): DatabaseService {
if (!DatabaseService.instance) {
DatabaseService.instance = new DatabaseService();
}
return DatabaseService.instance;
}
async initializeDatabase(context: Context): Promise<void> {
if (this.isInitialized) {
console.info('[DatabaseService] Database already initialized');
return;
}
try {
await this.dbManager.initDatabase(context);
this.isInitialized = true;
console.info('[DatabaseService] Database service initialized successfully');
} catch (error) {
const err = error as Error;
console.error('[DatabaseService] Failed to initialize database service:', err.message);
throw new Error(`Failed to initialize database service: ${err.message}`);
}
}
isDbInitialized(): boolean {
return this.isInitialized;
}
get contacts(): ContactDAO {
this.checkInitialization();
return this.contactDAO;
}
async addContact(contact: ContactEntity): Promise<number> {
this.checkInitialization();
return await this.contactDAO.insertContact(contact);
}
async getAllContacts(): Promise<ContactEntity[]> {
this.checkInitialization();
return await this.contactDAO.getAllContacts();
}
async getContactById(id: number): Promise<ContactEntity | null> {
this.checkInitialization();
return await this.contactDAO.getContactById(id);
}
async searchContacts(keyword: string): Promise<ContactEntity[]> {
this.checkInitialization();
return await this.contactDAO.searchContacts(keyword);
}
async updateContact(id: number, contact: Partial<ContactEntity>): Promise<number> {
this.checkInitialization();
return await this.contactDAO.updateContact(id, contact);
}
async deleteContact(id: number): Promise<boolean> {
this.checkInitialization();
try {
await this.commemorationDAO.deleteCommemorationsByContactId(id);
await this.greetingHistoryDAO.deleteGreetingHistoryByContactId(id);
const result = await this.contactDAO.deleteContact(id);
return result > 0;
} catch (error) {
console.error(`[DatabaseService] Failed to delete contact ${id}:`, error);
return false;
}
}
get commemorations(): CommemorationDAO {
this.checkInitialization();
return this.commemorationDAO;
}
async addCommemoration(commemoration: CommemorationEntity): Promise<number> {
this.checkInitialization();
return await this.commemorationDAO.insertCommemoration(commemoration);
}
async getCommemorationsByContact(contactId: number): Promise<CommemorationEntity[]> {
this.checkInitialization();
return await this.commemorationDAO.getCommemorationsByContactId(contactId);
}
async getCommemorationsForReminder(): Promise<CommemorationWithContact[]> {
this.checkInitialization();
return await this.commemorationDAO.getCommemorationsForReminder();
}
async getCommemorationsInMonth(month: number, year?: number): Promise<CommemorationEntity[]> {
this.checkInitialization();
return await this.commemorationDAO.getCommemorationsInMonth(month, year);
}
get greetingHistory(): GreetingHistoryDAO {
this.checkInitialization();
return this.greetingHistoryDAO;
}
async addGreetingHistory(greetingHistory: GreetingHistoryEntity): Promise<number> {
this.checkInitialization();
return await this.greetingHistoryDAO.insertGreetingHistory(greetingHistory);
}
async getGreetingHistoryByContact(contactId: number): Promise<GreetingHistoryEntity[]> {
this.checkInitialization();
return await this.greetingHistoryDAO.getGreetingHistoryByContactId(contactId);
}
async getRecentGreetingHistory(limit: number = 10): Promise<GreetingHistoryWithContact[]> {
this.checkInitialization();
return await this.greetingHistoryDAO.getGreetingHistoryWithContactInfo(limit);
}
async recordSentGreeting(contactId: number, greetingContent: string, occasion: string): Promise<number> {
this.checkInitialization();
const greetingHistory: GreetingHistoryEntity = {
contact_id: contactId,
greeting_content: greetingContent,
occasion: occasion,
sent_at: new Date().toISOString(),
created_at: new Date().toISOString()
};
return await this.greetingHistoryDAO.insertGreetingHistory(greetingHistory);
}
async getDatabaseStatistics(): Promise<DatabaseStatisticsResult> {
this.checkInitialization();
try {
const stats = await this.dbManager.getDatabaseStats();
const result: DatabaseStatisticsResult = {
contactCount: stats.contactCount,
commemorationCount: stats.commemorationCount,
greetingCount: stats.greetingCount,
totalRecords: stats.contactCount + stats.commemorationCount + stats.greetingCount
};
return result;
} catch (error) {
const err = error as Error;
console.error('[DatabaseService] Failed to get statistics:', err.message);
const defaultResult: DatabaseStatisticsResult = { contactCount: 0, commemorationCount: 0, greetingCount: 0, totalRecords: 0 };
return defaultResult;
}
}
async getGreetingStatistics(): Promise<Map<string, number>> {
this.checkInitialization();
return await this.greetingHistoryDAO.getGreetingStatsByOccasion();
}
async clearAllData(): Promise<void> {
this.checkInitialization();
await this.dbManager.clearAllData();
console.info('[DatabaseService] All data cleared');
}
async rebuildDatabase(): Promise<void> {
this.checkInitialization();
await this.dbManager.rebuildDatabase();
console.info('[DatabaseService] Database rebuilt (production mode - no sample data)');
}
async closeDatabase(): Promise<void> {
if (this.isInitialized) {
await this.dbManager.closeDatabase();
this.isInitialized = false;
console.info('[DatabaseService] Database service closed');
}
}
private checkInitialization(): void {
if (!this.isInitialized) {
throw new Error('Database service not initialized. Call initializeDatabase() first.');
}
}
private async insertSampleDataIfEmpty(): Promise<void> {
try {
const contactCount = await this.contactDAO.getContactCount();
if (contactCount === 0) {
console.info('[DatabaseService] Inserting sample data...');
const sampleContacts: ContactEntity[] = [
{
name: '张小红',
relation: '家人',
birthday: '1995-03-15',
is_lunar_birthday: false,
lunar_birthday_month: 3,
lunar_birthday_day: 15,
gender: '女',
preferences: '喜欢看电影和阅读',
phone: '13800138001',
email: 'xiaohong@example.com',
address: '北京市朝阳区',
notes: '妹妹,性格开朗,公历3月15日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '李大明',
relation: '朋友',
birthday: '1992-07-22',
is_lunar_birthday: false,
lunar_birthday_month: 7,
lunar_birthday_day: 22,
gender: '男',
preferences: '热爱运动和旅行',
phone: '13800138002',
email: 'daming@example.com',
address: '上海市浦东新区',
notes: '大学同学,现在上海工作,公历7月22日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '王美丽',
relation: '同事',
birthday: '1988-11-08',
is_lunar_birthday: false,
lunar_birthday_month: 11,
lunar_birthday_day: 8,
gender: '女',
preferences: '音乐和绘画',
phone: '13800138003',
email: 'meili@example.com',
address: '广州市天河区',
notes: '部门经理,艺术爱好者,公历11月8日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '陈小华',
relation: '家人',
birthday: '1990-12-25',
is_lunar_birthday: false,
lunar_birthday_month: 12,
lunar_birthday_day: 25,
gender: '男',
preferences: '烹饪和科技',
phone: '13800138004',
email: 'xiaohua@example.com',
address: '深圳市南山区',
notes: '表哥,程序员,公历12月25日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '刘晓芳',
relation: '朋友',
birthday: '1996-06-18',
is_lunar_birthday: false,
lunar_birthday_month: 6,
lunar_birthday_day: 18,
gender: '女',
preferences: '瑜伽和摄影',
phone: '13800138005',
email: 'xiaofang@example.com',
address: '成都市锦江区',
notes: '闺蜜,瑜伽教练,公历6月18日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '赵志强',
relation: '朋友',
birthday: '1985-09-30',
is_lunar_birthday: false,
lunar_birthday_month: 9,
lunar_birthday_day: 30,
gender: '男',
preferences: '读书和投资',
phone: '13800138006',
email: 'zhiqiang@example.com',
address: '杭州市西湖区',
notes: '创业朋友,投资顾问,公历9月30日生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '吴奶奶',
relation: '家人',
birthday: '1950-01-01',
is_lunar_birthday: true,
lunar_birthday_month: 8,
lunar_birthday_day: 15,
gender: '女',
preferences: '太极和广场舞',
phone: '13800138007',
email: '',
address: '天津市和平区',
notes: '奶奶,农历八月十五中秋节生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '刘老爷',
relation: '其他',
birthday: '1948-01-01',
is_lunar_birthday: true,
lunar_birthday_month: 1,
lunar_birthday_day: 1,
gender: '男',
preferences: '书法和太极',
phone: '13800138008',
email: '',
address: '西安市雁塔区',
notes: '邻居爷爷,农历正月初一春节生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '陈小玲',
relation: '朋友',
birthday: '1993-01-01',
is_lunar_birthday: true,
lunar_birthday_month: 3,
lunar_birthday_day: 3,
gender: '女',
preferences: '中医和养生',
phone: '13800138009',
email: 'xiaoling@example.com',
address: '南京市鼓楼区',
notes: '中医理疗师,农历三月初三生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
name: '张大山',
relation: '同事',
birthday: '1987-01-01',
is_lunar_birthday: true,
lunar_birthday_month: 5,
lunar_birthday_day: 5,
gender: '男',
preferences: '登山和摄影',
phone: '13800138010',
email: 'dashan@example.com',
address: '重庆市渝中区',
notes: '摄影师,农历五月初五端午节生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
}
];
const insertedCount = await this.contactDAO.batchInsertContacts(sampleContacts);
console.info(`[DatabaseService] ${insertedCount} contacts inserted successfully`);
await this.insertSampleCommemorations();
console.info('[DatabaseService] All sample data inserted successfully');
}
} catch (error) {
const err = error as Error;
console.warn('[DatabaseService] Failed to insert sample data:', err.message);
}
}
private async insertSampleCommemorations(): Promise<void> {
try {
const sampleCommemorations: CommemorationEntity[] = [
{
contact_id: 1,
title: '生日',
commemoration_date: '1995-03-15',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 3,
notes: '妹妹的生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 2,
title: '生日',
commemoration_date: '1992-07-22',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 1,
notes: '大学同学的生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 3,
title: '生日',
commemoration_date: '1988-11-08',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 7,
notes: '同事的生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 4,
title: '生日',
commemoration_date: '1990-12-25',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 3,
notes: '哥哥的生日,圣诞节',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 1,
title: '毕业纪念日',
commemoration_date: '2017-06-15',
type: '纪念日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 1,
notes: '大学毕业纪念日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
},
{
contact_id: 5,
title: '生日',
commemoration_date: '1996-06-18',
type: '生日',
is_lunar: false,
reminder_enabled: true,
reminder_days_advance: 3,
notes: '高中同学的生日',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
}
];
for (const commemoration of sampleCommemorations) {
await this.commemorationDAO.insertCommemoration(commemoration);
}
console.info('[DatabaseService] Sample commemorations inserted successfully');
} catch (error) {
const err = error as Error;
console.warn('[DatabaseService] Failed to insert sample commemorations:', err.message);
}
}
private async insertSampleGreetingHistory(): Promise<void> {
try {
const sampleGreetings: GreetingHistoryEntity[] = [
{
contact_id: 1,
greeting_content: '亲爱的妹妹,生日快乐!愿你永远年轻美丽,工作顺利,身体健康!',
occasion: '生日祝福',
sent_at: '2024-03-15T09:00:00.000Z',
created_at: '2024-03-15T09:00:00.000Z'
},
{
contact_id: 2,
greeting_content: '大明,生日快乐!希望你在新的一岁里事业蝤蝤日上,身体健康!',
occasion: '生日祝福',
sent_at: '2024-07-22T10:30:00.000Z',
created_at: '2024-07-22T10:30:00.000Z'
},
{
contact_id: 3,
greeting_content: '美丽,生日快乐!谢谢你在工作中的帮助和支持,愿你天天开心!',
occasion: '生日祝福',
sent_at: '2024-11-08T14:20:00.000Z',
created_at: '2024-11-08T14:20:00.000Z'
},
{
contact_id: 1,
greeting_content: '新年快乐!愿妹妹在新的一年里工作顺利,生活幸福!',
occasion: '新年祝福',
sent_at: '2024-02-10T08:00:00.000Z',
created_at: '2024-02-10T08:00:00.000Z'
},
{
contact_id: 5,
greeting_content: '晓芳,生日快乐!希望你在杭州一切都好,有时间回来聚聚!',
occasion: '生日祝福',
sent_at: '2024-06-18T11:15:00.000Z',
created_at: '2024-06-18T11:15:00.000Z'
}
];
for (const greeting of sampleGreetings) {
await this.greetingHistoryDAO.insertGreetingHistory(greeting);
}
console.info('[DatabaseService] Sample greeting history inserted successfully');
} catch (error) {
const err = error as Error;
console.warn('[DatabaseService] Failed to insert sample greeting history:', err.message);
}
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L21-L668
|
9605d1fa4a7a808490050c42f252cd1e84a6b24e
|
github
|
|
Delsin-Yu/JustPDF.git
|
d53f566e02820dac46e1752151750144acbed50a
|
entry/src/main/ets/components/PageInfo.ets
|
arkts
|
evictViewerCache
|
Evicts all viewer caches, releasing PixelMaps and cancelling pending tasks.
Used to free memory for pages that are far from the current view.
|
public evictViewerCache(): void {
// Release all cached PixelMaps
for (const cache of this.caches.values()) {
try {
cache.pixelMap.release();
} catch (error) {
hilog.warn(0, 'PDFView', `释放 PixelMap 时出错: ${error}`);
}
}
this.caches.clear();
// Cancel pending cache tasks
this.cancelPendingTasks();
hilog.warn(0, 'PDFView', `页面 ${this.localPageIndex} 查看器缓存已清除`);
}
|
AST#method_declaration#Left public evictViewerCache AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // Release all cached PixelMaps AST#statement#Left AST#for_statement#Left for ( const cache of 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 . caches AST#member_expression#Right AST#expression#Right . values 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#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 cache AST#expression#Right . pixelMap 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 ; 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 . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 'PDFView' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 释放 PixelMap 时出错: 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#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . caches AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Cancel pending cache tasks 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 . cancelPendingTasks 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 hilog AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 'PDFView' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 页面 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . localPageIndex AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 查看器缓存已清除 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public evictViewerCache(): void {
for (const cache of this.caches.values()) {
try {
cache.pixelMap.release();
} catch (error) {
hilog.warn(0, 'PDFView', `释放 PixelMap 时出错: ${error}`);
}
}
this.caches.clear();
this.cancelPendingTasks();
hilog.warn(0, 'PDFView', `页面 ${this.localPageIndex} 查看器缓存已清除`);
}
|
https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/PageInfo.ets#L208-L223
|
ddeb60db94f21096c7bde7875a4b85c67c72a314
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets
|
arkts
|
默认图片Referer
|
export const DEFAULT_REFER: string = 'https://gitee.com/';
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DEFAULT_REFER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'https://gitee.com/' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const DEFAULT_REFER: string = 'https://gitee.com/';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets#L20-L20
|
b0dec245fb2b03b88f2fa80834ec2e65f80d75de
|
gitee
|
|
TianQvQ/WeChat_ArkTs.git
|
077ddcdb8e8032f71f45540461fbd66f2d49c973
|
entry/src/main/ets/Toptag/StatusBarManager.ets
|
arkts
|
immerseFullScreenAsync
|
沉浸式全屏(全屏屏幕,且显示状态栏、导航栏)
异步方法:适合动态监听状态栏,导航栏并做相应调整的方式。这种方案比较麻烦,但是用户体验和性能更好。
仅在Ability使用(Ability全局,且初始化状态栏和导航栏的高度),建议在 Ability --> onWindowStageCreate 中执行
|
static async immerseFullScreenAsync(windowStage: window.WindowStage) {
let windowClass: window.Window = await windowStage.getMainWindow()
// 获取状态栏和导航栏的高度
windowClass.on("avoidAreaChange", ({ type, area }) => {
if (type == window.AvoidAreaType.TYPE_SYSTEM) {
// 将状态栏和导航栏的高度保存在AppStorage中
AppStorage.SetOrCreate<number>(STATUS_BAR_HEIGHT, area.topRect.height);
AppStorage.SetOrCreate<number>(NAV_BAR_HEIGHT, area.bottomRect.height);
}
|
AST#method_declaration#Left static async immerseFullScreenAsync AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left windowStage AST#expression#Right AST#await_expression#Right AST#expression#Right . getMainWindow 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 w AST#ERROR#Right in AST#expression#Left dowClass AST#expression#Right AST#binary_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "avoidAreaChange" AST#expression#Right AST#ERROR#Left , AST#ERROR#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left type AST#property_assignment#Right , AST#property_assignment#Left area AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right => AST#ERROR#Right { AST#property_name#Left if AST#property_name#Right ( type AST#ERROR#Right == AST#expression#Left window AST#expression#Right AST#binary_expression#Right AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_SYSTEM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { // 将状态栏和导航栏的高度保存在AppStorage中 AST#property_assignment#Left AppStorage AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right 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#argument_list#Left ( AST#expression#Left STATUS_BAR_HEIGHT AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left area AST#expression#Right . topRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#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#argument_list#Left ( AST#expression#Left NAV_BAR_HEIGHT AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left area AST#expression#Right . bottomRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async immerseFullScreenAsync(windowStage: window.WindowStage) {
let windowClass: window.Window = await windowStage.getMainWindow()
windowClass.on("avoidAreaChange", ({ type, area }) => {
if (type == window.AvoidAreaType.TYPE_SYSTEM) {
AppStorage.SetOrCreate<number>(STATUS_BAR_HEIGHT, area.topRect.height);
AppStorage.SetOrCreate<number>(NAV_BAR_HEIGHT, area.bottomRect.height);
}
|
https://github.com/TianQvQ/WeChat_ArkTs.git/blob/077ddcdb8e8032f71f45540461fbd66f2d49c973/entry/src/main/ets/Toptag/StatusBarManager.ets#L33-L41
|
6d9a44da10e1dba13b451956d71ccfe51f83452a
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_encryption_decryption/sm4_gcm_encryption_decryption_asynchronous.ets
|
arkts
|
decryptMessagePromise
|
解密消息
|
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let decryptUpdate = await decoder.update(cipherText);
// gcm模式解密doFinal时传入空,验证init时传入的tag数据,如果验证失败会抛出异常。
let decryptData = await decoder.doFinal(null);
if (decryptData == null) {
console.info('GCM decrypt success, decryptData is null');
}
return decryptUpdate;
}
|
AST#function_declaration#Left async function decryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cipherText : 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_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'SM4_128|GCM|PKCS7' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . DECRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left gcmParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decryptUpdate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . update AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cipherText AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // gcm模式解密doFinal时传入空,验证init时传入的tag数据,如果验证失败会抛出异常。 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decryptData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left decryptData AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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 'GCM decrypt success, decryptData is null' AST#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 decryptUpdate AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let decryptUpdate = await decoder.update(cipherText);
let decryptData = await decoder.doFinal(null);
if (decryptData == null) {
console.info('GCM decrypt success, decryptData is null');
}
return decryptUpdate;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_encryption_decryption/sm4_gcm_encryption_decryption_asynchronous.ets#L59-L69
|
2c8287c93aac99c90bc3d4d29f64750caa8ed16e
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/videolinkagelist/Index.ets
|
arkts
|
VideoLinkageListView
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export { VideoLinkageListView } from './src/main/ets/pages/VideoLinkageList'
|
AST#export_declaration#Left export { VideoLinkageListView } from './src/main/ets/pages/VideoLinkageList' AST#export_declaration#Right
|
export { VideoLinkageListView } from './src/main/ets/pages/VideoLinkageList'
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/Index.ets#L15-L15
|
c50d0994b6c083efcc75d3bec21c340a247d07d5
|
gitee
|
Rayawa/dashboard.git
|
9107efe7fb69a58d799a378b79ea8ffa4041cec8
|
entry/src/main/ets/component/index/AppsTableComponent.ets
|
arkts
|
AppsTableComponent
|
AppsTableComponent.ets
|
@Component
export struct AppsTableComponent {
currentPage: number = 1;
searchKeyword: string = "";
searchKey: string = "name";
excludeHuawei: boolean = false;
excludeAtomic: boolean = false;
searchExact: boolean = false;
@State appList: Array<AppItem> = [];
@State isLoading: boolean = true;
build() {
Column() {
// 标题和搜索区域
Column() {
Row() {
Text("应用列表 (施工中, 功能可能出现 bug)")
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor("#92400e")
}
.width("100%")
.margin({ bottom: 16 })
// 搜索行
Row() {
TextInput({ placeholder: "搜索应用" })
.width("60%")
.height(40)
.padding(8)
.backgroundColor("#fef3c7")
.border({ width: 1, color: "#fbbf24" })
.borderRadius(12)
.margin({ right: 8 })
// Picker({ range: ['应用名称', '包名', '应用描述', '应用 ID', '开发者名称', '开发者英文名称', '供应商', '类型名', '标签名', '应用分类', '最小api', '目标api'] })
// .width(120)
// .height(40)
// .margin({ right: 8 })
Button("搜索", { type: ButtonType.Normal })
.backgroundColor("#f59e0b")
.fontColor(Color.White)
.borderRadius(12)
.padding(8)
}
.width("100%")
.margin({ bottom: 8 })
// 操作按钮行
Row() {
Button("清除搜索", { type: ButtonType.Normal })
.backgroundColor("#6b7280")
.fontColor(Color.White)
.borderRadius(12)
.padding(8)
.margin({ right: 8 })
Button("搜索功能帮助", { type: ButtonType.Normal })
.backgroundColor("#f59e0b")
.fontColor(Color.White)
.borderRadius(12)
.padding(8)
.margin({ right: 8 })
Toggle({ type: ToggleType.Checkbox, isOn: false })
.margin({ right: 4 })
Text("忽略华为")
.fontSize(14)
.fontColor("#92400e")
.margin({ right: 16 })
Toggle({ type: ToggleType.Checkbox, isOn: false })
.margin({ right: 4 })
Text("忽略元服务")
.fontSize(14)
.fontColor("#92400e")
.margin({ right: 16 })
Toggle({ type: ToggleType.Checkbox, isOn: false })
.margin({ right: 4 })
Text("精确匹配")
.fontSize(14)
.fontColor("#92400e")
}.width("100%")
}
.width("100%")
.padding(24)
.backgroundColor("#fef3c7")
.borderRadius(16)
.margin({ bottom: 16 })
// 表格区域
if (this.isLoading) {
Column() {
LoadingProgress()
.width(50)
.height(50)
.color("#f59e0b")
}
.width("100%")
.height(200)
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center);
} else {
List() {
ForEach(this.appList, (item: AppItem) => {
ListItem() {
AppTableRow({ appData: item })
};
})
}
.width("100%")
.layoutWeight(1);
}
// 分页组件
PaginationComponent()
}
.width("100%")
.padding(24)
.backgroundColor("#fef3c7")
.borderRadius(16)
.shadow({ radius: 8, color: "#000000", offsetX: 2, offsetY: 2 });
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AppsTableComponent AST#component_body#Left { AST#property_declaration#Left currentPage : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left searchKeyword : 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 searchKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "name" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left excludeHuawei : 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 excludeAtomic : 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 searchExact : 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 @ State AST#decorator#Right appList : 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 AppItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isLoading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 标题和搜索区域 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "应用列表 (施工中, 功能可能出现 bug)" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left "#92400e" 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left "搜索应用" AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "60%" AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left "#fef3c7" AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left "#fbbf24" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 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 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 // Picker({ range: ['应用名称', '包名', '应用描述', '应用 ID', '开发者名称', '开发者英文名称', '供应商', '类型名', '标签名', '应用分类', '最小api', '目标api'] }) // .width(120) // .height(40) // .margin({ right: 8 }) AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#ERROR#Left AST#expression#Left "搜索" AST#expression#Right , AST#ERROR#Right AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left "#f59e0b" AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 操作按钮行 AST#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#ERROR#Left AST#expression#Left "清除搜索" AST#expression#Right , AST#ERROR#Right AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left "#6b7280" AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 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 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#ERROR#Left AST#expression#Left "搜索功能帮助" AST#expression#Right , AST#ERROR#Right AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left "#f59e0b" AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 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 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 Toggle ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Checkbox AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 "#92400e" 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 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 Toggle ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Checkbox AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 "#92400e" 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 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 Toggle ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Checkbox AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 "#92400e" 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#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 24 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left "#fef3c7" AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 . isLoading AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left "#f59e0b" 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 200 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 AST#ERROR#Left ; AST#ERROR#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 . appList 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 AppItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppTableRow ( AST#component_parameters#Left { AST#component_parameter#Left appData : 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#ERROR#Left ; AST#ERROR#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 分页组件 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left PaginationComponent ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left "#fef3c7" AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left "#000000" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct AppsTableComponent {
currentPage: number = 1;
searchKeyword: string = "";
searchKey: string = "name";
excludeHuawei: boolean = false;
excludeAtomic: boolean = false;
searchExact: boolean = false;
@State appList: Array<AppItem> = [];
@State isLoading: boolean = true;
build() {
Column() {
Column() {
Row() {
Text("应用列表 (施工中, 功能可能出现 bug)")
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor("#92400e")
}
.width("100%")
.margin({ bottom: 16 })
Row() {
TextInput({ placeholder: "搜索应用" })
.width("60%")
.height(40)
.padding(8)
.backgroundColor("#fef3c7")
.border({ width: 1, color: "#fbbf24" })
.borderRadius(12)
.margin({ right: 8 })
Button("搜索", { type: ButtonType.Normal })
.backgroundColor("#f59e0b")
.fontColor(Color.White)
.borderRadius(12)
.padding(8)
}
.width("100%")
.margin({ bottom: 8 })
Row() {
Button("清除搜索", { type: ButtonType.Normal })
.backgroundColor("#6b7280")
.fontColor(Color.White)
.borderRadius(12)
.padding(8)
.margin({ right: 8 })
Button("搜索功能帮助", { type: ButtonType.Normal })
.backgroundColor("#f59e0b")
.fontColor(Color.White)
.borderRadius(12)
.padding(8)
.margin({ right: 8 })
Toggle({ type: ToggleType.Checkbox, isOn: false })
.margin({ right: 4 })
Text("忽略华为")
.fontSize(14)
.fontColor("#92400e")
.margin({ right: 16 })
Toggle({ type: ToggleType.Checkbox, isOn: false })
.margin({ right: 4 })
Text("忽略元服务")
.fontSize(14)
.fontColor("#92400e")
.margin({ right: 16 })
Toggle({ type: ToggleType.Checkbox, isOn: false })
.margin({ right: 4 })
Text("精确匹配")
.fontSize(14)
.fontColor("#92400e")
}.width("100%")
}
.width("100%")
.padding(24)
.backgroundColor("#fef3c7")
.borderRadius(16)
.margin({ bottom: 16 })
if (this.isLoading) {
Column() {
LoadingProgress()
.width(50)
.height(50)
.color("#f59e0b")
}
.width("100%")
.height(200)
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center);
} else {
List() {
ForEach(this.appList, (item: AppItem) => {
ListItem() {
AppTableRow({ appData: item })
};
})
}
.width("100%")
.layoutWeight(1);
}
PaginationComponent()
}
.width("100%")
.padding(24)
.backgroundColor("#fef3c7")
.borderRadius(16)
.shadow({ radius: 8, color: "#000000", offsetX: 2, offsetY: 2 });
}
}
|
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/component/index/AppsTableComponent.ets#L2-L124
|
3247c25de4ba0b18cbdd46b749f82fd2380299a8
|
github
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets
|
arkts
|
confirm
|
确认按钮
@param confirm
@returns
|
confirm(confirm: ButtonOptions) {
this.builderOptions.confirm = confirm
return this;
}
|
AST#method_declaration#Left confirm AST#parameter_list#Left ( AST#parameter#Left confirm : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . confirm AST#member_expression#Right = AST#expression#Left confirm AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
confirm(confirm: ButtonOptions) {
this.builderOptions.confirm = confirm
return this;
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets#L46-L49
|
0dbeef88f298ac80c0aa3c300ea73d9fd1d71de0
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/NumberMenu.ets
|
arkts
|
NumberMenu
|
数字键盘
|
@Component
export struct NumberMenu {
@StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle();
@Consume menuType: number;
private numberList: sourceListType[] = numberSourceListData;
private spaceWidth: Resource = this.inputStyle.spaceButtonWidth_2;
private returnWidth: Resource = this.inputStyle.returnButtonWidthType_2;
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
ForEach(this.numberList.slice(0, 10), (item: sourceListType) => {
KeyItem({ keyValue: { content: item.content, title: item.content, upperContent: item.content } })
}, (item: sourceListType) => item.content)
}
.width('100%')
.height(this.inputStyle.basicButtonHeight)
.margin({ top: this.inputStyle.paddingTop })
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
ForEach(this.numberList.slice(10, 20), (item: sourceListType) => {
KeyItem({ keyValue: { content: item.content, title: item.content, upperContent: item.content } })
}, (item: sourceListType) => item.content)
}
.width('100%')
.height(this.inputStyle.basicButtonHeight)
.margin({ top: this.inputStyle.paddingTop })
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
KeyItemGray({ keyValue: MenuKey.SPECIAL_KEY })
ForEach(this.numberList.slice(20), (item: sourceListType) => {
KeyItem({ keyValue: { content: item.content, title: item.content, upperContent: item.content } })
}, (item: sourceListType) => item.content)
DeleteItem()
}
.width('100%')
.height(this.inputStyle.basicButtonHeight)
.margin({ top: this.inputStyle.paddingTop })
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
KeyItemGray({ keyValue: MenuKey.NORMAL_KEY })
KeyItem({ keyValue: { content: '_', title: '_', upperContent: '_' } })
KeyItem({ keyValue: { content: ',', title: ',', upperContent: ',' } })
SpaceItem({ spaceWith: this.spaceWidth })
KeyItem({ keyValue: { content: '.', title: '.', upperContent: '.' } })
ReturnItem({ returnWidth: this.returnWidth })
}
.width('100%')
.height(this.inputStyle.basicButtonHeight)
.margin({ top: this.inputStyle.paddingTop })
}
.padding({
left: this.inputStyle.paddingLeftRight,
right: this.inputStyle.paddingLeftRight
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NumberMenu AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Left AST#primary_type#Left KeyStyle 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 StyleConfiguration AST#expression#Right . getSavedInputStyle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right menuType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private numberList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left sourceListType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left numberSourceListData AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private spaceWidth : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . spaceButtonWidth_2 AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private returnWidth : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . returnButtonWidthType_2 AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . numberList AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left sourceListType 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 KeyItem ( AST#component_parameters#Left { AST#component_parameter#Left keyValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left upperContent AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 sourceListType 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 . content AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . basicButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . paddingTop 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . numberList AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 10 AST#expression#Right , AST#expression#Left 20 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left sourceListType 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 KeyItem ( AST#component_parameters#Left { AST#component_parameter#Left keyValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left upperContent AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 sourceListType 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 . content AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . basicButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . paddingTop 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left KeyItemGray ( AST#component_parameters#Left { AST#component_parameter#Left keyValue : AST#expression#Left AST#member_expression#Left AST#expression#Left MenuKey AST#expression#Right . SPECIAL_KEY AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . numberList AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 20 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left sourceListType 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 KeyItem ( AST#component_parameters#Left { AST#component_parameter#Left keyValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left upperContent AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 sourceListType 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 . content AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left DeleteItem ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . basicButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . paddingTop 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left KeyItemGray ( AST#component_parameters#Left { AST#component_parameter#Left keyValue : AST#expression#Left AST#member_expression#Left AST#expression#Left MenuKey AST#expression#Right . NORMAL_KEY AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left KeyItem ( AST#component_parameters#Left { AST#component_parameter#Left keyValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left '_' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '_' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left upperContent 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_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left KeyItem ( AST#component_parameters#Left { AST#component_parameter#Left keyValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left ',' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left ',' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left upperContent 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_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SpaceItem ( AST#component_parameters#Left { AST#component_parameter#Left spaceWith : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spaceWidth AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left KeyItem ( AST#component_parameters#Left { AST#component_parameter#Left keyValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left '.' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '.' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left upperContent 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_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ReturnItem ( AST#component_parameters#Left { AST#component_parameter#Left returnWidth : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . returnWidth AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . basicButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . paddingTop 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 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 . inputStyle AST#member_expression#Right AST#expression#Right . paddingLeftRight 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 . inputStyle AST#member_expression#Right AST#expression#Right . paddingLeftRight AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct NumberMenu {
@StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle();
@Consume menuType: number;
private numberList: sourceListType[] = numberSourceListData;
private spaceWidth: Resource = this.inputStyle.spaceButtonWidth_2;
private returnWidth: Resource = this.inputStyle.returnButtonWidthType_2;
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
ForEach(this.numberList.slice(0, 10), (item: sourceListType) => {
KeyItem({ keyValue: { content: item.content, title: item.content, upperContent: item.content } })
}, (item: sourceListType) => item.content)
}
.width('100%')
.height(this.inputStyle.basicButtonHeight)
.margin({ top: this.inputStyle.paddingTop })
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
ForEach(this.numberList.slice(10, 20), (item: sourceListType) => {
KeyItem({ keyValue: { content: item.content, title: item.content, upperContent: item.content } })
}, (item: sourceListType) => item.content)
}
.width('100%')
.height(this.inputStyle.basicButtonHeight)
.margin({ top: this.inputStyle.paddingTop })
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
KeyItemGray({ keyValue: MenuKey.SPECIAL_KEY })
ForEach(this.numberList.slice(20), (item: sourceListType) => {
KeyItem({ keyValue: { content: item.content, title: item.content, upperContent: item.content } })
}, (item: sourceListType) => item.content)
DeleteItem()
}
.width('100%')
.height(this.inputStyle.basicButtonHeight)
.margin({ top: this.inputStyle.paddingTop })
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
KeyItemGray({ keyValue: MenuKey.NORMAL_KEY })
KeyItem({ keyValue: { content: '_', title: '_', upperContent: '_' } })
KeyItem({ keyValue: { content: ',', title: ',', upperContent: ',' } })
SpaceItem({ spaceWith: this.spaceWidth })
KeyItem({ keyValue: { content: '.', title: '.', upperContent: '.' } })
ReturnItem({ returnWidth: this.returnWidth })
}
.width('100%')
.height(this.inputStyle.basicButtonHeight)
.margin({ top: this.inputStyle.paddingTop })
}
.padding({
left: this.inputStyle.paddingLeftRight,
right: this.inputStyle.paddingLeftRight
})
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/NumberMenu.ets#L25-L82
|
e36e97b36a65858aa581c07c036769862dc2c3bc
|
gitee
|
ni202383/Chenguang-Calendar.git
|
c04543db2c394d662bc1336d098335134ff1e9a5
|
entry/src/main/ets/pages/Model/TaskStore.ets
|
arkts
|
init
|
必须在应用启动时调用一次
例如在 EntryAbility.onCreate 里:
await taskStore.init(this.context);
|
public async init(context: common.UIAbilityContext) {
this.context = context;
this.pref = await dataPreferences.getPreferences(context, TaskStore.PREF_NAME);
await this.loadFromDisk();
}
|
AST#method_declaration#Left public async init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right = AST#expression#Left context AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pref 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 dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left TaskStore AST#expression#Right . PREF_NAME AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#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 . loadFromDisk 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 async init(context: common.UIAbilityContext) {
this.context = context;
this.pref = await dataPreferences.getPreferences(context, TaskStore.PREF_NAME);
await this.loadFromDisk();
}
|
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/pages/Model/TaskStore.ets#L18-L22
|
68f0c549bbafa1f03c279ecf9393854a34085840
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/ResourceAllocation/ApplicationThemeSwitch/entry/src/main/ets/models/ThemeConst.ets
|
arkts
|
DEFAULT_COLOR 默认字体颜色 BACKGROUND_COLOR 默认背景色 TITLE_BACKGROUND title背景色 STATUS_COLOR 状态栏字体颜色 CATEGORIES_BACKGROUND_COLOR title下边的导航字体颜色 nav_* 导航图片 NAV_SELECTED_COLOR 导航选中字体颜色 MAIN_BACKGROUND_COLOR 主体背景色 自定义主题
|
export class CustomTheme {
static DEFAULT_COLOR = $r('app.color.white')
static BACKGROUND_COLOR = $r('app.color.custom_main_color')
static TITLE_BACKGROUND = $r('app.color.custom_main_color')
static STATUS_COLOR = $r('app.color.custom_status_color')
static CATEGORIES_BACKGROUND_COLOR = $r('app.color.custom_main_color')
static NAV_HOME = $r('app.media.nav_home_light')
static NAV_PRODUCT = $r('app.media.nav_product_light')
static NAV_CART = $r('app.media.nav_cart_light')
static NAV_ME = $r('app.media.nav_me_light')
static NAV_SELECTED_COLOR = $r('app.color.custom_status_color')
static MAIN_BACKGROUND_COLOR = $r('app.color.custom_background_color')
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CustomTheme AST#class_body#Left { AST#property_declaration#Left static DEFAULT_COLOR = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.white' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static BACKGROUND_COLOR = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_main_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static TITLE_BACKGROUND = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_main_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static STATUS_COLOR = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_status_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static CATEGORIES_BACKGROUND_COLOR = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_main_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static NAV_HOME = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.nav_home_light' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static NAV_PRODUCT = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.nav_product_light' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static NAV_CART = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.nav_cart_light' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static NAV_ME = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.nav_me_light' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static NAV_SELECTED_COLOR = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_status_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static MAIN_BACKGROUND_COLOR = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_background_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class CustomTheme {
static DEFAULT_COLOR = $r('app.color.white')
static BACKGROUND_COLOR = $r('app.color.custom_main_color')
static TITLE_BACKGROUND = $r('app.color.custom_main_color')
static STATUS_COLOR = $r('app.color.custom_status_color')
static CATEGORIES_BACKGROUND_COLOR = $r('app.color.custom_main_color')
static NAV_HOME = $r('app.media.nav_home_light')
static NAV_PRODUCT = $r('app.media.nav_product_light')
static NAV_CART = $r('app.media.nav_cart_light')
static NAV_ME = $r('app.media.nav_me_light')
static NAV_SELECTED_COLOR = $r('app.color.custom_status_color')
static MAIN_BACKGROUND_COLOR = $r('app.color.custom_background_color')
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ResourceAllocation/ApplicationThemeSwitch/entry/src/main/ets/models/ThemeConst.ets#L25-L37
|
eda82c499b08fe972cdde9f7634dc77148701ca8
|
gitee
|
|
IceYuanyyy/OxHornCampus.git
|
bb5686f77fa36db89687502e35898cda218d601f
|
entry/src/main/ets/pages/VerifyPage.ets
|
arkts
|
updateVerifyItem
|
更新验证码显示项
|
updateVerifyItem() {
let verifyItemNew: VerifyItem | undefined = this.verifyMap.get(this.imageId);
if (verifyItemNew !== undefined) {
this.verifyItem = verifyItemNew;
}
}
|
AST#method_declaration#Left updateVerifyItem AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left verifyItemNew : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left VerifyItem AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . verifyMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left verifyItemNew 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 . verifyItem AST#member_expression#Right = AST#expression#Left verifyItemNew AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
updateVerifyItem() {
let verifyItemNew: VerifyItem | undefined = this.verifyMap.get(this.imageId);
if (verifyItemNew !== undefined) {
this.verifyItem = verifyItemNew;
}
}
|
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/VerifyPage.ets#L57-L62
|
c5060f9b7b5511ea1099c8952359fdaacf4f7534
|
github
|
sedlei/Smart-park-system.git
|
253228f73e419e92fd83777f564889d202f7c699
|
src/main/ets/utils/MqttUtil.ets
|
arkts
|
loadConfigs
|
加载配置文件
|
private async loadConfigs(): Promise<void> {
// 读取配置文件数据
let context = getContext(this);
const mqttConfigData: Uint8Array = await context.resourceManager.getRawFileContent('MqttConfig.json');
// 数据转换为文本
const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
const mqttConfigText = decoder.decodeWithStream(mqttConfigData, { stream: false });
// 解析为 JS 对象
const config = JSON.parse(mqttConfigText) as MqttConfig;
// 制作动态userName
const timestamp = Date.now().toString();
const userName = `accessKey=${config.accessKey}|timestamp=${timestamp}|instanceId=4513b637-32f6-4159-a4d5-80ea8d7a6355`;
this.mqttConfig = {
host: config.host,
port: config.port,
clientId: config.clientId,
persistenceType: config.persistenceType,
userName: userName,
password: config.password,
connectTimeout: config.connectTimeout,
MQTTVersion: config.MQTTVersion,
accessKey: config.accessKey
};
console.log('MQTT配置:', mqttConfigText);
}
|
AST#method_declaration#Left private async loadConfigs 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#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mqttConfigData : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getRawFileContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'MqttConfig.json' AST#expression#Right ) AST#argument_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 decoder = 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#variable_declaration#Left const AST#variable_declarator#Left mqttConfigText = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decoder AST#expression#Right . decodeWithStream AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mqttConfigData AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left stream 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 解析为 JS 对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left config = 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 mqttConfigText AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left MqttConfig 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 // 制作动态userName 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 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 . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left userName = AST#expression#Left AST#template_literal#Left ` accessKey= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . accessKey AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right |timestamp= AST#template_substitution#Left $ { AST#expression#Left timestamp AST#expression#Right } AST#template_substitution#Right |instanceId=4513b637-32f6-4159-a4d5-80ea8d7a6355 ` 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mqttConfig AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left host AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . host AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left port AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . port AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left clientId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . clientId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left persistenceType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . persistenceType AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left userName AST#property_name#Right : AST#expression#Left userName AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left password AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . password AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . connectTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left MQTTVersion AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . MQTTVersion AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left accessKey AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . accessKey AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 'MQTT配置:' AST#expression#Right , AST#expression#Left mqttConfigText AST#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
|
private async loadConfigs(): Promise<void> {
let context = getContext(this);
const mqttConfigData: Uint8Array = await context.resourceManager.getRawFileContent('MqttConfig.json');
const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
const mqttConfigText = decoder.decodeWithStream(mqttConfigData, { stream: false });
const config = JSON.parse(mqttConfigText) as MqttConfig;
const timestamp = Date.now().toString();
const userName = `accessKey=${config.accessKey}|timestamp=${timestamp}|instanceId=4513b637-32f6-4159-a4d5-80ea8d7a6355`;
this.mqttConfig = {
host: config.host,
port: config.port,
clientId: config.clientId,
persistenceType: config.persistenceType,
userName: userName,
password: config.password,
connectTimeout: config.connectTimeout,
MQTTVersion: config.MQTTVersion,
accessKey: config.accessKey
};
console.log('MQTT配置:', mqttConfigText);
}
|
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/utils/MqttUtil.ets#L39-L63
|
c89ab93a2cd16d93b478757ee1e4e44cf4edb1f7
|
github
|
ChangweiZhang/chardet-arkts.git
|
3a214882ec6a2753c0fed84162952aa659341c19
|
src/main/ets/components/encoding/mbcs.ets
|
arkts
|
The charset recognize for EUC-KR. A singleton instance of this class
is created and kept by the public CharsetDetector class
|
export class euc_kr extends mbcs {
name() {
return 'EUC-KR';
}
language() {
return 'ko';
}
// TODO: This set of data comes from the character frequency-
// of-occurrence analysis tool. The data needs to be moved
// into a resource and loaded from there.
commonChars = [
0xb0a1, 0xb0b3, 0xb0c5, 0xb0cd, 0xb0d4, 0xb0e6, 0xb0ed, 0xb0f8, 0xb0fa,
0xb0fc, 0xb1b8, 0xb1b9, 0xb1c7, 0xb1d7, 0xb1e2, 0xb3aa, 0xb3bb, 0xb4c2,
0xb4cf, 0xb4d9, 0xb4eb, 0xb5a5, 0xb5b5, 0xb5bf, 0xb5c7, 0xb5e9, 0xb6f3,
0xb7af, 0xb7c2, 0xb7ce, 0xb8a6, 0xb8ae, 0xb8b6, 0xb8b8, 0xb8bb, 0xb8e9,
0xb9ab, 0xb9ae, 0xb9cc, 0xb9ce, 0xb9fd, 0xbab8, 0xbace, 0xbad0, 0xbaf1,
0xbbe7, 0xbbf3, 0xbbfd, 0xbcad, 0xbcba, 0xbcd2, 0xbcf6, 0xbdba, 0xbdc0,
0xbdc3, 0xbdc5, 0xbec6, 0xbec8, 0xbedf, 0xbeee, 0xbef8, 0xbefa, 0xbfa1,
0xbfa9, 0xbfc0, 0xbfe4, 0xbfeb, 0xbfec, 0xbff8, 0xc0a7, 0xc0af, 0xc0b8,
0xc0ba, 0xc0bb, 0xc0bd, 0xc0c7, 0xc0cc, 0xc0ce, 0xc0cf, 0xc0d6, 0xc0da,
0xc0e5, 0xc0fb, 0xc0fc, 0xc1a4, 0xc1a6, 0xc1b6, 0xc1d6, 0xc1df, 0xc1f6,
0xc1f8, 0xc4a1, 0xc5cd, 0xc6ae, 0xc7cf, 0xc7d1, 0xc7d2, 0xc7d8, 0xc7e5,
0xc8ad,
];
nextChar = eucNextChar;
}
|
AST#export_declaration#Left export AST#class_declaration#Left class euc_kr extends AST#type_annotation#Left AST#primary_type#Left mbcs AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left name AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 'EUC-KR' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left language AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 'ko' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // TODO: This set of data comes from the character frequency- // of-occurrence analysis tool. The data needs to be moved // into a resource and loaded from there. AST#property_declaration#Left commonChars = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0xb0a1 AST#expression#Right , AST#expression#Left 0xb0b3 AST#expression#Right , AST#expression#Left 0xb0c5 AST#expression#Right , AST#expression#Left 0xb0cd AST#expression#Right , AST#expression#Left 0xb0d4 AST#expression#Right , AST#expression#Left 0xb0e6 AST#expression#Right , AST#expression#Left 0xb0ed AST#expression#Right , AST#expression#Left 0xb0f8 AST#expression#Right , AST#expression#Left 0xb0fa AST#expression#Right , AST#expression#Left 0xb0fc AST#expression#Right , AST#expression#Left 0xb1b8 AST#expression#Right , AST#expression#Left 0xb1b9 AST#expression#Right , AST#expression#Left 0xb1c7 AST#expression#Right , AST#expression#Left 0xb1d7 AST#expression#Right , AST#expression#Left 0xb1e2 AST#expression#Right , AST#expression#Left 0xb3aa AST#expression#Right , AST#expression#Left 0xb3bb AST#expression#Right , AST#expression#Left 0xb4c2 AST#expression#Right , AST#expression#Left 0xb4cf AST#expression#Right , AST#expression#Left 0xb4d9 AST#expression#Right , AST#expression#Left 0xb4eb AST#expression#Right , AST#expression#Left 0xb5a5 AST#expression#Right , AST#expression#Left 0xb5b5 AST#expression#Right , AST#expression#Left 0xb5bf AST#expression#Right , AST#expression#Left 0xb5c7 AST#expression#Right , AST#expression#Left 0xb5e9 AST#expression#Right , AST#expression#Left 0xb6f3 AST#expression#Right , AST#expression#Left 0xb7af AST#expression#Right , AST#expression#Left 0xb7c2 AST#expression#Right , AST#expression#Left 0xb7ce AST#expression#Right , AST#expression#Left 0xb8a6 AST#expression#Right , AST#expression#Left 0xb8ae AST#expression#Right , AST#expression#Left 0xb8b6 AST#expression#Right , AST#expression#Left 0xb8b8 AST#expression#Right , AST#expression#Left 0xb8bb AST#expression#Right , AST#expression#Left 0xb8e9 AST#expression#Right , AST#expression#Left 0xb9ab AST#expression#Right , AST#expression#Left 0xb9ae AST#expression#Right , AST#expression#Left 0xb9cc AST#expression#Right , AST#expression#Left 0xb9ce AST#expression#Right , AST#expression#Left 0xb9fd AST#expression#Right , AST#expression#Left 0xbab8 AST#expression#Right , AST#expression#Left 0xbace AST#expression#Right , AST#expression#Left 0xbad0 AST#expression#Right , AST#expression#Left 0xbaf1 AST#expression#Right , AST#expression#Left 0xbbe7 AST#expression#Right , AST#expression#Left 0xbbf3 AST#expression#Right , AST#expression#Left 0xbbfd AST#expression#Right , AST#expression#Left 0xbcad AST#expression#Right , AST#expression#Left 0xbcba AST#expression#Right , AST#expression#Left 0xbcd2 AST#expression#Right , AST#expression#Left 0xbcf6 AST#expression#Right , AST#expression#Left 0xbdba AST#expression#Right , AST#expression#Left 0xbdc0 AST#expression#Right , AST#expression#Left 0xbdc3 AST#expression#Right , AST#expression#Left 0xbdc5 AST#expression#Right , AST#expression#Left 0xbec6 AST#expression#Right , AST#expression#Left 0xbec8 AST#expression#Right , AST#expression#Left 0xbedf AST#expression#Right , AST#expression#Left 0xbeee AST#expression#Right , AST#expression#Left 0xbef8 AST#expression#Right , AST#expression#Left 0xbefa AST#expression#Right , AST#expression#Left 0xbfa1 AST#expression#Right , AST#expression#Left 0xbfa9 AST#expression#Right , AST#expression#Left 0xbfc0 AST#expression#Right , AST#expression#Left 0xbfe4 AST#expression#Right , AST#expression#Left 0xbfeb AST#expression#Right , AST#expression#Left 0xbfec AST#expression#Right , AST#expression#Left 0xbff8 AST#expression#Right , AST#expression#Left 0xc0a7 AST#expression#Right , AST#expression#Left 0xc0af AST#expression#Right , AST#expression#Left 0xc0b8 AST#expression#Right , AST#expression#Left 0xc0ba AST#expression#Right , AST#expression#Left 0xc0bb AST#expression#Right , AST#expression#Left 0xc0bd AST#expression#Right , AST#expression#Left 0xc0c7 AST#expression#Right , AST#expression#Left 0xc0cc AST#expression#Right , AST#expression#Left 0xc0ce AST#expression#Right , AST#expression#Left 0xc0cf AST#expression#Right , AST#expression#Left 0xc0d6 AST#expression#Right , AST#expression#Left 0xc0da AST#expression#Right , AST#expression#Left 0xc0e5 AST#expression#Right , AST#expression#Left 0xc0fb AST#expression#Right , AST#expression#Left 0xc0fc AST#expression#Right , AST#expression#Left 0xc1a4 AST#expression#Right , AST#expression#Left 0xc1a6 AST#expression#Right , AST#expression#Left 0xc1b6 AST#expression#Right , AST#expression#Left 0xc1d6 AST#expression#Right , AST#expression#Left 0xc1df AST#expression#Right , AST#expression#Left 0xc1f6 AST#expression#Right , AST#expression#Left 0xc1f8 AST#expression#Right , AST#expression#Left 0xc4a1 AST#expression#Right , AST#expression#Left 0xc5cd AST#expression#Right , AST#expression#Left 0xc6ae AST#expression#Right , AST#expression#Left 0xc7cf AST#expression#Right , AST#expression#Left 0xc7d1 AST#expression#Right , AST#expression#Left 0xc7d2 AST#expression#Right , AST#expression#Left 0xc7d8 AST#expression#Right , AST#expression#Left 0xc7e5 AST#expression#Right , AST#expression#Left 0xc8ad AST#expression#Right , ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left nextChar = AST#expression#Left eucNextChar AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class euc_kr extends mbcs {
name() {
return 'EUC-KR';
}
language() {
return 'ko';
}
commonChars = [
0xb0a1, 0xb0b3, 0xb0c5, 0xb0cd, 0xb0d4, 0xb0e6, 0xb0ed, 0xb0f8, 0xb0fa,
0xb0fc, 0xb1b8, 0xb1b9, 0xb1c7, 0xb1d7, 0xb1e2, 0xb3aa, 0xb3bb, 0xb4c2,
0xb4cf, 0xb4d9, 0xb4eb, 0xb5a5, 0xb5b5, 0xb5bf, 0xb5c7, 0xb5e9, 0xb6f3,
0xb7af, 0xb7c2, 0xb7ce, 0xb8a6, 0xb8ae, 0xb8b6, 0xb8b8, 0xb8bb, 0xb8e9,
0xb9ab, 0xb9ae, 0xb9cc, 0xb9ce, 0xb9fd, 0xbab8, 0xbace, 0xbad0, 0xbaf1,
0xbbe7, 0xbbf3, 0xbbfd, 0xbcad, 0xbcba, 0xbcd2, 0xbcf6, 0xbdba, 0xbdc0,
0xbdc3, 0xbdc5, 0xbec6, 0xbec8, 0xbedf, 0xbeee, 0xbef8, 0xbefa, 0xbfa1,
0xbfa9, 0xbfc0, 0xbfe4, 0xbfeb, 0xbfec, 0xbff8, 0xc0a7, 0xc0af, 0xc0b8,
0xc0ba, 0xc0bb, 0xc0bd, 0xc0c7, 0xc0cc, 0xc0ce, 0xc0cf, 0xc0d6, 0xc0da,
0xc0e5, 0xc0fb, 0xc0fc, 0xc1a4, 0xc1a6, 0xc1b6, 0xc1d6, 0xc1df, 0xc1f6,
0xc1f8, 0xc4a1, 0xc5cd, 0xc6ae, 0xc7cf, 0xc7d1, 0xc7d2, 0xc7d8, 0xc7e5,
0xc8ad,
];
nextChar = eucNextChar;
}
|
https://github.com/ChangweiZhang/chardet-arkts.git/blob/3a214882ec6a2753c0fed84162952aa659341c19/src/main/ets/components/encoding/mbcs.ets#L396-L424
|
dbebe8ca1e6d442df0e1445d79020c1a49ca432d
|
github
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/model/src/main/ets/request/FeedbackSubmitRequest.ets
|
arkts
|
@file 提交意见反馈请求模型
@author Joker.X
|
export class FeedbackSubmitRequest {
/**
* 联系方式
*/
contact?: string | null;
/**
* 类型
*/
type: number;
/**
* 内容
*/
content: string;
/**
* 图片
*/
images?: string[] | null;
/**
* @param {FeedbackSubmitRequest} init - 初始化数据
*/
constructor(init: FeedbackSubmitRequest) {
this.type = init.type;
this.content = init.content;
if (init.contact !== undefined) {
this.contact = init.contact;
}
if (init.images !== undefined) {
this.images = init.images;
}
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class FeedbackSubmitRequest AST#class_body#Left { /**
* 联系方式
*/ AST#property_declaration#Left contact ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 类型
*/ AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 内容
*/ AST#property_declaration#Left content : 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 images ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left string [ ] 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#property_declaration#Right /**
* @param {FeedbackSubmitRequest} init - 初始化数据
*/ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init : AST#type_annotation#Left AST#primary_type#Left FeedbackSubmitRequest 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 . type AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . 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 this AST#expression#Right . content AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . contact AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contact AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . contact AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . images AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . images AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . images AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class FeedbackSubmitRequest {
contact?: string | null;
type: number;
content: string;
images?: string[] | null;
constructor(init: FeedbackSubmitRequest) {
this.type = init.type;
this.content = init.content;
if (init.contact !== undefined) {
this.contact = init.contact;
}
if (init.images !== undefined) {
this.images = init.images;
}
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/FeedbackSubmitRequest.ets#L5-L36
|
12380eee9c8c53ec556ccd57dc8c84de2d2521a3
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/Index.ets
|
arkts
|
DetailPage
|
Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export { DetailPage } from './src/main/ets/main/DetailPage';
|
AST#export_declaration#Left export { DetailPage } from './src/main/ets/main/DetailPage' ; AST#export_declaration#Right
|
export { DetailPage } from './src/main/ets/main/DetailPage';
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/Index.ets#L17-L17
|
7071093ffa93c33265a0484d0cdce937d900e87f
|
gitee
|
chongzi/Lucky-ArkTs.git
|
84fc104d4a68def780a483e2543ebf9f53e793fd
|
entry/src/main/ets/model/OfferModel.ets
|
arkts
|
getRemainingDays
|
获取剩余天数
|
getRemainingDays(): number {
if (!this.expiryDate) return -1;
const expiryTime = new Date(this.expiryDate).getTime();
const now = new Date().getTime();
const diffTime = expiryTime - now;
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
}
|
AST#method_declaration#Left getRemainingDays 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#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 . expiryDate 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 expiryTime = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . expiryDate AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left diffTime = AST#expression#Left AST#binary_expression#Left AST#expression#Left expiryTime AST#expression#Right - AST#expression#Left now AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . ceil AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left diffTime AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 1000 AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getRemainingDays(): number {
if (!this.expiryDate) return -1;
const expiryTime = new Date(this.expiryDate).getTime();
const now = new Date().getTime();
const diffTime = expiryTime - now;
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
}
|
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L215-L221
|
38987dde2db622b94d7c615900ea9c74e7d39575
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/model/base/HmDialogOptions.ets
|
arkts
|
TODO 确认弹出框,Base参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18
|
export interface HmDialogOptions extends DialogOptions {
content?: ResourceStr; //弹框内容。
primaryButton?: ButtonOptions | ResourceStr; //弹框左侧按钮。
secondaryButton?: ButtonOptions | ResourceStr; //弹框右侧按钮。
onAction: ActionCallBack; //按钮的CallBack事件。
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface HmDialogOptions AST#extends_clause#Left extends DialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left content ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //弹框内容。 AST#type_member#Left primaryButton ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //弹框左侧按钮。 AST#type_member#Left secondaryButton ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //弹框右侧按钮。 AST#type_member#Left onAction : AST#type_annotation#Left AST#primary_type#Left ActionCallBack AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //按钮的CallBack事件。 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface HmDialogOptions extends DialogOptions {
content?: ResourceStr;
primaryButton?: ButtonOptions | ResourceStr;
secondaryButton?: ButtonOptions | ResourceStr;
onAction: ActionCallBack;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/base/HmDialogOptions.ets#L25-L32
|
8a03ce3da7dcb8042f6283b5ceae2ece7ece8000
|
gitee
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
|
arkts
|
syncRotationAngle
|
Sync rotate angle.
@param angle
|
syncRotationAngle(angle: number) {
this.rotationAngle = angle;
MathUtils.swapWidthHeight(this.cropRect);
this.swapCurrentRatio();
this.enlargeCropArea();
}
|
AST#method_declaration#Left syncRotationAngle AST#parameter_list#Left ( AST#parameter#Left angle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 . rotationAngle AST#member_expression#Right = AST#expression#Left angle 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 MathUtils AST#expression#Right . swapWidthHeight 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 . cropRect AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swapCurrentRatio AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . enlargeCropArea 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
|
syncRotationAngle(angle: number) {
this.rotationAngle = angle;
MathUtils.swapWidthHeight(this.cropRect);
this.swapCurrentRatio();
this.enlargeCropArea();
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets#L122-L127
|
a8be5c103684c07469f9395186cf26d198da582d
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
|
arkts
|
getNode
|
Retrieve sub components based on type, reuse them directly if available, and create new sub components if not available
|
public getNode(type: string, item: ESObject, itemColor: Color,
builder: WrappedBuilder<ESObject>): NodeItem | undefined {
let nodeItem: NodeItem | undefined = this.nodePool.get(type)?.pop();
if (!nodeItem) {
nodeItem = new NodeItem();
nodeItem.builder = builder;
nodeItem.data.data = item;
nodeItem.type = type;
nodeItem.data.itemColor = itemColor;
} else {
nodeItem.data.data = item;
nodeItem.data.itemColor = itemColor;
}
return nodeItem;
}
|
AST#method_declaration#Left public getNode AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left itemColor : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject 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#union_type#Left AST#primary_type#Left NodeItem 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 let AST#variable_declarator#Left nodeItem : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left NodeItem AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . nodePool AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. pop 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#unary_expression#Left ! AST#expression#Left nodeItem 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 nodeItem = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left NodeItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . builder AST#member_expression#Right = AST#expression#Left builder AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . data AST#member_expression#Right AST#expression#Right . data AST#member_expression#Right = AST#expression#Left item 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 nodeItem AST#expression#Right . type AST#member_expression#Right = AST#expression#Left type AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . data AST#member_expression#Right AST#expression#Right . itemColor AST#member_expression#Right = AST#expression#Left itemColor AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . data AST#member_expression#Right AST#expression#Right . data AST#member_expression#Right = AST#expression#Left item AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nodeItem AST#expression#Right . data AST#member_expression#Right AST#expression#Right . itemColor AST#member_expression#Right = AST#expression#Left itemColor 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 nodeItem AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getNode(type: string, item: ESObject, itemColor: Color,
builder: WrappedBuilder<ESObject>): NodeItem | undefined {
let nodeItem: NodeItem | undefined = this.nodePool.get(type)?.pop();
if (!nodeItem) {
nodeItem = new NodeItem();
nodeItem.builder = builder;
nodeItem.data.data = item;
nodeItem.type = type;
nodeItem.data.itemColor = itemColor;
} else {
nodeItem.data.data = item;
nodeItem.data.itemColor = itemColor;
}
return nodeItem;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L89-L103
|
761615bca9e877c3caf2d4364cda77c15b1b0f53
|
gitee
|
Hyricane/Interview_Success.git
|
9783273fe05fc8951b99bf32d3887c605268db8f
|
entry/src/main/ets/views/Home/HomeCategory.ets
|
arkts
|
textTitle
|
只支持全局
|
@Extend(Text)
function textTitle() {
.fontSize(14)
.fontWeight(500)
.fontColor($r('app.color.black'))
.width('100%')
.margin({ top: 20 })
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function textTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 500 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.black' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#decorated_function_declaration#Right
|
@Extend(Text)
function textTitle() {
.fontSize(14)
.fontWeight(500)
.fontColor($r('app.color.black'))
.width('100%')
.margin({ top: 20 })
}
|
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/views/Home/HomeCategory.ets#L9-L16
|
9eea4ab1c57677cb23dcade2b6e95c100af6719a
|
github
|
xsdkhlgz/ATSOBJECT_OF_FIRST.git
|
8c14e875d7ec3f418bb7cdaae123a8fea87a7e76
|
entry/src/main/ets/view/record/DatePickDialog.ets
|
arkts
|
DatePickDialog
|
不是component ,吃了大亏,一定要再仔细一点,但有一点不明白的就是将CustomDialog
替换成component就会报错到底是什么原因
|
@CustomDialog
export default struct DatePickDialog {
//对话框的开发不能漏掉下面这句
controller: CustomDialogController
selectedDate: Date = new Date()
build() {
Column({ space: 12 }) {
//1.日期选择器
DatePicker({
start: new Date('2020-01-01'),
end: new Date('2100-01-01'),
selected: this.selectedDate
})
.onChange((value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
console.info('select current date is :' + JSON.stringify(value))
})
//2.按钮
Row({ space: 12 }) {
//取消按钮
Button('取消')
.type(ButtonType.Capsule)
.fontColor('#ffffff')
.backgroundColor('#f1f1f1')
.width(120)
.onClick(() => {
//点击取消按钮退出界面
this.controller.close()
})
//确定按钮
Button('确定')
.type(ButtonType.Capsule)
.fontColor('#ffffff')
.backgroundColor('#ff66dbee')
.width(120)
.onClick(() => {
/*1.将日期保存至全局存储,存储的时候不要将日期date对象存进去,因为在未来作状态变量监控的时候会出问题;
所以要加getTime()转换成毫秒值再进行存储*/
AppStorage.SetOrCreate('selectedDate', this.selectedDate.getTime())
//2.关闭窗口
this.controller.close()
})
}
.width('100%')
.justifyContent(FlexAlign.SpaceAround)
}
//内边距
.padding(12)
.borderRadius(15)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct DatePickDialog 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#ERROR#Left selectedDate : Date AST#ERROR#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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { //1.日期选择器 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left DatePicker ( AST#component_parameters#Left { AST#component_parameter#Left start : 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 '2020-01-01' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left end : 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 '2100-01-01' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left selected : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedDate AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left DatePickerResult 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 . selectedDate AST#member_expression#Right AST#expression#Right . setFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . year AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . month AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . day 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'select current date is :' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //2.按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { //取消按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '取消' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f1f1' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 120 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#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 . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ff66dbee' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 120 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 { /*1.将日期保存至全局存储,存储的时候不要将日期date对象存进去,因为在未来作状态变量监控的时候会出问题;
所以要加getTime()转换成毫秒值再进行存储*/ AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'selectedDate' 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 . selectedDate AST#member_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right //2.关闭窗口 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right //内边距 AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@CustomDialog
export default struct DatePickDialog {
controller: CustomDialogController
selectedDate: Date = new Date()
build() {
Column({ space: 12 }) {
DatePicker({
start: new Date('2020-01-01'),
end: new Date('2100-01-01'),
selected: this.selectedDate
})
.onChange((value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
console.info('select current date is :' + JSON.stringify(value))
})
Row({ space: 12 }) {
Button('取消')
.type(ButtonType.Capsule)
.fontColor('#ffffff')
.backgroundColor('#f1f1f1')
.width(120)
.onClick(() => {
this.controller.close()
})
Button('确定')
.type(ButtonType.Capsule)
.fontColor('#ffffff')
.backgroundColor('#ff66dbee')
.width(120)
.onClick(() => {
AppStorage.SetOrCreate('selectedDate', this.selectedDate.getTime())
this.controller.close()
})
}
.width('100%')
.justifyContent(FlexAlign.SpaceAround)
}
.padding(12)
.borderRadius(15)
}
}
|
https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/view/record/DatePickDialog.ets#L4-L56
|
ad23e0f03d895404d45192691a5ed4d9b373eadc
|
github
|
salehelper/algorithm_arkts.git
|
61af15272038646775a4745fca98a48ba89e1f4e
|
entry/src/main/ets/ciphers/A1Z26Cipher.ets
|
arkts
|
A1Z26密码实现
A1Z26密码是一种简单的替换密码,将字母A-Z替换为数字1-26
|
export class A1Z26Cipher {
/**
* 将文本转换为数字序列
* @param text 要加密的文本
* @param separator 数字之间的分隔符
* @returns 加密后的数字序列
*/
static encrypt(text: string, separator: string = '-'): string {
if (!text) {
return '';
}
return text.toUpperCase().split('').map(char => {
if (char >= 'A' && char <= 'Z') {
return (char.charCodeAt(0) - 64).toString();
}
return char;
}).join(separator);
}
/**
* 将数字序列转换回文本
* @param numbers 要解密的数字序列
* @param separator 数字之间的分隔符
* @returns 解密后的文本
*/
static decrypt(numbers: string, separator: string = '-'): string {
if (!numbers) {
return '';
}
return numbers.split(separator).map(num => {
const n = parseInt(num);
if (!isNaN(n) && n >= 1 && n <= 26) {
return String.fromCharCode(n + 64);
}
return num;
}).join('');
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class A1Z26Cipher AST#class_body#Left { /**
* 将文本转换为数字序列
* @param text 要加密的文本
* @param separator 数字之间的分隔符
* @returns 加密后的数字序列
*/ AST#method_declaration#Left static encrypt 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 separator : 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#unary_expression#Left ! AST#expression#Left text AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { 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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 text AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left char => 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 char AST#expression#Right >= AST#expression#Left 'A' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right <= AST#expression#Left 'Z' 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#call_expression#Left 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left char AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left 64 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_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#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 char 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 . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left separator AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 将数字序列转换回文本
* @param numbers 要解密的数字序列
* @param separator 数字之间的分隔符
* @returns 解密后的文本
*/ AST#method_declaration#Left static decrypt AST#parameter_list#Left ( AST#parameter#Left numbers : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left separator : 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#unary_expression#Left ! AST#expression#Left numbers AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { 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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left numbers AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left separator 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 num => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left n = AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left num AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isNaN AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left n AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left n AST#expression#Right >= AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left n AST#expression#Right <= AST#expression#Left 26 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left String AST#expression#Right . fromCharCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left n AST#expression#Right + AST#expression#Left 64 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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left num 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 . 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#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class A1Z26Cipher {
static encrypt(text: string, separator: string = '-'): string {
if (!text) {
return '';
}
return text.toUpperCase().split('').map(char => {
if (char >= 'A' && char <= 'Z') {
return (char.charCodeAt(0) - 64).toString();
}
return char;
}).join(separator);
}
static decrypt(numbers: string, separator: string = '-'): string {
if (!numbers) {
return '';
}
return numbers.split(separator).map(num => {
const n = parseInt(num);
if (!isNaN(n) && n >= 1 && n <= 26) {
return String.fromCharCode(n + 64);
}
return num;
}).join('');
}
}
|
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/A1Z26Cipher.ets#L5-L44
|
350dbf9f3e30c250959b2fdef78c3d526ea57f95
|
github
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/views/login/LogOffView.ets
|
arkts
|
confirmLogoff
|
确认退出登录
|
confirmLogoff(){
Toast.showAlert({
title: $r('app.string.alert_title_confirm'),//退出登录
message: $r('app.string.logoff_msg_logoff'),
secondaryButton: {value: $r('app.string.cfm_btn_cancel'), fontColor: Color.Gray, action: () => {}},
primaryButton: {value: $r('app.string.logoff_cfm_yes'), action: () => {
//注销
this.logOff()
}}
})
}
|
AST#method_declaration#Left confirmLogoff 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 Toast AST#expression#Right . showAlert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.alert_title_confirm' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , //退出登录 AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.logoff_msg_logoff' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.cfm_btn_cancel' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left primaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.logoff_cfm_yes' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#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 . logOff 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
confirmLogoff(){
Toast.showAlert({
title: $r('app.string.alert_title_confirm'),
message: $r('app.string.logoff_msg_logoff'),
secondaryButton: {value: $r('app.string.cfm_btn_cancel'), fontColor: Color.Gray, action: () => {}},
primaryButton: {value: $r('app.string.logoff_cfm_yes'), action: () => {
this.logOff()
}}
})
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/login/LogOffView.ets#L109-L120
|
779d087218b8bf55bc327bff761c5454d461de8b
|
github
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/common/ThemeManager.ets
|
arkts
|
getDefaultTheme
|
获取默认主题
|
private getDefaultTheme(): ThemeModel {
return {
type: 'minimal',
name: '简约主题',
description: '简洁清爽,专注内容',
colors: {
primaryColor: '#00C851',
primaryLightColor: '#4DD776',
secondaryColor: '#FFD700',
backgroundColor: '#F8F9FA',
surfaceColor: '#FFFFFF',
surfaceVariantColor: '#F5F5F5',
textColor: '#1A1A1A',
textSecondary: '#666666',
borderColor: '#E0E0E0',
successColor: '#4CAF50',
warningColor: '#FF9800',
errorColor: '#FF4444'
}
};
}
|
AST#method_declaration#Left private getDefaultTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ThemeModel 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 type AST#property_name#Right : AST#expression#Left 'minimal' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '简约主题' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left '简洁清爽,专注内容' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left colors AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left primaryColor AST#property_name#Right : AST#expression#Left '#00C851' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left primaryLightColor AST#property_name#Right : AST#expression#Left '#4DD776' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondaryColor AST#property_name#Right : AST#expression#Left '#FFD700' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left '#F8F9FA' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left surfaceColor AST#property_name#Right : AST#expression#Left '#FFFFFF' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left surfaceVariantColor AST#property_name#Right : AST#expression#Left '#F5F5F5' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left textColor AST#property_name#Right : AST#expression#Left '#1A1A1A' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left textSecondary AST#property_name#Right : AST#expression#Left '#666666' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left borderColor AST#property_name#Right : AST#expression#Left '#E0E0E0' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left successColor AST#property_name#Right : AST#expression#Left '#4CAF50' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left warningColor AST#property_name#Right : AST#expression#Left '#FF9800' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errorColor AST#property_name#Right : AST#expression#Left '#FF4444' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private getDefaultTheme(): ThemeModel {
return {
type: 'minimal',
name: '简约主题',
description: '简洁清爽,专注内容',
colors: {
primaryColor: '#00C851',
primaryLightColor: '#4DD776',
secondaryColor: '#FFD700',
backgroundColor: '#F8F9FA',
surfaceColor: '#FFFFFF',
surfaceVariantColor: '#F5F5F5',
textColor: '#1A1A1A',
textSecondary: '#666666',
borderColor: '#E0E0E0',
successColor: '#4CAF50',
warningColor: '#FF9800',
errorColor: '#FF4444'
}
};
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L52-L72
|
281199276e87d8cab51ae7ae29a55038e9e92e56
|
github
|
ikunbranch666-auto/SimpleCalculator.git
|
ea24568014d05285ad3def5b741380294308aef2
|
entry/src/main/ets/model/ImageList.ets
|
arkts
|
垂直方向的按钮(右侧操作符 - 第5列)
|
export function obtainImgV(): ImageList[] {
return [
{
image: '',
value: '+' // 第1行第5列
},
{
image: '',
value: '-' // 第2行第5列
},
{
image: '',
value: '=' // 第3行第5列(占两行)
}
]
}
|
AST#export_declaration#Left export AST#function_declaration#Left function obtainImgV AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ImageList [ ] 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left image AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left '+' AST#expression#Right AST#property_assignment#Right // 第1行第5列 } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left image AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left '-' AST#expression#Right AST#property_assignment#Right // 第2行第5列 } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left image AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left '=' AST#expression#Right AST#property_assignment#Right // 第3行第5列(占两行) } AST#object_literal#Right AST#expression#Right ] AST#array_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 obtainImgV(): ImageList[] {
return [
{
image: '',
value: '+'
},
{
image: '',
value: '-'
},
{
image: '',
value: '='
}
]
}
|
https://github.com/ikunbranch666-auto/SimpleCalculator.git/blob/ea24568014d05285ad3def5b741380294308aef2/entry/src/main/ets/model/ImageList.ets#L22-L37
|
4959dad86dc752791fa222f896d8204f5e3f5f3b
|
github
|
|
charon2pluto/MoodDiary-HarmonyOS.git
|
0ec7ee6861e150bc9b4571062dbf302d1b106b8c
|
entry/src/main/ets/pages/SettingsPage.ets
|
arkts
|
handleClearData
|
处理清空数据的逻辑
|
handleClearData() {
AlertDialog.show({
title: '⚠️ 危险操作',
message: '确定要删除所有的心情日记吗?删除后无法恢复!',
autoCancel: true,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
primaryButton: {
value: '取消',
action: () => {}
},
secondaryButton: {
value: '确认删除',
fontColor: '#FF0000',
action: () => {
MoodDB.clearUserData().then(() => {
promptAction.showToast({ message: '所有数据已清空' });
});
}
}
});
}
|
AST#method_declaration#Left handleClearData 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 AlertDialog AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '⚠️ 危险操作' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '确定要删除所有的心情日记吗?删除后无法恢复!' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left autoCancel AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offset AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dx AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dy AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 20 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left primaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left '取消' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left '确认删除' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left '#FF0000' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action 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#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 MoodDB AST#expression#Right . clearUserData 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#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#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
handleClearData() {
AlertDialog.show({
title: '⚠️ 危险操作',
message: '确定要删除所有的心情日记吗?删除后无法恢复!',
autoCancel: true,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
primaryButton: {
value: '取消',
action: () => {}
},
secondaryButton: {
value: '确认删除',
fontColor: '#FF0000',
action: () => {
MoodDB.clearUserData().then(() => {
promptAction.showToast({ message: '所有数据已清空' });
});
}
}
});
}
|
https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/pages/SettingsPage.ets#L120-L141
|
6e80697480a8c708026107b7d717d3e66e2e6a7a
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SavePictureFromWeb.ets
|
arkts
|
saveImage
|
将沙箱路径下的图片写入到相册
@param srcFileUris 图片的沙箱路径
|
async saveImage(srcFileUris: Array<string>) {
let phAccessHelper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(this.context);
try {
let photoCreationConfigs: Array<photoAccessHelper.PhotoCreationConfig> = [
{
title: 'savePictureFromWeb',
fileNameExtension: 'png',
photoType: photoAccessHelper.PhotoType.IMAGE,
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
}
];
// 拉起授予权限的弹窗,获取将图片保存到相册的权限
let desFileUris: Array<string> = await phAccessHelper.showAssetsCreationDialog(srcFileUris, photoCreationConfigs);
logger.info(TAG, 'showAssetsCreationDialog success, data is:' + desFileUris);
// 转换为uri
let uri: string = fileUri.getUriFromPath(srcFileUris[0]);
// 打开沙箱路径下图片
const file: fs.File = fs.openSync(uri, fs.OpenMode.READ_WRITE);
// 读取沙箱路径下图片为buffer
const photoSize: number = fs.statSync(file.fd).size;
let arrayBuffer: ArrayBuffer = new ArrayBuffer(photoSize);
let readLength: number = fs.readSync(file.fd, arrayBuffer);
let imageBuffer: ArrayBuffer = buffer.from(arrayBuffer, 0, readLength).buffer;
try {
// 打开相册下路径
let fileInAlbum = fs.openSync(desFileUris[0], fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
// 写入相册
await fs.write(fileInAlbum.fd, imageBuffer);
// 关闭文件
await fs.close(file.fd);
await fs.close(fileInAlbum.fd);
logger.info(TAG, 'save image succeed');
// 图片保存成功后,删掉沙箱路径下图片
fs.unlinkSync(srcFileUris[0]);
promptAction.showToast({
message: $r('app.string.photo_pick_and_save_success_message'),
duration: ANIMATION_DURATION
});
// 关闭bindPopup
this.showMenu = false;
} catch (error) {
logger.error(TAG, `save image failed, code is: ${error.code}, message is: ${error.message}`);
}
} catch (err) {
logger.error(TAG, `showAssetsCreationDialog failed, errCode is: ${err.code}, message is: ${err.message}`);
}
}
|
AST#method_declaration#Left async saveImage AST#parameter_list#Left ( AST#parameter#Left srcFileUris : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left phAccessHelper : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left photoAccessHelper . PhotoAccessHelper 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 photoAccessHelper AST#expression#Right . getPhotoAccessHelper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoCreationConfigs : 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#qualified_type#Left photoAccessHelper . PhotoCreationConfig AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left 'savePictureFromWeb' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fileNameExtension AST#property_name#Right : AST#expression#Left 'png' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left photoType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left photoAccessHelper AST#expression#Right . PhotoType AST#member_expression#Right AST#expression#Right . IMAGE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subtype AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left photoAccessHelper AST#expression#Right . PhotoSubtype AST#member_expression#Right AST#expression#Right . DEFAULT AST#member_expression#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 desFileUris : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left phAccessHelper AST#expression#Right AST#await_expression#Right AST#expression#Right . showAssetsCreationDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcFileUris AST#expression#Right , AST#expression#Left photoCreationConfigs AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'showAssetsCreationDialog success, data is:' AST#expression#Right + AST#expression#Left desFileUris 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 // 转换为uri AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uri : 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 fileUri AST#expression#Right . getUriFromPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left srcFileUris AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 打开沙箱路径下图片 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left file : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fs . File 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 fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 读取沙箱路径下图片为buffer AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left photoSize : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . statSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left arrayBuffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer 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 ArrayBuffer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left photoSize AST#expression#Right ) AST#argument_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 readLength : 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 fs AST#expression#Right . readSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left arrayBuffer AST#expression#Right ) AST#argument_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 imageBuffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left arrayBuffer AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left readLength AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 打开相册下路径 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fileInAlbum = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left desFileUris AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 写入相册 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left fs AST#expression#Right AST#await_expression#Right AST#expression#Right . write AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left fileInAlbum AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left imageBuffer AST#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 fs AST#expression#Right AST#await_expression#Right 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 file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 fs AST#expression#Right AST#await_expression#Right 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 fileInAlbum AST#expression#Right . fd AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 'save image succeed' AST#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 fs AST#expression#Right . unlinkSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left srcFileUris AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.photo_pick_and_save_success_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left ANIMATION_DURATION 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 // 关闭bindPopup 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 . showMenu 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#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` save image failed, code is: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 ` showAssetsCreationDialog failed, errCode is: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async saveImage(srcFileUris: Array<string>) {
let phAccessHelper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(this.context);
try {
let photoCreationConfigs: Array<photoAccessHelper.PhotoCreationConfig> = [
{
title: 'savePictureFromWeb',
fileNameExtension: 'png',
photoType: photoAccessHelper.PhotoType.IMAGE,
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
}
];
let desFileUris: Array<string> = await phAccessHelper.showAssetsCreationDialog(srcFileUris, photoCreationConfigs);
logger.info(TAG, 'showAssetsCreationDialog success, data is:' + desFileUris);
let uri: string = fileUri.getUriFromPath(srcFileUris[0]);
const file: fs.File = fs.openSync(uri, fs.OpenMode.READ_WRITE);
const photoSize: number = fs.statSync(file.fd).size;
let arrayBuffer: ArrayBuffer = new ArrayBuffer(photoSize);
let readLength: number = fs.readSync(file.fd, arrayBuffer);
let imageBuffer: ArrayBuffer = buffer.from(arrayBuffer, 0, readLength).buffer;
try {
let fileInAlbum = fs.openSync(desFileUris[0], fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
await fs.write(fileInAlbum.fd, imageBuffer);
await fs.close(file.fd);
await fs.close(fileInAlbum.fd);
logger.info(TAG, 'save image succeed');
fs.unlinkSync(srcFileUris[0]);
promptAction.showToast({
message: $r('app.string.photo_pick_and_save_success_message'),
duration: ANIMATION_DURATION
});
this.showMenu = false;
} catch (error) {
logger.error(TAG, `save image failed, code is: ${error.code}, message is: ${error.message}`);
}
} catch (err) {
logger.error(TAG, `showAssetsCreationDialog failed, errCode is: ${err.code}, message is: ${err.message}`);
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SavePictureFromWeb.ets#L73-L124
|
2793df3e90b80e0f7dfe5b09bc85817763932903
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/utils/Tools.ets
|
arkts
|
log
|
日志打印
@param msg
|
static log(msg: string): void {
if (ArkWebHelper.debug) {
switch (ArkWebHelper.level) {
case hilog.LogLevel.DEBUG:
hilog.debug(0x0001, ArkWebHelper.tag, msg);
break
case hilog.LogLevel.INFO:
hilog.info(0x0001, ArkWebHelper.tag, msg);
|
AST#method_declaration#Left static log AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right { if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#ERROR#Left ) { AST#ERROR#Left AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#expression_statement#Right AST#ERROR#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . level AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . LogLevel AST#member_expression#Right AST#expression#Right . DEBUG AST#member_expression#Right AST#expression#Right AST#expression_statement#Right : AST#qualified_type#Left hilog . debug AST#qualified_type#Right ( AST#ERROR#Right AST#expression_statement#Left AST#expression#Left 0x0001 AST#expression#Right AST#expression_statement#Right AST#ERROR#Right , ArkWebHelper AST#ERROR#Right . tag AST#member_expression#Right AST#expression#Right AST#ERROR#Left , msg ) AST#ERROR#Left ; AST#ERROR#Right break case hilog AST#ERROR#Right . LogLevel AST#member_expression#Right AST#expression#Right . INFO AST#member_expression#Right AST#expression#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left hilog . info AST#ERROR#Left ( 0x0001 , ArkWebHelper AST#ERROR#Right . tag AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left , msg ) AST#ERROR#Right ; AST#method_declaration#Right
|
static log(msg: string): void {
if (ArkWebHelper.debug) {
switch (ArkWebHelper.level) {
case hilog.LogLevel.DEBUG:
hilog.debug(0x0001, ArkWebHelper.tag, msg);
break
case hilog.LogLevel.INFO:
hilog.info(0x0001, ArkWebHelper.tag, msg);
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L411-L418
|
9452d9b8106d61b26d7a09a22e6e22e6e200ace5
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/ui/src/main/ets/component/image/MediumAvatar.ets
|
arkts
|
MediumAvatar
|
@file 中等尺寸头像组件
@author Joker.X
|
@ComponentV2
export struct MediumAvatar {
/**
* 头像地址
*/
@Param
src: ResourceStr | PixelMap | DrawableDescriptor = "";
/**
* 点击回调
*/
@Param
onTap: (() => void) | undefined = undefined;
/**
* 构建中等尺寸头像
* @returns {void} 无返回值
*/
build(): void {
Avatar({
src: this.src,
avatarSize: 48,
onTap: this.onTap
});
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct MediumAvatar AST#component_body#Left { /**
* 头像地址
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left DrawableDescriptor 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 onTap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 构建中等尺寸头像
* @returns {void} 无返回值
*/ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left Avatar ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . src AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left avatarSize : AST#expression#Left 48 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct MediumAvatar {
@Param
src: ResourceStr | PixelMap | DrawableDescriptor = "";
@Param
onTap: (() => void) | undefined = undefined;
build(): void {
Avatar({
src: this.src,
avatarSize: 48,
onTap: this.onTap
});
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/MediumAvatar.ets#L7-L31
|
57bf26eb15cf7b51170d101a81111deef8b95603
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets
|
arkts
|
BottomBar
|
自定义封装底部bar组件
|
@Component
export struct BottomBar {
@State buttonModifier: AttributeModifier<ButtonAttribute> = new ButtonModifier();
@State barModifier: AttributeModifier<RowAttribute> = new BarModifier();
@State buttonName: Resource = $r('app.string.dynamicattributes_settlement');
@State barType: BarType = BarType.SHOPPING_CART;
build() {
Row() {
Column() {
if (this.barType === BarType.DETAILS) {
Button($r('app.string.dynamicattributes_add_cart'))
.attributeModifier(this.buttonModifier)
.margin({ right: $r('app.float.dynamicattributes_float_10') })
.onClick(() => {
promptAction.showToast({ message: $r('app.string.dynamicattributes_only_show') });
})
}
}
Button(this.buttonName)
.attributeModifier(this.buttonModifier)
.onClick(() => {
promptAction.showToast({ message: $r('app.string.dynamicattributes_only_show') });
})
}
.attributeModifier(this.barModifier)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BottomBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right buttonModifier : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ButtonAttribute AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ButtonModifier 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 barModifier : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttribute AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left BarModifier 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 buttonName : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.dynamicattributes_settlement' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right barType : AST#type_annotation#Left AST#primary_type#Left BarType AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BarType AST#expression#Right . SHOPPING_CART AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . barType AST#member_expression#Right AST#expression#Right === AST#expression#Left BarType AST#expression#Right AST#binary_expression#Right AST#expression#Right . DETAILS AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.dynamicattributes_add_cart' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . attributeModifier ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonModifier AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.dynamicattributes_float_10' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { 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#resource_expression#Left $r ( AST#expression#Left 'app.string.dynamicattributes_only_show' AST#expression#Right ) AST#resource_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#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#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . attributeModifier ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonModifier AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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#resource_expression#Left $r ( AST#expression#Left 'app.string.dynamicattributes_only_show' AST#expression#Right ) AST#resource_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#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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . attributeModifier ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . barModifier AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct BottomBar {
@State buttonModifier: AttributeModifier<ButtonAttribute> = new ButtonModifier();
@State barModifier: AttributeModifier<RowAttribute> = new BarModifier();
@State buttonName: Resource = $r('app.string.dynamicattributes_settlement');
@State barType: BarType = BarType.SHOPPING_CART;
build() {
Row() {
Column() {
if (this.barType === BarType.DETAILS) {
Button($r('app.string.dynamicattributes_add_cart'))
.attributeModifier(this.buttonModifier)
.margin({ right: $r('app.float.dynamicattributes_float_10') })
.onClick(() => {
promptAction.showToast({ message: $r('app.string.dynamicattributes_only_show') });
})
}
}
Button(this.buttonName)
.attributeModifier(this.buttonModifier)
.onClick(() => {
promptAction.showToast({ message: $r('app.string.dynamicattributes_only_show') });
})
}
.attributeModifier(this.barModifier)
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets#L44-L72
|
13383658e6d1b15edb495b21b825aa2a81dca247
|
gitee
|
Tianpei-Shi/MusicDash.git
|
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
|
src/model/UserModel.ets
|
arkts
|
用户数据JSON类型
|
export interface UserJsonData {
id: number;
username: string;
password: string;
like?: string;
history?: string;
phone?: number;
createdTime?: number;
lastLoginTime?: number;
avatar?: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface UserJsonData AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left like ? : 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 history ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left phone ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left createdTime ? : 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 lastLoginTime ? : 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 avatar ? : 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 UserJsonData {
id: number;
username: string;
password: string;
like?: string;
history?: string;
phone?: number;
createdTime?: number;
lastLoginTime?: number;
avatar?: string;
}
|
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L4-L14
|
caab4437296a468daf027829d647cb2a5e7b809c
|
github
|
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/alprazolamdiv/11.5.1/package/src/structures/Channel.ets
|
arkts
|
delete
|
应用约束10: 使用具体返回类型
|
delete(): Promise<Channel> {
return this.client.rest.methods.deleteChannel(this);
}
|
AST#method_declaration#Left delete 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 Channel 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . rest AST#member_expression#Right AST#expression#Right . methods AST#member_expression#Right AST#expression#Right . deleteChannel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
delete(): Promise<Channel> {
return this.client.rest.methods.deleteChannel(this);
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/Channel.ets#L34-L36
|
bd627488c23117da1f17b88d376808f830427f84
|
github
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/components/XAxis.ets
|
arkts
|
setAvoidFirstLastClipping
|
if set to true, the chart will avoid that the first and last label entry
in the chart "clip" off the edge of the chart or the screen
@param enabled
|
public setAvoidFirstLastClipping(enabled: boolean): void {
this.mAvoidFirstLastClipping = enabled;
}
|
AST#method_declaration#Left public setAvoidFirstLastClipping AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAvoidFirstLastClipping AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setAvoidFirstLastClipping(enabled: boolean): void {
this.mAvoidFirstLastClipping = enabled;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L138-L140
|
99223a66d7457b96891860e3e7b6714dc6bb51d2
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/demo/src/main/ets/viewmodel/NetworkRequestViewModel.ets
|
arkts
|
requestGoodsList
|
发起 POST 请求(商品列表)
|
requestGoodsList() {
const params: GoodsSearchRequest = new GoodsSearchRequest();
params.page = 1;
params.size = 20;
RequestHelper.repository<NetworkPageData<Goods>>(this.repository.getGoodsPage(params))
.start((): void => {
this.postLoading = true;
})
.execute()
.then((): void => {
ToastUtils.showSuccess($r("app.string.demo_network_request_post_success"));
})
.finally((): void => {
this.postLoading = false;
});
}
|
AST#method_declaration#Left requestGoodsList AST#parameter_list#Left ( ) AST#parameter_list#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 GoodsSearchRequest 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 GoodsSearchRequest 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 . page AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . size AST#member_expression#Right = AST#expression#Left 20 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkPageData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Goods 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#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . repository AST#member_expression#Right AST#expression#Right . getGoodsPage 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#argument_list#Right AST#call_expression#Right AST#expression#Right . start 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#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . postLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . execute 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#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ToastUtils AST#expression#Right . showSuccess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_network_request_post_success" 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . finally 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#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . postLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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
|
requestGoodsList() {
const params: GoodsSearchRequest = new GoodsSearchRequest();
params.page = 1;
params.size = 20;
RequestHelper.repository<NetworkPageData<Goods>>(this.repository.getGoodsPage(params))
.start((): void => {
this.postLoading = true;
})
.execute()
.then((): void => {
ToastUtils.showSuccess($r("app.string.demo_network_request_post_success"));
})
.finally((): void => {
this.postLoading = false;
});
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/NetworkRequestViewModel.ets#L49-L64
|
184c49bc252dc62eff42392d270a4fa62579676c
|
github
|
kumaleap/ArkSwipeDeck.git
|
5afa77b9b2a2a531595d31f895c54a3371e4249a
|
library/src/main/ets/types/SwipeCardTypes.ets
|
arkts
|
滑动事件处理器接口
|
export interface SwipeEventHandler {
/**
* 卡片滑动回调
*/
onCardSwiped?: OnCardSwipedCallback;
/**
* 卡片点击回调
*/
onCardClicked?: OnCardClickedCallback;
/**
* 卡片栈即将为空回调
*/
onStackNearEmpty?: OnStackNearEmptyCallback;
/**
* 卡片栈为空回调
*/
onStackEmpty?: OnStackEmptyCallback;
/**
* 预加载下一页回调
*/
onLoadNextPage?: OnLoadNextPageCallback;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface SwipeEventHandler AST#object_type#Left { /**
* 卡片滑动回调
*/ AST#type_member#Left onCardSwiped ? : AST#type_annotation#Left AST#primary_type#Left OnCardSwipedCallback AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 卡片点击回调
*/ AST#type_member#Left onCardClicked ? : AST#type_annotation#Left AST#primary_type#Left OnCardClickedCallback AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 卡片栈即将为空回调
*/ AST#type_member#Left onStackNearEmpty ? : AST#type_annotation#Left AST#primary_type#Left OnStackNearEmptyCallback AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 卡片栈为空回调
*/ AST#type_member#Left onStackEmpty ? : AST#type_annotation#Left AST#primary_type#Left OnStackEmptyCallback AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 预加载下一页回调
*/ AST#type_member#Left onLoadNextPage ? : AST#type_annotation#Left AST#primary_type#Left OnLoadNextPageCallback 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 SwipeEventHandler {
onCardSwiped?: OnCardSwipedCallback;
onCardClicked?: OnCardClickedCallback;
onStackNearEmpty?: OnStackNearEmptyCallback;
onStackEmpty?: OnStackEmptyCallback;
onLoadNextPage?: OnLoadNextPageCallback;
}
|
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L80-L105
|
1f9a738741420778e3bb26bfee982f9d0b721a65
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/bigfilecopy/src/main/ets/constants/BigFileCopyConstants.ets
|
arkts
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export class BigFileCopyConstants {
static readonly PROGRESS_MAX: number = 100;
static readonly PROGRESS_MIN: number = 0;
static readonly BUFF_SIZE: number = 4096;
static readonly COMPONENT_SIZE: number = 200;
static readonly ANIMATION_DURATION: number = 300;
static readonly SANDBOX_PREFIX: string = "file://";
static readonly TEST_FILE_NAME: string = "bigfilecopy_test.jpg";
}
|
AST#export_declaration#Left export AST#class_declaration#Left class BigFileCopyConstants AST#class_body#Left { AST#property_declaration#Left static readonly PROGRESS_MAX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly PROGRESS_MIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUFF_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4096 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly COMPONENT_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly ANIMATION_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SANDBOX_PREFIX : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "file://" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TEST_FILE_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "bigfilecopy_test.jpg" AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class BigFileCopyConstants {
static readonly PROGRESS_MAX: number = 100;
static readonly PROGRESS_MIN: number = 0;
static readonly BUFF_SIZE: number = 4096;
static readonly COMPONENT_SIZE: number = 200;
static readonly ANIMATION_DURATION: number = 300;
static readonly SANDBOX_PREFIX: string = "file://";
static readonly TEST_FILE_NAME: string = "bigfilecopy_test.jpg";
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bigfilecopy/src/main/ets/constants/BigFileCopyConstants.ets#L16-L24
|
b4b2e23ee6b7586cd89be1c4cd463fe59d9e161f
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/Index_backup.ets
|
arkts
|
buildMainContent
|
构建主内容区域
|
@Builder
buildMainContent() {
Scroll() {
Column({ space: 16 }) {
// 根据当前Tab显示不同内容
if (this.currentTabIndex === 0) {
this.buildHomeContent()
} else if (this.currentTabIndex === 1) {
this.buildContactsContent()
} else if (this.currentTabIndex === 2) {
this.buildCalendarContent()
} else if (this.currentTabIndex === 3) {
this.buildGreetingsContent()
} else if (this.currentTabIndex === 4) {
this.buildSettingsContent()
}
}
.padding(16)
}
.layoutWeight(1)
.scrollBar(BarState.Off)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildMainContent 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 { // 根据当前Tab显示不同内容 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildHomeContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildContactsContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildCalendarContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildGreetingsContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildSettingsContent 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_if_statement#Right AST#ui_if_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 . 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
buildMainContent() {
Scroll() {
Column({ space: 16 }) {
if (this.currentTabIndex === 0) {
this.buildHomeContent()
} else if (this.currentTabIndex === 1) {
this.buildContactsContent()
} else if (this.currentTabIndex === 2) {
this.buildCalendarContent()
} else if (this.currentTabIndex === 3) {
this.buildGreetingsContent()
} else if (this.currentTabIndex === 4) {
this.buildSettingsContent()
}
}
.padding(16)
}
.layoutWeight(1)
.scrollBar(BarState.Off)
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L311-L332
|
3bd912b0a8f5918e7d233abfe1a03922a64da0f2
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/entryability/EntryAbility.ets
|
arkts
|
handleForeground
|
处理应用回到前台
|
private handleForeground(): void {
// TODO: 刷新生日提醒数据
// TODO: 检查通知权限
// TODO: 更新UI状态
}
|
AST#method_declaration#Left private handleForeground 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 { // TODO: 刷新生日提醒数据 // TODO: 检查通知权限 // TODO: 更新UI状态 } AST#builder_function_body#Right AST#method_declaration#Right
|
private handleForeground(): void {
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L212-L216
|
29d5da224f4e792af54c39880d0dcabd8230651b
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ArkUI/PureTabsExt/entry/src/main/ets/common/constant/Constants.ets
|
arkts
|
Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export class Constants {
/**
* Full screen width.
*/
static readonly FULL_WIDTH: string = '100%';
/**
* Full screen height.
*/
static readonly FULL_HEIGHT: string = '100%';
}
|
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { /**
* Full screen width.
*/ AST#property_declaration#Left static readonly FULL_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /**
* Full screen height.
*/ AST#property_declaration#Left static readonly FULL_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class Constants {
static readonly FULL_WIDTH: string = '100%';
static readonly FULL_HEIGHT: string = '100%';
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/PureTabsExt/entry/src/main/ets/common/constant/Constants.ets#L16-L25
|
64ee668fd11b8fa8a4952fabd9de3965a4d06680
|
gitee
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
|
arkts
|
asDBPlan
|
MARK: - DBPlanとの交換 / 转换为 DBPlan
|
asDBPlan(): DBPlan {
let dbPlan = new DBPlan();
dbPlan.planId = this.planId;
dbPlan.planName = this.planName;
dbPlan.bookId = this.bookId;
dbPlan.countPerDay = this.countPerDay;
dbPlan.startDate = this.startDate;
dbPlan.distances = this.distances.join(",");
dbPlan.process = this.process;
return dbPlan;
}
|
AST#method_declaration#Left asDBPlan AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DBPlan AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dbPlan = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DBPlan 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 dbPlan AST#expression#Right . planId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . planId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left dbPlan AST#expression#Right . planName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . planName 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 dbPlan AST#expression#Right . bookId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bookId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left dbPlan AST#expression#Right . countPerDay AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . countPerDay 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 dbPlan AST#expression#Right . startDate AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startDate 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 dbPlan AST#expression#Right . distances AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . distances AST#member_expression#Right AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "," AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 dbPlan AST#expression#Right . process AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . process 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#return_statement#Left return AST#expression#Left dbPlan AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
asDBPlan(): DBPlan {
let dbPlan = new DBPlan();
dbPlan.planId = this.planId;
dbPlan.planName = this.planName;
dbPlan.bookId = this.bookId;
dbPlan.countPerDay = this.countPerDay;
dbPlan.startDate = this.startDate;
dbPlan.distances = this.distances.join(",");
dbPlan.process = this.process;
return dbPlan;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L408-L418
|
bb3626059622a3b35266dc41fd593df96665655b
|
github
|
open9527/OpenHarmony
|
fdea69ed722d426bf04e817ec05bff4002e81a4e
|
entry/src/main/ets/common/component/TextMatchUtils.ets
|
arkts
|
topic
|
export class TopicMatchRegExp extends TextMatchRegExp {
topicInfos: TopicInfoInterface[] = []
getTopicId(title: string): string {
return this.topicInfos.find(element => element.title == title)?.topicId ?? ''
}
|
AST#export_declaration#Left export AST#class_declaration#Left class TopicMatchRegExp extends AST#type_annotation#Left AST#primary_type#Left TextMatchRegExp AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#ERROR#Left topicInfos : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TopicInfoInterface [ ] 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#ERROR#Left getTopicId AST#ERROR#Right ( 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#member_expression#Left AST#expression#Left title AST#expression#Right AST#ERROR#Left : AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ) : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right { return this AST#ERROR#Right . topicInfos AST#member_expression#Right AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left element => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left element AST#expression#Right . title AST#member_expression#Right AST#expression#Right == AST#expression#Left title 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 ?. topicId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class TopicMatchRegExp extends TextMatchRegExp {
topicInfos: TopicInfoInterface[] = []
getTopicId(title: string): string {
return this.topicInfos.find(element => element.title == title)?.topicId ?? ''
}
|
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/common/component/TextMatchUtils.ets#L199-L204
|
c64533838ed2fbb3a064d6a4b3aeb1beb4a4f44b
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVPlayerModel.ets
|
arkts
|
regAVPlayerCallback
|
注册avplayer回调函数
@param avPlayer AVPlayer实例
@param timeUpdateCb 歌曲时间更新回调
@param stateUpdateCb avplayer状态更新回调
@param completeCb avplayer单曲完成回调
@returns {void}
|
private regAVPlayerCallback(
avPlayer: media.AVPlayer,
timeUpdateCb: Function,
stateUpdateCb: Function,
completeCb: Function
): void {
// seek操作结果回调函数
avPlayer.on('seekDone', (seekDoneTime: number) => {
logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
// error回调监听函数,当avPlayer在操作过程中出现错误时调用 reset接口触发重置流程
avPlayer.on('error', (err: BusinessError) => {
logger.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
// 调用reset重置资源,触发idle状态
avPlayer.reset();
})
// 歌曲时间进度更新
avPlayer.on('timeUpdate', (newTime: number) => {
timeUpdateCb(newTime);
})
// 状态机变化回调函数
avPlayer.on('stateChange', (state: media.AVPlayerState) => {
stateUpdateCb(state);
switch (state) {
// 成功调用reset接口后触发该状态机上报
case CommonConstants.AVPLAYER_STATE_IDLE:
logger.debug('AVPlayer state idle called.');
|
AST#method_declaration#Left private regAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeUpdateCb : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stateUpdateCb : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left completeCb : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right { // seek操作结果回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'seekDone' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left seekDoneTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AVPlayer seek succeeded, seek time is AST#template_substitution#Left $ { AST#expression#Left seekDoneTime AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // error回调监听函数,当avPlayer在操作过程中出现错误时调用 reset接口触发重置流程 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'error' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Invoke avPlayer failed, code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 调用reset重置资源,触发idle状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 歌曲时间进度更新 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'timeUpdate' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left newTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left timeUpdateCb AST#expression#Right AST#argument_list#Left ( AST#expression#Left newTime AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 状态机变化回调函数 AST#expression#Left AST#member_expression#Left AST#expression#Left avPlayer AST#expression#Right . on AST#member_expression#Right AST#expression#Right ( AST#member_expression#Left AST#expression#Left 'stateChange' AST#expression#Right AST#ERROR#Left , AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayerState AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left stateUpdateCb 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_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left state AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right { // 成功调用reset接口后触发该状态机上报 AST#property_name#Left case AST#property_name#Right CommonConstants AST#ERROR#Right . AVPLAYER_STATE_IDLE AST#member_expression#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . debug AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'AVPlayer state idle called.' ) AST#ERROR#Right ; AST#method_declaration#Right
|
private regAVPlayerCallback(
avPlayer: media.AVPlayer,
timeUpdateCb: Function,
stateUpdateCb: Function,
completeCb: Function
): void {
avPlayer.on('seekDone', (seekDoneTime: number) => {
logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
avPlayer.on('error', (err: BusinessError) => {
logger.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
avPlayer.reset();
})
avPlayer.on('timeUpdate', (newTime: number) => {
timeUpdateCb(newTime);
})
avPlayer.on('stateChange', (state: media.AVPlayerState) => {
stateUpdateCb(state);
switch (state) {
case CommonConstants.AVPLAYER_STATE_IDLE:
logger.debug('AVPlayer state idle called.');
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVPlayerModel.ets#L83-L110
|
d746ebb80897bc943a9698ea287584857f243043
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets
|
arkts
|
deleteAddress
|
删除地址
@param {{ ids: number[] }} params - 地址 ID 集合
@returns {Promise<NetworkResponse<void>>} 删除结果
|
async deleteAddress(params: Ids): Promise<NetworkResponse<void>> {
const resp: AxiosResponse<NetworkResponse<void>> =
await NetworkClient.http.post("user/address/delete", params);
return resp.data;
}
|
AST#method_declaration#Left async deleteAddress AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Ids AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#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 resp : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse 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#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 AST#await_expression#Left await AST#expression#Left NetworkClient AST#expression#Right AST#await_expression#Right AST#expression#Right . http AST#member_expression#Right AST#expression#Right . post AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "user/address/delete" AST#expression#Right , 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left resp AST#expression#Right . data AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async deleteAddress(params: Ids): Promise<NetworkResponse<void>> {
const resp: AxiosResponse<NetworkResponse<void>> =
await NetworkClient.http.post("user/address/delete", params);
return resp.data;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets#L48-L52
|
9f0a226431ce0e714a38a0d6ffefe4d420143df7
|
github
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/api/Router.ets
|
arkts
|
getNavStackByName
|
根据栈名获取路由栈,【初次调用会创建一个实例,并入参到Navigation构造方法中】
@param stackName
@returns
|
public static getNavStackByName(stackName: string): NavPathStack {
return ZRouter.getRouterMgr().getNavStackByName(stackName)
}
|
AST#method_declaration#Left public static getNavStackByName AST#parameter_list#Left ( AST#parameter#Left stackName : 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 NavPathStack AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ZRouter AST#expression#Right . getRouterMgr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getNavStackByName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left stackName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static getNavStackByName(stackName: string): NavPathStack {
return ZRouter.getRouterMgr().getNavStackByName(stackName)
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L253-L255
|
8177390cea40e6d80f20676c5fb026b3bc90ba5a
|
gitee
|
openharmony/applications_launcher
|
f75dfb6bf7276e942793b75e7a9081bbcd015843
|
feature/form/src/main/ets/default/view/FormManagerComponent.ets
|
arkts
|
clearNoUseFormById
|
Keep the form which be added to the desktop, and delete the remaining forms.
|
private clearNoUseFormById(): void {
for (let i = 0; i < this.mFormIdMap.size; i++) {
if (i != this.mSwiperIndex) {
this.mFormModel.deleteFormByFormID(this.mFormIdMap.get(i));
}
}
}
|
AST#method_declaration#Left private clearNoUseFormById AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 . mFormIdMap AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 . mSwiperIndex 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 . mFormModel AST#member_expression#Right AST#expression#Right . deleteFormByFormID AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFormIdMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private clearNoUseFormById(): void {
for (let i = 0; i < this.mFormIdMap.size; i++) {
if (i != this.mSwiperIndex) {
this.mFormModel.deleteFormByFormID(this.mFormIdMap.get(i));
}
}
}
|
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/form/src/main/ets/default/view/FormManagerComponent.ets#L119-L125
|
73845def7586e6fb8a1fcbdceff2fc2a5b3b3e25
|
gitee
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/core/dialog/SelectDialog.ets
|
arkts
|
【系统】SelectDialog单选系统弹框
@description 该弹窗采用系统SelectDialog单选系统弹框view,所以样式和内容构建参照系统参数设置。(ISelectDialogOptions 即 SelectDialog 的参数)
|
export class SelectDialog extends BaseModalDialog implements IDialog {
protected getBuilder(): WrappedBuilder<[IBaseDialogOptions]> {
return wrapBuilder(SelectDialogBuilder) as WrappedBuilder<[IBaseDialogOptions]>
}
protected initModalOptions(options: ISelectDialogOptions): IBaseDialogOptions {
return this.initBase(options)
}
/*------------------------- 保护、私有方法 protected | private methods -------------------------*/
private initBase(options: ISelectDialogOptions): ISelectDialogOptions {
if (options.confirm) {
options.confirm = this.initButton(options, options.confirm, false, 0) as ButtonOptions
}
if (options.radioContent?.length && options.actionCancel) {
options.radioContent = options.radioContent.map(item => {
return this.initButton(options, item, false, 0) as SheetInfo
})
}
return options
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class SelectDialog extends AST#type_annotation#Left AST#primary_type#Left BaseModalDialog AST#primary_type#Right AST#type_annotation#Right AST#implements_clause#Left implements IDialog AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left protected getBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left IBaseDialogOptions AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left SelectDialogBuilder AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left 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 IBaseDialogOptions AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left protected initModalOptions AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ISelectDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left IBaseDialogOptions 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 this AST#expression#Right . initBase 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 /*------------------------- 保护、私有方法 protected | private methods -------------------------*/ AST#method_declaration#Left private initBase AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ISelectDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ISelectDialogOptions 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 options AST#expression#Right . confirm 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 options AST#expression#Right . confirm AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ButtonOptions 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#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . radioContent AST#member_expression#Right AST#expression#Right ?. length AST#member_expression#Right AST#expression#Right && AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . actionCancel 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 options AST#expression#Right . radioContent AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . radioContent AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right , AST#expression#Left item AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left SheetInfo 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_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 options AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class SelectDialog extends BaseModalDialog implements IDialog {
protected getBuilder(): WrappedBuilder<[IBaseDialogOptions]> {
return wrapBuilder(SelectDialogBuilder) as WrappedBuilder<[IBaseDialogOptions]>
}
protected initModalOptions(options: ISelectDialogOptions): IBaseDialogOptions {
return this.initBase(options)
}
private initBase(options: ISelectDialogOptions): ISelectDialogOptions {
if (options.confirm) {
options.confirm = this.initButton(options, options.confirm, false, 0) as ButtonOptions
}
if (options.radioContent?.length && options.actionCancel) {
options.radioContent = options.radioContent.map(item => {
return this.initButton(options, item, false, 0) as SheetInfo
})
}
return options
}
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/SelectDialog.ets#L12-L33
|
3622ff1468c3ace69d6634fcaeeeaa691c479d37
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/StatisticsPage.ets
|
arkts
|
onPageShow
|
页面生命周期 - 页面显示时
|
onPageShow() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'StatisticsPage onPageShow - refreshing statistics');
// 每次页面显示时刷新统计数据
this.loadStatisticsData();
}
|
AST#method_declaration#Left onPageShow 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 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 'StatisticsPage onPageShow - refreshing statistics' 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 . loadStatisticsData 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
|
onPageShow() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'StatisticsPage onPageShow - refreshing statistics');
this.loadStatisticsData();
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/StatisticsPage.ets#L42-L46
|
8bf7e5b41d47a948e6a75e5a6f10d0741c243d89
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/ArrayUtil.ets
|
arkts
|
union
|
平铺二维数组,并去重。
@param arrays 数组
@returns 返回一个新的数组
|
static union(arrays: string[][]): string[] {
return Array.from(new Set(arrays.flat()));
}
|
AST#method_declaration#Left static union AST#parameter_list#Left ( AST#parameter#Left arrays : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] 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 Array AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arrays AST#expression#Right . flat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static union(arrays: string[][]): string[] {
return Array.from(new Set(arrays.flat()));
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ArrayUtil.ets#L167-L169
|
09214ca7293fceda4edeef68dcc3da5016a77b08
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/common/router/AppRouter.ets
|
arkts
|
goGreetingSend
|
跳转到祝福语发送页面
@param contactId 联系人ID
@param greetingId 祝福语ID(可选)
|
async goGreetingSend(contactId: string, greetingId?: string): Promise<void> {
const params: RouteParams = { contactId, greetingId };
const options: RouteOptions = { params };
await this.push(RoutePaths.GREETING_SEND, options);
}
|
AST#method_declaration#Left async goGreetingSend AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left greetingId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left RouteParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left contactId AST#property_assignment#Right , AST#property_assignment#Left greetingId 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 options : AST#type_annotation#Left AST#primary_type#Left RouteOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left params AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_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 RoutePaths AST#expression#Right . GREETING_SEND AST#member_expression#Right AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async goGreetingSend(contactId: string, greetingId?: string): Promise<void> {
const params: RouteParams = { contactId, greetingId };
const options: RouteOptions = { params };
await this.push(RoutePaths.GREETING_SEND, options);
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L290-L294
|
d3c1d6d324a2c3a4417b64fe6d9066a284d95252
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Data/SetAppFontSize/entry/src/main/ets/common/database/PreferencesUtil.ets
|
arkts
|
The PreferencesUtil provides preferences of create, save and query.
|
export class PreferencesUtil {
createFontPreferences(context: Context) {
let fontPreferences: Function = (() => {
let preferences: Promise<dataPreferences.Preferences> = dataPreferences.getPreferences(context,
PREFERENCES_NAME);
return preferences;
});
GlobalContext.getContext().setObject('getFontPreferences', fontPreferences);
}
saveDefaultFontSize(fontSize: number) {
let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;
getFontPreferences().then((preferences: dataPreferences.Preferences) => {
preferences.has(KEY_APP_FONT_SIZE).then(async (isExist: boolean) => {
Logger.info(TAG, 'preferences has changeFontSize is ' + isExist);
if (!isExist) {
await preferences.put(KEY_APP_FONT_SIZE, fontSize);
preferences.flush();
}
}).catch((err: Error) => {
Logger.error(TAG, 'Has the value failed with err: ' + err);
});
}).catch((err: Error) => {
Logger.error(TAG, 'Get the preferences failed, err: ' + err);
});
}
saveChangeFontSize(fontSize: number) {
let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;
getFontPreferences().then(async (preferences: dataPreferences.Preferences) => {
await preferences.put(KEY_APP_FONT_SIZE, fontSize);
preferences.flush();
}).catch((err: Error) => {
Logger.error(TAG, 'put the preferences failed, err: ' + err);
});
}
async getChangeFontSize() {
let fontSize: number = 0;
let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;
fontSize = await (await getFontPreferences()).get(KEY_APP_FONT_SIZE, fontSize);
return fontSize;
}
async deleteChangeFontSize() {
let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;
const preferences: dataPreferences.Preferences = await getFontPreferences();
let deleteValue = preferences.delete(KEY_APP_FONT_SIZE);
deleteValue.then(() => {
Logger.info(TAG, 'Succeeded in deleting the key appFontSize.');
}).catch((err: Error) => {
Logger.error(TAG, 'Failed to delete the key appFontSize. Cause: ' + err);
});
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class PreferencesUtil AST#class_body#Left { AST#method_declaration#Left createFontPreferences AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fontPreferences : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#parenthesized_expression#Left ( 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 preferences : 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 dataPreferences . Preferences AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataPreferences AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left PREFERENCES_NAME AST#expression#Right ) AST#argument_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 preferences AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getFontPreferences' AST#expression#Right , AST#expression#Left fontPreferences AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left saveDefaultFontSize AST#parameter_list#Left ( AST#parameter#Left fontSize : 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 getFontPreferences : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getFontPreferences' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getFontPreferences 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#Left preferences : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dataPreferences . Preferences AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 preferences AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left KEY_APP_FONT_SIZE 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 async AST#parameter_list#Left ( AST#parameter#Left isExist : 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 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 'preferences has changeFontSize is ' AST#expression#Right + AST#expression#Left isExist 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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isExist 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 AST#await_expression#Left await AST#expression#Left preferences AST#expression#Right AST#await_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left KEY_APP_FONT_SIZE AST#expression#Right , AST#expression#Left fontSize AST#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 preferences AST#expression#Right . flush AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Has the value failed with err: ' AST#expression#Right + AST#expression#Left err 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#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 . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Get the preferences failed, err: ' AST#expression#Right + AST#expression#Left err 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left saveChangeFontSize AST#parameter_list#Left ( AST#parameter#Left fontSize : 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 getFontPreferences : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getFontPreferences' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getFontPreferences 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 async AST#parameter_list#Left ( AST#parameter#Left preferences : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dataPreferences . Preferences AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left preferences AST#expression#Right AST#await_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left KEY_APP_FONT_SIZE AST#expression#Right , AST#expression#Left fontSize AST#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 preferences AST#expression#Right . flush AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'put the preferences failed, err: ' AST#expression#Right + AST#expression#Left err 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left async getChangeFontSize AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fontSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left getFontPreferences : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getFontPreferences' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left fontSize = 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 AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getFontPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#await_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left KEY_APP_FONT_SIZE AST#expression#Right , AST#expression#Left fontSize 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 fontSize AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left async deleteChangeFontSize AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left getFontPreferences : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getFontPreferences' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left preferences : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dataPreferences . Preferences AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getFontPreferences AST#expression#Right AST#await_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 deleteValue = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left preferences AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left KEY_APP_FONT_SIZE AST#expression#Right ) AST#argument_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 deleteValue AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'Succeeded in deleting the key appFontSize.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Failed to delete the key appFontSize. Cause: ' AST#expression#Right + AST#expression#Left err 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class PreferencesUtil {
createFontPreferences(context: Context) {
let fontPreferences: Function = (() => {
let preferences: Promise<dataPreferences.Preferences> = dataPreferences.getPreferences(context,
PREFERENCES_NAME);
return preferences;
});
GlobalContext.getContext().setObject('getFontPreferences', fontPreferences);
}
saveDefaultFontSize(fontSize: number) {
let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;
getFontPreferences().then((preferences: dataPreferences.Preferences) => {
preferences.has(KEY_APP_FONT_SIZE).then(async (isExist: boolean) => {
Logger.info(TAG, 'preferences has changeFontSize is ' + isExist);
if (!isExist) {
await preferences.put(KEY_APP_FONT_SIZE, fontSize);
preferences.flush();
}
}).catch((err: Error) => {
Logger.error(TAG, 'Has the value failed with err: ' + err);
});
}).catch((err: Error) => {
Logger.error(TAG, 'Get the preferences failed, err: ' + err);
});
}
saveChangeFontSize(fontSize: number) {
let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;
getFontPreferences().then(async (preferences: dataPreferences.Preferences) => {
await preferences.put(KEY_APP_FONT_SIZE, fontSize);
preferences.flush();
}).catch((err: Error) => {
Logger.error(TAG, 'put the preferences failed, err: ' + err);
});
}
async getChangeFontSize() {
let fontSize: number = 0;
let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;
fontSize = await (await getFontPreferences()).get(KEY_APP_FONT_SIZE, fontSize);
return fontSize;
}
async deleteChangeFontSize() {
let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;
const preferences: dataPreferences.Preferences = await getFontPreferences();
let deleteValue = preferences.delete(KEY_APP_FONT_SIZE);
deleteValue.then(() => {
Logger.info(TAG, 'Succeeded in deleting the key appFontSize.');
}).catch((err: Error) => {
Logger.error(TAG, 'Failed to delete the key appFontSize. Cause: ' + err);
});
}
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/common/database/PreferencesUtil.ets#L27-L81
|
293931c49f71989e4aab4035368639b26c7dbc63
|
gitee
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.