common.service.d.ts
5.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import { GenFilter } from '../model/gen-filter';
import 'devextreme-intl';
export declare class Common {
DATE_FORMAT: string;
constructor();
/**
* fn. เช็ค data ทุกประเภท จะ Return กลับไปเป็น true|false
* @param data
*/
isNotEmpty(data: any): boolean;
/**
* fn. ปั้น filter สำหรับ Custom Store แบบมี field,filter,orderby
* @param filterOptions : {}
*/
fnGenFilter(filterOptions: GenFilter): {};
fnCheckLoadOptions(loadOptions: any): {
limit: string;
offset: string;
order_by: any[];
};
fnCheckFilterData(filterList: any, exceptionList: any): {
fields: string;
filter: string;
offset: string;
limit: string;
orderby: string;
};
fnCheckOptions(data1: any, data2: any, options: any): any;
fnRemoveEmptyKey(obj: any): any;
fnConverstFilterDate(filter: any, exceptionList: any): any;
/**
* fn. ปั้น filter สำหรับ Custom Store แบบ basic
* @param loadOptions
*/
fnGenFilterBasic(loadOptions: any): string;
/**
* แปลงวันที่ จาก String เป็น Type Date
* @param date วันที่ ที่ต้องการแปลง
* @param formatOfDate ถ้ารู้ format ของ date ที่ส่งเข้ามาให้ระบุด้วย
*/
fnToDate(date: any, formatOfDate?: any): Date;
/**
* แปลงวันที่ จาก String เป็น Type Date โดยมีอิง format จาก DB 'YYYY-MM-DD'
* @param date วันที่ ที่ต้องการแปลง
*/
fnLToDateFromDB(date: any): Date;
/**
* เปลี่ยนภาษา Date Picker ของ Prime NG
* @param local ภาษา
*/
fnLocalPCalendar(local: any): {
firstDayOfWeek: number;
dayNames: string[];
dayNamesShort: string[];
dayNamesMin: string[];
monthNames: string[];
monthNamesShort: string[];
today: string;
clear: string;
};
collapseFn(id: any): void;
/**
* เซ็ต action delete สำหรับส่ง post ไป api
* @param idList id ที่ลบ
* @param dataList array data ที่ต้องการจัดการ
*/
fnFlagDelete(idList: any[], dataList: any[]): any[];
/**
* เซ็ต action edit สำหรับส่ง post ไป api
* @param dataList array data ที่ต้องการจัดการ
* @param nameId ชื่อ ref id ของ table
* @param mainId ค่า ref id ของ table
*/
fnFlagEdit(dataList: any[]): any[];
/**
* เซ็ตค่าเมื่อกด edit
* @param dataList array data ที่ต้องการจัดการ
* @param data data ของ row ปัจจุบัน หรือ data ที่ต้องการเอาค่าไปอัพเดตให้ array data
* @param nameId ชื่อ ref id ของ table
* @param mainId ค่า ref id ของ table
*/
fnSetValueEdit(dataList: any[], data: any): any[];
/**
* ลบ id ชั่วคราวที่สร้างขึ้นมาใช้สำหรับ datagrid
* @param dataList array data ที่ต้องการจัดการ
*/
fnRemoveFakeId(dataList: any[]): any[];
/**
* check response และแสดง modal ตาม result code
* @param response data ที่ส่งมาจาก api
* @param modal modal ที่ผูกกับ UI นั้น ๆ
*/
fnCheckResponse(response: any, modal: any): void;
/**
* fn จัดการ action ของ data CRUD
* @param a datalist ที่เก็บไว้ตอน Get
* @param b datalist ปัจจุบันที่เปลี่ยนแปลง
* @param idName key key หลักที่ต้องการใช้เปรียบเทียบ
*/
fnBuildArrayAction(a: any, b: any, idName?: string): any;
/**
* fn ปั้นข้อความหัว Table
* @param result ผลลัพ data ที่ได้จาก custom store
*/
fnGenTextTotal(result: any): string;
/**
* fn ปั้นข้อความหัว Table สำหรับ datasource แบบ get ครั้งเดียว
* @param event event ที่ได้จาก event onOptionChanged
*/
fnGenTextTotalRaw(event: any): Promise<{}>;
/** fn เปลี่ยน calendar devextreme ให้ปี เป็นแบบ พ.ศ. */
fnChangeCalendarYear(): void;
fnChangeCalendarYearOnce(): void;
fnGenUuid(): string;
/**
* fn แปลง date ก่อนส่งไปให้ API
* @param dataList data ที่ต้องการจัดการหรือ model ที่ผูก
* @param fieldList list รายชื่อ field ที่ต้องการแปลง date
*/
fnFormatDateList(dataList: any, fieldList: any[]): any;
/**
* fn. แปลง string date จาก db เป็น วัน เวลา ประเทศไทย
* @param value String date ที่ต้องการแปลง
*/
fnDisplayFormatDate(value: any): string;
replacer(key: any, value: any): any;
replacernotrim(key: any, value: any): any;
convertTHShortDate(date: any): string;
NumberToThaiNumber(Number: any): any;
fnGetMonthTH(month: any, short: any): string;
convertTHDate(date: any, format: any, typeTH: any): any;
}