forked from Sight-wcg/layui-dts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmisc.d.ts
More file actions
276 lines (269 loc) · 7.34 KB
/
Copy pathmisc.d.ts
File metadata and controls
276 lines (269 loc) · 7.34 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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
declare namespace Layui {
// utils
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
type Fn = () => void;
type AnyFn = (...args: any[]) => any;
type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
type MaybeArray<T> = T | T[];
type MaybePromise<T> = T | Promise<T> | JQuery.Deferred<T>;
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type PlainObject<T = any> = {
[key: string]: T;
};
type OmitIndexSignature<ObjectType> = {
[
KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never
: KeyType
]: ObjectType[KeyType];
};
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
type LiteralStringUnion<T> = LiteralUnion<T, string>;
type Selector = string;
type ExportsCallback = (this: Layui, fn: (app: string, exports: object) => void) => void;
/**
* 全局属性
*/
interface GlobalConfigOptions {
/**
* layui.js 所在目录(如果是 script 单独引入 layui.js,无需设定该参数)
*/
dir?: string;
/**
* 一般用于更新模块缓存,默认不开启。设为 true 即让浏览器不缓存。也可以设为一个固定的值,如:201610
*/
version?: boolean;
/**
* 用于开启调试模式,默认 false,如果设为 true,则 JS 模块的节点会保留在页面
*/
debug?: boolean;
/**
* 设定扩展的 layui 模块的所在目录,一般用于外部模块扩展
*/
base?: string;
}
/**
* 缓存的所有数据
*/
interface CacheData {
base: string;
builtin: {
[T in keyof BuiltinModules]: string;
};
/**
* 记录模块回调
*/
callback: {
[T in keyof GlobalModules]: AnyFn;
};
/**
* layui.js所在目录,如果是 script 单独引入 layui.js,无需设定该参数
*/
dir: string;
/**
* 记录模块自定义事件
*/
event: Record<string, Record<string, Array<AnyFn>>>;
host: string;
/**
* 记录模块物理路径
*/
modules: ModulesPathMap;
/**
* 记录模块加载状态
*/
status: {
[T in keyof GlobalModules]: boolean;
};
/**
* 符合规范的模块请求最长等待秒数
*/
timeout: number;
version: string;
}
/**
* 内置模块名和外置名称映射
*/
type ModulesPathMap = { [T in keyof GlobalModules]: string };
interface GlobalModules extends Omit<BuiltinModules, "all"> {
[index: string]: any;
}
interface BuiltinModules {
/**
* 用于标识的属性
* @internal
*/
all: any;
/**
* 轮播
* @see https://layui.dev/docs/2/carousel/
*/
carousel: Carousel;
/**
* 代码预览
* @see https://layui.dev/docs/2/code/
*/
code: Code;
/**
* 颜色选择器
* @see https://layui.dev/docs/2/colorpicker/
*/
colorpicker: ColorPicker;
/**
* 组件构建器
* @see https://layui.dev/docs/2/component/
* @since 2.10.0
*/
component: ComponentBuilder;
/**
* 下拉菜单
* @see https://layui.dev/docs/2/dropdown/
*/
dropdown: Dropdown;
/**
* 元素操作
* @see https://layui.dev/docs/2/nav/ - 导航栏
* @see https://layui.dev/docs/2/tab/ - 选项卡
* @see https://layui.dev/docs/2/panel/ - 折叠面板
* @see https://layui.dev/docs/2/progress/ - 进度条
* @see https://layui.dev/docs/2/nav/#separator - 面包屑
*/
element: Element;
/**
* 流加载
* @see https://layui.dev/docs/2/flow/
*/
flow: Flow;
/**
* 表单
* @see https://layui.dev/docs/2/form/
*/
form: Form;
jquery: JQueryStatic;
/**
* layui 内部使用的工具函数
*
* 请谨慎使用,不保证兼容性
* @internal
*/
lay: LayStatic;
/**
* 日期选择器
* @see https://layui.dev/docs/2/laydate/
*/
laydate: Laydate;
/**
* 富文本编辑器
* @deprecated 2.8.0 已移除
*/
layedit: Layedit;
/**
* 弹层
* @see https://layui.dev/docs/2/layer/
*/
layer: Layer;
/**
* 分页
* @see https://layui.dev/docs/2/laypage/
*/
laypage: Laypage;
/**
* 模板引擎
* @see https://layui.dev/docs/2/laytpl/
*/
laytpl: Laytpl;
/**
* 用于标识的属性
* @internal
*/
"layui.all": string;
/**
* 评分
* @see https://layui.dev/docs/2/rate/
* @since 2.11.0 后继承自 Component 组件
*/
rate: Rate;
/**
* 滑块
* @see https://layui.dev/docs/2/slider/
*/
slider: Slider;
/**
* 表格
* @see https://layui.dev/docs/2/table
*/
table: Table;
/**
* 标签页
* 该组件继承自 Component 组件
* @see https://layui.dev/docs/2/tabs/
* @since 2.10.0
*/
tabs: Tabs;
/**
* 树形表格
* @since 2.8.0
* @see https://layui.dev/docs/2/treeTable/
*/
treeTable: TreeTable;
/**
* 穿梭框
* @see https://layui.dev/docs/2/transfer/
*/
transfer: Transfer;
/**
* 树
* @see https://layui.dev/docs/2/tree/
*/
tree: Tree;
/**
* 上传
* @see https://layui.dev/docs/2/upload/
*/
upload: Upload;
/**
* 工具集
* @see https://layui.dev/docs/2/util/
*/
util: Util;
}
/**
* 地址中的参数和路径信息
*/
interface UrlHash {
hash: string;
href?: string;
/**
* @deprecated 2.11.0 已废弃,使用 {@link UrlHash["pathname"]|pathname}
*/
path: string[];
pathname: string[];
search: { [index: string]: string };
}
interface deviceReturn {
/**
* 当前浏览器所在的底层操作系统,如:Windows、Linux、Mac 等
*/
os: string;
/**
* 当前浏览器是否为 ie6-11 的版本,如果不是 ie 浏览器,则为 false
*/
ie: boolean;
/**
* 当前浏览器是否为微信 App 环境
*/
weixin: boolean;
/**
* 当前浏览器是否为安卓系统环境
*/
android: boolean;
/**
* 当前浏览器是否为 iOS 系统环境
*/
ios: boolean;
/**
* 当前浏览器是否为移动设备环境
* @since v2.5.7
*/
mobile: boolean;
}
}