snail.vue 1.0.22 → 1.0.23
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 +2 -84
- package/dist/snail.vue.js +43 -179
- package/dist/snail.vue.umd.js +39 -182
- package/dist/styles/snail.vue.vue.css +17 -17
- package/package.json +4 -4
package/dist/snail.vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignStyle, SizeOptions } from 'snail.
|
|
1
|
+
import { AlignStyle, SizeOptions } from 'snail.view';
|
|
2
2
|
import * as vue from 'vue';
|
|
3
3
|
import { Component, App, Ref, ShallowRef } from 'vue';
|
|
4
4
|
import { IScope } from 'snail.core';
|
|
@@ -549,73 +549,6 @@ declare function triggerAppCreated(app: App): App;
|
|
|
549
549
|
*/
|
|
550
550
|
declare function getSvgIcon(options: IconOptions): IconPathOptions;
|
|
551
551
|
|
|
552
|
-
/**
|
|
553
|
-
* 监视器 模块:封装便捷方法做监听,并在不支持浏览器下做垫片
|
|
554
|
-
* - 和 VueUse 库很像,但只封装自己需要的
|
|
555
|
-
* - 内部变量不使用响应式,那样外部需要 传入el时内部需要兼容useTemplateRef逻辑,这个交给外部处理更灵活
|
|
556
|
-
* - ResizeObserver 监听元素大小变化
|
|
557
|
-
*/
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
* 使用作用域
|
|
561
|
-
* - 内部管理多个子作用域,在destroy时自动执行子作用域的destroy方法
|
|
562
|
-
* - 在vue的setup中使用时,vue组件销毁时,自动销毁作用域
|
|
563
|
-
* @returns 销毁方法,add 添加子作用域
|
|
564
|
-
*/
|
|
565
|
-
declare function useScopes(): IScope & {
|
|
566
|
-
add: (scope: IScope) => void;
|
|
567
|
-
};
|
|
568
|
-
/**
|
|
569
|
-
* 监听Interval执行
|
|
570
|
-
* - 内部使用 setInterval 实现
|
|
571
|
-
* @param fn 执行方法
|
|
572
|
-
* @param delay 间隔,单位:ms
|
|
573
|
-
* @param args fn执行时传递参数
|
|
574
|
-
* @returns destroy 停止fn执行
|
|
575
|
-
*/
|
|
576
|
-
declare function onInterval(fn: (...args: any[]) => void, delay?: number, ...args: any[]): IScope;
|
|
577
|
-
/**
|
|
578
|
-
* 监听Timeout执行
|
|
579
|
-
* - 内部使用 setTimeout 实现
|
|
580
|
-
* @param fn 执行方法
|
|
581
|
-
* @param delay 延时,单位:ms
|
|
582
|
-
* @param args fn执行时传递参数
|
|
583
|
-
* @returns destroy 停止fn执行;若fn已执行则无效
|
|
584
|
-
*/
|
|
585
|
-
declare function onTimeout(fn: (...args: any[]) => void, delay?: number, ...args: any[]): IScope;
|
|
586
|
-
/**
|
|
587
|
-
* 监听事件
|
|
588
|
-
* - 内部使用addEventListener 方法监听事件,销毁时自动执行removeEventListener
|
|
589
|
-
* @param target 监听元素
|
|
590
|
-
* @param name 事件名称
|
|
591
|
-
* @param fn 事件处理方法
|
|
592
|
-
* @returns destroy 销毁监听
|
|
593
|
-
*/
|
|
594
|
-
declare function onEvent(target: Element | Window, name: string, fn: EventListenerOrEventListenerObject): IScope;
|
|
595
|
-
/**
|
|
596
|
-
* 监听元素尺寸变化
|
|
597
|
-
* @param el 监听元素
|
|
598
|
-
* @param fn 尺寸变化时的回调方法
|
|
599
|
-
* @returns destroy 销毁监听
|
|
600
|
-
*/
|
|
601
|
-
declare function onResize(el: Element, fn: (size: Readonly<{
|
|
602
|
-
width: number;
|
|
603
|
-
height: number;
|
|
604
|
-
}>) => void): IScope;
|
|
605
|
-
/**
|
|
606
|
-
* 监听元素客户端位置、大小变化
|
|
607
|
-
* - 位置计算规则:相对window屏幕
|
|
608
|
-
* @param el 监听元素
|
|
609
|
-
* @param fn
|
|
610
|
-
* @returns destroy 销毁监听
|
|
611
|
-
*/
|
|
612
|
-
declare function onRerect(el: Element, fn: (rect: DOMRectReadOnly) => void): IScope;
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* 动画相应时样式类型
|
|
616
|
-
*/
|
|
617
|
-
type AnimationRefStyle = Partial<CSSStyleDeclaration>;
|
|
618
|
-
|
|
619
552
|
/**
|
|
620
553
|
* 响应式助手类,封装一些响应式相关的工具方法
|
|
621
554
|
*/
|
|
@@ -632,21 +565,6 @@ type AnimationRefStyle = Partial<CSSStyleDeclaration>;
|
|
|
632
565
|
* @returns 新创建的作用域对象
|
|
633
566
|
*/
|
|
634
567
|
declare function scopeRef<T>(rv: Ref<T> | ShallowRef<T>, start: T, end: T, dealy?: number): IScope;
|
|
635
|
-
/**
|
|
636
|
-
* 动画ref,方法执行逻辑:
|
|
637
|
-
* - 1、初始动画,设置styleRef起始值:styleRef.value = start
|
|
638
|
-
* - 2、开始动画,设置styleRef目标值:styleRef.value = target
|
|
639
|
-
* - 3、结束动画,设置styleRef最终值:styleRef.value = end
|
|
640
|
-
* - 备注示例:外部自己控制动画效果,这里只操作样式值
|
|
641
|
-
* - 1、设置height动画效果(0-100,1s动画结束后清理height值):animationRef(styleRef,1000,{height:0},{height:"100px",{}})
|
|
642
|
-
* @param styleRef 动画样式ref对象
|
|
643
|
-
* @param start 初始动画style样式
|
|
644
|
-
* @param target 目标动画style样式
|
|
645
|
-
* @param aTime 动画时间,单位ms,延迟 aTime后执行【结束动画】操作,不传入则忽略【结束动画】操作
|
|
646
|
-
* @param end 结束动画style样式;不传入则忽略【结束动画】操作
|
|
647
|
-
* @returns 作用域对象,destroy 方法直接执行【结束动画】操作
|
|
648
|
-
*/
|
|
649
|
-
declare function animationRef(styleRef: ShallowRef<AnimationRefStyle>, start: AnimationRefStyle, target: AnimationRefStyle, aTime?: number, end?: AnimationRefStyle): IScope;
|
|
650
568
|
|
|
651
569
|
/**
|
|
652
570
|
* 模态弹窗显示的组件配置选项
|
|
@@ -1124,5 +1042,5 @@ declare const components: {
|
|
|
1124
1042
|
*/
|
|
1125
1043
|
declare function mount(options: ComponentMountOptions, onDestroyed?: (fn: () => void) => void): IScope;
|
|
1126
1044
|
|
|
1127
|
-
export {
|
|
1045
|
+
export { components, confirm, getSvgIcon, mount, onAppCreated, openDialog, scopeDialog, scopeRef, toast, triggerAppCreated };
|
|
1128
1046
|
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, TableStyleOptions, ToastHandle, ToastOptions };
|
package/dist/snail.vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//@ sourceURL=/snail.vue.js
|
|
2
|
-
import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, createBlock, createCommentVNode, toDisplayString, createElementVNode, normalizeProps, guardReactiveProps, unref, computed, mergeProps, mergeModels, useModel,
|
|
3
|
-
import { tidyString, throwError, mustString, style, mustFunction,
|
|
4
|
-
import {
|
|
2
|
+
import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, createBlock, createCommentVNode, toDisplayString, createElementVNode, normalizeProps, guardReactiveProps, unref, computed, mergeProps, mergeModels, useModel, Transition, withCtx, ref, shallowRef, watch, onErrorCaptured, onActivated, onDeactivated, Fragment, resolveDynamicComponent, createSlots, renderList, useTemplateRef, onUnmounted, createVNode, normalizeStyle, TransitionGroup, withModifiers, createApp, onMounted } from 'vue';
|
|
3
|
+
import { tidyString, throwError, mustString, style, mustFunction, useScope, isStringNotEmpty, isObject, script, delay, getMessage, useHook, mustObject, defer, newId, isFunction } from 'snail.core';
|
|
4
|
+
import { useAnimation, style as style$1, useObserver } from 'snail.view';
|
|
5
5
|
|
|
6
6
|
var _sfc_main$h = defineComponent({
|
|
7
7
|
...{
|
|
@@ -135,10 +135,6 @@ var _sfc_main$f = defineComponent({
|
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
-
var addLink = href => setTimeout(style.register, 0, href);
|
|
139
|
-
|
|
140
|
-
addLink("/styles/snail.vue.vue.css");
|
|
141
|
-
|
|
142
138
|
const _hoisted_1$8 = ["textContent"];
|
|
143
139
|
var _sfc_main$e = defineComponent({
|
|
144
140
|
...{
|
|
@@ -194,6 +190,10 @@ var _sfc_main$e = defineComponent({
|
|
|
194
190
|
}
|
|
195
191
|
});
|
|
196
192
|
|
|
193
|
+
var addLink = href => setTimeout(style.register, 0, href);
|
|
194
|
+
|
|
195
|
+
addLink("/styles/snail.vue.vue.css");
|
|
196
|
+
|
|
197
197
|
var _sfc_main$d = defineComponent({
|
|
198
198
|
...{
|
|
199
199
|
name: "Switch",
|
|
@@ -246,150 +246,21 @@ const appCreatedFns = [];
|
|
|
246
246
|
function onAppCreated(fn) {
|
|
247
247
|
mustFunction(fn, "fn");
|
|
248
248
|
appCreatedFns.push(fn);
|
|
249
|
-
return {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
};
|
|
249
|
+
return useScope().onDestroy(() => {
|
|
250
|
+
const index = appCreatedFns.indexOf(fn);
|
|
251
|
+
index >= 0 && appCreatedFns.splice(index, 1);
|
|
252
|
+
});
|
|
255
253
|
}
|
|
256
254
|
function triggerAppCreated(app) {
|
|
257
255
|
appCreatedFns.forEach(fn => fn(app));
|
|
258
256
|
return app;
|
|
259
257
|
}
|
|
260
258
|
|
|
261
|
-
function tryOnScopeDispose(fn) {
|
|
262
|
-
if (getCurrentScope()) {
|
|
263
|
-
onScopeDispose(fn);
|
|
264
|
-
return true;
|
|
265
|
-
}
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
function useScopes() {
|
|
269
|
-
const scopes = [];
|
|
270
|
-
const destroy = () => scopes.forEach(scope => scope.destroy());
|
|
271
|
-
tryOnScopeDispose(destroy);
|
|
272
|
-
function add(scope) {
|
|
273
|
-
onScope(scope, () => {
|
|
274
|
-
const index = scopes.indexOf(scope);
|
|
275
|
-
index >= 0 && scopes.splice(index, 1);
|
|
276
|
-
});
|
|
277
|
-
scopes.push(scope);
|
|
278
|
-
}
|
|
279
|
-
return {
|
|
280
|
-
add,
|
|
281
|
-
destroy
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
function onScope(scope, destroy) {
|
|
285
|
-
mustFunction((scope || {}).destroy, "onScope: scope.destroy");
|
|
286
|
-
mustFunction(destroy, "onScope: destroy");
|
|
287
|
-
const origin = scope.destroy;
|
|
288
|
-
scope.destroy = function () {
|
|
289
|
-
origin();
|
|
290
|
-
destroy();
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
function onInterval(fn, delay) {
|
|
294
|
-
mustFunction(fn, "onInterval: fn");
|
|
295
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
296
|
-
args[_key - 2] = arguments[_key];
|
|
297
|
-
}
|
|
298
|
-
const timer = setInterval(fn, delay, ...args);
|
|
299
|
-
return {
|
|
300
|
-
destroy: () => clearInterval(timer)
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
function onTimeout(fn, delay) {
|
|
304
|
-
mustFunction(fn, "onTimeout: fn");
|
|
305
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
306
|
-
args[_key2 - 2] = arguments[_key2];
|
|
307
|
-
}
|
|
308
|
-
const timer = setTimeout(fn, delay, ...args);
|
|
309
|
-
return {
|
|
310
|
-
destroy: () => clearTimeout(timer)
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
function onEvent(target, name, fn) {
|
|
314
|
-
throwIfFalse(target instanceof Element || target === window, "onEvent: target must be Element or Window");
|
|
315
|
-
mustString(name, "onEvent: name");
|
|
316
|
-
mustFunction(fn, "onEvent: fn");
|
|
317
|
-
target.addEventListener(name, fn);
|
|
318
|
-
return {
|
|
319
|
-
destroy: () => target.removeEventListener(name, fn)
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
function onResize(el, fn) {
|
|
323
|
-
throwIfFalse(el instanceof Element, "onResize: el must be Element.");
|
|
324
|
-
var isDestroy = false;
|
|
325
|
-
var preSize = void 0;
|
|
326
|
-
function calcSize() {
|
|
327
|
-
if (isDestroy == true) {
|
|
328
|
-
resizeObserver && resizeObserver.disconnect();
|
|
329
|
-
timer && clearInterval(timer);
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
const rect = el.getBoundingClientRect();
|
|
333
|
-
const isChange = preSize == void 0 || preSize.width != rect.width || preSize.height != rect.height;
|
|
334
|
-
if (isChange == true) {
|
|
335
|
-
preSize = Object.freeze({
|
|
336
|
-
width: rect.width,
|
|
337
|
-
height: rect.height
|
|
338
|
-
});
|
|
339
|
-
fn(preSize);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
const resizeObserver = "ResizeObserver" in window ? new ResizeObserver(calcSize) : void 0;
|
|
343
|
-
const timer = resizeObserver ? resizeObserver.observe(el) : setInterval(calcSize, 100);
|
|
344
|
-
calcSize();
|
|
345
|
-
return {
|
|
346
|
-
destroy: () => isDestroy = true
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
function onRerect(el, fn) {
|
|
350
|
-
throwIfFalse(el instanceof Element, "onRect: el must be Element.");
|
|
351
|
-
var isDestroy = false;
|
|
352
|
-
var preRect = void 0;
|
|
353
|
-
function calcRect() {
|
|
354
|
-
if (isDestroy == true) {
|
|
355
|
-
clearInterval(timer);
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
const rect = el.getBoundingClientRect();
|
|
359
|
-
const isChange = preRect == void 0 || rect.x != preRect.x || rect.y != preRect.y || rect.width != preRect.width || rect.height != preRect.height;
|
|
360
|
-
if (isChange == true) {
|
|
361
|
-
preRect = DOMRectReadOnly.fromRect(rect);
|
|
362
|
-
fn(preRect);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
const timer = setInterval(calcRect, 100);
|
|
366
|
-
calcRect();
|
|
367
|
-
return {
|
|
368
|
-
destroy: () => isDestroy = true
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
|
|
372
259
|
function scopeRef(rv, start, end, dealy) {
|
|
373
260
|
rv.value = start;
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
} : {
|
|
378
|
-
destroy
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
function animationRef(styleRef, start, target, aTime, end) {
|
|
382
|
-
styleRef.value = start;
|
|
383
|
-
const st = setTimeout(() => styleRef.value = target, 1);
|
|
384
|
-
const ct = aTime != void 0 && end != void 0 ? setTimeout(() => styleRef.value = end, aTime) : void 0;
|
|
385
|
-
function destroy() {
|
|
386
|
-
clearTimeout(st);
|
|
387
|
-
ct && clearTimeout(ct);
|
|
388
|
-
styleRef.value = end;
|
|
389
|
-
}
|
|
390
|
-
return {
|
|
391
|
-
destroy
|
|
392
|
-
};
|
|
261
|
+
return useScope().onDestroy(() => {
|
|
262
|
+
dealy > 0 ? setTimeout(() => rv.value = end, dealy) : rv.value = end;
|
|
263
|
+
});
|
|
393
264
|
}
|
|
394
265
|
|
|
395
266
|
var _sfc_main$c = defineComponent({
|
|
@@ -547,22 +418,21 @@ var _sfc_main$a = defineComponent({
|
|
|
547
418
|
} = _ref;
|
|
548
419
|
const props = __props;
|
|
549
420
|
const emit = __emit;
|
|
421
|
+
const animationScope = useAnimation();
|
|
550
422
|
const status = useModel(__props, "status");
|
|
551
423
|
const statusWatch = watch(status, calcFoldStyle);
|
|
552
424
|
const statusIcon = getFoldStatusDraw();
|
|
553
425
|
const foldBodyRef = useTemplateRef("foldBodyRef");
|
|
554
|
-
const foldStyleRef = shallowRef(Object.create(null));
|
|
555
426
|
function calcFoldStyle() {
|
|
556
427
|
if (foldBodyRef.value) {
|
|
557
428
|
const minHeight = 32;
|
|
558
429
|
const maxHeight = minHeight + foldBodyRef.value.getBoundingClientRect().height;
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
}, 200, Object.create(null));
|
|
430
|
+
animationScope.roll(foldBodyRef.value, "vertical", {
|
|
431
|
+
start: `${status.value == "expand" ? minHeight : maxHeight}px`,
|
|
432
|
+
target: `${status.value == "expand" ? maxHeight : minHeight}px`,
|
|
433
|
+
time: 200,
|
|
434
|
+
clear: true
|
|
435
|
+
});
|
|
566
436
|
}
|
|
567
437
|
}
|
|
568
438
|
function onStatusClick() {
|
|
@@ -578,11 +448,13 @@ var _sfc_main$a = defineComponent({
|
|
|
578
448
|
}
|
|
579
449
|
emit("change", status.value);
|
|
580
450
|
}
|
|
581
|
-
onUnmounted(() =>
|
|
451
|
+
onUnmounted(() => {
|
|
452
|
+
animationScope.destroy();
|
|
453
|
+
statusWatch.stop();
|
|
454
|
+
});
|
|
582
455
|
return (_ctx, _cache) => {
|
|
583
456
|
return openBlock(), createElementBlock("div", {
|
|
584
|
-
class: normalizeClass(["snail-fold", status.value])
|
|
585
|
-
style: normalizeStyle(foldStyleRef.value)
|
|
457
|
+
class: normalizeClass(["snail-fold", status.value])
|
|
586
458
|
}, [createElementVNode("div", _hoisted_1$7, [renderSlot(_ctx.$slots, "header", {}, () => [createElementVNode("div", {
|
|
587
459
|
class: "title",
|
|
588
460
|
textContent: toDisplayString(props.title)
|
|
@@ -600,7 +472,7 @@ var _sfc_main$a = defineComponent({
|
|
|
600
472
|
class: "fold-body",
|
|
601
473
|
ref_key: "foldBodyRef",
|
|
602
474
|
ref: foldBodyRef
|
|
603
|
-
}, [renderSlot(_ctx.$slots, "default")], 512)],
|
|
475
|
+
}, [renderSlot(_ctx.$slots, "default")], 512)], 2);
|
|
604
476
|
};
|
|
605
477
|
}
|
|
606
478
|
});
|
|
@@ -846,19 +718,17 @@ function openDialog(options, onDestroyed) {
|
|
|
846
718
|
}
|
|
847
719
|
async function scopeDialog(options, scopeRef) {
|
|
848
720
|
scopeRef.value && scopeRef.value.destroy();
|
|
849
|
-
scopeRef.value = {
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}
|
|
854
|
-
};
|
|
721
|
+
scopeRef.value = useScope().onDestroy(() => {
|
|
722
|
+
scopeRef.value = void 0;
|
|
723
|
+
ret.destroy();
|
|
724
|
+
});
|
|
855
725
|
const ret = openDialog(options);
|
|
856
726
|
const data = await ret;
|
|
857
727
|
scopeRef.value = void 0;
|
|
858
728
|
return data;
|
|
859
729
|
}
|
|
860
730
|
const descriptors = ref([]);
|
|
861
|
-
const dialogHook =
|
|
731
|
+
const dialogHook = useHook();
|
|
862
732
|
const createDialogHookCode = dialog => `onCloseDialog:${dialog.id}`;
|
|
863
733
|
function destroyDialog(dialog) {
|
|
864
734
|
const index = descriptors.value.indexOf(dialog);
|
|
@@ -887,12 +757,10 @@ const initVueApp = (() => {
|
|
|
887
757
|
})();
|
|
888
758
|
|
|
889
759
|
function getTitleStyle(options, isFlex) {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
}
|
|
895
|
-
return style;
|
|
760
|
+
return options && options.titleStyle ? style$1.build({
|
|
761
|
+
...options.titleStyle,
|
|
762
|
+
width: options.titleStyle
|
|
763
|
+
}, isFlex) : Object.create(null);
|
|
896
764
|
}
|
|
897
765
|
|
|
898
766
|
const _hoisted_1$4 = ["textContent"];
|
|
@@ -1008,8 +876,8 @@ var _sfc_main$3 = defineComponent({
|
|
|
1008
876
|
width: 0,
|
|
1009
877
|
height: 0
|
|
1010
878
|
});
|
|
1011
|
-
const scopes = useScopes();
|
|
1012
879
|
var destroyTimer;
|
|
880
|
+
const observer = useObserver();
|
|
1013
881
|
function onMouseEvent(isLeave) {
|
|
1014
882
|
destroyTimer && clearTimeout(destroyTimer);
|
|
1015
883
|
destroyTimer = void 0;
|
|
@@ -1020,12 +888,12 @@ var _sfc_main$3 = defineComponent({
|
|
|
1020
888
|
setTimeout(props.close, 200);
|
|
1021
889
|
}
|
|
1022
890
|
onMounted(() => {
|
|
1023
|
-
|
|
891
|
+
observer.onSize(toastRef.value, size => toastSize.value = size);
|
|
1024
892
|
destroyTimer = setTimeout(onToastClose, 2e3);
|
|
1025
893
|
showToast.value = true;
|
|
1026
894
|
});
|
|
1027
895
|
onUnmounted(() => {
|
|
1028
|
-
|
|
896
|
+
observer.destroy();
|
|
1029
897
|
destroyTimer && clearTimeout(destroyTimer);
|
|
1030
898
|
});
|
|
1031
899
|
return (_ctx, _cache) => {
|
|
@@ -1314,13 +1182,9 @@ function mount(options, onDestroyed) {
|
|
|
1314
1182
|
});
|
|
1315
1183
|
triggerAppCreated(app);
|
|
1316
1184
|
app.mount(options.target);
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
isFunction(onDestroyed) && onDestroyed(destroy);
|
|
1321
|
-
return {
|
|
1322
|
-
destroy
|
|
1323
|
-
};
|
|
1185
|
+
const scope = useScope().onDestroy(() => app.unmount());
|
|
1186
|
+
isFunction(onDestroyed) && onDestroyed(scope.destroy);
|
|
1187
|
+
return scope;
|
|
1324
1188
|
}
|
|
1325
1189
|
|
|
1326
|
-
export {
|
|
1190
|
+
export { components, confirm, getSvgIcon, mount, onAppCreated, openDialog, scopeDialog, scopeRef, toast, triggerAppCreated };
|
package/dist/snail.vue.umd.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//@ sourceURL=/snail.vue.js
|
|
2
2
|
(function (global, factory) {
|
|
3
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('snail.core'), require('snail.
|
|
4
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'snail.core', 'snail.
|
|
5
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SnailVue = global.SnailVue || {}, global.Vue, global.Snail, global.
|
|
6
|
-
})(this, (function (exports, vue, snail_core,
|
|
3
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('snail.core'), require('snail.view')) :
|
|
4
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'snail.core', 'snail.view'], factory) :
|
|
5
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SnailVue = global.SnailVue || {}, global.Vue, global.Snail, global.SnailView));
|
|
6
|
+
})(this, (function (exports, vue, snail_core, snail_view) { 'use strict';
|
|
7
7
|
|
|
8
8
|
var _sfc_main$h = vue.defineComponent({
|
|
9
9
|
...{
|
|
@@ -244,150 +244,21 @@
|
|
|
244
244
|
function onAppCreated(fn) {
|
|
245
245
|
snail_core.mustFunction(fn, "fn");
|
|
246
246
|
appCreatedFns.push(fn);
|
|
247
|
-
return {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
};
|
|
247
|
+
return snail_core.useScope().onDestroy(() => {
|
|
248
|
+
const index = appCreatedFns.indexOf(fn);
|
|
249
|
+
index >= 0 && appCreatedFns.splice(index, 1);
|
|
250
|
+
});
|
|
253
251
|
}
|
|
254
252
|
function triggerAppCreated(app) {
|
|
255
253
|
appCreatedFns.forEach(fn => fn(app));
|
|
256
254
|
return app;
|
|
257
255
|
}
|
|
258
256
|
|
|
259
|
-
function tryOnScopeDispose(fn) {
|
|
260
|
-
if (vue.getCurrentScope()) {
|
|
261
|
-
vue.onScopeDispose(fn);
|
|
262
|
-
return true;
|
|
263
|
-
}
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
function useScopes() {
|
|
267
|
-
const scopes = [];
|
|
268
|
-
const destroy = () => scopes.forEach(scope => scope.destroy());
|
|
269
|
-
tryOnScopeDispose(destroy);
|
|
270
|
-
function add(scope) {
|
|
271
|
-
onScope(scope, () => {
|
|
272
|
-
const index = scopes.indexOf(scope);
|
|
273
|
-
index >= 0 && scopes.splice(index, 1);
|
|
274
|
-
});
|
|
275
|
-
scopes.push(scope);
|
|
276
|
-
}
|
|
277
|
-
return {
|
|
278
|
-
add,
|
|
279
|
-
destroy
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
function onScope(scope, destroy) {
|
|
283
|
-
snail_core.mustFunction((scope || {}).destroy, "onScope: scope.destroy");
|
|
284
|
-
snail_core.mustFunction(destroy, "onScope: destroy");
|
|
285
|
-
const origin = scope.destroy;
|
|
286
|
-
scope.destroy = function () {
|
|
287
|
-
origin();
|
|
288
|
-
destroy();
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
function onInterval(fn, delay) {
|
|
292
|
-
snail_core.mustFunction(fn, "onInterval: fn");
|
|
293
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
294
|
-
args[_key - 2] = arguments[_key];
|
|
295
|
-
}
|
|
296
|
-
const timer = setInterval(fn, delay, ...args);
|
|
297
|
-
return {
|
|
298
|
-
destroy: () => clearInterval(timer)
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
function onTimeout(fn, delay) {
|
|
302
|
-
snail_core.mustFunction(fn, "onTimeout: fn");
|
|
303
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
304
|
-
args[_key2 - 2] = arguments[_key2];
|
|
305
|
-
}
|
|
306
|
-
const timer = setTimeout(fn, delay, ...args);
|
|
307
|
-
return {
|
|
308
|
-
destroy: () => clearTimeout(timer)
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
function onEvent(target, name, fn) {
|
|
312
|
-
snail_core.throwIfFalse(target instanceof Element || target === window, "onEvent: target must be Element or Window");
|
|
313
|
-
snail_core.mustString(name, "onEvent: name");
|
|
314
|
-
snail_core.mustFunction(fn, "onEvent: fn");
|
|
315
|
-
target.addEventListener(name, fn);
|
|
316
|
-
return {
|
|
317
|
-
destroy: () => target.removeEventListener(name, fn)
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
function onResize(el, fn) {
|
|
321
|
-
snail_core.throwIfFalse(el instanceof Element, "onResize: el must be Element.");
|
|
322
|
-
var isDestroy = false;
|
|
323
|
-
var preSize = void 0;
|
|
324
|
-
function calcSize() {
|
|
325
|
-
if (isDestroy == true) {
|
|
326
|
-
resizeObserver && resizeObserver.disconnect();
|
|
327
|
-
timer && clearInterval(timer);
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
const rect = el.getBoundingClientRect();
|
|
331
|
-
const isChange = preSize == void 0 || preSize.width != rect.width || preSize.height != rect.height;
|
|
332
|
-
if (isChange == true) {
|
|
333
|
-
preSize = Object.freeze({
|
|
334
|
-
width: rect.width,
|
|
335
|
-
height: rect.height
|
|
336
|
-
});
|
|
337
|
-
fn(preSize);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
const resizeObserver = "ResizeObserver" in window ? new ResizeObserver(calcSize) : void 0;
|
|
341
|
-
const timer = resizeObserver ? resizeObserver.observe(el) : setInterval(calcSize, 100);
|
|
342
|
-
calcSize();
|
|
343
|
-
return {
|
|
344
|
-
destroy: () => isDestroy = true
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
function onRerect(el, fn) {
|
|
348
|
-
snail_core.throwIfFalse(el instanceof Element, "onRect: el must be Element.");
|
|
349
|
-
var isDestroy = false;
|
|
350
|
-
var preRect = void 0;
|
|
351
|
-
function calcRect() {
|
|
352
|
-
if (isDestroy == true) {
|
|
353
|
-
clearInterval(timer);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
const rect = el.getBoundingClientRect();
|
|
357
|
-
const isChange = preRect == void 0 || rect.x != preRect.x || rect.y != preRect.y || rect.width != preRect.width || rect.height != preRect.height;
|
|
358
|
-
if (isChange == true) {
|
|
359
|
-
preRect = DOMRectReadOnly.fromRect(rect);
|
|
360
|
-
fn(preRect);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
const timer = setInterval(calcRect, 100);
|
|
364
|
-
calcRect();
|
|
365
|
-
return {
|
|
366
|
-
destroy: () => isDestroy = true
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
|
|
370
257
|
function scopeRef(rv, start, end, dealy) {
|
|
371
258
|
rv.value = start;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
} : {
|
|
376
|
-
destroy
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
function animationRef(styleRef, start, target, aTime, end) {
|
|
380
|
-
styleRef.value = start;
|
|
381
|
-
const st = setTimeout(() => styleRef.value = target, 1);
|
|
382
|
-
const ct = aTime != void 0 && end != void 0 ? setTimeout(() => styleRef.value = end, aTime) : void 0;
|
|
383
|
-
function destroy() {
|
|
384
|
-
clearTimeout(st);
|
|
385
|
-
ct && clearTimeout(ct);
|
|
386
|
-
styleRef.value = end;
|
|
387
|
-
}
|
|
388
|
-
return {
|
|
389
|
-
destroy
|
|
390
|
-
};
|
|
259
|
+
return snail_core.useScope().onDestroy(() => {
|
|
260
|
+
dealy > 0 ? setTimeout(() => rv.value = end, dealy) : rv.value = end;
|
|
261
|
+
});
|
|
391
262
|
}
|
|
392
263
|
|
|
393
264
|
var _sfc_main$c = vue.defineComponent({
|
|
@@ -545,22 +416,21 @@
|
|
|
545
416
|
} = _ref;
|
|
546
417
|
const props = __props;
|
|
547
418
|
const emit = __emit;
|
|
419
|
+
const animationScope = snail_view.useAnimation();
|
|
548
420
|
const status = vue.useModel(__props, "status");
|
|
549
421
|
const statusWatch = vue.watch(status, calcFoldStyle);
|
|
550
422
|
const statusIcon = getFoldStatusDraw();
|
|
551
423
|
const foldBodyRef = vue.useTemplateRef("foldBodyRef");
|
|
552
|
-
const foldStyleRef = vue.shallowRef(Object.create(null));
|
|
553
424
|
function calcFoldStyle() {
|
|
554
425
|
if (foldBodyRef.value) {
|
|
555
426
|
const minHeight = 32;
|
|
556
427
|
const maxHeight = minHeight + foldBodyRef.value.getBoundingClientRect().height;
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
}, 200, Object.create(null));
|
|
428
|
+
animationScope.roll(foldBodyRef.value, "vertical", {
|
|
429
|
+
start: `${status.value == "expand" ? minHeight : maxHeight}px`,
|
|
430
|
+
target: `${status.value == "expand" ? maxHeight : minHeight}px`,
|
|
431
|
+
time: 200,
|
|
432
|
+
clear: true
|
|
433
|
+
});
|
|
564
434
|
}
|
|
565
435
|
}
|
|
566
436
|
function onStatusClick() {
|
|
@@ -576,11 +446,13 @@
|
|
|
576
446
|
}
|
|
577
447
|
emit("change", status.value);
|
|
578
448
|
}
|
|
579
|
-
vue.onUnmounted(() =>
|
|
449
|
+
vue.onUnmounted(() => {
|
|
450
|
+
animationScope.destroy();
|
|
451
|
+
statusWatch.stop();
|
|
452
|
+
});
|
|
580
453
|
return (_ctx, _cache) => {
|
|
581
454
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
582
|
-
class: vue.normalizeClass(["snail-fold", status.value])
|
|
583
|
-
style: vue.normalizeStyle(foldStyleRef.value)
|
|
455
|
+
class: vue.normalizeClass(["snail-fold", status.value])
|
|
584
456
|
}, [vue.createElementVNode("div", _hoisted_1$7, [vue.renderSlot(_ctx.$slots, "header", {}, () => [vue.createElementVNode("div", {
|
|
585
457
|
class: "title",
|
|
586
458
|
textContent: vue.toDisplayString(props.title)
|
|
@@ -598,7 +470,7 @@
|
|
|
598
470
|
class: "fold-body",
|
|
599
471
|
ref_key: "foldBodyRef",
|
|
600
472
|
ref: foldBodyRef
|
|
601
|
-
}, [vue.renderSlot(_ctx.$slots, "default")], 512)],
|
|
473
|
+
}, [vue.renderSlot(_ctx.$slots, "default")], 512)], 2);
|
|
602
474
|
};
|
|
603
475
|
}
|
|
604
476
|
});
|
|
@@ -844,19 +716,17 @@
|
|
|
844
716
|
}
|
|
845
717
|
async function scopeDialog(options, scopeRef) {
|
|
846
718
|
scopeRef.value && scopeRef.value.destroy();
|
|
847
|
-
scopeRef.value = {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
}
|
|
852
|
-
};
|
|
719
|
+
scopeRef.value = snail_core.useScope().onDestroy(() => {
|
|
720
|
+
scopeRef.value = void 0;
|
|
721
|
+
ret.destroy();
|
|
722
|
+
});
|
|
853
723
|
const ret = openDialog(options);
|
|
854
724
|
const data = await ret;
|
|
855
725
|
scopeRef.value = void 0;
|
|
856
726
|
return data;
|
|
857
727
|
}
|
|
858
728
|
const descriptors = vue.ref([]);
|
|
859
|
-
const dialogHook = snail_core.
|
|
729
|
+
const dialogHook = snail_core.useHook();
|
|
860
730
|
const createDialogHookCode = dialog => `onCloseDialog:${dialog.id}`;
|
|
861
731
|
function destroyDialog(dialog) {
|
|
862
732
|
const index = descriptors.value.indexOf(dialog);
|
|
@@ -885,12 +755,10 @@
|
|
|
885
755
|
})();
|
|
886
756
|
|
|
887
757
|
function getTitleStyle(options, isFlex) {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
}
|
|
893
|
-
return style;
|
|
758
|
+
return options && options.titleStyle ? snail_view.style.build({
|
|
759
|
+
...options.titleStyle,
|
|
760
|
+
width: options.titleStyle
|
|
761
|
+
}, isFlex) : Object.create(null);
|
|
894
762
|
}
|
|
895
763
|
|
|
896
764
|
const _hoisted_1$4 = ["textContent"];
|
|
@@ -1006,8 +874,8 @@
|
|
|
1006
874
|
width: 0,
|
|
1007
875
|
height: 0
|
|
1008
876
|
});
|
|
1009
|
-
const scopes = useScopes();
|
|
1010
877
|
var destroyTimer;
|
|
878
|
+
const observer = snail_view.useObserver();
|
|
1011
879
|
function onMouseEvent(isLeave) {
|
|
1012
880
|
destroyTimer && clearTimeout(destroyTimer);
|
|
1013
881
|
destroyTimer = void 0;
|
|
@@ -1018,12 +886,12 @@
|
|
|
1018
886
|
setTimeout(props.close, 200);
|
|
1019
887
|
}
|
|
1020
888
|
vue.onMounted(() => {
|
|
1021
|
-
|
|
889
|
+
observer.onSize(toastRef.value, size => toastSize.value = size);
|
|
1022
890
|
destroyTimer = setTimeout(onToastClose, 2e3);
|
|
1023
891
|
showToast.value = true;
|
|
1024
892
|
});
|
|
1025
893
|
vue.onUnmounted(() => {
|
|
1026
|
-
|
|
894
|
+
observer.destroy();
|
|
1027
895
|
destroyTimer && clearTimeout(destroyTimer);
|
|
1028
896
|
});
|
|
1029
897
|
return (_ctx, _cache) => {
|
|
@@ -1312,31 +1180,20 @@
|
|
|
1312
1180
|
});
|
|
1313
1181
|
triggerAppCreated(app);
|
|
1314
1182
|
app.mount(options.target);
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
snail_core.isFunction(onDestroyed) && onDestroyed(destroy);
|
|
1319
|
-
return {
|
|
1320
|
-
destroy
|
|
1321
|
-
};
|
|
1183
|
+
const scope = snail_core.useScope().onDestroy(() => app.unmount());
|
|
1184
|
+
snail_core.isFunction(onDestroyed) && onDestroyed(scope.destroy);
|
|
1185
|
+
return scope;
|
|
1322
1186
|
}
|
|
1323
1187
|
|
|
1324
|
-
exports.animationRef = animationRef;
|
|
1325
1188
|
exports.components = components;
|
|
1326
1189
|
exports.confirm = confirm;
|
|
1327
1190
|
exports.getSvgIcon = getSvgIcon;
|
|
1328
1191
|
exports.mount = mount;
|
|
1329
1192
|
exports.onAppCreated = onAppCreated;
|
|
1330
|
-
exports.onEvent = onEvent;
|
|
1331
|
-
exports.onInterval = onInterval;
|
|
1332
|
-
exports.onRerect = onRerect;
|
|
1333
|
-
exports.onResize = onResize;
|
|
1334
|
-
exports.onTimeout = onTimeout;
|
|
1335
1193
|
exports.openDialog = openDialog;
|
|
1336
1194
|
exports.scopeDialog = scopeDialog;
|
|
1337
1195
|
exports.scopeRef = scopeRef;
|
|
1338
1196
|
exports.toast = toast;
|
|
1339
1197
|
exports.triggerAppCreated = triggerAppCreated;
|
|
1340
|
-
exports.useScopes = useScopes;
|
|
1341
1198
|
|
|
1342
1199
|
}));
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
/* src:base\button.vue index:0 */
|
|
2
2
|
.snail-button{align-items:center;border-radius:2px;cursor:pointer;display:inline-flex;font-size:14px;justify-content:center;white-space:nowrap}.snail-button.max{height:40px;width:120px}.snail-button.middle{height:32px;width:90px}.snail-button.normal{height:28px;width:54px}.snail-button.small{height:20px;width:30px}.snail-button.primary{background-color:#5ca3ff;color:#fff}.snail-button.default{background-color:#fff;border:1px solid #dddfed;color:#2e2f33}.snail-button.link{color:#4c9aff}
|
|
3
|
-
/* src:base\icon.vue index:0 */
|
|
4
|
-
.snail-icon{cursor:pointer;opacity:1}
|
|
5
|
-
/* src:base\switch.vue index:0 */
|
|
6
|
-
.snail-switch{border-radius:10px 10px 10px 10px;cursor:pointer;height:20px!important;overflow:hidden;position:relative;width:36px!important}.snail-switch>div{height:100%;width:100%}.snail-switch>div.on{background-color:#5ca3ff}.snail-switch>div.off{background-color:#c4c8cc;position:absolute;transition:left .2s ease}.snail-switch>div.status{background:#fff;border-radius:10px 10px 10px 10px;height:16px;position:absolute;top:2px;transition:left .2s ease;width:16px}.snail-switch.on>div.off{left:100%;top:0}.snail-switch.on>div.status{left:calc(100% - 18px)}.snail-switch.off>div.off{left:0;top:0}.snail-switch.off>div.status{left:2px}.snail-switch.readonly{cursor:default}
|
|
7
3
|
/* src:base\footer.vue index:0 */
|
|
8
4
|
.snail-footer{align-items:center;background-color:#fff;display:flex;flex-shrink:0;height:72px;padding:0 40px;width:100%}.snail-footer>.snail-button:nth-child(n+2){margin-left:20px}.snail-footer.start-divider{border-top:1px solid #dddfed}.snail-footer.left{justify-content:left}.snail-footer.center{justify-content:center}.snail-footer.right{justify-content:right}
|
|
9
|
-
/* src:container\dynamic.vue index:0 */
|
|
10
|
-
.snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
|
|
11
5
|
/* src:base\header.vue index:0 */
|
|
12
6
|
.snail-header{align-items:center;background-color:#fff;display:flex;flex-direction:row;flex-shrink:0;position:relative;width:100%}.snail-header>.header-title{color:#2e3033;flex:1;line-height:48px;overflow:hidden;padding-left:24px;text-overflow:ellipsis;white-space:nowrap}.snail-header>.header-title.center{text-align:center}.snail-header>.header-title.right{text-align:right}.snail-header.start-divider{border-bottom:1px solid #dddfed}.snail-header.page{height:48px}.snail-header.page>.header-title{font-size:16px;font-weight:700}.snail-header.page>.close-icon{margin-right:18px}.snail-header.dialog{height:64px;padding-top:16px}.snail-header.dialog>.header-title{font-size:20px}.snail-header.dialog>.close-icon{position:absolute;right:8px;top:8px}
|
|
7
|
+
/* src:base\icon.vue index:0 */
|
|
8
|
+
.snail-icon{cursor:pointer;opacity:1}
|
|
9
|
+
/* src:container\dynamic.vue index:0 */
|
|
10
|
+
.snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
|
|
11
|
+
/* src:base\switch.vue index:0 */
|
|
12
|
+
.snail-switch{border-radius:10px 10px 10px 10px;cursor:pointer;height:20px!important;overflow:hidden;position:relative;width:36px!important}.snail-switch>div{height:100%;width:100%}.snail-switch>div.on{background-color:#5ca3ff}.snail-switch>div.off{background-color:#c4c8cc;position:absolute;transition:left .2s ease}.snail-switch>div.status{background:#fff;border-radius:10px 10px 10px 10px;height:16px;position:absolute;top:2px;transition:left .2s ease;width:16px}.snail-switch.on>div.off{left:100%;top:0}.snail-switch.on>div.status{left:calc(100% - 18px)}.snail-switch.off>div.off{left:0;top:0}.snail-switch.off>div.status{left:2px}.snail-switch.readonly{cursor:default}
|
|
13
13
|
/* src:container\fold.vue index:0 */
|
|
14
14
|
.snail-fold{flex-shrink:0;transition:height .2s ease}.snail-fold>div.fold-header{align-items:center;display:flex;height:32px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.snail-fold>div.fold-header:before{background-color:#2c97fb;content:"";height:18px;left:0;position:absolute;top:7px;width:4px}.snail-fold>div.fold-header>.subtitle,.snail-fold>div.fold-header>.title{overflow:hidden;white-space:nowrap}.snail-fold>div.fold-header>.title{color:#2e3033;font-size:14px;font-weight:700;padding-left:20px}.snail-fold>div.fold-header>.subtitle{color:#8a9099;font-size:13px}.snail-fold>div.fold-header>div.status{display:flex;flex:1;justify-content:right;justify-self:right}.snail-fold>div.fold-header>div.status>span{transition:transform .2s ease}.snail-fold>div.fold-body{padding-left:20px}.snail-fold.expand>div.fold-header>div.status>span{transform:rotate(0deg)}.snail-fold.fold{height:32px;overflow:hidden}.snail-fold.fold>div.fold-header>div.status>span{transform:rotate(180deg)}
|
|
15
|
+
/* src:container\components\table-col.vue index:0 */
|
|
16
|
+
.table-col{align-items:center;display:inline-flex;height:100%;white-space:nowrap}.table-col.left{justify-content:left}.table-col.center{justify-content:center}.table-col.right{justify-content:right}
|
|
15
17
|
/* src:container\table.vue index:0 */
|
|
16
18
|
.snail-table{display:flex;flex-direction:column}.snail-table>footer.table-footer,.snail-table>header.table-header{align-items:center;display:flex;flex-shrink:0;width:100%}.snail-table>header.table-header{position:sticky!important;top:0}.snail-table>main.table-body{flex:1;width:100%}.snail-table.start-border>footer.table-footer>.table-col:nth-child(n+2),.snail-table.start-border>header.table-header>.table-col:nth-child(n+2),.snail-table.start-border>main.table-body>.table-row>.table-col:nth-child(n+2){border-left:none!important}.snail-table.start-border>footer.table-footer>.table-col,.snail-table.start-border>main.table-body>.table-row>.table-col{border-top:none!important}
|
|
17
|
-
/* src:container\scroll.vue index:0 */
|
|
18
|
-
.snail-scroll{overflow:hidden}.snail-scroll.scroll-x{overflow-x:auto}.snail-scroll.scroll-y{overflow-y:auto}
|
|
19
19
|
/* src:container\components\table-row.vue index:0 */
|
|
20
20
|
.table-row{align-items:center;display:flex;min-width:100%}
|
|
21
|
-
/* src:container\components\table-col.vue index:0 */
|
|
22
|
-
.table-col{align-items:center;display:inline-flex;height:100%;white-space:nowrap}.table-col.left{justify-content:left}.table-col.center{justify-content:center}.table-col.right{justify-content:right}
|
|
23
|
-
/* src:prompt\empty.vue index:0 */
|
|
24
|
-
.snail-empty{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;width:100%}.snail-empty>img{height:60px;width:60px}.snail-empty>div.message{color:#babdc2;font-size:14px;font-weight:400;padding:0 10px 10px}
|
|
25
|
-
/* src:prompt\loading.vue index:0 */
|
|
26
|
-
.snail-loading{bottom:0;left:0;position:absolute;right:0;top:0;z-index:10000}.snail-loading.show-mask{background-color:rgba(0,0,0,.15)}.snail-loading:after,.snail-loading:before{animation:snail-loading-stretch 1s ease-in-out infinite;border-radius:50%;content:"";display:block;display:inline-block;height:10px;left:50%;margin-left:-18px;margin-top:-6px;position:absolute;top:50%;width:10px}.snail-loading:before{background-color:#279bf1}.snail-loading:after{animation-delay:-.5s;background:#64d214;margin-left:0;margin-right:-18px}@keyframes snail-loading-stretch{0%,to{transform:scale(1)}50%{transform:scale(2)}}.snail-loading-enter-active,.snail-loading-leave-active{transition:opacity .5s ease-in-out}.snail-loading-enter-from,.snail-loading-leave-to{opacity:0}
|
|
27
21
|
/* src:form\input.vue index:0 */
|
|
28
22
|
.snail-input{display:inline-flex;min-height:34px}.snail-input>.input-title{flex-shrink:0;font-size:14px;padding-top:6px}.snail-input>.input-title>span.text{color:#2e3033}.snail-input>.input-title>span.required{color:#f74b4b;margin-left:2px}.snail-input>.input-body{align-self:start;display:flex;flex:1;height:32px}.snail-input>.input-body>input{border:1px solid #dddfed;color:#2e3033;flex:1;font-size:14px;font-weight:400;padding:0 10px;text-overflow:ellipsis}.snail-input>.input-body>input:focus{border:1px solid #3292ea}.snail-input>.input-body>span{background-color:red;flex-shrink:0}.snail-input.readonly>div.input-body>input:focus{border:1px solid #dddfed}
|
|
29
23
|
/* src:prompt\drag-verify.vue index:0 */
|
|
30
24
|
.snail-drag-verify{background:#f8f9fa;border:1px solid #dddfed;border-radius:8px;height:40px;overflow:hidden;position:relative;width:100%}.snail-drag-verify>div{height:100%;width:100%}.snail-drag-verify>.drag-progress{background-color:#0c6;transition:width .5s ease-in-out}.snail-drag-verify>.drag-handle,.snail-drag-verify>.verify-message{left:0;position:absolute;top:0;transition:left .5s ease-in-out}.snail-drag-verify>.verify-message{align-items:center;background-image:-webkit-linear-gradient(left,#666,#666 45%,#fff 50%,#666 55%,#666);color:#7e848c;display:flex;font-size:12px;font-weight:400;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-text-fill-color:transparent;animation:snail-drag-verify 2s linear infinite;-webkit-background-clip:text;background-clip:text;background-size:200% 100%}.snail-drag-verify>.drag-handle{align-items:center;background-color:#fff;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURQAAAGBQUGBaWmJZWWJYWGNYWGNZWWJYWGJZWWBYWGNYWGNZWWRYWIqwlb0AAAANdFJOUwAQMMDQoFBgcCCw4ECQ8pPMAAAAP0lEQVQI12NgwATTGBgawAwRBYZwMIPRiYErAcxSFmA0AjN4HBikBcCsUgYmQxQGE0wKphhIQrSzwAyEW4EOACHhB32zIad6AAAAAElFTkSuQmCC);background-position:50%;background-repeat:no-repeat;border-right:1px solid #dddfed;cursor:move;display:flex;justify-content:center;width:40px}.snail-drag-verify.dragging>.drag-handle,.snail-drag-verify.dragging>.drag-progress{transition:none!important}.snail-drag-verify.success>.verify-message{-webkit-text-fill-color:#fff;color:#fff}.snail-drag-verify.success>.drag-handle>svg{background:#76c61d;border-radius:50%;padding:4px}@keyframes snail-drag-verify{0%{background-position:0 0}to{background-position:-200% 0}}
|
|
25
|
+
/* src:prompt\empty.vue index:0 */
|
|
26
|
+
.snail-empty{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;width:100%}.snail-empty>img{height:60px;width:60px}.snail-empty>div.message{color:#babdc2;font-size:14px;font-weight:400;padding:0 10px 10px}
|
|
27
|
+
/* src:prompt\loading.vue index:0 */
|
|
28
|
+
.snail-loading{bottom:0;left:0;position:absolute;right:0;top:0;z-index:10000}.snail-loading.show-mask{background-color:rgba(0,0,0,.15)}.snail-loading:after,.snail-loading:before{animation:snail-loading-stretch 1s ease-in-out infinite;border-radius:50%;content:"";display:block;display:inline-block;height:10px;left:50%;margin-left:-18px;margin-top:-6px;position:absolute;top:50%;width:10px}.snail-loading:before{background-color:#279bf1}.snail-loading:after{animation-delay:-.5s;background:#64d214;margin-left:0;margin-right:-18px}@keyframes snail-loading-stretch{0%,to{transform:scale(1)}50%{transform:scale(2)}}.snail-loading-enter-active,.snail-loading-leave-active{transition:opacity .5s ease-in-out}.snail-loading-enter-from,.snail-loading-leave-to{opacity:0}
|
|
29
|
+
/* src:container\scroll.vue index:0 */
|
|
30
|
+
.snail-scroll{overflow:hidden}.snail-scroll.scroll-x{overflow-x:auto}.snail-scroll.scroll-y{overflow-y:auto}
|
|
31
|
+
/* src:container\components\dialog-wrapper.vue index:0 */
|
|
32
|
+
.snail-dialog{align-items:center;bottom:0;display:flex;justify-content:center;left:0;overflow:hidden;position:fixed;right:0;top:0}.snail-dialog:before{background-color:rgba(24,27,33,.45);content:"";height:100%;position:absolute;width:100%}.snail-dialog>.dialog-body{background-color:#fff;border-radius:4px;box-shadow:0 0 15px rgba(0,0,0,.3);box-sizing:border-box;position:relative}.snail-dialog.unactive:before{display:none!important}.snail-dialog.unactive>.dialog-body{box-shadow:0 0 4px rgba(0,0,0,.3)}.snail-dialog-enter-active,.snail-dialog-leave-active{transition:scale .1s ease-in-out,opacity .1s ease}.snail-dialog-enter-from{opacity:0;scale:.4}.snail-dialog-leave-to{opacity:0;scale:0}
|
|
31
33
|
/* src:prompt\components\confirm.vue index:0 */
|
|
32
34
|
.snail-confirm{background-color:#fff;border-radius:4px;box-sizing:border-box;color:#2e2f33;display:flex;flex-direction:column;max-height:350px;max-width:548px;min-width:348px}.snail-confirm>main{flex:1;font-size:14px;margin:20px 40px;overflow:auto;word-wrap:break-word;box-sizing:border-box}
|
|
33
35
|
/* src:prompt\components\toast.vue index:0 */
|
|
34
|
-
.snail-toast{background:rgba(0,0,0,.7);border-radius:5px;color:#fff;display:flex;max-height:200px;max-width:500px;min-width:200px;opacity:.2;overflow:hidden;padding:20px 30px 20px 20px;position:fixed;transition:opacity .2s ease;z-index:99999}.snail-toast.show-toast{opacity:1}.snail-toast>svg.close-icon{position:absolute;right:10px;top:12px}.snail-toast>div.icon{align-items:center;align-self:center;background:hsla(0,0%,100%,.15);border-radius:50%;display:flex;height:26px;justify-content:center;margin-right:6px;width:26px}.snail-toast>div.icon>svg{background:#fff;border-radius:50%;cursor:none!important}.snail-toast>div.message{flex:1;line-height:24px;overflow:hidden;word-break:break-all}
|
|
35
|
-
/* src:container\components\dialog-wrapper.vue index:0 */
|
|
36
|
-
.snail-dialog{align-items:center;bottom:0;display:flex;justify-content:center;left:0;overflow:hidden;position:fixed;right:0;top:0}.snail-dialog:before{background-color:rgba(24,27,33,.45);content:"";height:100%;position:absolute;width:100%}.snail-dialog>.dialog-body{background-color:#fff;border-radius:4px;box-shadow:0 0 15px rgba(0,0,0,.3);box-sizing:border-box;position:relative}.snail-dialog.unactive:before{display:none!important}.snail-dialog.unactive>.dialog-body{box-shadow:0 0 4px rgba(0,0,0,.3)}.snail-dialog-enter-active,.snail-dialog-leave-active{transition:scale .1s ease-in-out,opacity .1s ease}.snail-dialog-enter-from{opacity:0;scale:.4}.snail-dialog-leave-to{opacity:0;scale:0}
|
|
36
|
+
.snail-toast{background:rgba(0,0,0,.7);border-radius:5px;color:#fff;display:flex;max-height:200px;max-width:500px;min-width:200px;opacity:.2;overflow:hidden;padding:20px 30px 20px 20px;position:fixed;transition:opacity .2s ease;z-index:99999}.snail-toast.show-toast{opacity:1}.snail-toast>svg.close-icon{position:absolute;right:10px;top:12px}.snail-toast>div.icon{align-items:center;align-self:center;background:hsla(0,0%,100%,.15);border-radius:50%;display:flex;height:26px;justify-content:center;margin-right:6px;width:26px}.snail-toast>div.icon>svg{background:#fff;border-radius:50%;cursor:none!important}.snail-toast>div.message{flex:1;line-height:24px;overflow:hidden;word-break:break-all}
|
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.23",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/snail.vue.js",
|
|
9
9
|
"module": "dist/snail.vue.js",
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"vue": "^3.5.14",
|
|
18
|
-
"snail.core": ">=
|
|
18
|
+
"snail.core": ">=2.0.3",
|
|
19
|
+
"snail.view": ">=1.0.2"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
22
|
"vue-tsc": "^2.2.10",
|
|
22
23
|
"snail.rollup": ">=1.2.8",
|
|
23
24
|
"snail.rollup-asset": ">=1.2.1",
|
|
24
25
|
"snail.rollup-html": ">=1.2.3",
|
|
25
|
-
"snail.rollup-url": ">=1.2.
|
|
26
|
+
"snail.rollup-url": ">=1.2.2",
|
|
26
27
|
"snail.rollup-inject": ">=1.2.1",
|
|
27
28
|
"snail.rollup-script": ">=1.2.4",
|
|
28
29
|
"snail.rollup-style": ">=1.2.5",
|
|
29
|
-
"snail.style": ">=1.0.0",
|
|
30
30
|
"snail.rollup-vue": ">=1.2.4"
|
|
31
31
|
}
|
|
32
32
|
}
|