snail.vue 2.0.27 → 2.0.28
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 +512 -499
- package/dist/snail.vue.js +61 -49
- package/dist/snail.vue.umd.js +60 -48
- package/dist/styles/snail.vue.vue.css +4 -4
- package/package.json +1 -1
package/dist/snail.vue.d.ts
CHANGED
|
@@ -1881,6 +1881,18 @@ type IconOptions = TitleOptions & {
|
|
|
1881
1881
|
* - 不传入,默认1
|
|
1882
1882
|
*/
|
|
1883
1883
|
opacity?: number;
|
|
1884
|
+
/**
|
|
1885
|
+
* 图标边样式
|
|
1886
|
+
*/
|
|
1887
|
+
border?: string;
|
|
1888
|
+
/**
|
|
1889
|
+
* 图标圆角样式
|
|
1890
|
+
*/
|
|
1891
|
+
radius?: string;
|
|
1892
|
+
/**
|
|
1893
|
+
* 图标背景样式
|
|
1894
|
+
*/
|
|
1895
|
+
background?: string;
|
|
1884
1896
|
/**
|
|
1885
1897
|
* 图形伸展
|
|
1886
1898
|
* - svg.viewBox 属性
|
|
@@ -1900,6 +1912,7 @@ type IconOptions = TitleOptions & {
|
|
|
1900
1912
|
* - - download 下载
|
|
1901
1913
|
* - - print 打印
|
|
1902
1914
|
* - - edit 编辑
|
|
1915
|
+
* - - pause 暂停,两道竖线
|
|
1903
1916
|
* - 指向类:
|
|
1904
1917
|
* - - arrow 向右箭头
|
|
1905
1918
|
* - - datepicker 日期选择器
|
|
@@ -1910,7 +1923,7 @@ type IconOptions = TitleOptions & {
|
|
|
1910
1923
|
* - - more 更多,默认垂直三个点
|
|
1911
1924
|
* - - grip 紧握图标,垂直方向,一般用于拖动句柄
|
|
1912
1925
|
*/
|
|
1913
|
-
type IconType = "success" | "error" | "warn" | "close" | "trash" | "download" | "print" | "edit" | "arrow" | "datepicker" | "timepicker" | "plus" | "subtract" | "more" | "grip";
|
|
1926
|
+
type IconType = "success" | "error" | "warn" | "close" | "trash" | "download" | "print" | "edit" | "pause" | "arrow" | "datepicker" | "timepicker" | "plus" | "subtract" | "more" | "grip";
|
|
1914
1927
|
|
|
1915
1928
|
/**
|
|
1916
1929
|
* 检查选项 数据结构
|
|
@@ -2007,220 +2020,493 @@ type ButtonOptions = TitleOptions & {
|
|
|
2007
2020
|
};
|
|
2008
2021
|
|
|
2009
2022
|
/**
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
*/
|
|
2013
|
-
type ActionOptions = DisabledOptions & {
|
|
2014
|
-
/**
|
|
2015
|
-
* 触发方式
|
|
2016
|
-
* - always :始终显示一个触发图标,点击图标弹出操作项
|
|
2017
|
-
* - hover:鼠标移入显示一个触发图标,点击图标弹出操作项
|
|
2018
|
-
* - long-press:长摁直接弹出操作项
|
|
2019
|
-
*/
|
|
2020
|
-
trigger: "always" | "hover" | "long-press";
|
|
2021
|
-
/**
|
|
2022
|
-
* 显示模式
|
|
2023
|
-
* - popup:弹出显示操作项
|
|
2024
|
-
* - inline:内联显示操作项
|
|
2025
|
-
*/
|
|
2026
|
-
/**
|
|
2027
|
-
* 可用操作项
|
|
2028
|
-
*/
|
|
2029
|
-
actions: ActionItem[];
|
|
2030
|
-
};
|
|
2031
|
-
/**
|
|
2032
|
-
* 操作项集合 组件渲染配置选项
|
|
2023
|
+
* 公共通用数据结构:
|
|
2024
|
+
* 1、在弹窗、模态弹窗、跟随弹窗的效果下复用
|
|
2033
2025
|
*/
|
|
2034
|
-
|
|
2035
|
-
/**
|
|
2036
|
-
* 展示模式
|
|
2037
|
-
* - horizontal 水平展示
|
|
2038
|
-
* - vertical 垂直展示
|
|
2039
|
-
*/
|
|
2040
|
-
mode: "horizontal" | "vertical";
|
|
2041
|
-
/**
|
|
2042
|
-
* 要渲染的操作项
|
|
2043
|
-
*/
|
|
2044
|
-
actions: ActionItem[];
|
|
2045
|
-
};
|
|
2026
|
+
|
|
2046
2027
|
/**
|
|
2047
|
-
*
|
|
2028
|
+
* 弹窗配置选项
|
|
2029
|
+
* - 约束弹出组件信息
|
|
2030
|
+
* - 弹出组件时传递的参数信息
|
|
2031
|
+
* @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
|
|
2048
2032
|
*/
|
|
2049
|
-
type
|
|
2033
|
+
type PopupOptions<Props = void, Model = void> = ComponentOptions & ComponentBindOptions<Props, Model> & {
|
|
2050
2034
|
/**
|
|
2051
|
-
*
|
|
2052
|
-
* -
|
|
2035
|
+
* 弹窗动画名
|
|
2036
|
+
* - 不传则默认“fade”
|
|
2037
|
+
* - 动画规则:打开弹窗时,为 [transition]-in ;关闭弹窗时,为[transition]-out
|
|
2038
|
+
* - - 传入 "scale",则打开弹窗为 "scale-in";关闭弹窗时为 "scale-out"
|
|
2053
2039
|
*/
|
|
2054
|
-
|
|
2040
|
+
transition?: string;
|
|
2055
2041
|
/**
|
|
2056
|
-
*
|
|
2057
|
-
* -
|
|
2042
|
+
* 动画持续时间
|
|
2043
|
+
* - 配合 transition 使用;单位ms,默认500ms
|
|
2044
|
+
* - 外部传入自定义动画时,传入动画持续时间,否则可能导致关闭时动画失效
|
|
2058
2045
|
*/
|
|
2059
|
-
|
|
2046
|
+
transitionDuration?: number;
|
|
2060
2047
|
/**
|
|
2061
|
-
*
|
|
2048
|
+
* 自定义class
|
|
2049
|
+
* - 绑定到内容组件根元素上
|
|
2050
|
+
* - 可以直接在props中指定,无需特殊设置
|
|
2051
|
+
class?: string | string[];
|
|
2062
2052
|
*/
|
|
2063
|
-
color?: string;
|
|
2064
2053
|
/**
|
|
2065
|
-
*
|
|
2054
|
+
* 自定义style
|
|
2055
|
+
* - 绑定到内容组件根元素上
|
|
2056
|
+
* - 可以直接在props中指定,无需特殊设置
|
|
2057
|
+
style?: AllStyle;
|
|
2066
2058
|
*/
|
|
2067
|
-
hoverColor?: string;
|
|
2068
2059
|
/**
|
|
2069
|
-
*
|
|
2060
|
+
* 弹窗的z-index值
|
|
2061
|
+
* - 无特殊情况,建议不指定,内部会自动生成,确保弹窗正确性
|
|
2070
2062
|
*/
|
|
2071
|
-
|
|
2063
|
+
zIndex?: number;
|
|
2072
2064
|
};
|
|
2073
2065
|
/**
|
|
2074
|
-
*
|
|
2066
|
+
* 弹出组件句柄
|
|
2075
2067
|
*/
|
|
2076
|
-
type
|
|
2068
|
+
type PopupHandle<T> = {
|
|
2077
2069
|
/**
|
|
2078
|
-
*
|
|
2070
|
+
* 组件是否在【弹出窗口】中
|
|
2071
|
+
* - popup : 普通弹出弹窗
|
|
2072
|
+
* - dialog : 模态对话弹窗
|
|
2073
|
+
* - follow : 跟随效果弹窗
|
|
2079
2074
|
*/
|
|
2080
|
-
|
|
2075
|
+
inPopup: Readonly<"popup" | "dialog" | "follow">;
|
|
2081
2076
|
/**
|
|
2082
|
-
*
|
|
2077
|
+
* 关闭弹窗
|
|
2078
|
+
* @param data 关闭时传递数据
|
|
2083
2079
|
*/
|
|
2084
|
-
|
|
2080
|
+
closePopup(data?: T): void;
|
|
2085
2081
|
};
|
|
2086
2082
|
/**
|
|
2087
|
-
*
|
|
2083
|
+
* 弹窗状态:响应式
|
|
2084
|
+
* - open 打开
|
|
2085
|
+
* - active 激活,针对Dialog弹窗生效
|
|
2086
|
+
* - unactive 非激活,针对Dialog弹窗生效
|
|
2087
|
+
* - closed 关闭
|
|
2088
2088
|
*/
|
|
2089
|
-
type
|
|
2090
|
-
/**
|
|
2091
|
-
* 操作项激活时
|
|
2092
|
-
* @param code 操作项的code
|
|
2093
|
-
*/
|
|
2094
|
-
trigger: [code: string];
|
|
2095
|
-
};
|
|
2096
|
-
|
|
2089
|
+
type PopupStatus = ShallowRef<"open" | "active" | "unactive" | "closed">;
|
|
2097
2090
|
/**
|
|
2098
|
-
*
|
|
2099
|
-
* - title 将作为 输入框标题区域文本;不传入则不展示 标题区域,仅展示输入框
|
|
2100
|
-
* - 暂不提供 disabled 逻辑
|
|
2091
|
+
* 弹窗状态 配置选项
|
|
2101
2092
|
*/
|
|
2102
|
-
type
|
|
2103
|
-
/**
|
|
2104
|
-
* 输入框类型
|
|
2105
|
-
* - text: 文本输入框
|
|
2106
|
-
* - number: 数字输入框
|
|
2107
|
-
* - password: 密码输入框
|
|
2108
|
-
*/
|
|
2109
|
-
type?: "text" | "number" | "password";
|
|
2110
|
-
/**
|
|
2111
|
-
* 输入框是否必填
|
|
2112
|
-
* - 必填,则验证不通过时,显示错误信息
|
|
2113
|
-
* - 必填时,显示必填标记,红色 * 号
|
|
2114
|
-
*/
|
|
2115
|
-
required?: boolean;
|
|
2093
|
+
type PopupStatusOptions = {
|
|
2116
2094
|
/**
|
|
2117
|
-
*
|
|
2118
|
-
* - 对齐方式
|
|
2119
|
-
* - 标题区域宽度
|
|
2095
|
+
* 弹窗状态:响应式
|
|
2120
2096
|
*/
|
|
2121
|
-
|
|
2097
|
+
popupStatus: PopupStatus;
|
|
2122
2098
|
};
|
|
2123
2099
|
/**
|
|
2124
|
-
*
|
|
2100
|
+
* 弹窗对象描述器
|
|
2101
|
+
* - 给弹窗容器使用,传递过去作为props使用
|
|
2125
2102
|
*/
|
|
2126
|
-
type
|
|
2103
|
+
type PopupDescriptor<Options extends PopupOptions, ExtOptions> = PopupStatusOptions & {
|
|
2127
2104
|
/**
|
|
2128
|
-
*
|
|
2105
|
+
* 弹窗Id
|
|
2106
|
+
* - 自动分配,全局唯一
|
|
2129
2107
|
*/
|
|
2130
|
-
|
|
2108
|
+
popupId: string;
|
|
2131
2109
|
/**
|
|
2132
|
-
*
|
|
2133
|
-
*
|
|
2110
|
+
* 弹窗配置选项
|
|
2111
|
+
* - 由外部传递过来的业务数据配置信息
|
|
2112
|
+
* - 约束具体弹窗的业务组件和业务组件所需props等数据
|
|
2134
2113
|
*/
|
|
2135
|
-
|
|
2136
|
-
};
|
|
2137
|
-
|
|
2138
|
-
/**
|
|
2139
|
-
* 接口:响应式管理器
|
|
2140
|
-
*/
|
|
2141
|
-
interface IReactiveManager {
|
|
2114
|
+
options: Options;
|
|
2142
2115
|
/**
|
|
2143
|
-
*
|
|
2144
|
-
* -
|
|
2145
|
-
* -
|
|
2146
|
-
* - 开始时,设置 rv.value 值为 from;延迟time时间后,强制销毁scope
|
|
2147
|
-
* - 销毁scope时,强制将 rv.value 值设置为 to 值
|
|
2148
|
-
* @param rv 响应式变量对象
|
|
2149
|
-
* @param effect 过渡效果配置,约束 from end 样式
|
|
2150
|
-
* @param time 过渡持续时间,到时间后销毁作用域
|
|
2151
|
-
* @returns 作用域对象,可销毁【值过渡】效果
|
|
2116
|
+
* 弹窗扩展配置选项
|
|
2117
|
+
* - 由 popup、follow等方法内部组件:如关闭弹窗方法、钩子函数等
|
|
2118
|
+
* - 配合业务组件使用的一些配置数据
|
|
2152
2119
|
*/
|
|
2153
|
-
|
|
2154
|
-
from: T;
|
|
2155
|
-
to: T;
|
|
2156
|
-
}, time: number): IScope;
|
|
2120
|
+
extOptions: ExtOptions;
|
|
2157
2121
|
/**
|
|
2158
|
-
*
|
|
2159
|
-
* - 任务运行时,设置loading.value=true
|
|
2160
|
-
* - 任务完成后,设置loading.value=false
|
|
2161
|
-
* - 可通过delay值,延迟执行 loading.value=false 操作
|
|
2162
|
-
* - 可在api请求等耗时操作任务过程中,实现响应式显隐Loading组件
|
|
2163
|
-
* @param task 要运行的任务
|
|
2164
|
-
* @param loading 正在加载的响应式变量
|
|
2165
|
-
* @param delay 延迟时间,单位ms;不传则不延迟
|
|
2166
|
-
* @returns 任务自身
|
|
2122
|
+
* 实际分配的zIndex值
|
|
2167
2123
|
*/
|
|
2168
|
-
|
|
2124
|
+
zIndex: number;
|
|
2169
2125
|
/**
|
|
2170
|
-
*
|
|
2171
|
-
* -
|
|
2172
|
-
* -
|
|
2173
|
-
* - 仅实现简化版本watch监听;复杂的监听逻辑,自行使用watch方法
|
|
2174
|
-
* @param source 监听源
|
|
2175
|
-
* @param callback 回调方法:可接收新旧值变化
|
|
2176
|
-
* @param deep 是否进行深度监听;默认false
|
|
2177
|
-
* @returns 监听作用域,destroy可销毁监听
|
|
2126
|
+
* 弹窗动画名
|
|
2127
|
+
* - 约束打开、关闭动画;基于 PopupOptions.transition 构建出来的
|
|
2128
|
+
* - 具体使用方,将此值绑定的根元素上
|
|
2178
2129
|
*/
|
|
2179
|
-
|
|
2180
|
-
}
|
|
2130
|
+
popupTransition: ShallowRef<string>;
|
|
2131
|
+
};
|
|
2132
|
+
|
|
2181
2133
|
/**
|
|
2182
|
-
*
|
|
2134
|
+
* 跟随效果 弹窗
|
|
2183
2135
|
*/
|
|
2184
|
-
type ReactiveVar<T> = ShallowRef<T> | Ref<T>;
|
|
2185
2136
|
|
|
2186
2137
|
/**
|
|
2187
|
-
*
|
|
2138
|
+
* 跟随弹窗 配置选项
|
|
2139
|
+
* - 传入的组件,根据配置跟随 target 位置和大小;
|
|
2140
|
+
* @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
|
|
2188
2141
|
*/
|
|
2189
|
-
type
|
|
2190
|
-
/**
|
|
2191
|
-
* 类型,决定开启/关闭状态的渲染效果
|
|
2192
|
-
* - switch 开关类型,默认效果
|
|
2193
|
-
* - radio 单选框效果,圆角边框
|
|
2194
|
-
* - checkbox 复选框效果,矩形边框
|
|
2195
|
-
*/
|
|
2196
|
-
type?: "switch" | "radio" | "checkbox";
|
|
2197
|
-
};
|
|
2142
|
+
type FollowOptions<Props = void, Model = void> = PopupOptions<Props, Model> & FollowPositionOptions;
|
|
2198
2143
|
/**
|
|
2199
|
-
*
|
|
2144
|
+
* 跟随位置 配置选项
|
|
2145
|
+
* - 基于此计算出最终的跟随效果
|
|
2200
2146
|
*/
|
|
2201
|
-
type
|
|
2147
|
+
type FollowPositionOptions = {
|
|
2202
2148
|
/**
|
|
2203
|
-
*
|
|
2204
|
-
*
|
|
2149
|
+
* 启用【宽度】跟随
|
|
2150
|
+
* - 为true则和 target 宽度保持一致
|
|
2151
|
+
* - false时,宽度由 弹出组件 自己维护
|
|
2152
|
+
* - 不管是true、还是false,若宽度超过浏览器最大宽度,会进行强制干预
|
|
2205
2153
|
*/
|
|
2206
|
-
|
|
2207
|
-
};
|
|
2208
|
-
|
|
2209
|
-
/**
|
|
2210
|
-
* 多行文本框组件配置选项
|
|
2211
|
-
*/
|
|
2212
|
-
type TextareaOptions = ReadonlyOptions & PlaceholderOptions & {
|
|
2154
|
+
followWidth?: boolean;
|
|
2213
2155
|
/**
|
|
2214
|
-
*
|
|
2215
|
-
* -
|
|
2216
|
-
* -
|
|
2156
|
+
* 启用【高度】跟随
|
|
2157
|
+
* - 为true则和 target 高度保持一致
|
|
2158
|
+
* - false时,高度由 弹出组件 自己维护
|
|
2159
|
+
* - 不管是true、还是false,若高度超过浏览器最大高度,会进行强制干预
|
|
2217
2160
|
*/
|
|
2218
|
-
|
|
2161
|
+
followHeight?: boolean;
|
|
2219
2162
|
/**
|
|
2220
|
-
*
|
|
2221
|
-
* -
|
|
2222
|
-
* -
|
|
2223
|
-
|
|
2163
|
+
* x轴方向上的跟随策略
|
|
2164
|
+
* - 支持传入一个或者多个,依次尝试选举最优位置(全宽度展示,否则取最大宽度位置)
|
|
2165
|
+
* - 不传入则按照默认策略;["start","end","after","before","center","ratio"]
|
|
2166
|
+
* - 可选策略值如下:
|
|
2167
|
+
* - - start : 起点跟随,和 target 起始位置(left)一致
|
|
2168
|
+
* - - end : 终点跟随,和 target 结束位置(right)一致
|
|
2169
|
+
* - - center : 中心跟随,和 target 中心位置一致
|
|
2170
|
+
* - - before : 之前跟随,组件在 target 左侧展示
|
|
2171
|
+
* - - after : 之后跟随,组件在 target 右侧展示
|
|
2172
|
+
* - - ratio : 比例跟随,按比例(target中心点/窗口宽度)锚定位置,动态计算left值。
|
|
2173
|
+
*/
|
|
2174
|
+
followX?: FollowStrategy | FollowStrategy[];
|
|
2175
|
+
/**
|
|
2176
|
+
* y轴方向上的跟随策略
|
|
2177
|
+
* - 支持传入一个或者多个,依次尝试选举最优位置(全高度展示,否则取最大高度位置)
|
|
2178
|
+
* - 不传入则按照默认策略;["after","before","start","end","center","ratio"]
|
|
2179
|
+
* - 可选策略值如下:
|
|
2180
|
+
* - - start : 起点跟随,和 target 起始位置(top)一致
|
|
2181
|
+
* - - end : 终点跟随,和 target 结束位置(bottom)一致
|
|
2182
|
+
* - - center : 中心跟随,和 target 中心位置一致
|
|
2183
|
+
* - - before : 之前跟随,组件在 target 顶部展示
|
|
2184
|
+
* - - after : 之后跟随,组件在 target 底部展示
|
|
2185
|
+
* - - ratio : 比例跟随,按比例(target中心点/窗口高度)锚定位置,动态计算top值。
|
|
2186
|
+
*/
|
|
2187
|
+
followY?: FollowStrategy | FollowStrategy[];
|
|
2188
|
+
/**
|
|
2189
|
+
* x轴方向上 target 之间的留白空间
|
|
2190
|
+
* - 默认0; followX 为 center、ratio 时间距失效
|
|
2191
|
+
* - 增加间距,提升展示效果
|
|
2192
|
+
* -
|
|
2193
|
+
*/
|
|
2194
|
+
spaceX?: number;
|
|
2195
|
+
/**
|
|
2196
|
+
* y轴方向上 target 之间的留白空间
|
|
2197
|
+
* - 默认0;followY 为 center、ratio 时间距失效
|
|
2198
|
+
* - 增加间距,提升展示效果
|
|
2199
|
+
*/
|
|
2200
|
+
spaceY?: number;
|
|
2201
|
+
/**
|
|
2202
|
+
* 和 浏览器客户 端之间的留白空间
|
|
2203
|
+
* - 弹出组件 和浏览器客户端窗口之间的【留白空间】
|
|
2204
|
+
* - 仅在 弹出组件 计算出来位置紧贴浏览器窗口时生效
|
|
2205
|
+
* - 若强制指定了 start、end,则对应的起始、结束位置不受此值影响
|
|
2206
|
+
*/
|
|
2207
|
+
spaceClient?: number;
|
|
2208
|
+
/**
|
|
2209
|
+
* 点击【遮罩层】时是否关闭弹窗
|
|
2210
|
+
* - 则点击非【跟随组件】区域时是否关闭
|
|
2211
|
+
*/
|
|
2212
|
+
closeOnMask?: boolean;
|
|
2213
|
+
/**
|
|
2214
|
+
* 按下【ESC】健时是否关闭弹窗
|
|
2215
|
+
*/
|
|
2216
|
+
closeOnEscape?: boolean;
|
|
2217
|
+
/**
|
|
2218
|
+
* window窗口【resize】时是否关闭弹窗
|
|
2219
|
+
*/
|
|
2220
|
+
closeOnResize?: boolean;
|
|
2221
|
+
/**
|
|
2222
|
+
* target改变时是否关闭弹窗
|
|
2223
|
+
* - target尺寸、位置变化
|
|
2224
|
+
* - target点击时
|
|
2225
|
+
*/
|
|
2226
|
+
closeOnTarget?: boolean;
|
|
2227
|
+
};
|
|
2228
|
+
/**
|
|
2229
|
+
* 跟随策略
|
|
2230
|
+
* - 详细值定义,参照 FollowOptions.followX 和 FollowOptions.followY
|
|
2231
|
+
*/
|
|
2232
|
+
type FollowStrategy = "start" | "center" | "end" | "before" | "after" | "ratio";
|
|
2233
|
+
/**
|
|
2234
|
+
* 跟随弹窗 句柄
|
|
2235
|
+
* - 用于在 弹窗组件 内部进行模式判断和关闭跟随弹窗
|
|
2236
|
+
*/
|
|
2237
|
+
type FollowHandle<T> = PopupHandle<T> & {};
|
|
2238
|
+
/**
|
|
2239
|
+
* 跟随弹窗 扩展配置
|
|
2240
|
+
*/
|
|
2241
|
+
type FollowExtend = PopupStatusOptions & {
|
|
2242
|
+
/**
|
|
2243
|
+
* 跟随的目标元素
|
|
2244
|
+
*/
|
|
2245
|
+
target: Element;
|
|
2246
|
+
/**
|
|
2247
|
+
* x轴方向的跟随策略:响应式
|
|
2248
|
+
* - 基于外部传入的跟随策略,计算选举出来的最优策略值
|
|
2249
|
+
*/
|
|
2250
|
+
followX: ShallowRef<FollowStrategy>;
|
|
2251
|
+
/**
|
|
2252
|
+
* y轴方向的跟随策略:响应式
|
|
2253
|
+
* - 基于外部传入的跟随策略,计算选举出来的最优策略值
|
|
2254
|
+
*/
|
|
2255
|
+
followY: ShallowRef<FollowStrategy>;
|
|
2256
|
+
/**
|
|
2257
|
+
* Follow弹窗是否【钉住】了
|
|
2258
|
+
* - 为true时,closeOnMask、closeOnEscape失效
|
|
2259
|
+
* - 满足 子弹窗 点击等操作时,不自动销毁父级弹窗
|
|
2260
|
+
*/
|
|
2261
|
+
pinned: ShallowRef<boolean>;
|
|
2262
|
+
};
|
|
2263
|
+
/**
|
|
2264
|
+
* 跟随策略 配置选项
|
|
2265
|
+
*/
|
|
2266
|
+
type FollowStrategyOptions = {
|
|
2267
|
+
/**
|
|
2268
|
+
* x轴的跟随策略
|
|
2269
|
+
*/
|
|
2270
|
+
followX?: FollowStrategy;
|
|
2271
|
+
/**
|
|
2272
|
+
* x轴的跟随策略
|
|
2273
|
+
*/
|
|
2274
|
+
followY?: FollowStrategy;
|
|
2275
|
+
};
|
|
2276
|
+
/**
|
|
2277
|
+
* 跟随选举结果
|
|
2278
|
+
*/
|
|
2279
|
+
type FollowElectResult = {
|
|
2280
|
+
/**
|
|
2281
|
+
* 跟随策略
|
|
2282
|
+
*/
|
|
2283
|
+
strategy: FollowStrategy;
|
|
2284
|
+
/**
|
|
2285
|
+
* 开始位置:x/top
|
|
2286
|
+
*/
|
|
2287
|
+
start: number;
|
|
2288
|
+
/**
|
|
2289
|
+
* 调整后的尺寸(width/height)
|
|
2290
|
+
* - 为undefined表示无需调整尺寸
|
|
2291
|
+
*/
|
|
2292
|
+
size?: number;
|
|
2293
|
+
};
|
|
2294
|
+
|
|
2295
|
+
/**
|
|
2296
|
+
* 可操作项组件 的配置选项
|
|
2297
|
+
* - disabled 为true时,不响应操作项触发
|
|
2298
|
+
*/
|
|
2299
|
+
type ActionOptions = DisabledOptions & {
|
|
2300
|
+
/**
|
|
2301
|
+
* 触发方式
|
|
2302
|
+
* - always :始终显示一个触发图标,点击图标弹出操作项
|
|
2303
|
+
* - hover:鼠标移入显示一个触发图标,点击图标弹出操作项
|
|
2304
|
+
* - long-press:长摁直接弹出操作项
|
|
2305
|
+
*/
|
|
2306
|
+
trigger: "always" | "hover" | "long-press";
|
|
2307
|
+
/**
|
|
2308
|
+
* 显示模式
|
|
2309
|
+
* - popup:弹出显示操作项
|
|
2310
|
+
* - inline:内联显示操作项
|
|
2311
|
+
*/
|
|
2312
|
+
/**
|
|
2313
|
+
* 可用操作项
|
|
2314
|
+
*/
|
|
2315
|
+
actions: ActionItem[];
|
|
2316
|
+
} & Pick<FollowPositionOptions, "followX" | "followY" | "spaceX" | "spaceY">;
|
|
2317
|
+
/**
|
|
2318
|
+
* 操作项集合 组件渲染配置选项
|
|
2319
|
+
*/
|
|
2320
|
+
type ActionItemsOptions = {
|
|
2321
|
+
/**
|
|
2322
|
+
* 展示模式
|
|
2323
|
+
* - horizontal 水平展示
|
|
2324
|
+
* - vertical 垂直展示
|
|
2325
|
+
*/
|
|
2326
|
+
mode: "horizontal" | "vertical";
|
|
2327
|
+
/**
|
|
2328
|
+
* 要渲染的操作项
|
|
2329
|
+
*/
|
|
2330
|
+
actions: ActionItem[];
|
|
2331
|
+
};
|
|
2332
|
+
/**
|
|
2333
|
+
* 一个操作项的配置
|
|
2334
|
+
*/
|
|
2335
|
+
type ActionItem = {
|
|
2336
|
+
/**
|
|
2337
|
+
* 操作项编码
|
|
2338
|
+
* - 确保唯一
|
|
2339
|
+
*/
|
|
2340
|
+
code: string;
|
|
2341
|
+
/**
|
|
2342
|
+
* 操作项名称
|
|
2343
|
+
* - 确保唯一
|
|
2344
|
+
*/
|
|
2345
|
+
name: string;
|
|
2346
|
+
/**
|
|
2347
|
+
* 操作项颜色
|
|
2348
|
+
*/
|
|
2349
|
+
color?: string;
|
|
2350
|
+
/**
|
|
2351
|
+
* 操作项移入时颜色
|
|
2352
|
+
*/
|
|
2353
|
+
hoverColor?: string;
|
|
2354
|
+
/**
|
|
2355
|
+
* 操作项图标
|
|
2356
|
+
*/
|
|
2357
|
+
icon?: Pick<IconOptions, "type" | "size" | "title">;
|
|
2358
|
+
};
|
|
2359
|
+
/**
|
|
2360
|
+
* 可操作向组件 插槽句柄
|
|
2361
|
+
*/
|
|
2362
|
+
type ActionSlotHandle = {
|
|
2363
|
+
/**
|
|
2364
|
+
* 操作项是否激活显示
|
|
2365
|
+
*/
|
|
2366
|
+
isActived(): boolean;
|
|
2367
|
+
/**
|
|
2368
|
+
* 触发操作项显示
|
|
2369
|
+
*/
|
|
2370
|
+
trigger(): void;
|
|
2371
|
+
};
|
|
2372
|
+
/**
|
|
2373
|
+
* 可操作项组件 的事件
|
|
2374
|
+
*/
|
|
2375
|
+
type ActionEvents = {
|
|
2376
|
+
/**
|
|
2377
|
+
* 操作项激活时
|
|
2378
|
+
* @param code 操作项的code
|
|
2379
|
+
*/
|
|
2380
|
+
trigger: [code: string];
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
/**
|
|
2384
|
+
* 输入框配置选项
|
|
2385
|
+
* - title 将作为 输入框标题区域文本;不传入则不展示 标题区域,仅展示输入框
|
|
2386
|
+
* - 暂不提供 disabled 逻辑
|
|
2387
|
+
*/
|
|
2388
|
+
type InputOptions = ReadonlyOptions & /*DisabledOptions & */ PlaceholderOptions & TitleOptions & {
|
|
2389
|
+
/**
|
|
2390
|
+
* 输入框类型
|
|
2391
|
+
* - text: 文本输入框
|
|
2392
|
+
* - number: 数字输入框
|
|
2393
|
+
* - password: 密码输入框
|
|
2394
|
+
*/
|
|
2395
|
+
type?: "text" | "number" | "password";
|
|
2396
|
+
/**
|
|
2397
|
+
* 输入框是否必填
|
|
2398
|
+
* - 必填,则验证不通过时,显示错误信息
|
|
2399
|
+
* - 必填时,显示必填标记,红色 * 号
|
|
2400
|
+
*/
|
|
2401
|
+
required?: boolean;
|
|
2402
|
+
/**
|
|
2403
|
+
* 标题区域样式
|
|
2404
|
+
* - 对齐方式
|
|
2405
|
+
* - 标题区域宽度
|
|
2406
|
+
*/
|
|
2407
|
+
titleStyle?: BaseStyle & WidthStyle & FlexBoxStyle;
|
|
2408
|
+
};
|
|
2409
|
+
/**
|
|
2410
|
+
* 输入框事件
|
|
2411
|
+
*/
|
|
2412
|
+
type InputEvents = {
|
|
2413
|
+
/**
|
|
2414
|
+
* 输入框点击时
|
|
2415
|
+
*/
|
|
2416
|
+
click: [];
|
|
2417
|
+
/**
|
|
2418
|
+
* 输入框内容发生改变时
|
|
2419
|
+
* @param value 输入框内容
|
|
2420
|
+
*/
|
|
2421
|
+
change: [value: string];
|
|
2422
|
+
};
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* 接口:响应式管理器
|
|
2426
|
+
*/
|
|
2427
|
+
interface IReactiveManager {
|
|
2428
|
+
/**
|
|
2429
|
+
* 响应式【过渡】变量值
|
|
2430
|
+
* - 通过设置 rv.value 的值来实现.value值过渡
|
|
2431
|
+
* - 执行顺序 from、to
|
|
2432
|
+
* - 开始时,设置 rv.value 值为 from;延迟time时间后,强制销毁scope
|
|
2433
|
+
* - 销毁scope时,强制将 rv.value 值设置为 to 值
|
|
2434
|
+
* @param rv 响应式变量对象
|
|
2435
|
+
* @param effect 过渡效果配置,约束 from end 样式
|
|
2436
|
+
* @param time 过渡持续时间,到时间后销毁作用域
|
|
2437
|
+
* @returns 作用域对象,可销毁【值过渡】效果
|
|
2438
|
+
*/
|
|
2439
|
+
transition<T>(rv: ReactiveVar<T>, effect: {
|
|
2440
|
+
from: T;
|
|
2441
|
+
to: T;
|
|
2442
|
+
}, time: number): IScope;
|
|
2443
|
+
/**
|
|
2444
|
+
* 响应式【加载】任务
|
|
2445
|
+
* - 任务运行时,设置loading.value=true
|
|
2446
|
+
* - 任务完成后,设置loading.value=false
|
|
2447
|
+
* - 可通过delay值,延迟执行 loading.value=false 操作
|
|
2448
|
+
* - 可在api请求等耗时操作任务过程中,实现响应式显隐Loading组件
|
|
2449
|
+
* @param task 要运行的任务
|
|
2450
|
+
* @param loading 正在加载的响应式变量
|
|
2451
|
+
* @param delay 延迟时间,单位ms;不传则不延迟
|
|
2452
|
+
* @returns 任务自身
|
|
2453
|
+
*/
|
|
2454
|
+
load<T>(task: Promise<T>, loading: ReactiveVar<boolean>, delay: number): Promise<RunResult<T>>;
|
|
2455
|
+
/**
|
|
2456
|
+
* 监听器:监听单个值变化
|
|
2457
|
+
* - 内部利用vue的watch逻辑实现
|
|
2458
|
+
* - 自动进行生命周期管理,作用域销毁时自动清理watch监听
|
|
2459
|
+
* - 仅实现简化版本watch监听;复杂的监听逻辑,自行使用watch方法
|
|
2460
|
+
* @param source 监听源
|
|
2461
|
+
* @param callback 回调方法:可接收新旧值变化
|
|
2462
|
+
* @param deep 是否进行深度监听;默认false
|
|
2463
|
+
* @returns 监听作用域,destroy可销毁监听
|
|
2464
|
+
*/
|
|
2465
|
+
watcher<T>(source: WatchSource<T>, callback: (newValue: T, oldValue: T) => void, deep?: boolean): IScope;
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* 响应式变量
|
|
2469
|
+
*/
|
|
2470
|
+
type ReactiveVar<T> = ShallowRef<T> | Ref<T>;
|
|
2471
|
+
|
|
2472
|
+
/**
|
|
2473
|
+
* 开关组件 配置选项
|
|
2474
|
+
*/
|
|
2475
|
+
type SwitchOptions = ReadonlyOptions & {
|
|
2476
|
+
/**
|
|
2477
|
+
* 类型,决定开启/关闭状态的渲染效果
|
|
2478
|
+
* - switch 开关类型,默认效果
|
|
2479
|
+
* - radio 单选框效果,圆角边框
|
|
2480
|
+
* - checkbox 复选框效果,矩形边框
|
|
2481
|
+
*/
|
|
2482
|
+
type?: "switch" | "radio" | "checkbox";
|
|
2483
|
+
};
|
|
2484
|
+
/**
|
|
2485
|
+
* 开关 事件
|
|
2486
|
+
*/
|
|
2487
|
+
type SwitchEvents = {
|
|
2488
|
+
/**
|
|
2489
|
+
* 开关 状态变化时
|
|
2490
|
+
* @param value 开启、还是关闭
|
|
2491
|
+
*/
|
|
2492
|
+
change: [value: boolean];
|
|
2493
|
+
};
|
|
2494
|
+
|
|
2495
|
+
/**
|
|
2496
|
+
* 多行文本框组件配置选项
|
|
2497
|
+
*/
|
|
2498
|
+
type TextareaOptions = ReadonlyOptions & PlaceholderOptions & {
|
|
2499
|
+
/**
|
|
2500
|
+
* 是否自适应高度
|
|
2501
|
+
* - 传入true时,根据文本框内容,自动调整高度
|
|
2502
|
+
* - 若传入maxRows,则自动高度不会超过maxRows
|
|
2503
|
+
*/
|
|
2504
|
+
autoHeight: boolean;
|
|
2505
|
+
/**
|
|
2506
|
+
* 最小行数
|
|
2507
|
+
* - 作为默认行数
|
|
2508
|
+
* - 不传入则默认4
|
|
2509
|
+
*/
|
|
2224
2510
|
minRows?: number;
|
|
2225
2511
|
/**
|
|
2226
2512
|
* 最大行数
|
|
@@ -2321,182 +2607,71 @@ type DynamicOptions<Props = void> = ComponentOptions & Pick<ComponentBindOptions
|
|
|
2321
2607
|
* @param onDestroyed 监听【调用方】的销毁时机,用于自动销毁挂载的实力
|
|
2322
2608
|
* @returns 作用域对象,销毁挂载实例
|
|
2323
2609
|
*/
|
|
2324
|
-
declare function mount<Props>(target: HTMLElement, options: DynamicOptions<Props>, onDestroyed?: (fn: () => void) => void): IScope;
|
|
2325
|
-
|
|
2326
|
-
/**
|
|
2327
|
-
* 运动组件的助手方法变量
|
|
2328
|
-
*/
|
|
2329
|
-
/**
|
|
2330
|
-
* 运行效果常量
|
|
2331
|
-
*/
|
|
2332
|
-
declare const MOTION: Readonly<{
|
|
2333
|
-
/** 淡入淡出;进入时 `opacity:0~1`;退出时 `opacity:1~0`*/
|
|
2334
|
-
fade: {
|
|
2335
|
-
enter: string;
|
|
2336
|
-
leave: string;
|
|
2337
|
-
};
|
|
2338
|
-
/** 缩放进入:进入时 `scale:0~1`;退出时 `scale:1~0`*/
|
|
2339
|
-
scale: {
|
|
2340
|
-
enter: string;
|
|
2341
|
-
leave: string;
|
|
2342
|
-
};
|
|
2343
|
-
/** 旋转:进入时 `rotate:360deg~0`;退出时 `rotate:0~360deg`*/
|
|
2344
|
-
rotate: {
|
|
2345
|
-
enter: string;
|
|
2346
|
-
leave: string;
|
|
2347
|
-
};
|
|
2348
|
-
/** 顶部进入退出:进入时`translateY:-100%~0`;退出时`translateY:0~-100%`*/
|
|
2349
|
-
top: {
|
|
2350
|
-
enter: string;
|
|
2351
|
-
leave: string;
|
|
2352
|
-
};
|
|
2353
|
-
/** 顶部进入底部退出:进入时`translateY:-100%~0`;退出时`translateY:0~100%`*/
|
|
2354
|
-
topBottom: {
|
|
2355
|
-
enter: string;
|
|
2356
|
-
leave: string;
|
|
2357
|
-
};
|
|
2358
|
-
/** 底部进入退出:进入时`translateY:100%~0`;退出时`translateY:0~100%`*/
|
|
2359
|
-
bottom: {
|
|
2360
|
-
enter: string;
|
|
2361
|
-
leave: string;
|
|
2362
|
-
};
|
|
2363
|
-
/** 底部进入顶部退出:进入时`translateY:100%~0`;退出时`translateY:0~-100%`*/
|
|
2364
|
-
bottomTop: {
|
|
2365
|
-
enter: string;
|
|
2366
|
-
leave: string;
|
|
2367
|
-
};
|
|
2368
|
-
/** 左侧进入退出:进入时`translateX:-100%~0`;退出时`translateX:0~-100%`*/
|
|
2369
|
-
left: {
|
|
2370
|
-
enter: string;
|
|
2371
|
-
leave: string;
|
|
2372
|
-
};
|
|
2373
|
-
/** 左侧进入右侧退出:进入时`translateX:-100%~0`;退出时`translateX:0~100%`*/
|
|
2374
|
-
leftRight: {
|
|
2375
|
-
enter: string;
|
|
2376
|
-
leave: string;
|
|
2377
|
-
};
|
|
2378
|
-
/** 右侧进入右侧退出:进入时`translateX:100%~0`;退出时`translateX:0~100%`*/
|
|
2379
|
-
right: {
|
|
2380
|
-
enter: string;
|
|
2381
|
-
leave: string;
|
|
2382
|
-
};
|
|
2383
|
-
/** 右侧进入左侧退出:进入时`translateX:100%~0`;退出时`translateX:0~-100%`*/
|
|
2384
|
-
rightLeft: {
|
|
2385
|
-
enter: string;
|
|
2386
|
-
leave: string;
|
|
2387
|
-
};
|
|
2388
|
-
}>;
|
|
2389
|
-
|
|
2390
|
-
/**
|
|
2391
|
-
* 公共通用数据结构:
|
|
2392
|
-
* 1、在弹窗、模态弹窗、跟随弹窗的效果下复用
|
|
2393
|
-
*/
|
|
2394
|
-
|
|
2395
|
-
/**
|
|
2396
|
-
* 弹窗配置选项
|
|
2397
|
-
* - 约束弹出组件信息
|
|
2398
|
-
* - 弹出组件时传递的参数信息
|
|
2399
|
-
* @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
|
|
2400
|
-
*/
|
|
2401
|
-
type PopupOptions<Props = void, Model = void> = ComponentOptions & ComponentBindOptions<Props, Model> & {
|
|
2402
|
-
/**
|
|
2403
|
-
* 弹窗动画名
|
|
2404
|
-
* - 不传则默认“fade”
|
|
2405
|
-
* - 动画规则:打开弹窗时,为 [transition]-in ;关闭弹窗时,为[transition]-out
|
|
2406
|
-
* - - 传入 "scale",则打开弹窗为 "scale-in";关闭弹窗时为 "scale-out"
|
|
2407
|
-
*/
|
|
2408
|
-
transition?: string;
|
|
2409
|
-
/**
|
|
2410
|
-
* 动画持续时间
|
|
2411
|
-
* - 配合 transition 使用;单位ms,默认500ms
|
|
2412
|
-
* - 外部传入自定义动画时,传入动画持续时间,否则可能导致关闭时动画失效
|
|
2413
|
-
*/
|
|
2414
|
-
transitionDuration?: number;
|
|
2415
|
-
/**
|
|
2416
|
-
* 自定义class
|
|
2417
|
-
* - 绑定到内容组件根元素上
|
|
2418
|
-
* - 可以直接在props中指定,无需特殊设置
|
|
2419
|
-
class?: string | string[];
|
|
2420
|
-
*/
|
|
2421
|
-
/**
|
|
2422
|
-
* 自定义style
|
|
2423
|
-
* - 绑定到内容组件根元素上
|
|
2424
|
-
* - 可以直接在props中指定,无需特殊设置
|
|
2425
|
-
style?: AllStyle;
|
|
2426
|
-
*/
|
|
2427
|
-
/**
|
|
2428
|
-
* 弹窗的z-index值
|
|
2429
|
-
* - 无特殊情况,建议不指定,内部会自动生成,确保弹窗正确性
|
|
2430
|
-
*/
|
|
2431
|
-
zIndex?: number;
|
|
2432
|
-
};
|
|
2433
|
-
/**
|
|
2434
|
-
* 弹出组件句柄
|
|
2435
|
-
*/
|
|
2436
|
-
type PopupHandle<T> = {
|
|
2437
|
-
/**
|
|
2438
|
-
* 组件是否在【弹出窗口】中
|
|
2439
|
-
* - popup : 普通弹出弹窗
|
|
2440
|
-
* - dialog : 模态对话弹窗
|
|
2441
|
-
* - follow : 跟随效果弹窗
|
|
2442
|
-
*/
|
|
2443
|
-
inPopup: Readonly<"popup" | "dialog" | "follow">;
|
|
2444
|
-
/**
|
|
2445
|
-
* 关闭弹窗
|
|
2446
|
-
* @param data 关闭时传递数据
|
|
2447
|
-
*/
|
|
2448
|
-
closePopup(data?: T): void;
|
|
2449
|
-
};
|
|
2450
|
-
/**
|
|
2451
|
-
* 弹窗状态:响应式
|
|
2452
|
-
* - open 打开
|
|
2453
|
-
* - active 激活,针对Dialog弹窗生效
|
|
2454
|
-
* - unactive 非激活,针对Dialog弹窗生效
|
|
2455
|
-
* - closed 关闭
|
|
2456
|
-
*/
|
|
2457
|
-
type PopupStatus = ShallowRef<"open" | "active" | "unactive" | "closed">;
|
|
2458
|
-
/**
|
|
2459
|
-
* 弹窗状态 配置选项
|
|
2460
|
-
*/
|
|
2461
|
-
type PopupStatusOptions = {
|
|
2462
|
-
/**
|
|
2463
|
-
* 弹窗状态:响应式
|
|
2464
|
-
*/
|
|
2465
|
-
popupStatus: PopupStatus;
|
|
2466
|
-
};
|
|
2610
|
+
declare function mount<Props>(target: HTMLElement, options: DynamicOptions<Props>, onDestroyed?: (fn: () => void) => void): IScope;
|
|
2611
|
+
|
|
2467
2612
|
/**
|
|
2468
|
-
*
|
|
2469
|
-
* - 给弹窗容器使用,传递过去作为props使用
|
|
2613
|
+
* 运动组件的助手方法变量
|
|
2470
2614
|
*/
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
};
|
|
2615
|
+
/**
|
|
2616
|
+
* 运行效果常量
|
|
2617
|
+
*/
|
|
2618
|
+
declare const MOTION: Readonly<{
|
|
2619
|
+
/** 淡入淡出;进入时 `opacity:0~1`;退出时 `opacity:1~0`*/
|
|
2620
|
+
fade: {
|
|
2621
|
+
enter: string;
|
|
2622
|
+
leave: string;
|
|
2623
|
+
};
|
|
2624
|
+
/** 缩放进入:进入时 `scale:0~1`;退出时 `scale:1~0`*/
|
|
2625
|
+
scale: {
|
|
2626
|
+
enter: string;
|
|
2627
|
+
leave: string;
|
|
2628
|
+
};
|
|
2629
|
+
/** 旋转:进入时 `rotate:360deg~0`;退出时 `rotate:0~360deg`*/
|
|
2630
|
+
rotate: {
|
|
2631
|
+
enter: string;
|
|
2632
|
+
leave: string;
|
|
2633
|
+
};
|
|
2634
|
+
/** 顶部进入退出:进入时`translateY:-100%~0`;退出时`translateY:0~-100%`*/
|
|
2635
|
+
top: {
|
|
2636
|
+
enter: string;
|
|
2637
|
+
leave: string;
|
|
2638
|
+
};
|
|
2639
|
+
/** 顶部进入底部退出:进入时`translateY:-100%~0`;退出时`translateY:0~100%`*/
|
|
2640
|
+
topBottom: {
|
|
2641
|
+
enter: string;
|
|
2642
|
+
leave: string;
|
|
2643
|
+
};
|
|
2644
|
+
/** 底部进入退出:进入时`translateY:100%~0`;退出时`translateY:0~100%`*/
|
|
2645
|
+
bottom: {
|
|
2646
|
+
enter: string;
|
|
2647
|
+
leave: string;
|
|
2648
|
+
};
|
|
2649
|
+
/** 底部进入顶部退出:进入时`translateY:100%~0`;退出时`translateY:0~-100%`*/
|
|
2650
|
+
bottomTop: {
|
|
2651
|
+
enter: string;
|
|
2652
|
+
leave: string;
|
|
2653
|
+
};
|
|
2654
|
+
/** 左侧进入退出:进入时`translateX:-100%~0`;退出时`translateX:0~-100%`*/
|
|
2655
|
+
left: {
|
|
2656
|
+
enter: string;
|
|
2657
|
+
leave: string;
|
|
2658
|
+
};
|
|
2659
|
+
/** 左侧进入右侧退出:进入时`translateX:-100%~0`;退出时`translateX:0~100%`*/
|
|
2660
|
+
leftRight: {
|
|
2661
|
+
enter: string;
|
|
2662
|
+
leave: string;
|
|
2663
|
+
};
|
|
2664
|
+
/** 右侧进入右侧退出:进入时`translateX:100%~0`;退出时`translateX:0~100%`*/
|
|
2665
|
+
right: {
|
|
2666
|
+
enter: string;
|
|
2667
|
+
leave: string;
|
|
2668
|
+
};
|
|
2669
|
+
/** 右侧进入左侧退出:进入时`translateX:100%~0`;退出时`translateX:0~-100%`*/
|
|
2670
|
+
rightLeft: {
|
|
2671
|
+
enter: string;
|
|
2672
|
+
leave: string;
|
|
2673
|
+
};
|
|
2674
|
+
}>;
|
|
2500
2675
|
|
|
2501
2676
|
/**
|
|
2502
2677
|
* 模态弹窗数据结构
|
|
@@ -2588,168 +2763,6 @@ type ToastOptions = {
|
|
|
2588
2763
|
closeDisabled?: boolean;
|
|
2589
2764
|
};
|
|
2590
2765
|
|
|
2591
|
-
/**
|
|
2592
|
-
* 跟随效果 弹窗
|
|
2593
|
-
*/
|
|
2594
|
-
|
|
2595
|
-
/**
|
|
2596
|
-
* 跟随弹窗 配置选项
|
|
2597
|
-
* - 传入的组件,根据配置跟随 target 位置和大小;
|
|
2598
|
-
* @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
|
|
2599
|
-
*/
|
|
2600
|
-
type FollowOptions<Props = void, Model = void> = PopupOptions<Props, Model> & FollowPositionOptions;
|
|
2601
|
-
/**
|
|
2602
|
-
* 跟随位置 配置选项
|
|
2603
|
-
* - 基于此计算出最终的跟随效果
|
|
2604
|
-
*/
|
|
2605
|
-
type FollowPositionOptions = {
|
|
2606
|
-
/**
|
|
2607
|
-
* 启用【宽度】跟随
|
|
2608
|
-
* - 为true则和 target 宽度保持一致
|
|
2609
|
-
* - false时,宽度由 弹出组件 自己维护
|
|
2610
|
-
* - 不管是true、还是false,若宽度超过浏览器最大宽度,会进行强制干预
|
|
2611
|
-
*/
|
|
2612
|
-
followWidth?: boolean;
|
|
2613
|
-
/**
|
|
2614
|
-
* 启用【高度】跟随
|
|
2615
|
-
* - 为true则和 target 高度保持一致
|
|
2616
|
-
* - false时,高度由 弹出组件 自己维护
|
|
2617
|
-
* - 不管是true、还是false,若高度超过浏览器最大高度,会进行强制干预
|
|
2618
|
-
*/
|
|
2619
|
-
followHeight?: boolean;
|
|
2620
|
-
/**
|
|
2621
|
-
* x轴方向上的跟随策略
|
|
2622
|
-
* - 支持传入一个或者多个,依次尝试选举最优位置(全宽度展示,否则取最大宽度位置)
|
|
2623
|
-
* - 不传入则按照默认策略;["start","end","after","before","center","ratio"]
|
|
2624
|
-
* - 可选策略值如下:
|
|
2625
|
-
* - - start : 起点跟随,和 target 起始位置(left)一致
|
|
2626
|
-
* - - end : 终点跟随,和 target 结束位置(right)一致
|
|
2627
|
-
* - - center : 中心跟随,和 target 中心位置一致
|
|
2628
|
-
* - - before : 之前跟随,组件在 target 左侧展示
|
|
2629
|
-
* - - after : 之后跟随,组件在 target 右侧展示
|
|
2630
|
-
* - - ratio : 比例跟随,按比例(target中心点/窗口宽度)锚定位置,动态计算left值。
|
|
2631
|
-
*/
|
|
2632
|
-
followX?: FollowStrategy | FollowStrategy[];
|
|
2633
|
-
/**
|
|
2634
|
-
* y轴方向上的跟随策略
|
|
2635
|
-
* - 支持传入一个或者多个,依次尝试选举最优位置(全高度展示,否则取最大高度位置)
|
|
2636
|
-
* - 不传入则按照默认策略;["after","before","start","end","center","ratio"]
|
|
2637
|
-
* - 可选策略值如下:
|
|
2638
|
-
* - - start : 起点跟随,和 target 起始位置(top)一致
|
|
2639
|
-
* - - end : 终点跟随,和 target 结束位置(bottom)一致
|
|
2640
|
-
* - - center : 中心跟随,和 target 中心位置一致
|
|
2641
|
-
* - - before : 之前跟随,组件在 target 顶部展示
|
|
2642
|
-
* - - after : 之后跟随,组件在 target 底部展示
|
|
2643
|
-
* - - ratio : 比例跟随,按比例(target中心点/窗口高度)锚定位置,动态计算top值。
|
|
2644
|
-
*/
|
|
2645
|
-
followY?: FollowStrategy | FollowStrategy[];
|
|
2646
|
-
/**
|
|
2647
|
-
* x轴方向上 target 之间的留白空间
|
|
2648
|
-
* - 默认0; followX 为 center、ratio 时间距失效
|
|
2649
|
-
* - 增加间距,提升展示效果
|
|
2650
|
-
* -
|
|
2651
|
-
*/
|
|
2652
|
-
spaceX?: number;
|
|
2653
|
-
/**
|
|
2654
|
-
* y轴方向上 target 之间的留白空间
|
|
2655
|
-
* - 默认0;followY 为 center、ratio 时间距失效
|
|
2656
|
-
* - 增加间距,提升展示效果
|
|
2657
|
-
*/
|
|
2658
|
-
spaceY?: number;
|
|
2659
|
-
/**
|
|
2660
|
-
* 和 浏览器客户 端之间的留白空间
|
|
2661
|
-
* - 弹出组件 和浏览器客户端窗口之间的【留白空间】
|
|
2662
|
-
* - 仅在 弹出组件 计算出来位置紧贴浏览器窗口时生效
|
|
2663
|
-
* - 若强制指定了 start、end,则对应的起始、结束位置不受此值影响
|
|
2664
|
-
*/
|
|
2665
|
-
spaceClient?: number;
|
|
2666
|
-
/**
|
|
2667
|
-
* 点击【遮罩层】时是否关闭弹窗
|
|
2668
|
-
* - 则点击非【跟随组件】区域时是否关闭
|
|
2669
|
-
*/
|
|
2670
|
-
closeOnMask?: boolean;
|
|
2671
|
-
/**
|
|
2672
|
-
* 按下【ESC】健时是否关闭弹窗
|
|
2673
|
-
*/
|
|
2674
|
-
closeOnEscape?: boolean;
|
|
2675
|
-
/**
|
|
2676
|
-
* window窗口【resize】时是否关闭弹窗
|
|
2677
|
-
*/
|
|
2678
|
-
closeOnResize?: boolean;
|
|
2679
|
-
/**
|
|
2680
|
-
* target改变时是否关闭弹窗
|
|
2681
|
-
* - target尺寸、位置变化
|
|
2682
|
-
* - target点击时
|
|
2683
|
-
*/
|
|
2684
|
-
closeOnTarget?: boolean;
|
|
2685
|
-
};
|
|
2686
|
-
/**
|
|
2687
|
-
* 跟随策略
|
|
2688
|
-
* - 详细值定义,参照 FollowOptions.followX 和 FollowOptions.followY
|
|
2689
|
-
*/
|
|
2690
|
-
type FollowStrategy = "start" | "center" | "end" | "before" | "after" | "ratio";
|
|
2691
|
-
/**
|
|
2692
|
-
* 跟随弹窗 句柄
|
|
2693
|
-
* - 用于在 弹窗组件 内部进行模式判断和关闭跟随弹窗
|
|
2694
|
-
*/
|
|
2695
|
-
type FollowHandle<T> = PopupHandle<T> & {};
|
|
2696
|
-
/**
|
|
2697
|
-
* 跟随弹窗 扩展配置
|
|
2698
|
-
*/
|
|
2699
|
-
type FollowExtend = PopupStatusOptions & {
|
|
2700
|
-
/**
|
|
2701
|
-
* 跟随的目标元素
|
|
2702
|
-
*/
|
|
2703
|
-
target: Element;
|
|
2704
|
-
/**
|
|
2705
|
-
* x轴方向的跟随策略:响应式
|
|
2706
|
-
* - 基于外部传入的跟随策略,计算选举出来的最优策略值
|
|
2707
|
-
*/
|
|
2708
|
-
followX: ShallowRef<FollowStrategy>;
|
|
2709
|
-
/**
|
|
2710
|
-
* y轴方向的跟随策略:响应式
|
|
2711
|
-
* - 基于外部传入的跟随策略,计算选举出来的最优策略值
|
|
2712
|
-
*/
|
|
2713
|
-
followY: ShallowRef<FollowStrategy>;
|
|
2714
|
-
/**
|
|
2715
|
-
* Follow弹窗是否【钉住】了
|
|
2716
|
-
* - 为true时,closeOnMask、closeOnEscape失效
|
|
2717
|
-
* - 满足 子弹窗 点击等操作时,不自动销毁父级弹窗
|
|
2718
|
-
*/
|
|
2719
|
-
pinned: ShallowRef<boolean>;
|
|
2720
|
-
};
|
|
2721
|
-
/**
|
|
2722
|
-
* 跟随策略 配置选项
|
|
2723
|
-
*/
|
|
2724
|
-
type FollowStrategyOptions = {
|
|
2725
|
-
/**
|
|
2726
|
-
* x轴的跟随策略
|
|
2727
|
-
*/
|
|
2728
|
-
followX?: FollowStrategy;
|
|
2729
|
-
/**
|
|
2730
|
-
* x轴的跟随策略
|
|
2731
|
-
*/
|
|
2732
|
-
followY?: FollowStrategy;
|
|
2733
|
-
};
|
|
2734
|
-
/**
|
|
2735
|
-
* 跟随选举结果
|
|
2736
|
-
*/
|
|
2737
|
-
type FollowElectResult = {
|
|
2738
|
-
/**
|
|
2739
|
-
* 跟随策略
|
|
2740
|
-
*/
|
|
2741
|
-
strategy: FollowStrategy;
|
|
2742
|
-
/**
|
|
2743
|
-
* 开始位置:x/top
|
|
2744
|
-
*/
|
|
2745
|
-
start: number;
|
|
2746
|
-
/**
|
|
2747
|
-
* 调整后的尺寸(width/height)
|
|
2748
|
-
* - 为undefined表示无需调整尺寸
|
|
2749
|
-
*/
|
|
2750
|
-
size?: number;
|
|
2751
|
-
};
|
|
2752
|
-
|
|
2753
2766
|
/**
|
|
2754
2767
|
* 弹窗管理器
|
|
2755
2768
|
*/
|