vue-popup-plus-plugin-preset 1.3.3 → 1.4.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.
@@ -1,129 +1,282 @@
1
1
  import { Component } from 'vue';
2
2
  import { PopupPlugin } from 'vue-popup-plus';
3
+ import { version } from '../package.json';
4
+
5
+ export declare const album: PopupPlugin<GlobalOption>;
3
6
 
4
7
  declare type AlbumOption = {
5
8
  /**
6
9
  * 数据源
10
+ *
7
11
  * - 支持主流图片资源和视频资源
8
12
  */
9
13
  sources: Array<string>;
10
14
  /**
11
15
  * 默认选中的媒体索引
16
+ *
12
17
  * - 默认值为 `0`
13
18
  */
14
19
  defaultIndex?: number;
15
20
  /**
16
- * 是否禁用当前索引和总索引
21
+ * 是否禁用计数器
22
+ *
17
23
  * - 默认值为 `false`
18
24
  */
19
- countDisabled?: boolean;
25
+ disableCounter?: boolean;
20
26
  /**
21
27
  * 是否禁用媒体名称
28
+ *
22
29
  * - 默认值为 `false`
23
30
  */
24
- nameDisabled?: boolean;
31
+ disableName?: boolean;
25
32
  /**
26
- * 是否禁用纯模式
33
+ * 是否禁用纯净预览
34
+ *
27
35
  * - 默认值为 `false`
28
36
  */
29
- pureDisabled?: boolean;
37
+ disablePure?: boolean;
30
38
  /**
31
39
  * 是否禁用下载功能
40
+ *
32
41
  * - 默认值为 `false`
33
42
  * - 注意:下载功能仅在资源地址支持跨域时生效
34
43
  */
35
- downloadDisabled?: boolean;
44
+ disableDownload?: boolean;
36
45
  /**
37
46
  * 是否禁用缩放功能
47
+ *
38
48
  * - 默认值为 `false`
39
49
  */
40
- scaleDisabled?: boolean;
50
+ disableScale?: boolean;
41
51
  /**
42
52
  * 是否禁用拖动功能
53
+ *
43
54
  * - 默认值为 `false`
44
55
  */
45
- dragDisabled?: boolean;
56
+ disableDrag?: boolean;
57
+ /**
58
+ * 遮罩层是否模糊
59
+ *
60
+ * - 默认值:`true`
61
+ */
62
+ maskBlur?: boolean;
46
63
  };
47
64
 
65
+ declare const alert_2: PopupPlugin<GlobalOption>;
66
+ export { alert_2 as alert }
67
+
48
68
  declare type AlertOption = {
49
69
  /**
50
70
  * 提示框标题
71
+ *
51
72
  * - 默认值:`提示`
52
73
  */
53
74
  title?: string;
54
75
  /**
55
76
  * 标题栏是否显示关闭按钮
77
+ *
56
78
  * - 默认值:`true`
57
79
  */
58
80
  headerClose?: boolean;
59
81
  /**
60
82
  * 确认按钮文本
83
+ *
61
84
  * - 默认值:`确定`
62
85
  */
63
86
  confirmText?: string;
64
87
  /**
65
88
  * 是否可拖动
89
+ *
66
90
  * - 默认值:`false`
67
91
  */
68
92
  draggable?: boolean;
69
93
  /**
70
94
  * 是否可拖动超出窗口边界
95
+ *
71
96
  * - 默认值:`false`
72
97
  */
73
98
  dragOverflow?: boolean;
74
99
  /**
75
100
  * 遮罩层是否模糊
101
+ *
76
102
  * - 默认值:`true`
77
103
  */
78
104
  maskBlur?: boolean;
79
105
  };
80
106
 
107
+ declare const confirm_2: PopupPlugin<GlobalOption>;
108
+ export { confirm_2 as confirm }
109
+
81
110
  declare type ConfirmOption = {
82
111
  /**
83
112
  * 确认框标题
113
+ *
84
114
  * - 默认值:`确认`
85
115
  */
86
116
  title?: string;
87
117
  /**
88
118
  * 标题栏是否显示关闭按钮
119
+ *
89
120
  * - 默认值:`false`
90
121
  */
91
122
  headerClose?: boolean;
92
123
  /**
93
124
  * 确认按钮文本
125
+ *
94
126
  * - 默认值:`确定`
95
127
  */
96
128
  confirmText?: string;
97
129
  /**
98
130
  * 取消按钮文本
131
+ *
99
132
  * - 默认值:`取消`
100
133
  */
101
134
  cancelText?: string;
102
135
  /**
103
136
  * 是否可拖动
137
+ *
104
138
  * - 默认值:`false`
105
139
  */
106
140
  draggable?: boolean;
107
141
  /**
108
142
  * 是否可拖动超出窗口边界
143
+ *
109
144
  * - 默认值:`false`
110
145
  */
111
146
  dragOverflow?: boolean;
112
147
  /**
113
148
  * 遮罩层是否模糊
149
+ *
150
+ * - 默认值:`true`
151
+ */
152
+ maskBlur?: boolean;
153
+ };
154
+
155
+ export declare const dialog: PopupPlugin<GlobalOption>;
156
+
157
+ declare type DialogOption = {
158
+ /**
159
+ * 对话框标题
160
+ *
161
+ * - 默认值为 `对话`
162
+ */
163
+ title?: string;
164
+ /**
165
+ * 对话框内容组件
166
+ */
167
+ component: Component;
168
+ /**
169
+ * 对话框内容组件props
170
+ */
171
+ componentProps?: Record<string, any>;
172
+ /**
173
+ * 对话框渲染完成时调用的回调函数
174
+ */
175
+ onMounted?: () => void;
176
+ /**
177
+ * 是否显示对话框标题栏
178
+ *
179
+ * - 默认值为 `true`
180
+ */
181
+ header?: boolean;
182
+ /**
183
+ * 标题栏是否显示关闭按钮
184
+ *
185
+ * - 默认值:`true`
186
+ */
187
+ headerClose?: boolean;
188
+ /**
189
+ * 对话框宽度
190
+ *
191
+ * - 默认值为 `auto`
192
+ * - 支持 `string` 或 `number` 类型
193
+ */
194
+ width?: string | number;
195
+ /**
196
+ * 对话框最大宽度
197
+ *
198
+ * - 默认值为 `100%`
199
+ * - 支持 `string` 或 `number` 类型
200
+ */
201
+ maxWidth?: string | number;
202
+ /**
203
+ * 对话框最小宽度
204
+ *
205
+ * - 默认值为 `auto`
206
+ * - 支持 `string` 或 `number` 类型
207
+ */
208
+ minWidth?: string | number;
209
+ /**
210
+ * 对话框高度
211
+ *
212
+ * - 默认值为 `auto`
213
+ * - 支持 `string` 或 `number` 类型
214
+ */
215
+ height?: string | number;
216
+ /**
217
+ * 对话框最大高度
218
+ *
219
+ * - 默认值为 `100%`
220
+ * - 支持 `string` 或 `number` 类型
221
+ */
222
+ maxHeight?: string | number;
223
+ /**
224
+ * 对话框最小高度
225
+ *
226
+ * - 默认值为 `auto`
227
+ * - 支持 `string` 或 `number` 类型
228
+ */
229
+ minHeight?: string | number;
230
+ /**
231
+ * 是否显示对话框遮罩层
232
+ *
233
+ * - 默认值为 `true`
234
+ */
235
+ mask?: boolean;
236
+ /**
237
+ * 是否点击遮罩层关闭对话框
238
+ *
239
+ * - 默认值为 `false`
240
+ */
241
+ maskClickClose?: boolean;
242
+ /**
243
+ * 是否可拖拽
244
+ *
245
+ * - 默认值为 `false`
246
+ */
247
+ draggable?: boolean;
248
+ /**
249
+ * 是否可拖拽溢出屏幕
250
+ *
251
+ * - 默认值为 `false`
252
+ */
253
+ dragOverflow?: boolean;
254
+ /**
255
+ * 遮罩层是否模糊
256
+ *
114
257
  * - 默认值:`true`
115
258
  */
116
259
  maskBlur?: boolean;
117
260
  };
118
261
 
119
- declare const _default: PopupPlugin;
120
- export default _default;
262
+ declare type GlobalOption = {
263
+ /**
264
+ * 插件弹出层皮肤
265
+ * - 默认为 `classic` 经典皮肤
266
+ * - 可选值包括:
267
+ * - `classic` 经典皮肤
268
+ * - `modern` 现代皮肤(实验性)
269
+ */
270
+ skin?: Skin;
271
+ };
121
272
 
122
273
  export declare interface IAlbum {
123
274
  /**
124
275
  * 显示媒体相册
276
+ *
125
277
  * - 如果需要等待用户关闭媒体相册,需要通过 `await` 调用,等待执行结束后继续执行后续代码
126
278
  * - 使用示例:
279
+ *
127
280
  * ```ts
128
281
  * // 显示媒体相册,默认选中第二张媒体,即使用户不关闭媒体相册,也不会阻塞后续代码执行
129
282
  * popup.album({
@@ -131,7 +284,7 @@ export declare interface IAlbum {
131
284
  * 'https://example.com/image1.jpg',
132
285
  * 'https://example.com/video1.mp4',
133
286
  * ],
134
- * defaultIndex: 1
287
+ * defaultIndex: 1,
135
288
  * })
136
289
  *
137
290
  * // 只有用户关闭了媒体相册,才会继续执行后续代码
@@ -149,8 +302,11 @@ export declare interface IAlbum {
149
302
  export declare interface IAlert {
150
303
  /**
151
304
  * 显示提示框
152
- * - 如果需要等待用户点击确认按钮后继续执行后续代码,需要通过 `await` 调用,等待执行结束后继续执行后续代码
305
+ *
306
+ * - 如果需要等待用户点击确认按钮后继续执行后续代码,需要通过 `await`
307
+ * 调用,等待执行结束后继续执行后续代码
153
308
  * - 使用示例:
309
+ *
154
310
  * ```ts
155
311
  * popup.alert('删除成功')
156
312
  * // 即使用户不点击确定按钮,也不会阻塞后续代码执行
@@ -165,9 +321,11 @@ export declare interface IAlert {
165
321
  export declare interface IConfirm {
166
322
  /**
167
323
  * 显示确认框
168
- * - 如果需要获取点击的按钮是确定还是取消,需要通过 `await` 调用获得一个 `boolean` 类型的返回值,
169
- * 确认按钮点击时返回 `true`,取消按钮点击时返回 `false`
324
+ *
325
+ * - 如果需要获取点击的按钮是确定还是取消,需要通过 `await` 调用获得一个 `boolean`
326
+ * 类型的返回值,确认按钮点击时返回 `true`,取消按钮点击时返回 `false`
170
327
  * - 使用示例:
328
+ *
171
329
  * ```ts
172
330
  * if (await popup.confirm('确定删除吗?')) {
173
331
  * // 确认删除
@@ -182,18 +340,23 @@ export declare interface IConfirm {
182
340
  export declare interface IDialog {
183
341
  /**
184
342
  * 显示对话框
185
- * - 对话框内部组件可通过调用 `this.$emit('close', payload)` 关闭对话框,payload 为关闭时传递的参数
186
- * - 如需获取对话框关闭时传递的参数,可在调用 `dialog` 方法时使用 `await` 关键字等待 Promise resolve 后获取
343
+ *
344
+ * - 对话框内部组件可通过调用 `this.$emit('close', payload)`
345
+ * 关闭对话框,payload 为关闭时传递的参数
346
+ * - 如需获取对话框关闭时传递的参数,可在调用 `dialog` 方法时使用 `await` 关键字等待
347
+ * Promise resolve 后获取
187
348
  * - 对话框关闭时,无论是否传递了参数,Promise 都将 resolve,因此需要在调用时判断是否有返回参数
188
349
  */
189
- <T extends any = any>(options: PopupDialogOption): Promise<T | void>;
350
+ <T extends any = any>(options: DialogOption): Promise<T | void>;
190
351
  }
191
352
 
192
353
  export declare interface ILoading {
193
354
  /**
194
355
  * 显示加载遮罩
356
+ *
195
357
  * - 返回关闭加载遮罩的方法,调用后关闭加载遮罩
196
358
  * - 使用示例:
359
+ *
197
360
  * ```ts
198
361
  * const stopLoading = popup.loading()
199
362
  * // 关闭加载遮罩
@@ -206,13 +369,16 @@ export declare interface ILoading {
206
369
  export declare interface IPrompt {
207
370
  /**
208
371
  * 显示提示输入
372
+ *
209
373
  * - 可以在提示用户的同时,获取用户输入的内容,支持输入框和文本域
210
374
  * - 第一个参数为提示文本,如果不需要渲染提示文本,传入 `false` 即可
211
- * - 第二个参数为输入框默认值,第三个参数为选项对象,可以自定义输入框类型、标题、最大长度、占位符、确认按钮文本、取消按钮文本等,具体可以参考 {@link PromptOption}
212
- * - 获取输入的内容,需要通过 `await` 调用,等待执行结束后返回用户输入的内容,类型为 `string` | `void`,如果用户点击了取消按钮或者直接关闭弹出层,则返回 `undefined`
375
+ * - 第二个参数为选项对象,可以自定义输入框默认值、类型、标题、最大长度、
376
+ * 占位符、确认按钮文本、取消按钮文本等,具体可以参考 {@link PromptOption}
377
+ * - 获取输入的内容,需要通过 `await` 调用,等待执行结束后返回用户输入的内容,类型为 `string`
378
+ * | `void`,如果用户点击了取消按钮或者直接关闭弹出层,则返回 `undefined`
213
379
  * - 使用示例:
214
- * ```ts
215
380
  *
381
+ * ```ts
216
382
  * const name = await popup.prompt('请输入您的姓名')
217
383
  * if (name === undefined) {
218
384
  * console.log('用户取消了输入')
@@ -221,16 +387,18 @@ export declare interface IPrompt {
221
387
  * }
222
388
  * ```
223
389
  */
224
- (message: string | boolean, defaultValue?: string, options?: PromptOption): Promise<string | void>;
390
+ (message: string | boolean, options?: PromptOption): Promise<string | void>;
225
391
  }
226
392
 
227
393
  export declare interface IToast {
228
394
  /**
229
395
  * 显示消息
396
+ *
230
397
  * - 第一个参数为消息内容
231
398
  * - 第二个参数为消息选项,可自定义消息显示时间,默认值为 2000 毫秒
232
- * - 如果需要等待消息消失后继续执行后续代码,需要通过 `await` 调用,等待执行结束后继续执行后续代码
399
+ * - 如果需要等待消息消失后继续执行后续代码,需要通过 `await` 调用, 等待执行结束后继续执行后续代码
233
400
  * - 使用示例:
401
+ *
234
402
  * ```ts
235
403
  * popup.toast('这是一条消息')
236
404
  * // 不会阻塞后续代码执行
@@ -242,151 +410,108 @@ export declare interface IToast {
242
410
  (content: string, options?: ToastOption): Promise<void>;
243
411
  }
244
412
 
245
- declare type LoadingOption = {
246
- iconSize?: number;
247
- };
413
+ export declare const loading: PopupPlugin<GlobalOption>;
248
414
 
249
- declare type PopupDialogOption = {
250
- /**
251
- * 对话框标题
252
- * - 默认值为 `对话`
253
- */
254
- title?: string;
255
- /**
256
- * 对话框内容组件
257
- */
258
- component: Component;
259
- /**
260
- * 对话框内容组件props
261
- */
262
- componentProps?: Record<string, any>;
263
- /**
264
- * 对话框渲染完成时调用的回调函数
265
- */
266
- onMounted?: () => void;
267
- /**
268
- * 是否显示对话框标题栏
269
- * - 默认值为 `true`
270
- */
271
- header?: boolean;
272
- /**
273
- * 标题栏是否显示关闭按钮
274
- * - 默认值:`true`
275
- */
276
- headerClose?: boolean;
277
- /**
278
- * 对话框宽度
279
- * - 默认值为 `auto`
280
- * - 支持 `string` 或 `number` 类型
281
- */
282
- width?: string | number;
283
- /**
284
- * 对话框最大宽度
285
- * - 默认值为 `100%`
286
- * - 支持 `string` 或 `number` 类型
287
- */
288
- maxWidth?: string | number;
289
- /**
290
- * 对话框最小宽度
291
- * - 默认值为 `auto`
292
- * - 支持 `string` 或 `number` 类型
293
- */
294
- minWidth?: string | number;
295
- /**
296
- * 对话框高度
297
- * - 默认值为 `auto`
298
- * - 支持 `string` 或 `number` 类型
299
- */
300
- height?: string | number;
301
- /**
302
- * 对话框最大高度
303
- * - 默认值为 `100%`
304
- * - 支持 `string` 或 `number` 类型
305
- */
306
- maxHeight?: string | number;
307
- /**
308
- * 对话框最小高度
309
- * - 默认值为 `auto`
310
- * - 支持 `string` 或 `number` 类型
311
- */
312
- minHeight?: string | number;
415
+ declare type LoadingOption = {
313
416
  /**
314
- * 是否显示对话框遮罩层
315
- * - 默认值为 `true`
417
+ * 加载遮罩主题
418
+ *
419
+ * - 默认值:'primary'
420
+ * - 具体的可选主题请参考 {@link Theme }
316
421
  */
317
- mask?: boolean;
422
+ theme?: Theme;
318
423
  /**
319
- * 是否点击遮罩层关闭对话框
320
- * - 默认值为 `false`
321
- */
322
- maskClickClose?: boolean;
323
- /**
324
- * 是否可拖拽
325
- * - 默认值为 `false`
424
+ * 加载遮罩标题文本
425
+ *
426
+ * - 默认值:''
326
427
  */
327
- draggable?: boolean;
428
+ title?: string;
328
429
  /**
329
- * 是否可拖拽溢出屏幕
330
- * - 默认值为 `false`
430
+ * 加载遮罩图标大小
431
+ *
432
+ * - 默认值:60
331
433
  */
332
- dragOverflow?: boolean;
434
+ iconSize?: number;
333
435
  /**
334
436
  * 遮罩层是否模糊
437
+ *
335
438
  * - 默认值:`true`
336
439
  */
337
440
  maskBlur?: boolean;
338
441
  };
339
442
 
443
+ export declare const presetPlugin: PopupPlugin<GlobalOption>;
444
+
445
+ declare const prompt_2: PopupPlugin<GlobalOption>;
446
+ export { prompt_2 as prompt }
447
+
340
448
  declare type PromptOption = {
449
+ /**
450
+ * 提示输入框默认值
451
+ *
452
+ * - 默认值:`''`
453
+ */
454
+ defaultValue?: string;
341
455
  /**
342
456
  * 提示输入框类型
457
+ *
343
458
  * - 支持的类型包括:
344
- * - `input`:单行输入框
345
- * - `textarea`:多行文本域
459
+ *
460
+ * - `input`:单行输入框
461
+ * - `textarea`:多行文本域
346
462
  */
347
463
  type?: PromptType;
348
464
  /**
349
465
  * 提示输入框标题
466
+ *
350
467
  * - 默认值:`提示输入`
351
468
  */
352
469
  title?: string;
353
470
  /**
354
471
  * 标题栏是否显示关闭按钮
472
+ *
355
473
  * - 默认值:`true`
356
474
  */
357
475
  headerClose?: boolean;
358
476
  /**
359
477
  * 提示输入框最大长度
478
+ *
360
479
  * - 默认值:`null`
361
480
  */
362
481
  maxLength?: number | null;
363
482
  /**
364
483
  * 提示输入框占位符
484
+ *
365
485
  * - 默认值:`请输入`
366
486
  */
367
487
  placeholder?: string;
368
488
  /**
369
489
  * 确认按钮文本
490
+ *
370
491
  * - 默认值:`确定`
371
492
  */
372
493
  confirmText?: string;
373
494
  /**
374
495
  * 取消按钮文本
496
+ *
375
497
  * - 默认值:`取消`
376
498
  */
377
499
  cancelText?: string;
378
500
  /**
379
501
  * 提示输入框是否可拖拽
502
+ *
380
503
  * - 默认值:`false`
381
504
  */
382
505
  draggable?: boolean;
383
506
  /**
384
507
  * 提示输入框是否可拖拽溢出屏幕
508
+ *
385
509
  * - 默认值:`false`
386
510
  */
387
511
  dragOverflow?: boolean;
388
512
  /**
389
513
  * 遮罩层是否模糊
514
+ *
390
515
  * - 默认值:`true`
391
516
  */
392
517
  maskBlur?: boolean;
@@ -394,22 +519,29 @@ declare type PromptOption = {
394
519
 
395
520
  declare type PromptType = 'input' | 'textarea';
396
521
 
522
+ declare type Skin = 'classic' | 'modern';
523
+
524
+ declare type Theme = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
525
+
526
+ export declare const toast: PopupPlugin<GlobalOption>;
527
+
397
528
  declare type ToastOption = {
398
529
  /**
399
530
  * 消息主题
531
+ *
400
532
  * - 默认值: 'default'
401
- * - 具体的可选主题请参考 {@link ToastTheme }
533
+ * - 具体的可选主题请参考 {@link Theme }
402
534
  */
403
- theme?: ToastTheme;
535
+ theme?: Theme;
404
536
  /**
405
537
  * 消息显示时间,单位毫秒
538
+ *
406
539
  * - 默认值: 2000 毫秒
407
- * @default 2000
408
540
  */
409
541
  duration?: number;
410
542
  };
411
543
 
412
- declare type ToastTheme = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
544
+ export { version }
413
545
 
414
546
  export { }
415
547
 
@@ -423,28 +555,28 @@ declare module 'vue-popup-plus' {
423
555
 
424
556
  declare module 'vue-popup-plus' {
425
557
  interface PopupCustomProperties {
426
- alert: IAlert;
558
+ dialog: IDialog;
427
559
  }
428
560
  }
429
561
 
430
562
 
431
563
  declare module 'vue-popup-plus' {
432
564
  interface PopupCustomProperties {
433
- dialog: IDialog;
565
+ alert: IAlert;
434
566
  }
435
567
  }
436
568
 
437
569
 
438
570
  declare module 'vue-popup-plus' {
439
571
  interface PopupCustomProperties {
440
- loading: ILoading;
572
+ toast: IToast;
441
573
  }
442
574
  }
443
575
 
444
576
 
445
577
  declare module 'vue-popup-plus' {
446
578
  interface PopupCustomProperties {
447
- toast: IToast;
579
+ loading: ILoading;
448
580
  }
449
581
  }
450
582