snail.vue 1.0.29 → 1.0.31
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/snail.vue.d.ts +188 -112
- package/dist/snail.vue.js +472 -313
- package/dist/snail.vue.umd.js +470 -310
- package/dist/styles/app.css +1 -0
- package/dist/styles/snail.vue.vue.css +17 -15
- package/package.json +3 -3
package/dist/snail.vue.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as snail_view from 'snail.view';
|
|
2
2
|
import { BaseStyle, WidthStyle, FlexBoxStyle, HeightStyle, BorderStyle, PaddingStyle } from 'snail.view';
|
|
3
3
|
import * as vue from 'vue';
|
|
4
|
-
import { Component,
|
|
5
|
-
import { IScope } from 'snail.core';
|
|
4
|
+
import { Component, ShallowRef, Ref, App } from 'vue';
|
|
5
|
+
import { IScope, IAsyncScope } from 'snail.core';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* loading提示框的配置选项
|
|
@@ -461,7 +461,7 @@ type ButtonOptions = {
|
|
|
461
461
|
*/
|
|
462
462
|
interface IReactiveManager {
|
|
463
463
|
/**
|
|
464
|
-
*
|
|
464
|
+
* 【过渡】变量值
|
|
465
465
|
* - 通过设置 rv.value 的值来实现.value值过渡
|
|
466
466
|
* - 执行顺序 from、to
|
|
467
467
|
* - 开始时,设置 rv.value 值为 from;延迟time时间后,强制销毁scope
|
|
@@ -471,20 +471,28 @@ interface IReactiveManager {
|
|
|
471
471
|
* @param time 过渡持续时间,到时间后销毁作用域
|
|
472
472
|
* @returns 作用域对象,可销毁【值过渡】效果
|
|
473
473
|
*/
|
|
474
|
-
transition<T>(rv: {
|
|
475
|
-
value?: T;
|
|
476
|
-
}, effect: {
|
|
474
|
+
transition<T>(rv: ShallowRef<T> | Ref<T>, effect: {
|
|
477
475
|
from: T;
|
|
478
476
|
to: T;
|
|
479
477
|
}, time: number): IScope;
|
|
478
|
+
/**
|
|
479
|
+
* 【任务】响应式
|
|
480
|
+
* - 任务运行时,设置loading.value=true
|
|
481
|
+
* - 任务完成后,设置loading.value=false
|
|
482
|
+
* - 可通过delay值,延迟执行 loading.value=false 操作
|
|
483
|
+
* - 可在api请求等耗时操作任务过程中,实现响应式显隐Loading组件
|
|
484
|
+
* @param task 要运行的任务
|
|
485
|
+
* @param loading 正在加载的响应式变量
|
|
486
|
+
* @param delay 延迟时间,单位ms;不传则不延迟
|
|
487
|
+
* @returns 任务自身
|
|
488
|
+
*/
|
|
489
|
+
task<T, E>(task: Promise<T>, loading: ShallowRef<boolean> | Ref<boolean>, delay: number): Promise<{
|
|
490
|
+
success: boolean;
|
|
491
|
+
data?: T;
|
|
492
|
+
error?: E;
|
|
493
|
+
}>;
|
|
480
494
|
}
|
|
481
495
|
|
|
482
|
-
/**
|
|
483
|
-
* 响应式 模块;
|
|
484
|
-
* 1、针对Vue的响应式相关功能,做一些便捷封装
|
|
485
|
-
* 2、方便使用,减少重复性代码量
|
|
486
|
-
*/
|
|
487
|
-
|
|
488
496
|
/**
|
|
489
497
|
* 使用【响应式管理器】
|
|
490
498
|
* - 请在Vue组件的setup中使用此方法,否则 getCurrentScope 方法无法取到值
|
|
@@ -522,9 +530,26 @@ declare function triggerAppCreated(app: App): App;
|
|
|
522
530
|
declare function getSvgIcon(options: IconOptions): IconPathOptions;
|
|
523
531
|
|
|
524
532
|
/**
|
|
525
|
-
*
|
|
533
|
+
* 挂载vue组件
|
|
534
|
+
* - 全新创建一个Vue实例挂载的传入组件
|
|
535
|
+
* - 用于在非vue环境下渲染vue组件内容
|
|
536
|
+
* @param options 挂载配置选项
|
|
537
|
+
* @param onDestroyed 监听【调用方】的销毁时机,用于自动销毁挂载的实力
|
|
538
|
+
* @returns
|
|
539
|
+
*/
|
|
540
|
+
declare function mount(options: ComponentMountOptions, onDestroyed?: (fn: () => void) => void): IScope;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* 公共通用数据结构:
|
|
544
|
+
* 1、在弹窗、模态弹窗、跟随弹窗的效果下复用
|
|
545
|
+
*/
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* 弹窗配置选项
|
|
549
|
+
* - 约束弹出组件信息
|
|
550
|
+
* - 弹出组件时传递的参数信息
|
|
526
551
|
*/
|
|
527
|
-
type
|
|
552
|
+
type PopupOptions = ComponentOptions & {
|
|
528
553
|
/**
|
|
529
554
|
* 传递给组件的属性值,执行v-bind绑定到要显示的组件
|
|
530
555
|
* - key为属性名称,遵循vue解析规则
|
|
@@ -533,29 +558,101 @@ type DialogOptions = ComponentOptions & {
|
|
|
533
558
|
props?: Record<string, any>;
|
|
534
559
|
/**
|
|
535
560
|
* 自定义class
|
|
536
|
-
* -
|
|
537
|
-
|
|
561
|
+
* - 绑定到内容组件根元素上
|
|
562
|
+
* - 可以直接在props中指定,无需特殊设置
|
|
538
563
|
class?: string | string[];
|
|
564
|
+
*/
|
|
539
565
|
/**
|
|
540
566
|
* 自定义style
|
|
541
|
-
* -
|
|
567
|
+
* - 绑定到内容组件根元素上
|
|
568
|
+
* - 可以直接在props中指定,无需特殊设置
|
|
569
|
+
style?: AllStyle;
|
|
542
570
|
*/
|
|
543
|
-
style?: string | string[];
|
|
544
571
|
/**
|
|
545
|
-
*
|
|
546
|
-
* -
|
|
572
|
+
* 弹窗的z-index值
|
|
573
|
+
* - 无特殊情况,建议不指定,内部会自动生成,确保弹窗正确性
|
|
547
574
|
*/
|
|
548
|
-
|
|
575
|
+
zIndex?: number;
|
|
576
|
+
};
|
|
577
|
+
/**
|
|
578
|
+
* 弹窗标识信息
|
|
579
|
+
*/
|
|
580
|
+
type PopupFlagOptions = {
|
|
549
581
|
/**
|
|
550
|
-
*
|
|
551
|
-
|
|
582
|
+
* 分配给弹窗的Id值
|
|
583
|
+
*/
|
|
584
|
+
id: number;
|
|
585
|
+
/**
|
|
586
|
+
* 实际分配的zIndex值
|
|
587
|
+
*/
|
|
588
|
+
zIndex: number;
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* 弹出组件句柄
|
|
592
|
+
*/
|
|
593
|
+
type PopupHandle<T> = {
|
|
594
|
+
/**
|
|
595
|
+
* 组件是否在【弹出窗口】中
|
|
596
|
+
*/
|
|
597
|
+
inPopup: Readonly<boolean>;
|
|
598
|
+
/**
|
|
599
|
+
* 关闭弹窗
|
|
600
|
+
* @param data 关闭时传递数据
|
|
601
|
+
*/
|
|
602
|
+
closePopup(data?: T): void;
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* 弹窗状态:响应式
|
|
606
|
+
* - open 打开
|
|
607
|
+
* - active 激活
|
|
608
|
+
* - unactive 非激活
|
|
609
|
+
* - close 关闭
|
|
610
|
+
*/
|
|
611
|
+
type PopupStatus = ShallowRef<"open" | "active" | "unactive" | "close">;
|
|
612
|
+
/**
|
|
613
|
+
* 弹窗扩展信息
|
|
614
|
+
*/
|
|
615
|
+
type PopupExtend = {
|
|
616
|
+
/**
|
|
617
|
+
* 弹窗状态
|
|
618
|
+
*/
|
|
619
|
+
popupStatus: PopupStatus;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* 模态弹窗数据结构
|
|
624
|
+
*/
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* 模态弹窗配置选项
|
|
628
|
+
* - 继承 ComponentOptions ,动态加载组件
|
|
629
|
+
*/
|
|
630
|
+
type DialogOptions = PopupOptions & {
|
|
631
|
+
/**
|
|
632
|
+
* 禁用【遮罩层】
|
|
633
|
+
* - 目前没实现,先忽略
|
|
634
|
+
maskDisabled?: boolean;
|
|
635
|
+
*/
|
|
636
|
+
/**
|
|
637
|
+
* 点击【遮罩层】时是否关闭弹窗
|
|
638
|
+
* - 针对无遮罩层的弹窗,则点击非【弹窗组件】区域时是否关闭
|
|
552
639
|
*/
|
|
553
640
|
closeOnMask?: boolean;
|
|
554
641
|
/**
|
|
555
|
-
*
|
|
556
|
-
* - 无特殊情况,建议不粗韩,内部会自动生成,确保弹窗正确性
|
|
642
|
+
* 按下【ESC】健时是否关闭弹窗
|
|
557
643
|
*/
|
|
558
|
-
|
|
644
|
+
closeOnEscape?: boolean;
|
|
645
|
+
/**
|
|
646
|
+
* 模态弹窗动画名
|
|
647
|
+
* - 不传则使用默认,具体有弹窗容器确认,如dialog为 snail-dialog
|
|
648
|
+
*/
|
|
649
|
+
transition?: string;
|
|
650
|
+
/**
|
|
651
|
+
* 动画持续时间
|
|
652
|
+
* - 配合 transition 使用;单位ms,默认100ms
|
|
653
|
+
* - 外部传入自定义动画时,传入动画持续时间,否则可能导致关闭时动画失效
|
|
654
|
+
*/
|
|
655
|
+
transitionDuration?: number;
|
|
559
656
|
/**
|
|
560
657
|
* 模态弹窗的自定义class
|
|
561
658
|
* - 绑定到模态弹窗的根元素上
|
|
@@ -563,73 +660,36 @@ type DialogOptions = ComponentOptions & {
|
|
|
563
660
|
rootClass?: string | string[];
|
|
564
661
|
};
|
|
565
662
|
/**
|
|
566
|
-
*
|
|
567
|
-
* -
|
|
568
|
-
*/
|
|
569
|
-
type DialogOpenResult<T> = Promise<T> & IScope;
|
|
570
|
-
/**
|
|
571
|
-
* 弹窗句柄:绑定给子组件使用
|
|
663
|
+
* 弹窗组件句柄
|
|
664
|
+
* - 用于在弹窗内容组件中进行模式判断和关闭
|
|
572
665
|
*/
|
|
573
666
|
type DialogHandle<T> = {
|
|
574
|
-
/** 组件是否处于【弹窗】模式下 */
|
|
575
|
-
inDialog: boolean;
|
|
576
667
|
/**
|
|
577
|
-
*
|
|
668
|
+
* 组件是否处于【模态弹窗】模式
|
|
669
|
+
*/
|
|
670
|
+
inDialog: Readonly<boolean>;
|
|
671
|
+
/**
|
|
672
|
+
* 关闭弹窗
|
|
578
673
|
* @param data 关闭时传递数据
|
|
579
674
|
*/
|
|
580
675
|
closeDialog(data?: T): void;
|
|
581
676
|
/**
|
|
582
|
-
*
|
|
677
|
+
* 注册监听【弹窗关闭】事件方法
|
|
583
678
|
* - 仅支持注册一次,多次注册以最后一次的为准
|
|
584
679
|
* @param fn 关闭时执行的钩子函数,支持异步,返回false时将阻止弹窗关闭
|
|
585
680
|
*/
|
|
586
681
|
onDialogClose(fn: () => false | undefined | Promise<false | undefined>): void;
|
|
587
682
|
};
|
|
588
683
|
/**
|
|
589
|
-
*
|
|
684
|
+
* 弹窗扩展信息
|
|
590
685
|
*/
|
|
591
|
-
type
|
|
686
|
+
type DailogExtend = {
|
|
592
687
|
/**
|
|
593
|
-
*
|
|
688
|
+
* 弹窗状态
|
|
594
689
|
*/
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* 模态弹窗显示的组件配置选项
|
|
598
|
-
*/
|
|
599
|
-
options: DialogOptions;
|
|
600
|
-
/**
|
|
601
|
-
* 弹窗句柄
|
|
602
|
-
* - 提供关闭弹窗等操作
|
|
603
|
-
* - 将挂载到内容组件的属性上,方便使用
|
|
604
|
-
*/
|
|
605
|
-
handle: DialogHandle<any>;
|
|
690
|
+
dialogStatus: PopupStatus;
|
|
606
691
|
};
|
|
607
692
|
|
|
608
|
-
/**
|
|
609
|
-
* 模态弹窗助手;提供模态弹窗相关功能
|
|
610
|
-
* 1、内部维护一个VueApp实例,专门用于进行模态弹窗操
|
|
611
|
-
* 2、模态弹窗展示效果,通过 @see ../componets/dialog-wrapper.vue 实现
|
|
612
|
-
*/
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* 打开模态弹窗
|
|
616
|
-
* @param options 弹窗组件配置选项
|
|
617
|
-
* @param onDestroyed 监听【调用方】的销毁时机,用于自动销毁打开的弹窗
|
|
618
|
-
* @returns 弹窗打开结果,可手动关闭弹窗
|
|
619
|
-
*/
|
|
620
|
-
declare function openDialog<T>(options: DialogOptions, onDestroyed?: (fn: () => void) => void): DialogOpenResult<T>;
|
|
621
|
-
/**
|
|
622
|
-
* 作用域弹窗:方法执行逻辑:
|
|
623
|
-
* - 1、打开弹窗前:若scopeRef有值,则强制执行 scopeRef.value.destroy() 做销毁
|
|
624
|
-
* - 2、打开弹窗 :构建IScope赋值给 scopeRef.value ;外部可 scopeRef.value.destroy() 强制关闭弹窗
|
|
625
|
-
* - 3、等待弹窗关闭 :得到弹窗返回值,置空scopeRef值,并返回弹窗返回值:scopeRef.value = undefined
|
|
626
|
-
* - 备注说明:封装重复性代码,简化外部开发逻辑;无实际业务意义
|
|
627
|
-
* @param options 弹窗配置选项
|
|
628
|
-
* @param scopeRef 作用域响应式对象
|
|
629
|
-
* @returns 弹窗关闭时传递的数据
|
|
630
|
-
*/
|
|
631
|
-
declare function scopeDialog<T>(options: DialogOptions, scopeRef: ShallowRef<IScope | undefined>): Promise<T>;
|
|
632
|
-
|
|
633
693
|
/**
|
|
634
694
|
* 确认弹窗配置选项
|
|
635
695
|
*/
|
|
@@ -666,16 +726,6 @@ type ConfirmOptions = {
|
|
|
666
726
|
*/
|
|
667
727
|
confirmDisabled?: boolean;
|
|
668
728
|
};
|
|
669
|
-
/**
|
|
670
|
-
* 确认弹窗句柄
|
|
671
|
-
*/
|
|
672
|
-
type ConfirmHandle = {
|
|
673
|
-
/**
|
|
674
|
-
* 关闭弹窗
|
|
675
|
-
* @param confirm 是否是点击【确认】按钮触发的关闭
|
|
676
|
-
*/
|
|
677
|
-
close: (confirm: boolean) => void;
|
|
678
|
-
};
|
|
679
729
|
|
|
680
730
|
/**
|
|
681
731
|
* Toast配置选项
|
|
@@ -690,29 +740,65 @@ type ToastOptions = {
|
|
|
690
740
|
*/
|
|
691
741
|
message: string;
|
|
692
742
|
};
|
|
743
|
+
|
|
693
744
|
/**
|
|
694
|
-
*
|
|
745
|
+
* 弹窗管理器
|
|
695
746
|
*/
|
|
696
|
-
|
|
747
|
+
interface IPopupManager {
|
|
697
748
|
/**
|
|
698
|
-
*
|
|
749
|
+
* 弹出
|
|
750
|
+
* - 弹窗位置位置、大小、动画效果等由组件自己完成
|
|
751
|
+
* @param options 弹窗配置选项
|
|
752
|
+
* @returns 弹窗打开结果,外部可手动关闭弹窗
|
|
699
753
|
*/
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
754
|
+
popup<T>(options: PopupOptions): IAsyncScope<T>;
|
|
755
|
+
/**
|
|
756
|
+
* 对话框
|
|
757
|
+
* - 支持指定模态和非模态对话框
|
|
758
|
+
* - 默认垂直水平居中展示
|
|
759
|
+
* @param options 弹窗配置选项
|
|
760
|
+
* @returns 弹窗打开结果,外部可手动关闭弹窗
|
|
761
|
+
*/
|
|
762
|
+
dialog<T>(options: DialogOptions): IAsyncScope<T>;
|
|
763
|
+
/**
|
|
764
|
+
* 打开【确认】弹窗
|
|
765
|
+
* @param title 弹窗标题
|
|
766
|
+
* @param message 确认提示信息,支持html片段
|
|
767
|
+
* @param options 确认弹窗其他配置信息
|
|
768
|
+
* @returns 弹窗打开结果,外部可手动关闭弹窗
|
|
769
|
+
*/
|
|
770
|
+
confirm(title: string, message: string, options?: Omit<ConfirmOptions, "title" | "message">): IAsyncScope<boolean>;
|
|
771
|
+
/**
|
|
772
|
+
* Toast 提示框
|
|
773
|
+
* @param type 提示类型:成功、失败、、、
|
|
774
|
+
* @param message 提示消息
|
|
775
|
+
* @param options 提示框配置选项
|
|
776
|
+
*/
|
|
777
|
+
toast(type: IconType, message: string, options?: Omit<ToastOptions, "type" | "message">): void;
|
|
778
|
+
}
|
|
703
779
|
/**
|
|
704
|
-
*
|
|
705
|
-
* @param type 提示类型:成功、失败、、、
|
|
706
|
-
* @param message 提示消息
|
|
780
|
+
* 弹窗描述器
|
|
707
781
|
*/
|
|
708
|
-
|
|
782
|
+
type PopupDescriptor<Options extends PopupOptions, ExtOptions> = PopupFlagOptions & {
|
|
783
|
+
/**
|
|
784
|
+
* 弹窗打开的容器组件:如DialogContainer、PopupContainer、、、
|
|
785
|
+
*/
|
|
786
|
+
container: Component;
|
|
787
|
+
/**
|
|
788
|
+
* 弹窗配置选项
|
|
789
|
+
*/
|
|
790
|
+
options: Options;
|
|
791
|
+
/**
|
|
792
|
+
* 扩展数据
|
|
793
|
+
*/
|
|
794
|
+
extOptions: ExtOptions;
|
|
795
|
+
};
|
|
796
|
+
|
|
709
797
|
/**
|
|
710
|
-
*
|
|
711
|
-
* @
|
|
712
|
-
* @param message 确认提示信息,支持html片段
|
|
713
|
-
* @returns 弹窗句柄
|
|
798
|
+
* 使用【弹窗管理器】
|
|
799
|
+
* @returns 全新的【弹窗管理器】实例+作用域对象
|
|
714
800
|
*/
|
|
715
|
-
declare function
|
|
801
|
+
declare function usePopup(): IPopupManager & IScope;
|
|
716
802
|
|
|
717
803
|
declare const components: {
|
|
718
804
|
Button: {
|
|
@@ -987,15 +1073,5 @@ declare const components: {
|
|
|
987
1073
|
});
|
|
988
1074
|
};
|
|
989
1075
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
* - 全新创建一个Vue实例挂载的传入组件
|
|
993
|
-
* - 用于在非vue环境下渲染vue组件内容
|
|
994
|
-
* @param options 挂载配置选项
|
|
995
|
-
* @param onDestroyed 监听【调用方】的销毁时机,用于自动销毁挂载的实力
|
|
996
|
-
* @returns
|
|
997
|
-
*/
|
|
998
|
-
declare function mount(options: ComponentMountOptions, onDestroyed?: (fn: () => void) => void): IScope;
|
|
999
|
-
|
|
1000
|
-
export { components, confirm, getSvgIcon, mount, onAppCreated, openDialog, scopeDialog, toast, triggerAppCreated, useReactive };
|
|
1001
|
-
export type { ButtonOptions, ComponentMountOptions, ComponentOptions, ConfirmHandle, ConfirmOptions, Dialog, DialogHandle, DialogOpenResult, DialogOptions, DragVerifyInfo, DragVerifyOptions, EmptyOptions, FoldEvents, FoldOptions, FoldStatus, FooterEvents, FooterOptions, HeaderEvents, HeaderOptions, IconOptions, IconPathOptions, IconType, InputEvents, InputOptions, LoadingOptions, ScrollEvents, ScrollOptions, ScrollTouchType, SwitchEvents, SwitchOptions, TableColOptions, TableOptions, TableRowOptions, ToastHandle, ToastOptions };
|
|
1076
|
+
export { components, getSvgIcon, mount, onAppCreated, triggerAppCreated, usePopup, useReactive };
|
|
1077
|
+
export type { ButtonOptions, ComponentMountOptions, ComponentOptions, ConfirmOptions, DailogExtend, DialogHandle, DialogOptions, DragVerifyInfo, DragVerifyOptions, EmptyOptions, FoldEvents, FoldOptions, FoldStatus, FooterEvents, FooterOptions, HeaderEvents, HeaderOptions, IPopupManager, IReactiveManager, IconOptions, IconPathOptions, IconType, InputEvents, InputOptions, LoadingOptions, PopupDescriptor, PopupExtend, PopupFlagOptions, PopupHandle, PopupOptions, PopupStatus, ScrollEvents, ScrollOptions, ScrollTouchType, SwitchEvents, SwitchOptions, TableColOptions, TableOptions, TableRowOptions, ToastOptions };
|