-
Notifications
You must be signed in to change notification settings - Fork 26
/
index.d.ts
190 lines (120 loc) · 4.95 KB
/
index.d.ts
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
// @ts-ignore
import React from 'react'
// @ts-ignore
import {Image, TextProps, TouchableOpacityProps, FlatListProps, SectionListProps, ViewStyle} from 'react-native'
interface XStorage {
initStorage(targetObj: object, storageImp: object, initializedCallback: () => void, dataChangedCallback?: (dataSet) => void): string
initStorageSync(targetObj: object, storageImp: object, dataChangedCallback?: (dataSet) => void): Promise<boolean>;
multiGet(keys: string[]): Promise<any>;
saveItems(keyValuePairs: string[][]): Promise<any>;
removeItems(keys: string[]): Promise<any>;
clear(): Promise<any>;
}
// Storage
export var XStorage: XStorage;
interface HttpRequest {
constructor(serverTag?: string)
url(url: string): HttpRequest;
param(param: object): HttpRequest;
paramRaw(paramRaw: object): HttpRequest;
contentType(contentType: string): HttpRequest;
internal(internal: boolean): HttpRequest;
header(header: object): HttpRequest;
extra(extra: any): HttpRequest;
timeout(timeout: number): HttpRequest;
loadingFunc(func: (loading: boolean) => void): HttpRequest;
configCommonFunc(enableHeaderFunc: boolean, enableParamFunc: boolean): HttpRequest;
rawData(): HttpRequest;
pureText(): HttpRequest;
formJson(): HttpRequest;
formData(): HttpRequest;
formEncoded(): HttpRequest;
get(callback: (success: boolean, json: object, message: string, status: number) => void): void;
post(callback: (success: boolean, json: object, message: string, status: number) => void): void;
options(callback: (success: boolean, json: object, message: string, status: number) => void): void;
put(callback: (success: boolean, json: object, message: string, status: number) => void): void;
delete(callback: (success: boolean, json: object, message: string, status: number) => void): void;
patch(callback: (success: boolean, json: object, message: string, status: number) => void): void;
request(method: string, callback: (success: boolean, json: object, message: string, status: number) => void): void;
execute(method: string): Promise<any>
fetch(method: string): Promise<any>
}
interface HttpConfig {
constructor(serverTag?: string)
initBaseUrl(baseUrl: string): HttpConfig;
initTimeout(timeout: number): HttpConfig;
initLogOn(logOn: boolean): HttpConfig;
initHeaderSetFunc(headerSetFunc: (headers: object, request: object) => void): HttpConfig;
initParamSetFunc(paramSetFunc: (params: object, request: object) => void): HttpConfig;
initParseDataFunc(result: object, request: object, callback: (success: boolean, data: object, message: string, status: number, response: object) => void): HttpConfig;
initContentType(contentType: string): HttpConfig;
initLoadingFunc(loadingFunc: (loading: boolean) => void): HttpConfig;
initEncodeURIComponent(encodeComponent: boolean): HttpConfig;
initNetworkExceptionFunc(netInfo, networkExceptionFunc: (message: string, code: number) => void): HttpConfig;
}
interface XHttpConst {
TIMEOUT: number,
CONTENT_TYPE_JSON: string,
CONTENT_TYPE_FORM_DATA: string,
CONTENT_TYPE_URLENCODED: string,
ServerTag: string,
Methods: object,
errorDesc: object
statusDesc: object,
}
// XHttpConst
export var XHttpConst: XHttpConst;
// Http HttpRequest
export var HttpRequest: HttpRequest;
// Http HttpConfig
export var HttpConfig: HttpConfig;
export function XHttp(serverTag?: string): HttpRequest
export function XHttpConfig(serverTag?: string): HttpConfig
export function XSize(size: number): number
export function XTSize(size: number): number
export function ResetStyle(style: ViewStyle): ViewStyle
export function SplitStyle(style: ViewStyle): object
export function FattenStyle(style: ViewStyle): ViewStyle
interface XWidget {
initResource(imageBaseUrl: string): XWidget;
initReferenceScreen(targetWidth: number, targetHeight: number): XWidget;
}
// Widget Resource
export var XWidget: XWidget;
export interface XImageProps {
raw?: boolean
icon: string,
iconSize?: number,
}
// XImage
export class XImage extends React.Component<XImageProps & TouchableOpacityProps> {
}
declare type IconPosition = 'left' | 'top' | 'right' | 'bottom';
export interface XTextProps {
raw?: boolean,
text: string,
icon?: string,
iconSize?: number,
iconStyle?: object,
resizeMode?: string,
iconMargin?: number,
textExtend?: boolean,
iconPosition?: IconPosition,
}
// XText
export class XText extends React.Component<XTextProps & TextProps & TouchableOpacityProps> {
}
// XView
export class XView extends React.Component<TouchableOpacityProps> {
}
export interface XFatListProps {
onLoadMore?: Function,
noDataText?: string,
noDataImage?: boolean,
indicatorOffset?: number,
refreshStatus?: object,
emptyViewHeight?: number,
}
// XFlatList
export class XFlatList extends React.Component<XFatListProps & FlatListProps<any> & SectionListProps<any>> {
}