vue-popup-plus-plugin-preset 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PAlbum-BKExygsA.js +386 -0
- package/dist/PAlert-U35iHW1d.js +67 -0
- package/dist/PBody-B8SE3ACJ.js +129 -0
- package/dist/PButtonGroup-CfAPVmCi.js +80 -0
- package/dist/PConfirm-C7fPAwiu.js +79 -0
- package/dist/PDialog-Ch6TTWxG.js +72 -0
- package/dist/PFooter-Dd8fzezl.js +14 -0
- package/dist/PLoadingMask-D37Mt0Yw.js +61 -0
- package/dist/PPrompt-D0wfhr75.js +109 -0
- package/dist/PToast-WfcchnMz.js +24 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/vue-popup-plus-plugin-preset.d.ts +407 -0
- package/dist/vue-popup-plus-plugin-preset.js +234 -0
- package/dist/vue-popup-plus-plugin-preset.umd.cjs +3 -0
- package/package.json +68 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { PopupPlugin } from 'vue-popup-plus';
|
|
3
|
+
|
|
4
|
+
declare type AlbumOption = {
|
|
5
|
+
/**
|
|
6
|
+
* 数据源
|
|
7
|
+
* - 支持主流图片资源和视频资源
|
|
8
|
+
*/
|
|
9
|
+
sources: Array<string>;
|
|
10
|
+
/**
|
|
11
|
+
* 默认选中的媒体索引
|
|
12
|
+
* - 默认值为 `0`
|
|
13
|
+
*/
|
|
14
|
+
defaultIndex?: number;
|
|
15
|
+
/**
|
|
16
|
+
* 是否禁用当前索引和总索引
|
|
17
|
+
* - 默认值为 `false`
|
|
18
|
+
*/
|
|
19
|
+
countDisabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 是否禁用媒体名称
|
|
22
|
+
* - 默认值为 `false`
|
|
23
|
+
*/
|
|
24
|
+
nameDisabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 是否禁用纯模式
|
|
27
|
+
* - 默认值为 `false`
|
|
28
|
+
*/
|
|
29
|
+
pureDisabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 是否禁用下载功能
|
|
32
|
+
* - 默认值为 `false`
|
|
33
|
+
* - 注意:下载功能仅在资源地址支持跨域时生效
|
|
34
|
+
*/
|
|
35
|
+
downloadDisabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 是否禁用缩放功能
|
|
38
|
+
* - 默认值为 `false`
|
|
39
|
+
*/
|
|
40
|
+
scaleDisabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 是否禁用拖动功能
|
|
43
|
+
* - 默认值为 `false`
|
|
44
|
+
*/
|
|
45
|
+
dragDisabled?: boolean;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
declare type AlertOption = {
|
|
49
|
+
/**
|
|
50
|
+
* 提示框标题
|
|
51
|
+
* - 默认值:`提示`
|
|
52
|
+
*/
|
|
53
|
+
title?: string;
|
|
54
|
+
/**
|
|
55
|
+
* 确认按钮文本
|
|
56
|
+
* - 默认值:`确定`
|
|
57
|
+
*/
|
|
58
|
+
confirmText?: string;
|
|
59
|
+
/**
|
|
60
|
+
* 是否可拖动
|
|
61
|
+
* - 默认值:`false`
|
|
62
|
+
*/
|
|
63
|
+
draggable?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* 是否可拖动超出窗口边界
|
|
66
|
+
* - 默认值:`false`
|
|
67
|
+
*/
|
|
68
|
+
dragOverflow?: boolean;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
declare type ConfirmOption = {
|
|
72
|
+
/**
|
|
73
|
+
* 确认框标题
|
|
74
|
+
* - 默认值:`确认`
|
|
75
|
+
*/
|
|
76
|
+
title?: string;
|
|
77
|
+
/**
|
|
78
|
+
* 确认按钮文本
|
|
79
|
+
* - 默认值:`确定`
|
|
80
|
+
*/
|
|
81
|
+
confirmText?: string;
|
|
82
|
+
/**
|
|
83
|
+
* 取消按钮文本
|
|
84
|
+
* - 默认值:`取消`
|
|
85
|
+
*/
|
|
86
|
+
cancelText?: string;
|
|
87
|
+
/**
|
|
88
|
+
* 是否可拖动
|
|
89
|
+
* - 默认值:`false`
|
|
90
|
+
*/
|
|
91
|
+
draggable?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* 是否可拖动超出窗口边界
|
|
94
|
+
* - 默认值:`false`
|
|
95
|
+
*/
|
|
96
|
+
dragOverflow?: boolean;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
declare const _default: PopupPlugin;
|
|
100
|
+
export default _default;
|
|
101
|
+
|
|
102
|
+
export declare interface IAlbum {
|
|
103
|
+
/**
|
|
104
|
+
* 显示媒体相册
|
|
105
|
+
* - 如果需要等待用户关闭媒体相册,需要通过 `await` 调用,等待执行结束后继续执行后续代码
|
|
106
|
+
* - 使用示例:
|
|
107
|
+
* ```ts
|
|
108
|
+
* // 显示媒体相册,默认选中第二张媒体,即使用户不关闭媒体相册,也不会阻塞后续代码执行
|
|
109
|
+
* popup.album({
|
|
110
|
+
* sources: [
|
|
111
|
+
* 'https://example.com/image1.jpg',
|
|
112
|
+
* 'https://example.com/video1.mp4',
|
|
113
|
+
* ],
|
|
114
|
+
* defaultIndex: 1
|
|
115
|
+
* })
|
|
116
|
+
*
|
|
117
|
+
* // 只有用户关闭了媒体相册,才会继续执行后续代码
|
|
118
|
+
* await popup.album({
|
|
119
|
+
* sources: [
|
|
120
|
+
* 'https://example.com/image1.jpg',
|
|
121
|
+
* 'https://example.com/image1.jpg',
|
|
122
|
+
* ],
|
|
123
|
+
* })
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
(options: AlbumOption): Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export declare interface IAlert {
|
|
130
|
+
/**
|
|
131
|
+
* 显示提示框
|
|
132
|
+
* - 如果需要等待用户点击确认按钮后继续执行后续代码,需要通过 `await` 调用,等待执行结束后继续执行后续代码
|
|
133
|
+
* - 使用示例:
|
|
134
|
+
* ```ts
|
|
135
|
+
* popup.alert('删除成功')
|
|
136
|
+
* // 即使用户不点击确定按钮,也不会阻塞后续代码执行
|
|
137
|
+
*
|
|
138
|
+
* await popup.alert('删除成功')
|
|
139
|
+
* // 只有用户点击了确认按钮,才会继续执行后续代码
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
(content: string, options?: AlertOption): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export declare interface IConfirm {
|
|
146
|
+
/**
|
|
147
|
+
* 显示确认框
|
|
148
|
+
* - 如果需要获取点击的按钮是确定还是取消,需要通过 `await` 调用获得一个 `boolean` 类型的返回值,
|
|
149
|
+
* 确认按钮点击时返回 `true`,取消按钮点击时返回 `false`
|
|
150
|
+
* - 使用示例:
|
|
151
|
+
* ```ts
|
|
152
|
+
* if (await popup.confirm('确定删除吗?')) {
|
|
153
|
+
* // 确认删除
|
|
154
|
+
* } else {
|
|
155
|
+
* // 取消删除
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
(content: string, options?: ConfirmOption): Promise<boolean>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export declare interface IDialog {
|
|
163
|
+
/**
|
|
164
|
+
* 显示对话框
|
|
165
|
+
* - 对话框内部组件可通过调用 `this.$emit('close', payload)` 关闭对话框,payload 为关闭时传递的参数
|
|
166
|
+
* - 如需获取对话框关闭时传递的参数,可在调用 `dialog` 方法时使用 `await` 关键字等待 Promise resolve 后获取
|
|
167
|
+
* - 对话框关闭时,无论是否传递了参数,Promise 都将 resolve,因此需要在调用时判断是否有返回参数
|
|
168
|
+
*/
|
|
169
|
+
<T extends any = any>(options: PopupDialogOption): Promise<T | undefined>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export declare interface ILoading {
|
|
173
|
+
/**
|
|
174
|
+
* 显示加载遮罩
|
|
175
|
+
* - 返回关闭加载遮罩的方法,调用后关闭加载遮罩
|
|
176
|
+
* - 使用示例:
|
|
177
|
+
* ```ts
|
|
178
|
+
* const stopLoading = popup.loading()
|
|
179
|
+
* // 关闭加载遮罩
|
|
180
|
+
* stopLoading()
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
(option?: LoadingOption): () => void;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export declare interface IPrompt {
|
|
187
|
+
/**
|
|
188
|
+
* 显示提示输入
|
|
189
|
+
* - 可以在提示用户的同时,获取用户输入的内容,支持输入框和文本域
|
|
190
|
+
* - 第一个参数为提示文本,如果不需要渲染提示文本,传入 `false` 即可
|
|
191
|
+
* - 第二个参数为输入框默认值,第三个参数为选项对象,可以自定义输入框类型、标题、最大长度、占位符、确认按钮文本、取消按钮文本等,具体可以参考 {@link PromptOption}
|
|
192
|
+
* - 获取输入的内容,需要通过 `await` 调用,等待执行结束后返回用户输入的内容,类型为 `string` | `null`,如果用户点击了取消按钮,则返回 `null`
|
|
193
|
+
* - 使用示例:
|
|
194
|
+
* ```ts
|
|
195
|
+
*
|
|
196
|
+
* const name = await popup.prompt('请输入您的姓名')
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
(message: string | boolean, defaultValue?: string, options?: PromptOption): Promise<string>;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export declare interface IToast {
|
|
203
|
+
/**
|
|
204
|
+
* 显示消息
|
|
205
|
+
* - 第一个参数为消息内容
|
|
206
|
+
* - 第二个参数为消息选项,可自定义消息显示时间,默认值为 2000 毫秒
|
|
207
|
+
* - 如果需要等待消息消失后继续执行后续代码,需要通过 `await` 调用,等待执行结束后继续执行后续代码
|
|
208
|
+
* - 使用示例:
|
|
209
|
+
* ```ts
|
|
210
|
+
* popup.toast('这是一条消息')
|
|
211
|
+
* // 不会阻塞后续代码执行
|
|
212
|
+
*
|
|
213
|
+
* await popup.toast('这是一条消息')
|
|
214
|
+
* // 只有消息消失后,才会继续执行后续代码
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
(content: string, options?: ToastOption): Promise<void>;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
declare type LoadingOption = {
|
|
221
|
+
iconSize?: number;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
declare type PopupDialogOption = {
|
|
225
|
+
/**
|
|
226
|
+
* 对话框标题
|
|
227
|
+
* - 默认值为 `''`
|
|
228
|
+
*/
|
|
229
|
+
title?: string;
|
|
230
|
+
/**
|
|
231
|
+
* 对话框内容组件
|
|
232
|
+
*/
|
|
233
|
+
component: Component;
|
|
234
|
+
/**
|
|
235
|
+
* 对话框内容组件props
|
|
236
|
+
*/
|
|
237
|
+
props?: Record<string, any>;
|
|
238
|
+
/**
|
|
239
|
+
* 是否显示对话框标题栏
|
|
240
|
+
* - 默认值为 `true`
|
|
241
|
+
*/
|
|
242
|
+
header?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* 是否显示对话框标题栏关闭按钮
|
|
245
|
+
* - 默认值为 `true`
|
|
246
|
+
*/
|
|
247
|
+
headerCloseButton?: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* 对话框宽度
|
|
250
|
+
* - 默认值为 `auto`
|
|
251
|
+
* - 支持 `string` 或 `number` 类型
|
|
252
|
+
*/
|
|
253
|
+
width?: string | number;
|
|
254
|
+
/**
|
|
255
|
+
* 对话框最大宽度
|
|
256
|
+
* - 默认值为 `100%`
|
|
257
|
+
* - 支持 `string` 或 `number` 类型
|
|
258
|
+
*/
|
|
259
|
+
maxWidth?: string | number;
|
|
260
|
+
/**
|
|
261
|
+
* 对话框最小宽度
|
|
262
|
+
* - 默认值为 `auto`
|
|
263
|
+
* - 支持 `string` 或 `number` 类型
|
|
264
|
+
*/
|
|
265
|
+
minWidth?: string | number;
|
|
266
|
+
/**
|
|
267
|
+
* 对话框高度
|
|
268
|
+
* - 默认值为 `auto`
|
|
269
|
+
* - 支持 `string` 或 `number` 类型
|
|
270
|
+
*/
|
|
271
|
+
height?: string | number;
|
|
272
|
+
/**
|
|
273
|
+
* 对话框最大高度
|
|
274
|
+
* - 默认值为 `100%`
|
|
275
|
+
* - 支持 `string` 或 `number` 类型
|
|
276
|
+
*/
|
|
277
|
+
maxHeight?: string | number;
|
|
278
|
+
/**
|
|
279
|
+
* 对话框最小高度
|
|
280
|
+
* - 默认值为 `auto`
|
|
281
|
+
* - 支持 `string` 或 `number` 类型
|
|
282
|
+
*/
|
|
283
|
+
minHeight?: string | number;
|
|
284
|
+
/**
|
|
285
|
+
* 是否显示对话框遮罩层
|
|
286
|
+
* - 默认值为 `true`
|
|
287
|
+
*/
|
|
288
|
+
mask?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* 是否点击遮罩层关闭对话框
|
|
291
|
+
* - 默认值为 `false`
|
|
292
|
+
*/
|
|
293
|
+
maskClickCloseEnabled?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* 是否可拖拽
|
|
296
|
+
* - 默认值为 `false`
|
|
297
|
+
*/
|
|
298
|
+
draggable?: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* 是否可拖拽溢出屏幕
|
|
301
|
+
* - 默认值为 `false`
|
|
302
|
+
*/
|
|
303
|
+
dragOverflow?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* 对话框渲染完成时调用的回调函数
|
|
306
|
+
*/
|
|
307
|
+
onMounted?: () => void;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
declare type PromptOption = {
|
|
311
|
+
/**
|
|
312
|
+
* 提示输入框类型
|
|
313
|
+
* - 支持的类型包括:
|
|
314
|
+
* - `input`:单行输入框
|
|
315
|
+
* - `textarea`:多行文本域
|
|
316
|
+
*/
|
|
317
|
+
type?: PromptType;
|
|
318
|
+
/**
|
|
319
|
+
* 提示输入框标题
|
|
320
|
+
* - 默认值:`提示输入`
|
|
321
|
+
*/
|
|
322
|
+
title?: string;
|
|
323
|
+
/**
|
|
324
|
+
* 提示输入框最大长度
|
|
325
|
+
* - 默认值:`null`
|
|
326
|
+
*/
|
|
327
|
+
maxLength?: number | null;
|
|
328
|
+
/**
|
|
329
|
+
* 提示输入框占位符
|
|
330
|
+
* - 默认值:`请输入`
|
|
331
|
+
*/
|
|
332
|
+
placeholder?: string;
|
|
333
|
+
/**
|
|
334
|
+
* 确认按钮文本
|
|
335
|
+
* - 默认值:`确定`
|
|
336
|
+
*/
|
|
337
|
+
confirmText?: string;
|
|
338
|
+
/**
|
|
339
|
+
* 取消按钮文本
|
|
340
|
+
* - 默认值:`取消`
|
|
341
|
+
*/
|
|
342
|
+
cancelText?: string;
|
|
343
|
+
/**
|
|
344
|
+
* 提示输入框是否可拖拽
|
|
345
|
+
* - 默认值:`false`
|
|
346
|
+
*/
|
|
347
|
+
draggable?: boolean;
|
|
348
|
+
/**
|
|
349
|
+
* 提示输入框是否可拖拽溢出屏幕
|
|
350
|
+
* - 默认值:`false`
|
|
351
|
+
*/
|
|
352
|
+
dragOverflow?: boolean;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
declare type PromptType = 'input' | 'textarea';
|
|
356
|
+
|
|
357
|
+
declare type ToastOption = {
|
|
358
|
+
/**
|
|
359
|
+
* 消息显示时间,单位毫秒
|
|
360
|
+
* @default 2000
|
|
361
|
+
*/
|
|
362
|
+
duration?: number;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
export { }
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
declare module 'vue-popup-plus' {
|
|
369
|
+
interface PopupCustomProperties {
|
|
370
|
+
alert: IAlert;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
declare module 'vue-popup-plus' {
|
|
376
|
+
interface PopupCustomProperties {
|
|
377
|
+
confirm: IConfirm;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
declare module 'vue-popup-plus' {
|
|
383
|
+
interface PopupCustomProperties {
|
|
384
|
+
prompt: IPrompt;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
declare module 'vue-popup-plus' {
|
|
390
|
+
interface PopupCustomProperties {
|
|
391
|
+
loading: ILoading;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
declare module 'vue-popup-plus' {
|
|
397
|
+
interface PopupCustomProperties {
|
|
398
|
+
toast: IToast;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
declare module 'vue-popup-plus' {
|
|
404
|
+
interface PopupCustomProperties {
|
|
405
|
+
dialog: IDialog;
|
|
406
|
+
}
|
|
407
|
+
}
|