snail.vue 1.0.12 → 1.0.14
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 +38 -13
- package/dist/snail.vue.js +21 -2
- package/dist/snail.vue.umd.js +20 -0
- package/package.json +4 -4
package/dist/snail.vue.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { IScope } from 'snail.core';
|
|
1
2
|
import * as vue from 'vue';
|
|
2
3
|
import { App, Component } from 'vue';
|
|
3
|
-
import { IScope } from 'snail.core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Vue App助手类,做一些app实例的辅助性工作
|
|
@@ -41,6 +41,21 @@ type ComponentOptions = {
|
|
|
41
41
|
*/
|
|
42
42
|
url?: string;
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
type ComponentMountOptions = ComponentOptions & {
|
|
48
|
+
/**
|
|
49
|
+
* 挂载到哪个dom元素下
|
|
50
|
+
*/
|
|
51
|
+
target: Element;
|
|
52
|
+
/**
|
|
53
|
+
* 传递给组件的属性值,执行v-bind绑定到要显示的组件
|
|
54
|
+
* - key为属性名称,遵循vue解析规则
|
|
55
|
+
* - 若为事件监听,则使用onXXX
|
|
56
|
+
*/
|
|
57
|
+
props?: Record<string, any>;
|
|
58
|
+
};
|
|
44
59
|
|
|
45
60
|
/**
|
|
46
61
|
* 模态弹窗显示的组件配置选项
|
|
@@ -52,16 +67,6 @@ type DialogOptions = ComponentOptions & {
|
|
|
52
67
|
* - 若为事件监听,则使用onXXX
|
|
53
68
|
*/
|
|
54
69
|
props?: Record<string, any>;
|
|
55
|
-
/**
|
|
56
|
-
* 按下esc健时是否关闭弹窗
|
|
57
|
-
* - 默认值:false
|
|
58
|
-
*/
|
|
59
|
-
closeOnEscape?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* 点击遮罩层时是否关闭弹窗
|
|
62
|
-
* - 默认值:false
|
|
63
|
-
*/
|
|
64
|
-
closeOnMask?: boolean;
|
|
65
70
|
/**
|
|
66
71
|
* 自定义class
|
|
67
72
|
* - 绑定模块弹窗显示的组件根元素上
|
|
@@ -72,6 +77,16 @@ type DialogOptions = ComponentOptions & {
|
|
|
72
77
|
* - 绑定模块弹窗显示的组件根元素上
|
|
73
78
|
*/
|
|
74
79
|
style?: string | string[];
|
|
80
|
+
/**
|
|
81
|
+
* 按下esc健时是否关闭弹窗
|
|
82
|
+
* - 默认值:false
|
|
83
|
+
*/
|
|
84
|
+
closeOnEscape?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* 点击遮罩层时是否关闭弹窗
|
|
87
|
+
* - 默认值:false
|
|
88
|
+
*/
|
|
89
|
+
closeOnMask?: boolean;
|
|
75
90
|
/**
|
|
76
91
|
* 弹窗的z-index值
|
|
77
92
|
* - 无特殊情况,建议不粗韩,内部会自动生成,确保弹窗正确性
|
|
@@ -187,5 +202,15 @@ type __VLS_WithSlots<T, S> = T & {
|
|
|
187
202
|
};
|
|
188
203
|
};
|
|
189
204
|
|
|
190
|
-
|
|
191
|
-
|
|
205
|
+
/**
|
|
206
|
+
* 挂载vue组件
|
|
207
|
+
* - 全新创建一个Vue实例挂载的传入组件
|
|
208
|
+
* - 用于在非vue环境下渲染vue组件内容
|
|
209
|
+
* @param options 挂载配置选项
|
|
210
|
+
* @param onDestroyed 监听【调用方】的销毁时机,用于自动销毁挂载的实力
|
|
211
|
+
* @returns
|
|
212
|
+
*/
|
|
213
|
+
declare function mount(options: ComponentMountOptions, onDestroyed?: (fn: () => void) => void): IScope;
|
|
214
|
+
|
|
215
|
+
export { _default$1 as SnailDynamic, _default as SnailLoading, mount, onAppCreated, openDialog, triggerAppCreated };
|
|
216
|
+
export type { ComponentMountOptions, ComponentOptions, Dialog, DialogHandle, DialogOpenResult, DialogOptions, LoadingOptions };
|
package/dist/snail.vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//@ sourceURL=/snail.vue.js
|
|
2
|
-
import { mustFunction, isStringNotEmpty, isObject, script, delay, getMessage, style, hook, mustObject, defer, newId, isFunction } from 'snail.core';
|
|
2
|
+
import { mustFunction, isStringNotEmpty, isObject, script, delay, getMessage, style, hook, mustObject, defer, newId, isFunction, throwError } from 'snail.core';
|
|
3
3
|
import { defineComponent, createBlock, openBlock, Transition, withCtx, createElementBlock, createCommentVNode, normalizeClass, renderSlot, normalizeProps, guardReactiveProps, ref, shallowRef, watch, onErrorCaptured, onActivated, onDeactivated, Fragment, resolveDynamicComponent, mergeProps, createSlots, renderList, createTextVNode, createElementVNode, toDisplayString, TransitionGroup, withModifiers, normalizeStyle, createVNode, createApp } from 'vue';
|
|
4
4
|
|
|
5
5
|
const appCreatedFns = [];
|
|
@@ -260,4 +260,23 @@ const initVueApp = (() => {
|
|
|
260
260
|
};
|
|
261
261
|
})();
|
|
262
262
|
|
|
263
|
-
|
|
263
|
+
function mount(options, onDestroyed) {
|
|
264
|
+
mustObject(options, "options");
|
|
265
|
+
options.target instanceof HTMLElement || throwError("options.target must be a HTMLElement");
|
|
266
|
+
const app = createApp(_sfc_main$1, {
|
|
267
|
+
name: options.name,
|
|
268
|
+
compponent: options.component,
|
|
269
|
+
url: options.url,
|
|
270
|
+
...(options.props || {})
|
|
271
|
+
});
|
|
272
|
+
app.mount(options.target);
|
|
273
|
+
function destroy() {
|
|
274
|
+
app.unmount();
|
|
275
|
+
}
|
|
276
|
+
isFunction(onDestroyed) && onDestroyed(destroy);
|
|
277
|
+
return {
|
|
278
|
+
destroy
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export { _sfc_main$1 as SnailDynamic, _sfc_main$2 as SnailLoading, mount, onAppCreated, openDialog, triggerAppCreated };
|
package/dist/snail.vue.umd.js
CHANGED
|
@@ -259,8 +259,28 @@
|
|
|
259
259
|
};
|
|
260
260
|
})();
|
|
261
261
|
|
|
262
|
+
function mount(options, onDestroyed) {
|
|
263
|
+
snail_core.mustObject(options, "options");
|
|
264
|
+
options.target instanceof HTMLElement || snail_core.throwError("options.target must be a HTMLElement");
|
|
265
|
+
const app = vue.createApp(_sfc_main$1, {
|
|
266
|
+
name: options.name,
|
|
267
|
+
compponent: options.component,
|
|
268
|
+
url: options.url,
|
|
269
|
+
...(options.props || {})
|
|
270
|
+
});
|
|
271
|
+
app.mount(options.target);
|
|
272
|
+
function destroy() {
|
|
273
|
+
app.unmount();
|
|
274
|
+
}
|
|
275
|
+
snail_core.isFunction(onDestroyed) && onDestroyed(destroy);
|
|
276
|
+
return {
|
|
277
|
+
destroy
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
262
281
|
exports.SnailDynamic = _sfc_main$1;
|
|
263
282
|
exports.SnailLoading = _sfc_main$2;
|
|
283
|
+
exports.mount = mount;
|
|
264
284
|
exports.onAppCreated = onAppCreated;
|
|
265
285
|
exports.openDialog = openDialog;
|
|
266
286
|
exports.triggerAppCreated = triggerAppCreated;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "依赖【snail】,基于vue封装常用UI组件",
|
|
4
4
|
"author": "snail_dev@163.com",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.14",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/snail.vue.js",
|
|
9
9
|
"module": "dist/snail.vue.js",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"vue": "^3.5.14",
|
|
18
|
-
"snail.core": ">=1.2.
|
|
18
|
+
"snail.core": ">=1.2.10"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"vue-tsc": "^2.2.10",
|
|
22
|
-
"snail.rollup": ">=1.2.
|
|
22
|
+
"snail.rollup": ">=1.2.7",
|
|
23
23
|
"snail.rollup-asset": ">=1.2.1",
|
|
24
|
-
"snail.rollup-html": ">=1.2.
|
|
24
|
+
"snail.rollup-html": ">=1.2.2",
|
|
25
25
|
"snail.rollup-url": ">=1.2.1",
|
|
26
26
|
"snail.rollup-inject": ">=1.2.1",
|
|
27
27
|
"snail.rollup-script": ">=1.2.2",
|