snail.vue 1.0.20 → 1.0.21
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 +251 -37
- package/dist/snail.vue.js +345 -61
- package/dist/snail.vue.umd.js +347 -62
- package/dist/{css → styles}/snail.vue.vue.css +20 -14
- package/package.json +4 -3
package/dist/snail.vue.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//@ sourceURL=/snail.vue.js
|
|
2
|
-
import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, createBlock, createCommentVNode, toDisplayString, createElementVNode, normalizeProps, guardReactiveProps, unref, computed, mergeProps, getCurrentScope, onScopeDispose, Transition, withCtx, ref, shallowRef, watch, onErrorCaptured, onActivated, onDeactivated, Fragment, resolveDynamicComponent, createSlots, renderList,
|
|
2
|
+
import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, createBlock, createCommentVNode, toDisplayString, createElementVNode, normalizeProps, guardReactiveProps, unref, computed, mergeProps, mergeModels, useModel, getCurrentScope, onScopeDispose, Transition, withCtx, ref, shallowRef, watch, onErrorCaptured, onActivated, onDeactivated, Fragment, resolveDynamicComponent, createSlots, renderList, useTemplateRef, onUnmounted, normalizeStyle, createVNode, TransitionGroup, withModifiers, createApp, onMounted } from 'vue';
|
|
3
3
|
import { style, tidyString, throwError, mustString, mustFunction, throwIfFalse, isStringNotEmpty, isObject, script, delay, getMessage, hook, mustObject, defer, newId, isFunction } from 'snail.core';
|
|
4
|
+
import { getSizeStyle, getAlignStyle } from 'snail.style';
|
|
4
5
|
|
|
5
|
-
var _sfc_main$
|
|
6
|
+
var _sfc_main$h = defineComponent({
|
|
6
7
|
...{
|
|
7
8
|
name: "Button",
|
|
8
9
|
inheritAttrs: true
|
|
@@ -24,9 +25,9 @@ var _sfc_main$e = defineComponent({
|
|
|
24
25
|
|
|
25
26
|
var addLink = href => setTimeout(style.register, 0, href);
|
|
26
27
|
|
|
27
|
-
addLink("/
|
|
28
|
+
addLink("/styles/snail.vue.vue.css");
|
|
28
29
|
|
|
29
|
-
var _sfc_main$
|
|
30
|
+
var _sfc_main$g = defineComponent({
|
|
30
31
|
...{
|
|
31
32
|
name: "Footer",
|
|
32
33
|
inheritAttrs: true
|
|
@@ -58,13 +59,13 @@ var _sfc_main$d = defineComponent({
|
|
|
58
59
|
class: normalizeClass(["snail-footer", {
|
|
59
60
|
"start-divider": props.divider
|
|
60
61
|
}, props.align || "right"])
|
|
61
|
-
}, [renderSlot(_ctx.$slots, "default", {}, () => [props.cancelDisable != true ? (openBlock(), createBlock(_sfc_main$
|
|
62
|
+
}, [renderSlot(_ctx.$slots, "default", {}, () => [props.cancelDisable != true ? (openBlock(), createBlock(_sfc_main$h, {
|
|
62
63
|
key: 0,
|
|
63
64
|
size: "max",
|
|
64
65
|
type: "default",
|
|
65
66
|
onClick: _cache[0] || (_cache[0] = $event => emit("cancel")),
|
|
66
67
|
textContent: toDisplayString(props.cancelName || "取消")
|
|
67
|
-
}, null, 8, ["textContent"])) : createCommentVNode("", true), props.confirmDisable != true ? (openBlock(), createBlock(_sfc_main$
|
|
68
|
+
}, null, 8, ["textContent"])) : createCommentVNode("", true), props.confirmDisable != true ? (openBlock(), createBlock(_sfc_main$h, {
|
|
68
69
|
key: 1,
|
|
69
70
|
size: "max",
|
|
70
71
|
type: "primary",
|
|
@@ -111,8 +112,8 @@ function getSvgIcon(options) {
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
const _hoisted_1$
|
|
115
|
-
var _sfc_main$
|
|
115
|
+
const _hoisted_1$9 = ["width", "height"];
|
|
116
|
+
var _sfc_main$f = defineComponent({
|
|
116
117
|
...{
|
|
117
118
|
name: "Icon",
|
|
118
119
|
inheritAttrs: true
|
|
@@ -133,13 +134,13 @@ var _sfc_main$c = defineComponent({
|
|
|
133
134
|
width: props.size || 24,
|
|
134
135
|
height: props.size || 24,
|
|
135
136
|
class: normalizeClass([_ctx.type, "snail-icon"])
|
|
136
|
-
}, [createElementVNode("path", normalizeProps(guardReactiveProps(unref(icon))), null, 16)], 10, _hoisted_1$
|
|
137
|
+
}, [createElementVNode("path", normalizeProps(guardReactiveProps(unref(icon))), null, 16)], 10, _hoisted_1$9);
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
140
|
});
|
|
140
141
|
|
|
141
|
-
const _hoisted_1$
|
|
142
|
-
var _sfc_main$
|
|
142
|
+
const _hoisted_1$8 = ["textContent"];
|
|
143
|
+
var _sfc_main$e = defineComponent({
|
|
143
144
|
...{
|
|
144
145
|
name: "Header",
|
|
145
146
|
inheritAttrs: true
|
|
@@ -172,7 +173,7 @@ var _sfc_main$b = defineComponent({
|
|
|
172
173
|
const closeIconOptions = computed(() => ({
|
|
173
174
|
type: "close",
|
|
174
175
|
color: __props.useTo == "page" ? "#2e3033" : "#464953",
|
|
175
|
-
size:
|
|
176
|
+
size: 22
|
|
176
177
|
}));
|
|
177
178
|
return (_ctx, _cache) => {
|
|
178
179
|
return openBlock(), createElementBlock("header", {
|
|
@@ -183,9 +184,7 @@ var _sfc_main$b = defineComponent({
|
|
|
183
184
|
key: 0,
|
|
184
185
|
textContent: toDisplayString(_ctx.title),
|
|
185
186
|
class: normalizeClass(["header-title", _ctx.titleAlign])
|
|
186
|
-
}, null, 10, _hoisted_1$
|
|
187
|
-
class: "header-slot"
|
|
188
|
-
}), _ctx.closeDisable != true ? (openBlock(), createBlock(_sfc_main$c, mergeProps({
|
|
187
|
+
}, null, 10, _hoisted_1$8)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default"), _ctx.closeDisable != true ? (openBlock(), createBlock(_sfc_main$f, mergeProps({
|
|
189
188
|
key: 1,
|
|
190
189
|
class: "close-icon"
|
|
191
190
|
}, closeIconOptions.value, {
|
|
@@ -195,6 +194,54 @@ var _sfc_main$b = defineComponent({
|
|
|
195
194
|
}
|
|
196
195
|
});
|
|
197
196
|
|
|
197
|
+
var _sfc_main$d = defineComponent({
|
|
198
|
+
...{
|
|
199
|
+
name: "Switch",
|
|
200
|
+
inheritAttrs: true
|
|
201
|
+
},
|
|
202
|
+
__name: "switch",
|
|
203
|
+
props: mergeModels({
|
|
204
|
+
readonly: {
|
|
205
|
+
type: Boolean
|
|
206
|
+
}
|
|
207
|
+
}, {
|
|
208
|
+
"modelValue": {
|
|
209
|
+
type: Boolean,
|
|
210
|
+
...{
|
|
211
|
+
default: false
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"modelModifiers": {}
|
|
215
|
+
}),
|
|
216
|
+
emits: mergeModels(["change"], ["update:modelValue"]),
|
|
217
|
+
setup(__props, _ref) {
|
|
218
|
+
let {
|
|
219
|
+
emit: __emit
|
|
220
|
+
} = _ref;
|
|
221
|
+
const props = __props;
|
|
222
|
+
const emit = __emit;
|
|
223
|
+
const switchModel = useModel(__props, "modelValue");
|
|
224
|
+
function onSwitchChange() {
|
|
225
|
+
if (props.readonly != true) {
|
|
226
|
+
switchModel.value = !switchModel.value;
|
|
227
|
+
emit("change", switchModel.value);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return (_ctx, _cache) => {
|
|
231
|
+
return openBlock(), createElementBlock("div", {
|
|
232
|
+
class: normalizeClass(["snail-switch", [switchModel.value ? "on" : "off", props.readonly ? "readonly" : ""]]),
|
|
233
|
+
onClick: onSwitchChange
|
|
234
|
+
}, _cache[0] || (_cache[0] = [createElementVNode("div", {
|
|
235
|
+
class: "on"
|
|
236
|
+
}, null, -1), createElementVNode("div", {
|
|
237
|
+
class: "off"
|
|
238
|
+
}, null, -1), createElementVNode("div", {
|
|
239
|
+
class: "status"
|
|
240
|
+
}, null, -1)]), 2);
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
|
|
198
245
|
const appCreatedFns = [];
|
|
199
246
|
function onAppCreated(fn) {
|
|
200
247
|
mustFunction(fn, "fn");
|
|
@@ -222,11 +269,27 @@ function useScopes() {
|
|
|
222
269
|
const scopes = [];
|
|
223
270
|
const destroy = () => scopes.forEach(scope => scope.destroy());
|
|
224
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
|
+
}
|
|
225
279
|
return {
|
|
226
|
-
add
|
|
280
|
+
add,
|
|
227
281
|
destroy
|
|
228
282
|
};
|
|
229
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
|
+
}
|
|
230
293
|
function onInterval(fn, delay) {
|
|
231
294
|
mustFunction(fn, "onInterval: fn");
|
|
232
295
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
@@ -306,17 +369,30 @@ function onRerect(el, fn) {
|
|
|
306
369
|
};
|
|
307
370
|
}
|
|
308
371
|
|
|
309
|
-
function scopeRef(rv,
|
|
310
|
-
rv.value =
|
|
311
|
-
const destroy = () => rv.value =
|
|
372
|
+
function scopeRef(rv, start, end, dealy) {
|
|
373
|
+
rv.value = start;
|
|
374
|
+
const destroy = () => rv.value = end;
|
|
312
375
|
return dealy > 0 ? {
|
|
313
376
|
destroy: () => setTimeout(destroy, dealy)
|
|
314
377
|
} : {
|
|
315
378
|
destroy
|
|
316
379
|
};
|
|
317
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
|
+
};
|
|
393
|
+
}
|
|
318
394
|
|
|
319
|
-
var _sfc_main$
|
|
395
|
+
var _sfc_main$c = defineComponent({
|
|
320
396
|
...{
|
|
321
397
|
name: "Loading",
|
|
322
398
|
inheritAttrs: true
|
|
@@ -355,7 +431,7 @@ var _sfc_main$a = defineComponent({
|
|
|
355
431
|
}
|
|
356
432
|
});
|
|
357
433
|
|
|
358
|
-
var _sfc_main$
|
|
434
|
+
var _sfc_main$b = defineComponent({
|
|
359
435
|
...{
|
|
360
436
|
name: "Dynamic",
|
|
361
437
|
inheritAttrs: false
|
|
@@ -423,7 +499,7 @@ var _sfc_main$9 = defineComponent({
|
|
|
423
499
|
})]), 1040)), dynamicError.value != void 0 ? (openBlock(), createElementBlock("div", mergeProps({
|
|
424
500
|
key: 0,
|
|
425
501
|
class: "snail-dynamic-error"
|
|
426
|
-
}, _ctx.$attrs), [_cache[0] || (_cache[0] = createTextVNode(" load component error:")), createElementVNode("span", null, toDisplayString(dynamicError.value), 1)], 16)) : dynamicComponent.value == void 0 ? (openBlock(), createBlock(_sfc_main$
|
|
502
|
+
}, _ctx.$attrs), [_cache[0] || (_cache[0] = createTextVNode(" load component error:")), createElementVNode("span", null, toDisplayString(dynamicError.value), 1)], 16)) : dynamicComponent.value == void 0 ? (openBlock(), createBlock(_sfc_main$c, {
|
|
427
503
|
key: 1,
|
|
428
504
|
show: true,
|
|
429
505
|
"disabled-mask": true
|
|
@@ -432,7 +508,104 @@ var _sfc_main$9 = defineComponent({
|
|
|
432
508
|
}
|
|
433
509
|
});
|
|
434
510
|
|
|
435
|
-
|
|
511
|
+
function getFoldStatusDraw() {
|
|
512
|
+
return "M511.5 374.5c-8.2 0-16.4 3.1-22.6 9.4L273.4 599.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l192.9-192.9 192.9 192.9c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L534.1 383.9c-6.2-6.3-14.4-9.4-22.6-9.4z";
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const _hoisted_1$7 = {
|
|
516
|
+
class: "fold-header"
|
|
517
|
+
};
|
|
518
|
+
const _hoisted_2$4 = ["textContent"];
|
|
519
|
+
const _hoisted_3$2 = ["textContent"];
|
|
520
|
+
const _hoisted_4$1 = {
|
|
521
|
+
key: 1,
|
|
522
|
+
class: "status"
|
|
523
|
+
};
|
|
524
|
+
const _hoisted_5$1 = ["title"];
|
|
525
|
+
var _sfc_main$a = defineComponent({
|
|
526
|
+
...{
|
|
527
|
+
name: "Fold",
|
|
528
|
+
inheritAttrs: true
|
|
529
|
+
},
|
|
530
|
+
__name: "fold",
|
|
531
|
+
props: mergeModels({
|
|
532
|
+
title: {},
|
|
533
|
+
subtitle: {},
|
|
534
|
+
disable: {
|
|
535
|
+
type: Boolean
|
|
536
|
+
}
|
|
537
|
+
}, {
|
|
538
|
+
"status": {
|
|
539
|
+
default: "expand"
|
|
540
|
+
},
|
|
541
|
+
"statusModifiers": {}
|
|
542
|
+
}),
|
|
543
|
+
emits: mergeModels(["change"], ["update:status"]),
|
|
544
|
+
setup(__props, _ref) {
|
|
545
|
+
let {
|
|
546
|
+
emit: __emit
|
|
547
|
+
} = _ref;
|
|
548
|
+
const props = __props;
|
|
549
|
+
const emit = __emit;
|
|
550
|
+
const status = useModel(__props, "status");
|
|
551
|
+
const statusWatch = watch(status, calcFoldStyle);
|
|
552
|
+
const statusIcon = getFoldStatusDraw();
|
|
553
|
+
const foldBodyRef = useTemplateRef("foldBodyRef");
|
|
554
|
+
const foldStyleRef = shallowRef(Object.create(null));
|
|
555
|
+
function calcFoldStyle() {
|
|
556
|
+
if (foldBodyRef.value) {
|
|
557
|
+
const minHeight = 32;
|
|
558
|
+
const maxHeight = minHeight + foldBodyRef.value.getBoundingClientRect().height;
|
|
559
|
+
animationRef(foldStyleRef, {
|
|
560
|
+
height: `${status.value == "expand" ? minHeight : maxHeight}px`,
|
|
561
|
+
overflow: "hidden"
|
|
562
|
+
}, {
|
|
563
|
+
height: `${status.value == "expand" ? maxHeight : minHeight}px`,
|
|
564
|
+
overflow: "hidden"
|
|
565
|
+
}, 200, Object.create(null));
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function onStatusClick() {
|
|
569
|
+
switch (status.value) {
|
|
570
|
+
case "expand":
|
|
571
|
+
status.value = "fold";
|
|
572
|
+
break;
|
|
573
|
+
case "fold":
|
|
574
|
+
status.value = "expand";
|
|
575
|
+
break;
|
|
576
|
+
default:
|
|
577
|
+
throwError(`Fold not support status value: ${status.value}`);
|
|
578
|
+
}
|
|
579
|
+
emit("change", status.value);
|
|
580
|
+
}
|
|
581
|
+
onUnmounted(() => statusWatch.stop());
|
|
582
|
+
return (_ctx, _cache) => {
|
|
583
|
+
return openBlock(), createElementBlock("div", {
|
|
584
|
+
class: normalizeClass(["snail-fold", status.value]),
|
|
585
|
+
style: normalizeStyle(foldStyleRef.value)
|
|
586
|
+
}, [createElementVNode("div", _hoisted_1$7, [renderSlot(_ctx.$slots, "header", {}, () => [createElementVNode("div", {
|
|
587
|
+
class: "title",
|
|
588
|
+
textContent: toDisplayString(props.title)
|
|
589
|
+
}, null, 8, _hoisted_2$4), !!props.subtitle ? (openBlock(), createElementBlock("div", {
|
|
590
|
+
key: 0,
|
|
591
|
+
class: "subtitle",
|
|
592
|
+
textContent: toDisplayString(props.subtitle)
|
|
593
|
+
}, null, 8, _hoisted_3$2)) : createCommentVNode("", true), props.disable != true ? (openBlock(), createElementBlock("div", _hoisted_4$1, [createElementVNode("span", {
|
|
594
|
+
title: status.value == "expand" ? "收起" : "展开"
|
|
595
|
+
}, [createVNode(_sfc_main$f, {
|
|
596
|
+
type: "custom",
|
|
597
|
+
draw: unref(statusIcon),
|
|
598
|
+
onClick: onStatusClick
|
|
599
|
+
}, null, 8, ["draw"])], 8, _hoisted_5$1)])) : createCommentVNode("", true)])]), createElementVNode("div", {
|
|
600
|
+
class: "fold-body",
|
|
601
|
+
ref_key: "foldBodyRef",
|
|
602
|
+
ref: foldBodyRef
|
|
603
|
+
}, [renderSlot(_ctx.$slots, "default")], 512)], 6);
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
var _sfc_main$9 = defineComponent({
|
|
436
609
|
...{
|
|
437
610
|
name: "Scroll",
|
|
438
611
|
inheritAttrs: true
|
|
@@ -462,10 +635,10 @@ var _sfc_main$8 = defineComponent({
|
|
|
462
635
|
}
|
|
463
636
|
});
|
|
464
637
|
|
|
465
|
-
const _hoisted_1$
|
|
638
|
+
const _hoisted_1$6 = {
|
|
466
639
|
class: "table-body"
|
|
467
640
|
};
|
|
468
|
-
var _sfc_main$
|
|
641
|
+
var _sfc_main$8 = defineComponent({
|
|
469
642
|
...{
|
|
470
643
|
name: "Table",
|
|
471
644
|
inheritAttrs: true
|
|
@@ -487,13 +660,14 @@ var _sfc_main$7 = defineComponent({
|
|
|
487
660
|
setup(__props) {
|
|
488
661
|
const props = __props;
|
|
489
662
|
function getStyle(styleOptions) {
|
|
663
|
+
styleOptions = styleOptions || {};
|
|
490
664
|
const style = Object.create(null);
|
|
491
665
|
styleOptions.background && (style.background = styleOptions.background);
|
|
492
666
|
styleOptions.height && (style.height = styleOptions.height + (styleOptions.heightUnit || "px"));
|
|
493
667
|
return style;
|
|
494
668
|
}
|
|
495
669
|
return (_ctx, _cache) => {
|
|
496
|
-
return openBlock(), createBlock(_sfc_main$
|
|
670
|
+
return openBlock(), createBlock(_sfc_main$9, {
|
|
497
671
|
class: normalizeClass(["snail-table", {
|
|
498
672
|
"start-border": props.border == true
|
|
499
673
|
}]),
|
|
@@ -503,7 +677,7 @@ var _sfc_main$7 = defineComponent({
|
|
|
503
677
|
default: withCtx(() => [createElementVNode("header", {
|
|
504
678
|
class: "table-header",
|
|
505
679
|
style: normalizeStyle(getStyle(props.headerStyle))
|
|
506
|
-
}, [renderSlot(_ctx.$slots, "header")], 4), createElementVNode("main", _hoisted_1$
|
|
680
|
+
}, [renderSlot(_ctx.$slots, "header")], 4), createElementVNode("main", _hoisted_1$6, [renderSlot(_ctx.$slots, "default")]), createElementVNode("footer", {
|
|
507
681
|
class: "table-footer",
|
|
508
682
|
style: normalizeStyle(getStyle(props.footerStyle))
|
|
509
683
|
}, [renderSlot(_ctx.$slots, "footer")], 4)]),
|
|
@@ -513,7 +687,7 @@ var _sfc_main$7 = defineComponent({
|
|
|
513
687
|
}
|
|
514
688
|
});
|
|
515
689
|
|
|
516
|
-
var _sfc_main$
|
|
690
|
+
var _sfc_main$7 = defineComponent({
|
|
517
691
|
...{
|
|
518
692
|
name: "TableRow",
|
|
519
693
|
inheritAttrs: true
|
|
@@ -539,7 +713,7 @@ var _sfc_main$6 = defineComponent({
|
|
|
539
713
|
}
|
|
540
714
|
});
|
|
541
715
|
|
|
542
|
-
var _sfc_main$
|
|
716
|
+
var _sfc_main$6 = defineComponent({
|
|
543
717
|
...{
|
|
544
718
|
name: "TableCol",
|
|
545
719
|
inheritAttrs: true
|
|
@@ -564,22 +738,21 @@ var _sfc_main$5 = defineComponent({
|
|
|
564
738
|
props.minWidth && (style.minWidth = props.minWidth + (props.unit || "px"));
|
|
565
739
|
props.maxWidth && (style.maxWidth = props.maxWidth + (props.unit || "px"));
|
|
566
740
|
}
|
|
567
|
-
props.align && (style.justifyContent = props.align);
|
|
568
741
|
props.borderStyle && (style.border = props.borderStyle);
|
|
569
742
|
props.paddingStyle && (style.padding = props.paddingStyle);
|
|
570
743
|
return style;
|
|
571
744
|
});
|
|
572
745
|
return (_ctx, _cache) => {
|
|
573
746
|
return openBlock(), createElementBlock("div", {
|
|
574
|
-
class: "table-col",
|
|
747
|
+
class: normalizeClass(["table-col", props.align]),
|
|
575
748
|
style: normalizeStyle(colStyle.value)
|
|
576
|
-
}, [renderSlot(_ctx.$slots, "default")],
|
|
749
|
+
}, [renderSlot(_ctx.$slots, "default")], 6);
|
|
577
750
|
};
|
|
578
751
|
}
|
|
579
752
|
});
|
|
580
753
|
|
|
581
|
-
const _hoisted_1$
|
|
582
|
-
var _sfc_main$
|
|
754
|
+
const _hoisted_1$5 = ["onClick"];
|
|
755
|
+
var _sfc_main$5 = defineComponent({
|
|
583
756
|
...{
|
|
584
757
|
name: "DialogWrapper",
|
|
585
758
|
inheritAttrs: true
|
|
@@ -614,7 +787,7 @@ var _sfc_main$4 = defineComponent({
|
|
|
614
787
|
}]),
|
|
615
788
|
style: normalizeStyle("z-index:" + dialog.options.zIndex),
|
|
616
789
|
onClick: withModifiers($event => onMaskClick(dialog), ["self"])
|
|
617
|
-
}, [createVNode(_sfc_main$
|
|
790
|
+
}, [createVNode(_sfc_main$b, mergeProps({
|
|
618
791
|
class: ["dialog-body", dialog.options.class],
|
|
619
792
|
name: dialog.options.name,
|
|
620
793
|
component: dialog.options.component,
|
|
@@ -624,7 +797,7 @@ var _sfc_main$4 = defineComponent({
|
|
|
624
797
|
ref_for: true
|
|
625
798
|
}, dialog.options.props, {
|
|
626
799
|
ref_for: true
|
|
627
|
-
}, dialog.handle), null, 16, ["name", "component", "url", "class", "style"])], 14, _hoisted_1$
|
|
800
|
+
}, dialog.handle), null, 16, ["name", "component", "url", "class", "style"])], 14, _hoisted_1$5);
|
|
628
801
|
}), 128))]),
|
|
629
802
|
_: 1
|
|
630
803
|
});
|
|
@@ -671,6 +844,19 @@ function openDialog(options, onDestroyed) {
|
|
|
671
844
|
};
|
|
672
845
|
return dr;
|
|
673
846
|
}
|
|
847
|
+
async function scopeDialog(options, scopeRef) {
|
|
848
|
+
scopeRef.value && scopeRef.value.destroy();
|
|
849
|
+
scopeRef.value = {
|
|
850
|
+
destroy() {
|
|
851
|
+
scopeRef.value = void 0;
|
|
852
|
+
ret.destroy();
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
const ret = openDialog(options);
|
|
856
|
+
const data = await ret;
|
|
857
|
+
scopeRef.value = void 0;
|
|
858
|
+
return data;
|
|
859
|
+
}
|
|
674
860
|
const descriptors = ref([]);
|
|
675
861
|
const dialogHook = hook.newScope();
|
|
676
862
|
const createDialogHookCode = dialog => `onCloseDialog:${dialog.id}`;
|
|
@@ -692,7 +878,7 @@ const initVueApp = (() => {
|
|
|
692
878
|
container.style = "height:0 !important; width:0 !important;";
|
|
693
879
|
container.classList.add("snail-dialog-container");
|
|
694
880
|
document.body.appendChild(container);
|
|
695
|
-
dialogApp = createApp(_sfc_main$
|
|
881
|
+
dialogApp = createApp(_sfc_main$5, {
|
|
696
882
|
descriptors: descriptors.value
|
|
697
883
|
});
|
|
698
884
|
triggerAppCreated(dialogApp).mount(container);
|
|
@@ -700,6 +886,101 @@ const initVueApp = (() => {
|
|
|
700
886
|
};
|
|
701
887
|
})();
|
|
702
888
|
|
|
889
|
+
function getTitleStyle(options, isFlex) {
|
|
890
|
+
const style = Object.create(null);
|
|
891
|
+
if (options.titleStyle) {
|
|
892
|
+
getSizeStyle(style, options.titleStyle, "width", isFlex);
|
|
893
|
+
getAlignStyle(style, options.titleStyle, isFlex);
|
|
894
|
+
}
|
|
895
|
+
return style;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
const _hoisted_1$4 = ["textContent"];
|
|
899
|
+
const _hoisted_2$3 = {
|
|
900
|
+
key: 0,
|
|
901
|
+
class: "required",
|
|
902
|
+
textContent: "*"
|
|
903
|
+
};
|
|
904
|
+
const _hoisted_3$1 = {
|
|
905
|
+
class: "input-body"
|
|
906
|
+
};
|
|
907
|
+
const _hoisted_4 = ["type", "value", "readonly", "placeholder", "title"];
|
|
908
|
+
const _hoisted_5 = ["title"];
|
|
909
|
+
var _sfc_main$4 = defineComponent({
|
|
910
|
+
...{
|
|
911
|
+
name: "Input",
|
|
912
|
+
inheritAttrs: true
|
|
913
|
+
},
|
|
914
|
+
__name: "input",
|
|
915
|
+
props: mergeModels({
|
|
916
|
+
type: {},
|
|
917
|
+
title: {},
|
|
918
|
+
required: {
|
|
919
|
+
type: Boolean
|
|
920
|
+
},
|
|
921
|
+
placeholder: {},
|
|
922
|
+
readonly: {
|
|
923
|
+
type: Boolean
|
|
924
|
+
},
|
|
925
|
+
titleStyle: {}
|
|
926
|
+
}, {
|
|
927
|
+
"modelValue": {
|
|
928
|
+
default: ""
|
|
929
|
+
},
|
|
930
|
+
"modelModifiers": {}
|
|
931
|
+
}),
|
|
932
|
+
emits: mergeModels(["click", "change"], ["update:modelValue"]),
|
|
933
|
+
setup(__props, _ref) {
|
|
934
|
+
let {
|
|
935
|
+
emit: __emit
|
|
936
|
+
} = _ref;
|
|
937
|
+
const props = __props;
|
|
938
|
+
const emit = __emit;
|
|
939
|
+
const inputRef = useTemplateRef("inputRef");
|
|
940
|
+
const inputModel = useModel(__props, "modelValue");
|
|
941
|
+
const validateRef = shallowRef();
|
|
942
|
+
const titleStyle = getTitleStyle(props, true);
|
|
943
|
+
function onValueChange() {
|
|
944
|
+
const text = inputRef.value.value || "";
|
|
945
|
+
inputModel.value = text;
|
|
946
|
+
emit("change", text);
|
|
947
|
+
}
|
|
948
|
+
console.warn("Input:还没实现 验证相关逻辑");
|
|
949
|
+
return (_ctx, _cache) => {
|
|
950
|
+
return openBlock(), createElementBlock("div", {
|
|
951
|
+
class: normalizeClass(["snail-input", {
|
|
952
|
+
"readonly": props.readonly
|
|
953
|
+
}])
|
|
954
|
+
}, [!!props.title ? (openBlock(), createElementBlock("div", {
|
|
955
|
+
key: 0,
|
|
956
|
+
class: "input-title",
|
|
957
|
+
style: normalizeStyle(unref(titleStyle))
|
|
958
|
+
}, [createElementVNode("span", {
|
|
959
|
+
class: "text",
|
|
960
|
+
textContent: toDisplayString(props.title)
|
|
961
|
+
}, null, 8, _hoisted_1$4), props.readonly != true && props.required == true ? (openBlock(), createElementBlock("span", _hoisted_2$3)) : createCommentVNode("", true)], 4)) : createCommentVNode("", true), createElementVNode("div", _hoisted_3$1, [createElementVNode("input", {
|
|
962
|
+
ref_key: "inputRef",
|
|
963
|
+
ref: inputRef,
|
|
964
|
+
type: props.type || "text",
|
|
965
|
+
value: inputModel.value,
|
|
966
|
+
readonly: props.readonly,
|
|
967
|
+
placeholder: props.placeholder,
|
|
968
|
+
title: inputModel.value,
|
|
969
|
+
onChange: onValueChange,
|
|
970
|
+
onClick: _cache[0] || (_cache[0] = $event => emit("click"))
|
|
971
|
+
}, null, 40, _hoisted_4), !!validateRef.value ? (openBlock(), createElementBlock("span", {
|
|
972
|
+
key: 0,
|
|
973
|
+
class: "validate",
|
|
974
|
+
title: validateRef.value
|
|
975
|
+
}, [createVNode(_sfc_main$f, {
|
|
976
|
+
type: "error",
|
|
977
|
+
size: 16,
|
|
978
|
+
color: "red"
|
|
979
|
+
})], 8, _hoisted_5)) : createCommentVNode("", true)])], 2);
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
|
|
703
984
|
const _hoisted_1$3 = {
|
|
704
985
|
key: 0,
|
|
705
986
|
class: "icon"
|
|
@@ -760,7 +1041,7 @@ var _sfc_main$3 = defineComponent({
|
|
|
760
1041
|
}),
|
|
761
1042
|
onMouseenter: _cache[2] || (_cache[2] = $event => onMouseEvent(false)),
|
|
762
1043
|
onMouseleave: _cache[3] || (_cache[3] = $event => onMouseEvent(true))
|
|
763
|
-
}, [createVNode(_sfc_main$
|
|
1044
|
+
}, [createVNode(_sfc_main$f, {
|
|
764
1045
|
type: "close",
|
|
765
1046
|
class: "close-icon",
|
|
766
1047
|
fill: closeFill.value,
|
|
@@ -768,7 +1049,7 @@ var _sfc_main$3 = defineComponent({
|
|
|
768
1049
|
onMouseenter: _cache[0] || (_cache[0] = $event => closeFill.value = "red"),
|
|
769
1050
|
onMouseleave: _cache[1] || (_cache[1] = $event => closeFill.value = "#707070"),
|
|
770
1051
|
onClick: onToastClose
|
|
771
|
-
}, null, 8, ["fill"]), props.type ? (openBlock(), createElementBlock("div", _hoisted_1$3, [createVNode(_sfc_main$
|
|
1052
|
+
}, null, 8, ["fill"]), props.type ? (openBlock(), createElementBlock("div", _hoisted_1$3, [createVNode(_sfc_main$f, {
|
|
772
1053
|
type: props.type,
|
|
773
1054
|
fill: "black",
|
|
774
1055
|
size: 18
|
|
@@ -814,14 +1095,14 @@ var _sfc_main$2 = defineComponent({
|
|
|
814
1095
|
setup(__props) {
|
|
815
1096
|
const props = __props;
|
|
816
1097
|
return (_ctx, _cache) => {
|
|
817
|
-
return openBlock(), createElementBlock("div", _hoisted_1$2, [createVNode(_sfc_main$
|
|
1098
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [createVNode(_sfc_main$e, {
|
|
818
1099
|
"use-to": "dialog",
|
|
819
1100
|
title: props.title || "提示",
|
|
820
1101
|
onClose: _cache[0] || (_cache[0] = $event => props.closeDialog(false))
|
|
821
1102
|
}, null, 8, ["title"]), createElementVNode("main", {
|
|
822
1103
|
innerHTML: props.message || "请确认?"
|
|
823
|
-
}, null, 8, _hoisted_2$1), createVNode(_sfc_main$
|
|
824
|
-
align: "
|
|
1104
|
+
}, null, 8, _hoisted_2$1), createVNode(_sfc_main$g, {
|
|
1105
|
+
align: "right",
|
|
825
1106
|
"cancel-name": props.cancelName,
|
|
826
1107
|
"cancel-disable": props.cancelDisable,
|
|
827
1108
|
"confirm-name": props.confirmName,
|
|
@@ -960,12 +1241,12 @@ var _sfc_main$1 = defineComponent({
|
|
|
960
1241
|
onTouchstart: onStartDrag,
|
|
961
1242
|
onTouchmove: onDragMove,
|
|
962
1243
|
onTouchend: onDragEnd
|
|
963
|
-
}, [dragInfo.value.status == "success" ? (openBlock(), createBlock(_sfc_main$
|
|
1244
|
+
}, [dragInfo.value.status == "success" ? (openBlock(), createBlock(_sfc_main$f, {
|
|
964
1245
|
key: 0,
|
|
965
1246
|
type: "success",
|
|
966
1247
|
size: 20,
|
|
967
1248
|
color: "white"
|
|
968
|
-
})) : (openBlock(), createBlock(_sfc_main$
|
|
1249
|
+
})) : (openBlock(), createBlock(_sfc_main$f, {
|
|
969
1250
|
key: 1,
|
|
970
1251
|
type: "custom",
|
|
971
1252
|
size: 20,
|
|
@@ -977,16 +1258,16 @@ var _sfc_main$1 = defineComponent({
|
|
|
977
1258
|
});
|
|
978
1259
|
|
|
979
1260
|
const _hoisted_1 = {
|
|
980
|
-
class: "snail-
|
|
1261
|
+
class: "snail-empty"
|
|
981
1262
|
};
|
|
982
1263
|
const _hoisted_2 = ["src"];
|
|
983
1264
|
const _hoisted_3 = ["textContent"];
|
|
984
1265
|
var _sfc_main = defineComponent({
|
|
985
1266
|
...{
|
|
986
|
-
name: "
|
|
1267
|
+
name: "Empty",
|
|
987
1268
|
inheritAttrs: true
|
|
988
1269
|
},
|
|
989
|
-
__name: "
|
|
1270
|
+
__name: "empty",
|
|
990
1271
|
props: {
|
|
991
1272
|
message: {},
|
|
992
1273
|
imageUrl: {}
|
|
@@ -998,7 +1279,7 @@ var _sfc_main = defineComponent({
|
|
|
998
1279
|
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("img", {
|
|
999
1280
|
src: props.imageUrl || unref(defaultImageBase64)
|
|
1000
1281
|
}, null, 8, _hoisted_2), renderSlot(_ctx.$slots, "default", {}, () => [createElementVNode("div", {
|
|
1001
|
-
class: "
|
|
1282
|
+
class: "message",
|
|
1002
1283
|
textContent: toDisplayString(props.message || "无数据")
|
|
1003
1284
|
}, null, 8, _hoisted_3)])]);
|
|
1004
1285
|
};
|
|
@@ -1006,23 +1287,26 @@ var _sfc_main = defineComponent({
|
|
|
1006
1287
|
});
|
|
1007
1288
|
|
|
1008
1289
|
const components = {
|
|
1009
|
-
Button: _sfc_main$
|
|
1010
|
-
Footer: _sfc_main$
|
|
1011
|
-
Header: _sfc_main$
|
|
1012
|
-
Icon: _sfc_main$
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1290
|
+
Button: _sfc_main$h,
|
|
1291
|
+
Footer: _sfc_main$g,
|
|
1292
|
+
Header: _sfc_main$e,
|
|
1293
|
+
Icon: _sfc_main$f,
|
|
1294
|
+
Switch: _sfc_main$d,
|
|
1295
|
+
Dynamic: _sfc_main$b,
|
|
1296
|
+
Fold: _sfc_main$a,
|
|
1297
|
+
Scroll: _sfc_main$9,
|
|
1298
|
+
Table: _sfc_main$8,
|
|
1299
|
+
TableRow: _sfc_main$7,
|
|
1300
|
+
TableCol: _sfc_main$6,
|
|
1301
|
+
Input: _sfc_main$4,
|
|
1018
1302
|
DragVerify: _sfc_main$1,
|
|
1019
|
-
|
|
1020
|
-
|
|
1303
|
+
Empty: _sfc_main,
|
|
1304
|
+
Loading: _sfc_main$c
|
|
1021
1305
|
};
|
|
1022
1306
|
function mount(options, onDestroyed) {
|
|
1023
1307
|
mustObject(options, "options");
|
|
1024
1308
|
options.target instanceof HTMLElement || throwError("options.target must be a HTMLElement");
|
|
1025
|
-
const app = createApp(_sfc_main$
|
|
1309
|
+
const app = createApp(_sfc_main$b, {
|
|
1026
1310
|
name: options.name,
|
|
1027
1311
|
compponent: options.component,
|
|
1028
1312
|
url: options.url,
|
|
@@ -1039,4 +1323,4 @@ function mount(options, onDestroyed) {
|
|
|
1039
1323
|
};
|
|
1040
1324
|
}
|
|
1041
1325
|
|
|
1042
|
-
export { components, confirm, getSvgIcon, mount, onAppCreated, onEvent, onInterval, onRerect, onResize, onTimeout, openDialog, scopeRef, toast, triggerAppCreated, useScopes };
|
|
1326
|
+
export { animationRef, components, confirm, getSvgIcon, mount, onAppCreated, onEvent, onInterval, onRerect, onResize, onTimeout, openDialog, scopeDialog, scopeRef, toast, triggerAppCreated, useScopes };
|