snail.vue 1.0.29 → 1.0.30
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 +169 -101
- package/dist/snail.vue.js +443 -302
- package/dist/snail.vue.umd.js +437 -299
- package/dist/styles/snail.vue.vue.css +18 -16
- package/package.json +3 -3
package/dist/snail.vue.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ 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
4
|
import { Component, App, ShallowRef } from 'vue';
|
|
5
|
-
import { IScope } from 'snail.core';
|
|
5
|
+
import { IScope, IAsyncScope } from 'snail.core';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* loading提示框的配置选项
|
|
@@ -522,9 +522,26 @@ declare function triggerAppCreated(app: App): App;
|
|
|
522
522
|
declare function getSvgIcon(options: IconOptions): IconPathOptions;
|
|
523
523
|
|
|
524
524
|
/**
|
|
525
|
-
*
|
|
525
|
+
* 挂载vue组件
|
|
526
|
+
* - 全新创建一个Vue实例挂载的传入组件
|
|
527
|
+
* - 用于在非vue环境下渲染vue组件内容
|
|
528
|
+
* @param options 挂载配置选项
|
|
529
|
+
* @param onDestroyed 监听【调用方】的销毁时机,用于自动销毁挂载的实力
|
|
530
|
+
* @returns
|
|
526
531
|
*/
|
|
527
|
-
|
|
532
|
+
declare function mount(options: ComponentMountOptions, onDestroyed?: (fn: () => void) => void): IScope;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* 公共通用数据结构:
|
|
536
|
+
* 1、在弹窗、模态弹窗、跟随弹窗的效果下复用
|
|
537
|
+
*/
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* 弹窗配置选项
|
|
541
|
+
* - 约束弹出组件信息
|
|
542
|
+
* - 弹出组件时传递的参数信息
|
|
543
|
+
*/
|
|
544
|
+
type PopupOptions = ComponentOptions & {
|
|
528
545
|
/**
|
|
529
546
|
* 传递给组件的属性值,执行v-bind绑定到要显示的组件
|
|
530
547
|
* - key为属性名称,遵循vue解析规则
|
|
@@ -533,29 +550,101 @@ type DialogOptions = ComponentOptions & {
|
|
|
533
550
|
props?: Record<string, any>;
|
|
534
551
|
/**
|
|
535
552
|
* 自定义class
|
|
536
|
-
* -
|
|
537
|
-
|
|
553
|
+
* - 绑定到内容组件根元素上
|
|
554
|
+
* - 可以直接在props中指定,无需特殊设置
|
|
538
555
|
class?: string | string[];
|
|
556
|
+
*/
|
|
539
557
|
/**
|
|
540
558
|
* 自定义style
|
|
541
|
-
* -
|
|
559
|
+
* - 绑定到内容组件根元素上
|
|
560
|
+
* - 可以直接在props中指定,无需特殊设置
|
|
561
|
+
style?: AllStyle;
|
|
542
562
|
*/
|
|
543
|
-
style?: string | string[];
|
|
544
563
|
/**
|
|
545
|
-
*
|
|
546
|
-
* -
|
|
564
|
+
* 弹窗的z-index值
|
|
565
|
+
* - 无特殊情况,建议不指定,内部会自动生成,确保弹窗正确性
|
|
547
566
|
*/
|
|
548
|
-
|
|
567
|
+
zIndex?: number;
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* 弹窗标识信息
|
|
571
|
+
*/
|
|
572
|
+
type PopupFlagOptions = {
|
|
549
573
|
/**
|
|
550
|
-
*
|
|
551
|
-
|
|
574
|
+
* 分配给弹窗的Id值
|
|
575
|
+
*/
|
|
576
|
+
id: number;
|
|
577
|
+
/**
|
|
578
|
+
* 实际分配的zIndex值
|
|
579
|
+
*/
|
|
580
|
+
zIndex: number;
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* 弹出组件句柄
|
|
584
|
+
*/
|
|
585
|
+
type PopupHandle<T> = {
|
|
586
|
+
/**
|
|
587
|
+
* 组件是否在【弹出窗口】中
|
|
588
|
+
*/
|
|
589
|
+
inPopup: Readonly<boolean>;
|
|
590
|
+
/**
|
|
591
|
+
* 关闭弹窗
|
|
592
|
+
* @param data 关闭时传递数据
|
|
593
|
+
*/
|
|
594
|
+
closePopup(data?: T): void;
|
|
595
|
+
};
|
|
596
|
+
/**
|
|
597
|
+
* 弹窗状态:响应式
|
|
598
|
+
* - open 打开
|
|
599
|
+
* - active 激活
|
|
600
|
+
* - unactive 非激活
|
|
601
|
+
* - close 关闭
|
|
602
|
+
*/
|
|
603
|
+
type PopupStatus = ShallowRef<"open" | "active" | "unactive" | "close">;
|
|
604
|
+
/**
|
|
605
|
+
* 弹窗扩展信息
|
|
606
|
+
*/
|
|
607
|
+
type PopupExtend = {
|
|
608
|
+
/**
|
|
609
|
+
* 弹窗状态
|
|
610
|
+
*/
|
|
611
|
+
popupStatus: PopupStatus;
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* 模态弹窗数据结构
|
|
616
|
+
*/
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* 模态弹窗配置选项
|
|
620
|
+
* - 继承 ComponentOptions ,动态加载组件
|
|
621
|
+
*/
|
|
622
|
+
type DialogOptions = PopupOptions & {
|
|
623
|
+
/**
|
|
624
|
+
* 禁用【遮罩层】
|
|
625
|
+
* - 目前没实现,先忽略
|
|
626
|
+
maskDisabled?: boolean;
|
|
627
|
+
*/
|
|
628
|
+
/**
|
|
629
|
+
* 点击【遮罩层】时是否关闭弹窗
|
|
630
|
+
* - 针对无遮罩层的弹窗,则点击非【弹窗组件】区域时是否关闭
|
|
552
631
|
*/
|
|
553
632
|
closeOnMask?: boolean;
|
|
554
633
|
/**
|
|
555
|
-
*
|
|
556
|
-
* - 无特殊情况,建议不粗韩,内部会自动生成,确保弹窗正确性
|
|
634
|
+
* 按下【ESC】健时是否关闭弹窗
|
|
557
635
|
*/
|
|
558
|
-
|
|
636
|
+
closeOnEscape?: boolean;
|
|
637
|
+
/**
|
|
638
|
+
* 模态弹窗动画名
|
|
639
|
+
* - 不传则使用默认,具体有弹窗容器确认,如dialog为 snail-dialog
|
|
640
|
+
*/
|
|
641
|
+
transition?: string;
|
|
642
|
+
/**
|
|
643
|
+
* 动画持续时间
|
|
644
|
+
* - 配合 transition 使用;单位ms,默认100ms
|
|
645
|
+
* - 外部传入自定义动画时,传入动画持续时间,否则可能导致关闭时动画失效
|
|
646
|
+
*/
|
|
647
|
+
transitionDuration?: number;
|
|
559
648
|
/**
|
|
560
649
|
* 模态弹窗的自定义class
|
|
561
650
|
* - 绑定到模态弹窗的根元素上
|
|
@@ -563,73 +652,36 @@ type DialogOptions = ComponentOptions & {
|
|
|
563
652
|
rootClass?: string | string[];
|
|
564
653
|
};
|
|
565
654
|
/**
|
|
566
|
-
*
|
|
567
|
-
* -
|
|
568
|
-
*/
|
|
569
|
-
type DialogOpenResult<T> = Promise<T> & IScope;
|
|
570
|
-
/**
|
|
571
|
-
* 弹窗句柄:绑定给子组件使用
|
|
655
|
+
* 弹窗组件句柄
|
|
656
|
+
* - 用于在弹窗内容组件中进行模式判断和关闭
|
|
572
657
|
*/
|
|
573
658
|
type DialogHandle<T> = {
|
|
574
|
-
/** 组件是否处于【弹窗】模式下 */
|
|
575
|
-
inDialog: boolean;
|
|
576
659
|
/**
|
|
577
|
-
*
|
|
660
|
+
* 组件是否处于【模态弹窗】模式
|
|
661
|
+
*/
|
|
662
|
+
inDialog: Readonly<boolean>;
|
|
663
|
+
/**
|
|
664
|
+
* 关闭弹窗
|
|
578
665
|
* @param data 关闭时传递数据
|
|
579
666
|
*/
|
|
580
667
|
closeDialog(data?: T): void;
|
|
581
668
|
/**
|
|
582
|
-
*
|
|
669
|
+
* 注册监听【弹窗关闭】事件方法
|
|
583
670
|
* - 仅支持注册一次,多次注册以最后一次的为准
|
|
584
671
|
* @param fn 关闭时执行的钩子函数,支持异步,返回false时将阻止弹窗关闭
|
|
585
672
|
*/
|
|
586
673
|
onDialogClose(fn: () => false | undefined | Promise<false | undefined>): void;
|
|
587
674
|
};
|
|
588
675
|
/**
|
|
589
|
-
*
|
|
676
|
+
* 弹窗扩展信息
|
|
590
677
|
*/
|
|
591
|
-
type
|
|
592
|
-
/**
|
|
593
|
-
* 弹窗Id,唯一值
|
|
594
|
-
*/
|
|
595
|
-
id: string;
|
|
596
|
-
/**
|
|
597
|
-
* 模态弹窗显示的组件配置选项
|
|
598
|
-
*/
|
|
599
|
-
options: DialogOptions;
|
|
678
|
+
type DailogExtend = {
|
|
600
679
|
/**
|
|
601
|
-
*
|
|
602
|
-
* - 提供关闭弹窗等操作
|
|
603
|
-
* - 将挂载到内容组件的属性上,方便使用
|
|
680
|
+
* 弹窗状态
|
|
604
681
|
*/
|
|
605
|
-
|
|
682
|
+
dialogStatus: PopupStatus;
|
|
606
683
|
};
|
|
607
684
|
|
|
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
685
|
/**
|
|
634
686
|
* 确认弹窗配置选项
|
|
635
687
|
*/
|
|
@@ -666,16 +718,6 @@ type ConfirmOptions = {
|
|
|
666
718
|
*/
|
|
667
719
|
confirmDisabled?: boolean;
|
|
668
720
|
};
|
|
669
|
-
/**
|
|
670
|
-
* 确认弹窗句柄
|
|
671
|
-
*/
|
|
672
|
-
type ConfirmHandle = {
|
|
673
|
-
/**
|
|
674
|
-
* 关闭弹窗
|
|
675
|
-
* @param confirm 是否是点击【确认】按钮触发的关闭
|
|
676
|
-
*/
|
|
677
|
-
close: (confirm: boolean) => void;
|
|
678
|
-
};
|
|
679
721
|
|
|
680
722
|
/**
|
|
681
723
|
* Toast配置选项
|
|
@@ -690,29 +732,65 @@ type ToastOptions = {
|
|
|
690
732
|
*/
|
|
691
733
|
message: string;
|
|
692
734
|
};
|
|
735
|
+
|
|
693
736
|
/**
|
|
694
|
-
*
|
|
737
|
+
* 弹窗管理器
|
|
695
738
|
*/
|
|
696
|
-
|
|
739
|
+
interface IPopupManager {
|
|
697
740
|
/**
|
|
698
|
-
*
|
|
741
|
+
* 弹出
|
|
742
|
+
* - 弹窗位置位置、大小、动画效果等由组件自己完成
|
|
743
|
+
* @param options 弹窗配置选项
|
|
744
|
+
* @returns 弹窗打开结果,外部可手动关闭弹窗
|
|
699
745
|
*/
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
746
|
+
popup<T>(options: PopupOptions): IAsyncScope<T>;
|
|
747
|
+
/**
|
|
748
|
+
* 对话框
|
|
749
|
+
* - 支持指定模态和非模态对话框
|
|
750
|
+
* - 默认垂直水平居中展示
|
|
751
|
+
* @param options 弹窗配置选项
|
|
752
|
+
* @returns 弹窗打开结果,外部可手动关闭弹窗
|
|
753
|
+
*/
|
|
754
|
+
dialog<T>(options: DialogOptions): IAsyncScope<T>;
|
|
755
|
+
/**
|
|
756
|
+
* 打开【确认】弹窗
|
|
757
|
+
* @param title 弹窗标题
|
|
758
|
+
* @param message 确认提示信息,支持html片段
|
|
759
|
+
* @param options 确认弹窗其他配置信息
|
|
760
|
+
* @returns 弹窗打开结果,外部可手动关闭弹窗
|
|
761
|
+
*/
|
|
762
|
+
confirm(title: string, message: string, options?: Omit<ConfirmOptions, "title" | "message">): IAsyncScope<boolean>;
|
|
763
|
+
/**
|
|
764
|
+
* Toast 提示框
|
|
765
|
+
* @param type 提示类型:成功、失败、、、
|
|
766
|
+
* @param message 提示消息
|
|
767
|
+
* @param options 提示框配置选项
|
|
768
|
+
*/
|
|
769
|
+
toast(type: IconType, message: string, options?: Omit<ToastOptions, "type" | "message">): void;
|
|
770
|
+
}
|
|
703
771
|
/**
|
|
704
|
-
*
|
|
705
|
-
* @param type 提示类型:成功、失败、、、
|
|
706
|
-
* @param message 提示消息
|
|
772
|
+
* 弹窗描述器
|
|
707
773
|
*/
|
|
708
|
-
|
|
774
|
+
type PopupDescriptor<Options extends PopupOptions, ExtOptions> = PopupFlagOptions & {
|
|
775
|
+
/**
|
|
776
|
+
* 弹窗打开的容器组件:如DialogContainer、PopupContainer、、、
|
|
777
|
+
*/
|
|
778
|
+
container: Component;
|
|
779
|
+
/**
|
|
780
|
+
* 弹窗配置选项
|
|
781
|
+
*/
|
|
782
|
+
options: Options;
|
|
783
|
+
/**
|
|
784
|
+
* 扩展数据
|
|
785
|
+
*/
|
|
786
|
+
extOptions: ExtOptions;
|
|
787
|
+
};
|
|
788
|
+
|
|
709
789
|
/**
|
|
710
|
-
*
|
|
711
|
-
* @
|
|
712
|
-
* @param message 确认提示信息,支持html片段
|
|
713
|
-
* @returns 弹窗句柄
|
|
790
|
+
* 使用【弹窗管理器】
|
|
791
|
+
* @returns 全新的【弹窗管理器】实例+作用域对象
|
|
714
792
|
*/
|
|
715
|
-
declare function
|
|
793
|
+
declare function usePopup(): IPopupManager & IScope;
|
|
716
794
|
|
|
717
795
|
declare const components: {
|
|
718
796
|
Button: {
|
|
@@ -987,15 +1065,5 @@ declare const components: {
|
|
|
987
1065
|
});
|
|
988
1066
|
};
|
|
989
1067
|
|
|
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 };
|
|
1068
|
+
export { components, getSvgIcon, mount, onAppCreated, triggerAppCreated, usePopup, useReactive };
|
|
1069
|
+
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 };
|