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