@deot/vc-components 1.0.1 → 1.0.2

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.
@@ -71,58 +71,33 @@ var VcComponents = (function (exports, vue) {
71
71
  const MActionSheet = ActionSheet;
72
72
 
73
73
  const props$1f = {
74
- tag: {
74
+ modelValue: {
75
+ type: Boolean,
76
+ default: true
77
+ },
78
+ type: {
75
79
  type: String,
76
- default: "div"
77
- }
78
- };
79
-
80
- /** @jsxImportSource vue */
81
-
82
- const COMPONENT_NAME$1v = 'vc-alert';
83
- const Alert = /* @__PURE__ */ vue.defineComponent({
84
- name: COMPONENT_NAME$1v,
85
- props: props$1f,
86
- setup(props, {
87
- slots
88
- }) {
89
- return () => {
90
- return vue.createVNode("div", {
91
- "class": "vc-alert"
92
- }, [slots?.default?.()]);
93
- };
94
- }
95
- });
96
-
97
- const MAlert = Alert;
98
-
99
- const props$1e = {
100
- tag: {
80
+ default: "info"
81
+ },
82
+ title: {
101
83
  type: String,
102
- default: "div"
84
+ default: ""
85
+ },
86
+ desc: {
87
+ type: String,
88
+ default: ""
89
+ },
90
+ icon: {
91
+ type: [String, Boolean],
92
+ default: true
93
+ },
94
+ closable: {
95
+ type: Boolean,
96
+ default: false
103
97
  }
104
98
  };
105
99
 
106
- /** @jsxImportSource vue */
107
-
108
- const COMPONENT_NAME$1u = 'vc-artboard';
109
- const Artboard = /* @__PURE__ */ vue.defineComponent({
110
- name: COMPONENT_NAME$1u,
111
- props: props$1e,
112
- setup(props, {
113
- slots
114
- }) {
115
- return () => {
116
- return vue.createVNode("div", {
117
- "class": "vc-artboard"
118
- }, [slots?.default?.()]);
119
- };
120
- }
121
- });
122
-
123
- const MArtboard = Artboard;
124
-
125
- const props$1d = {
100
+ const props$1e = {
126
101
  type: String,
127
102
  inherit: {
128
103
  type: Boolean,
@@ -267,10 +242,10 @@ var VcComponents = (function (exports, vue) {
267
242
 
268
243
  /** @jsxImportSource vue */
269
244
 
270
- const COMPONENT_NAME$1t = 'vc-icon';
245
+ const COMPONENT_NAME$1v = 'vc-icon';
271
246
  const Icon = /* @__PURE__ */ vue.defineComponent({
272
- name: COMPONENT_NAME$1t,
273
- props: props$1d,
247
+ name: COMPONENT_NAME$1v,
248
+ props: props$1e,
274
249
  setup(props) {
275
250
  const viewBox = vue.ref('0 0 1024 1024');
276
251
  const path = vue.ref([]);
@@ -303,387 +278,987 @@ var VcComponents = (function (exports, vue) {
303
278
  }
304
279
  });
305
280
 
306
- const props$1c = {
307
- size: {
308
- type: Number,
309
- default: 28
281
+ const props$1d = {
282
+ /**
283
+ * 进入/离开持续时间
284
+ * {enter: 300, leave: 300}
285
+ */
286
+ duration: {
287
+ type: [Number, Object],
288
+ default: 300
310
289
  },
311
- foreground: {
290
+ /**
291
+ * 进入/离开延迟时间
292
+ */
293
+ delay: {
294
+ type: [Number, Object],
295
+ default: 0
296
+ },
297
+ /**
298
+ * `transition-group` component.
299
+ */
300
+ group: Boolean,
301
+ /**
302
+ * `transition-group` tag, v3版本默认值无
303
+ */
304
+ tag: {
312
305
  type: String,
313
- default: "#ccc"
306
+ default: void 0
314
307
  },
315
- background: {
308
+ /**
309
+ * 变换的初始位置, 可以用style代替, 更短~~
310
+ */
311
+ origin: {
316
312
  type: String,
317
- default: "var(--vc-color-primary)"
313
+ default: ""
318
314
  },
319
315
  /**
320
- * 待开发
316
+ * 在转换期间应用的元素样式。这些样式应用于@beforeEnter和@beforeLeave钩子
317
+ * inheritAttrs必须是false
321
318
  */
322
- fixed: {
323
- type: Boolean,
324
- default: false
319
+ style: {
320
+ type: Object,
321
+ default: () => {
322
+ return {
323
+ animationFillMode: "both",
324
+ animationTimingFunction: "ease-out"
325
+ };
326
+ }
327
+ },
328
+ prefix: {
329
+ type: String,
330
+ default: "vc-transition"
331
+ },
332
+ mode: {
333
+ type: String,
334
+ default: "none"
325
335
  }
326
336
  };
327
337
 
328
- /** @jsxImportSource vue */
338
+ const trim = (str) => str.trim().replace(/\s+/g, " ");
339
+ const useTransition = () => {
340
+ const instance = vue.getCurrentInstance();
341
+ const attrs = instance.attrs;
342
+ const props = instance.props;
343
+ const Wrapper = vue.computed(() => {
344
+ return props.group ? vue.TransitionGroup : vue.Transition;
345
+ });
346
+ const classes = vue.computed(() => {
347
+ const modeClass = props.mode !== "none" ? `is-${props.mode.replace(/-/g, " is-")}` : "";
348
+ return {
349
+ enterActiveClass: trim(`${attrs.enterActiveClass || ""} ${props.prefix} ${modeClass} is-in`),
350
+ leaveActiveClass: trim(`${attrs.leaveActiveClass || ""} ${props.prefix} ${modeClass} is-out`),
351
+ moveClass: props.group ? trim(`${attrs.moveClass || ""} ${props.prefix} ${modeClass} is-move`) : void 0
352
+ };
353
+ });
354
+ const clearStyles = (el) => {
355
+ Object.keys(props.style).forEach((key) => {
356
+ const v = props.style[key];
357
+ v && el.style.removeProperty(
358
+ key.replace(/([A-Z])/g, "-$1").toLowerCase()
359
+ );
360
+ });
361
+ el.style.removeProperty("animation-duration");
362
+ el.style.removeProperty("animation-delay");
363
+ };
364
+ const resetAbsolute = (el) => {
365
+ props.group && (el.style.position = "absolute");
366
+ };
367
+ const resetOrigin = (el) => {
368
+ props.origin && (el.style.transformOrigin = props.origin);
369
+ };
370
+ const resetStyles = (el) => {
371
+ resetOrigin(el);
372
+ Object.keys(props.style).forEach((key) => {
373
+ const v = props.style[key];
374
+ v && (el.style[key] = v);
375
+ });
376
+ };
377
+ const handleBeforeEnter = (el) => {
378
+ const duration = props.duration.enter || props.duration;
379
+ el.style.animationDuration = `${duration}ms`;
380
+ const delay = props.delay.enter || props.delay;
381
+ el.style.animationDelay = `${delay}ms`;
382
+ resetStyles(el);
383
+ attrs.onBeforeEnter?.(el);
384
+ };
385
+ const createNext = (callback, duration) => {
386
+ let hasDone = false;
387
+ return (immediate = true) => {
388
+ if (hasDone) return;
389
+ hasDone = true;
390
+ const done = () => callback?.();
391
+ immediate ? done() : setTimeout(done, duration);
392
+ };
393
+ };
394
+ const handleEnter = async (el, done) => {
395
+ const duration = props.duration.enter || props.duration;
396
+ const next = createNext(done, duration);
397
+ try {
398
+ await attrs.onEnter?.(el, next);
399
+ } finally {
400
+ next(false);
401
+ }
402
+ };
403
+ const handleAfterEnter = (el) => {
404
+ clearStyles(el);
405
+ attrs.onAfterEnter?.(el);
406
+ };
407
+ const handleBeforeLeave = (el) => {
408
+ const duration = props.duration.leave || props.duration;
409
+ el.style.animationDuration = `${duration}ms`;
410
+ const delay = props.delay.leave || props.delay;
411
+ el.style.animationDelay = `${delay}ms`;
412
+ resetStyles(el);
413
+ attrs.onBeforeLeave?.(el);
414
+ };
415
+ const handleLeave = async (el, done) => {
416
+ const duration = props.duration.leave || props.duration;
417
+ const next = createNext(done, duration);
418
+ try {
419
+ resetAbsolute(el);
420
+ await attrs.onLeave?.(el, next);
421
+ } finally {
422
+ next(props.group ? true : false);
423
+ }
424
+ };
425
+ const handleAfterLeave = (el) => {
426
+ clearStyles(el);
427
+ attrs.onAfterLeave?.(el);
428
+ };
429
+ return {
430
+ Wrapper,
431
+ resetStyles,
432
+ resetAbsolute,
433
+ classes,
434
+ createNext,
435
+ listeners: {
436
+ onBeforeEnter: handleBeforeEnter,
437
+ onEnter: handleEnter,
438
+ onAfterEnter: handleAfterEnter,
439
+ onBeforeLeave: handleBeforeLeave,
440
+ onLeave: handleLeave,
441
+ onAfterLeave: handleAfterLeave
442
+ }
443
+ };
444
+ };
329
445
 
330
- const COMPONENT_NAME$1s = 'vc-spin';
331
- const Spin = /* @__PURE__ */ vue.defineComponent({
332
- name: COMPONENT_NAME$1s,
333
- props: props$1c,
334
- setup(props, {
335
- slots
336
- }) {
446
+ const COMPONENT_NAME$1u = "vc-transition";
447
+ const Transition = vue.defineComponent({
448
+ name: COMPONENT_NAME$1u,
449
+ props: props$1d,
450
+ // 当不声明emits的情况下,事件存在于attrs中
451
+ inheritAttrs: false,
452
+ setup(props, { slots, attrs }) {
453
+ const { Wrapper, listeners, classes } = useTransition();
337
454
  return () => {
338
- return vue.createVNode("div", {
339
- "class": "vc-spin"
340
- }, [vue.createVNode("span", {
341
- "style": {
342
- fontSize: `${props.size}px`
343
- }
344
- }, [slots?.loading?.() || vue.createVNode("svg", {
345
- "xmlns": "http://www.w3.org/2000/svg",
346
- "version": "1.1",
347
- "viewBox": "0 0 32 32",
348
- "width": "100%",
349
- "height": "100%"
350
- }, [vue.createVNode("path", {
351
- "stroke": props.foreground,
352
- "d": "M 16 2 A 14 14 0 1 0 30 15",
353
- "fill": "none",
354
- "stroke-width": "2",
355
- "stroke-linecap": "round"
356
- }, null), vue.createVNode("path", {
357
- "stroke": props.background,
358
- "d": "M 16 2 A 14 14 0 0 1 30 15",
359
- "fill": "none",
360
- "stroke-width": "2",
361
- "stroke-linecap": "round"
362
- }, null)])]), slots?.default?.()]);
455
+ return vue.h(
456
+ Wrapper.value,
457
+ {
458
+ ...attrs,
459
+ ...listeners,
460
+ ...classes.value,
461
+ tag: props.tag
462
+ },
463
+ slots
464
+ );
363
465
  };
364
466
  }
365
467
  });
366
468
 
367
- /** Detect free variable `global` from Node.js. */
368
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
369
-
370
- /** Detect free variable `self`. */
371
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
372
-
373
- /** Used as a reference to the global object. */
374
- var root = freeGlobal || freeSelf || Function('return this')();
375
-
376
- /** Built-in value references. */
377
- var Symbol$1 = root.Symbol;
378
-
379
- /** Used for built-in method references. */
380
- var objectProto$b = Object.prototype;
381
-
382
- /** Used to check objects for own properties. */
383
- var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
384
-
385
- /**
386
- * Used to resolve the
387
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
388
- * of values.
389
- */
390
- var nativeObjectToString$1 = objectProto$b.toString;
391
-
392
- /** Built-in value references. */
393
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
394
-
395
- /**
396
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
397
- *
398
- * @private
399
- * @param {*} value The value to query.
400
- * @returns {string} Returns the raw `toStringTag`.
401
- */
402
- function getRawTag(value) {
403
- var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
404
- tag = value[symToStringTag$1];
405
-
406
- try {
407
- value[symToStringTag$1] = undefined;
408
- var unmasked = true;
409
- } catch (e) {}
469
+ const COMPONENT_NAME$1t = "vc-transition-collapse";
470
+ const TransitionCollapse = vue.defineComponent({
471
+ name: COMPONENT_NAME$1t,
472
+ props: props$1d,
473
+ // 当不声明emits的情况下,事件存在于attrs中
474
+ inheritAttrs: false,
475
+ setup(props, { slots, attrs: _attrs }) {
476
+ const attrs = _attrs;
477
+ const { Wrapper, resetStyles, resetAbsolute, createNext } = useTransition();
478
+ const getTransitionStyle = (duration) => {
479
+ const style = `
480
+ ${duration}ms height ease-in-out,
481
+ ${duration}ms padding-top ease-in-out,
482
+ ${duration}ms padding-bottom ease-in-out
483
+ `;
484
+ return style;
485
+ };
486
+ const handleBeforeEnter = (el) => {
487
+ const duration = props.duration.enter || props.duration;
488
+ el.style.transition = getTransitionStyle(duration);
489
+ /* istanbul ignore next -- @preserve */
490
+ if (!el.dataset) {
491
+ el.dataset = {};
492
+ }
493
+ el.dataset.oldPaddingTop = el.style.paddingTop;
494
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
495
+ el.style.height = "0px";
496
+ el.style.paddingTop = "0px";
497
+ el.style.paddingBottom = "0px";
498
+ resetStyles(el);
499
+ attrs.onBeforeEnter?.(el);
500
+ };
501
+ const handleEnter = async (el, done) => {
502
+ const duration = props.duration.enter || props.duration;
503
+ const next = createNext(done, duration);
504
+ try {
505
+ el.dataset.oldOverflow = el.style.overflow;
506
+ /* istanbul ignore next -- @preserve */
507
+ if (el.scrollHeight !== 0) {
508
+ el.style.height = el.scrollHeight + "px";
509
+ el.style.paddingTop = el.dataset.oldPaddingTop + "px";
510
+ el.style.paddingBottom = el.dataset.oldPaddingBottom + "px";
511
+ } else {
512
+ el.style.height = "";
513
+ el.style.paddingTop = el.dataset.oldPaddingTop + "px";
514
+ el.style.paddingBottom = el.dataset.oldPaddingBottom + "px";
515
+ }
516
+ el.style.overflow = "hidden";
517
+ attrs.onEnter?.(el);
518
+ } finally {
519
+ next(false);
520
+ }
521
+ };
522
+ const handleAfterEnter = (el) => {
523
+ el.style.transition = "";
524
+ el.style.height = "";
525
+ el.style.overflow = el.dataset.oldOverflow || "";
526
+ attrs.onAfterEnter?.(el);
527
+ };
528
+ const handleBeforeLeave = (el) => {
529
+ /* istanbul ignore next -- @preserve */
530
+ if (!el.dataset) {
531
+ el.dataset = {};
532
+ }
533
+ el.dataset.oldPaddingTop = el.style.paddingTop;
534
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
535
+ el.dataset.oldOverflow = el.style.overflow;
536
+ el.style.height = el.scrollHeight + "px";
537
+ el.style.overflow = "hidden";
538
+ resetStyles(el);
539
+ attrs.onBeforeLeave?.(el);
540
+ };
541
+ const handleLeave = (el, done) => {
542
+ const duration = props.duration.leave || props.duration;
543
+ const next = createNext(done, duration);
544
+ try {
545
+ const leaveDuration = props.duration.leave || props.duration;
546
+ /* istanbul ignore next -- @preserve */
547
+ if (el.scrollHeight !== 0) {
548
+ el.style.transition = getTransitionStyle(leaveDuration);
549
+ el.style.height = "0px";
550
+ el.style.paddingTop = "0px";
551
+ el.style.paddingBottom = "0px";
552
+ }
553
+ resetAbsolute(el);
554
+ attrs.onLeave?.(el);
555
+ } finally {
556
+ next(props.group ? true : false);
557
+ }
558
+ };
559
+ const handleAfterLeave = (el) => {
560
+ el.style.transition = "";
561
+ el.style.height = "";
562
+ el.style.overflow = el.dataset.oldOverflow || "";
563
+ el.style.paddingTop = el.dataset.oldPaddingTop || "";
564
+ el.style.paddingBottom = el.dataset.oldPaddingBottom || "";
565
+ attrs.onAfterLeave?.(el);
566
+ };
567
+ const listeners = {
568
+ onBeforeEnter: handleBeforeEnter,
569
+ onEnter: handleEnter,
570
+ onAfterEnter: handleAfterEnter,
571
+ onBeforeLeave: handleBeforeLeave,
572
+ onLeave: handleLeave,
573
+ onAfterLeave: handleAfterLeave
574
+ };
575
+ return () => {
576
+ return vue.h(
577
+ Wrapper.value,
578
+ {
579
+ ...attrs,
580
+ ...listeners,
581
+ tag: props.tag,
582
+ moveClass: props.group ? `${attrs.moveClass || ""} vc-transition-collapse is-move` : void 0
583
+ },
584
+ slots
585
+ );
586
+ };
587
+ }
588
+ });
410
589
 
411
- var result = nativeObjectToString$1.call(value);
412
- if (unmasked) {
413
- if (isOwn) {
414
- value[symToStringTag$1] = tag;
415
- } else {
416
- delete value[symToStringTag$1];
590
+ const COMPONENT_NAME$1s = "vc-transition-fade";
591
+ const TransitionFade = vue.defineComponent({
592
+ name: COMPONENT_NAME$1s,
593
+ props: {
594
+ ...props$1d,
595
+ // inheritAttrs必须是false
596
+ style: {
597
+ type: Object,
598
+ default: () => ({
599
+ animationFillMode: "both",
600
+ animationTimingFunction: void 0
601
+ })
602
+ },
603
+ prefix: {
604
+ type: String,
605
+ default: "vc-transition-fade"
417
606
  }
607
+ },
608
+ // 当不声明emits的情况下,事件存在于attrs中
609
+ inheritAttrs: false,
610
+ setup(props, { slots, attrs }) {
611
+ const { Wrapper, listeners, classes } = useTransition();
612
+ return () => {
613
+ return vue.h(
614
+ Wrapper.value,
615
+ {
616
+ ...attrs,
617
+ ...listeners,
618
+ ...classes.value,
619
+ tag: props.tag
620
+ },
621
+ slots
622
+ );
623
+ };
418
624
  }
419
- return result;
420
- }
421
-
422
- /** Used for built-in method references. */
423
- var objectProto$a = Object.prototype;
424
-
425
- /**
426
- * Used to resolve the
427
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
428
- * of values.
429
- */
430
- var nativeObjectToString = objectProto$a.toString;
431
-
432
- /**
433
- * Converts `value` to a string using `Object.prototype.toString`.
434
- *
435
- * @private
436
- * @param {*} value The value to convert.
437
- * @returns {string} Returns the converted string.
438
- */
439
- function objectToString(value) {
440
- return nativeObjectToString.call(value);
441
- }
442
-
443
- /** `Object#toString` result references. */
444
- var nullTag = '[object Null]',
445
- undefinedTag = '[object Undefined]';
446
-
447
- /** Built-in value references. */
448
- var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
625
+ });
449
626
 
450
- /**
451
- * The base implementation of `getTag` without fallbacks for buggy environments.
452
- *
453
- * @private
454
- * @param {*} value The value to query.
455
- * @returns {string} Returns the `toStringTag`.
456
- */
457
- function baseGetTag(value) {
458
- if (value == null) {
459
- return value === undefined ? undefinedTag : nullTag;
627
+ const COMPONENT_NAME$1r = "vc-transition-scale";
628
+ const TransitionScale = vue.defineComponent({
629
+ name: COMPONENT_NAME$1r,
630
+ props: {
631
+ ...props$1d,
632
+ mode: {
633
+ type: String,
634
+ default: "both",
635
+ validator: (v) => /(part|both|y|x|none)/.test(v)
636
+ },
637
+ // inheritAttrs必须是false
638
+ style: {
639
+ type: Object,
640
+ default: () => ({
641
+ animationFillMode: "both",
642
+ animationTimingFunction: void 0
643
+ })
644
+ },
645
+ prefix: {
646
+ type: String,
647
+ default: "vc-transition-scale"
648
+ }
649
+ },
650
+ // 当不声明emits的情况下,事件存在于attrs中
651
+ inheritAttrs: false,
652
+ setup(props, { slots, attrs }) {
653
+ const { Wrapper, listeners, classes } = useTransition();
654
+ return () => {
655
+ return vue.h(
656
+ Wrapper.value,
657
+ {
658
+ ...attrs,
659
+ ...listeners,
660
+ ...classes.value,
661
+ tag: props.tag
662
+ },
663
+ slots
664
+ );
665
+ };
460
666
  }
461
- return (symToStringTag && symToStringTag in Object(value))
462
- ? getRawTag(value)
463
- : objectToString(value);
464
- }
667
+ });
465
668
 
466
- /**
467
- * Checks if `value` is object-like. A value is object-like if it's not `null`
468
- * and has a `typeof` result of "object".
469
- *
470
- * @static
471
- * @memberOf _
472
- * @since 4.0.0
473
- * @category Lang
474
- * @param {*} value The value to check.
475
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
476
- * @example
477
- *
478
- * _.isObjectLike({});
479
- * // => true
480
- *
481
- * _.isObjectLike([1, 2, 3]);
482
- * // => true
483
- *
484
- * _.isObjectLike(_.noop);
485
- * // => false
486
- *
487
- * _.isObjectLike(null);
488
- * // => false
489
- */
490
- function isObjectLike(value) {
491
- return value != null && typeof value == 'object';
492
- }
669
+ const COMPONENT_NAME$1q = "vc-transition-slide";
670
+ const TransitionSlide = vue.defineComponent({
671
+ name: COMPONENT_NAME$1q,
672
+ props: {
673
+ ...props$1d,
674
+ mode: {
675
+ type: String,
676
+ default: "left",
677
+ validator: (v) => /^(left|right|down|up|none)(|-part)$/.test(v)
678
+ },
679
+ // inheritAttrs必须是false
680
+ style: {
681
+ type: Object,
682
+ default: () => ({
683
+ animationFillMode: "both",
684
+ animationTimingFunction: void 0
685
+ })
686
+ },
687
+ prefix: {
688
+ type: String,
689
+ default: "vc-transition-slide"
690
+ }
691
+ },
692
+ // 当不声明emits的情况下,事件存在于attrs中
693
+ inheritAttrs: false,
694
+ setup(props, { slots, attrs }) {
695
+ const { Wrapper, listeners, classes } = useTransition();
696
+ return () => {
697
+ return vue.h(
698
+ Wrapper.value,
699
+ {
700
+ ...attrs,
701
+ ...listeners,
702
+ ...classes.value,
703
+ tag: props.tag
704
+ },
705
+ slots
706
+ );
707
+ };
708
+ }
709
+ });
493
710
 
494
- /** `Object#toString` result references. */
495
- var symbolTag$2 = '[object Symbol]';
711
+ const COMPONENT_NAME$1p = "vc-transition-zoom";
712
+ const TransitionZoom = vue.defineComponent({
713
+ name: COMPONENT_NAME$1p,
714
+ props: {
715
+ ...props$1d,
716
+ mode: {
717
+ type: String,
718
+ default: "x",
719
+ validator: (v) => /^(x|y|center|none)$/.test(v)
720
+ },
721
+ // inheritAttrs必须是false
722
+ style: {
723
+ type: Object,
724
+ default: () => ({
725
+ animationFillMode: "both",
726
+ animationTimingFunction: void 0
727
+ })
728
+ },
729
+ prefix: {
730
+ type: String,
731
+ default: "vc-transition-zoom"
732
+ }
733
+ },
734
+ // 当不声明emits的情况下,事件存在于attrs中
735
+ inheritAttrs: false,
736
+ setup(props, { slots, attrs }) {
737
+ const { Wrapper, listeners, classes } = useTransition();
738
+ return () => {
739
+ return vue.h(
740
+ Wrapper.value,
741
+ {
742
+ ...attrs,
743
+ ...listeners,
744
+ ...classes.value,
745
+ tag: props.tag
746
+ },
747
+ slots
748
+ );
749
+ };
750
+ }
751
+ });
496
752
 
497
- /**
498
- * Checks if `value` is classified as a `Symbol` primitive or object.
499
- *
500
- * @static
501
- * @memberOf _
502
- * @since 4.0.0
503
- * @category Lang
504
- * @param {*} value The value to check.
505
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
506
- * @example
507
- *
508
- * _.isSymbol(Symbol.iterator);
509
- * // => true
510
- *
511
- * _.isSymbol('abc');
512
- * // => false
513
- */
514
- function isSymbol(value) {
515
- return typeof value == 'symbol' ||
516
- (isObjectLike(value) && baseGetTag(value) == symbolTag$2);
517
- }
753
+ /** @jsxImportSource vue */
518
754
 
519
- /**
520
- * A specialized version of `_.map` for arrays without support for iteratee
521
- * shorthands.
522
- *
523
- * @private
524
- * @param {Array} [array] The array to iterate over.
525
- * @param {Function} iteratee The function invoked per iteration.
526
- * @returns {Array} Returns the new mapped array.
527
- */
528
- function arrayMap(array, iteratee) {
529
- var index = -1,
530
- length = array == null ? 0 : array.length,
531
- result = Array(length);
755
+ const COMPONENT_NAME$1o = 'vc-alert';
532
756
 
533
- while (++index < length) {
534
- result[index] = iteratee(array[index], index, array);
757
+ // [color, borderColor, backgroundColor], -> CSS
758
+ const THEME_MAP = {
759
+ info: ['#5495f6', '#91d5ff', '#e6f7ff'],
760
+ success: ['#52c41a', '#b7eb8f', '#f6ffed'],
761
+ error: ['#ed4014', '#ffb08f', '#fbe9e9'],
762
+ warning: ['#ffbf00', '#ffe58f', '#fffbe6']
763
+ };
764
+ const Alert = /* @__PURE__ */ vue.defineComponent({
765
+ name: COMPONENT_NAME$1o,
766
+ props: props$1f,
767
+ setup(props, {
768
+ slots,
769
+ emit
770
+ }) {
771
+ const isActive = vue.ref(false);
772
+ const showIcon = vue.computed(() => props.icon !== false);
773
+ const containerStyle = vue.computed(() => {
774
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
775
+ const [_, borderColor, backgroundColor] = THEME_MAP[props.type];
776
+ return {
777
+ borderColor,
778
+ backgroundColor
779
+ };
780
+ });
781
+ const iconStyle = vue.computed(() => {
782
+ const [color] = THEME_MAP[props.type];
783
+ return {
784
+ color
785
+ };
786
+ });
787
+ const titleStyle = vue.computed(() => {
788
+ const [color] = THEME_MAP[props.type];
789
+ return props.desc || slots.desc ? {
790
+ marginBottom: '5px',
791
+ fontSize: '14px',
792
+ color
793
+ } : {};
794
+ });
795
+ const descStyle = vue.computed(() => {
796
+ const [color] = THEME_MAP[props.type];
797
+ return {
798
+ color,
799
+ opacity: '.7'
800
+ };
801
+ });
802
+ const iconType = vue.computed(() => {
803
+ return typeof props.icon === 'string' && props.icon ? props.icon : props.type;
804
+ });
805
+ const handleClose = () => {
806
+ isActive.value = false;
807
+ emit('close');
808
+ emit('update:modelValue', false);
809
+ emit('visible-change', false);
810
+ };
811
+ vue.watch(() => props.modelValue, v => {
812
+ isActive.value = v;
813
+ }, {
814
+ immediate: true
815
+ });
816
+ return () => {
817
+ return vue.createVNode(TransitionFade, null, {
818
+ default: () => [isActive.value && vue.createVNode("div", {
819
+ "class": [`is-${props.type}`, {
820
+ 'has-icon': showIcon.value,
821
+ 'has-desc': props.desc || slots.desc
822
+ }, 'vc-alert'],
823
+ "style": containerStyle.value
824
+ }, [showIcon.value && vue.createVNode(Icon, {
825
+ "type": iconType.value,
826
+ "style": iconStyle.value,
827
+ "class": "vc-alert__icon"
828
+ }, null), vue.createVNode("div", {
829
+ "class": "vc-alert__content"
830
+ }, [vue.createVNode("div", {
831
+ "class": "vc-alert__message"
832
+ }, [props.title ? vue.createVNode("div", {
833
+ "style": titleStyle.value,
834
+ "innerHTML": props.title
835
+ }, null) : vue.createVNode("div", {
836
+ "style": titleStyle.value
837
+ }, [slots?.default?.()]), props.desc ? vue.createVNode("div", {
838
+ "style": descStyle.value,
839
+ "innerHTML": props.desc
840
+ }, null) : slots.desc && vue.createVNode("div", {
841
+ "style": descStyle.value
842
+ }, [slots.desc?.()])]), props.closable && vue.createVNode("div", {
843
+ "class": "vc-alert__close",
844
+ "onClick": handleClose
845
+ }, [slots.close ? slots.close() : vue.createVNode(Icon, {
846
+ "type": "close"
847
+ }, null)])])])]
848
+ });
849
+ };
535
850
  }
536
- return result;
537
- }
851
+ });
538
852
 
539
- /**
540
- * Checks if `value` is classified as an `Array` object.
541
- *
542
- * @static
543
- * @memberOf _
544
- * @since 0.1.0
545
- * @category Lang
546
- * @param {*} value The value to check.
547
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
548
- * @example
549
- *
550
- * _.isArray([1, 2, 3]);
551
- * // => true
552
- *
553
- * _.isArray(document.body.children);
554
- * // => false
555
- *
556
- * _.isArray('abc');
557
- * // => false
558
- *
559
- * _.isArray(_.noop);
560
- * // => false
853
+ const MAlert = Alert;
854
+
855
+ const props$1c = {
856
+ tag: {
857
+ type: String,
858
+ default: "div"
859
+ }
860
+ };
861
+
862
+ /** @jsxImportSource vue */
863
+
864
+ const COMPONENT_NAME$1n = 'vc-artboard';
865
+ const Artboard = /* @__PURE__ */ vue.defineComponent({
866
+ name: COMPONENT_NAME$1n,
867
+ props: props$1c,
868
+ setup(props, {
869
+ slots
870
+ }) {
871
+ return () => {
872
+ return vue.createVNode("div", {
873
+ "class": "vc-artboard"
874
+ }, [slots?.default?.()]);
875
+ };
876
+ }
877
+ });
878
+
879
+ const MArtboard = Artboard;
880
+
881
+ const props$1b = {
882
+ size: {
883
+ type: Number,
884
+ default: 28
885
+ },
886
+ foreground: {
887
+ type: String,
888
+ default: "#ccc"
889
+ },
890
+ background: {
891
+ type: String,
892
+ default: "var(--vc-color-primary)"
893
+ },
894
+ /**
895
+ * 待开发
896
+ */
897
+ fixed: {
898
+ type: Boolean,
899
+ default: false
900
+ }
901
+ };
902
+
903
+ /** @jsxImportSource vue */
904
+
905
+ const COMPONENT_NAME$1m = 'vc-spin';
906
+ const Spin = /* @__PURE__ */ vue.defineComponent({
907
+ name: COMPONENT_NAME$1m,
908
+ props: props$1b,
909
+ setup(props, {
910
+ slots
911
+ }) {
912
+ return () => {
913
+ return vue.createVNode("div", {
914
+ "class": "vc-spin"
915
+ }, [vue.createVNode("span", {
916
+ "style": {
917
+ fontSize: `${props.size}px`
918
+ }
919
+ }, [slots?.loading?.() || vue.createVNode("svg", {
920
+ "xmlns": "http://www.w3.org/2000/svg",
921
+ "version": "1.1",
922
+ "viewBox": "0 0 32 32",
923
+ "width": "100%",
924
+ "height": "100%"
925
+ }, [vue.createVNode("path", {
926
+ "stroke": props.foreground,
927
+ "d": "M 16 2 A 14 14 0 1 0 30 15",
928
+ "fill": "none",
929
+ "stroke-width": "2",
930
+ "stroke-linecap": "round"
931
+ }, null), vue.createVNode("path", {
932
+ "stroke": props.background,
933
+ "d": "M 16 2 A 14 14 0 0 1 30 15",
934
+ "fill": "none",
935
+ "stroke-width": "2",
936
+ "stroke-linecap": "round"
937
+ }, null)])]), slots?.default?.()]);
938
+ };
939
+ }
940
+ });
941
+
942
+ /** Detect free variable `global` from Node.js. */
943
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
944
+
945
+ /** Detect free variable `self`. */
946
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
947
+
948
+ /** Used as a reference to the global object. */
949
+ var root = freeGlobal || freeSelf || Function('return this')();
950
+
951
+ /** Built-in value references. */
952
+ var Symbol$1 = root.Symbol;
953
+
954
+ /** Used for built-in method references. */
955
+ var objectProto$b = Object.prototype;
956
+
957
+ /** Used to check objects for own properties. */
958
+ var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
959
+
960
+ /**
961
+ * Used to resolve the
962
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
963
+ * of values.
561
964
  */
562
- var isArray = Array.isArray;
965
+ var nativeObjectToString$1 = objectProto$b.toString;
563
966
 
564
- /** Used to convert symbols to primitives and strings. */
565
- var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined,
566
- symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
967
+ /** Built-in value references. */
968
+ var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
567
969
 
568
970
  /**
569
- * The base implementation of `_.toString` which doesn't convert nullish
570
- * values to empty strings.
971
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
571
972
  *
572
973
  * @private
573
- * @param {*} value The value to process.
574
- * @returns {string} Returns the string.
974
+ * @param {*} value The value to query.
975
+ * @returns {string} Returns the raw `toStringTag`.
575
976
  */
576
- function baseToString(value) {
577
- // Exit early for strings to avoid a performance hit in some environments.
578
- if (typeof value == 'string') {
579
- return value;
580
- }
581
- if (isArray(value)) {
582
- // Recursively convert values (susceptible to call stack limits).
583
- return arrayMap(value, baseToString) + '';
584
- }
585
- if (isSymbol(value)) {
586
- return symbolToString ? symbolToString.call(value) : '';
977
+ function getRawTag(value) {
978
+ var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
979
+ tag = value[symToStringTag$1];
980
+
981
+ try {
982
+ value[symToStringTag$1] = undefined;
983
+ var unmasked = true;
984
+ } catch (e) {}
985
+
986
+ var result = nativeObjectToString$1.call(value);
987
+ if (unmasked) {
988
+ if (isOwn) {
989
+ value[symToStringTag$1] = tag;
990
+ } else {
991
+ delete value[symToStringTag$1];
992
+ }
587
993
  }
588
- var result = (value + '');
589
- return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
994
+ return result;
590
995
  }
591
996
 
592
- /** Used to match a single whitespace character. */
593
- var reWhitespace = /\s/;
997
+ /** Used for built-in method references. */
998
+ var objectProto$a = Object.prototype;
594
999
 
595
1000
  /**
596
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
597
- * character of `string`.
1001
+ * Used to resolve the
1002
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1003
+ * of values.
1004
+ */
1005
+ var nativeObjectToString = objectProto$a.toString;
1006
+
1007
+ /**
1008
+ * Converts `value` to a string using `Object.prototype.toString`.
598
1009
  *
599
1010
  * @private
600
- * @param {string} string The string to inspect.
601
- * @returns {number} Returns the index of the last non-whitespace character.
1011
+ * @param {*} value The value to convert.
1012
+ * @returns {string} Returns the converted string.
602
1013
  */
603
- function trimmedEndIndex(string) {
604
- var index = string.length;
605
-
606
- while (index-- && reWhitespace.test(string.charAt(index))) {}
607
- return index;
1014
+ function objectToString(value) {
1015
+ return nativeObjectToString.call(value);
608
1016
  }
609
1017
 
610
- /** Used to match leading whitespace. */
611
- var reTrimStart = /^\s+/;
1018
+ /** `Object#toString` result references. */
1019
+ var nullTag = '[object Null]',
1020
+ undefinedTag = '[object Undefined]';
1021
+
1022
+ /** Built-in value references. */
1023
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
612
1024
 
613
1025
  /**
614
- * The base implementation of `_.trim`.
1026
+ * The base implementation of `getTag` without fallbacks for buggy environments.
615
1027
  *
616
1028
  * @private
617
- * @param {string} string The string to trim.
618
- * @returns {string} Returns the trimmed string.
1029
+ * @param {*} value The value to query.
1030
+ * @returns {string} Returns the `toStringTag`.
619
1031
  */
620
- function baseTrim(string) {
621
- return string
622
- ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
623
- : string;
1032
+ function baseGetTag(value) {
1033
+ if (value == null) {
1034
+ return value === undefined ? undefinedTag : nullTag;
1035
+ }
1036
+ return (symToStringTag && symToStringTag in Object(value))
1037
+ ? getRawTag(value)
1038
+ : objectToString(value);
624
1039
  }
625
1040
 
626
1041
  /**
627
- * Checks if `value` is the
628
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
629
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1042
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1043
+ * and has a `typeof` result of "object".
630
1044
  *
631
1045
  * @static
632
1046
  * @memberOf _
633
- * @since 0.1.0
1047
+ * @since 4.0.0
634
1048
  * @category Lang
635
1049
  * @param {*} value The value to check.
636
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1050
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
637
1051
  * @example
638
1052
  *
639
- * _.isObject({});
1053
+ * _.isObjectLike({});
640
1054
  * // => true
641
1055
  *
642
- * _.isObject([1, 2, 3]);
1056
+ * _.isObjectLike([1, 2, 3]);
643
1057
  * // => true
644
1058
  *
645
- * _.isObject(_.noop);
646
- * // => true
1059
+ * _.isObjectLike(_.noop);
1060
+ * // => false
647
1061
  *
648
- * _.isObject(null);
1062
+ * _.isObjectLike(null);
649
1063
  * // => false
650
1064
  */
651
- function isObject(value) {
652
- var type = typeof value;
653
- return value != null && (type == 'object' || type == 'function');
1065
+ function isObjectLike(value) {
1066
+ return value != null && typeof value == 'object';
654
1067
  }
655
1068
 
656
- /** Used as references for various `Number` constants. */
657
- var NAN = 0 / 0;
658
-
659
- /** Used to detect bad signed hexadecimal string values. */
660
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
661
-
662
- /** Used to detect binary string values. */
663
- var reIsBinary = /^0b[01]+$/i;
664
-
665
- /** Used to detect octal string values. */
666
- var reIsOctal = /^0o[0-7]+$/i;
667
-
668
- /** Built-in method references without a dependency on `root`. */
669
- var freeParseInt = parseInt;
1069
+ /** `Object#toString` result references. */
1070
+ var symbolTag$2 = '[object Symbol]';
670
1071
 
671
1072
  /**
672
- * Converts `value` to a number.
1073
+ * Checks if `value` is classified as a `Symbol` primitive or object.
673
1074
  *
674
1075
  * @static
675
1076
  * @memberOf _
676
1077
  * @since 4.0.0
677
1078
  * @category Lang
678
- * @param {*} value The value to process.
679
- * @returns {number} Returns the number.
1079
+ * @param {*} value The value to check.
1080
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
680
1081
  * @example
681
1082
  *
682
- * _.toNumber(3.2);
683
- * // => 3.2
684
- *
685
- * _.toNumber(Number.MIN_VALUE);
686
- * // => 5e-324
1083
+ * _.isSymbol(Symbol.iterator);
1084
+ * // => true
1085
+ *
1086
+ * _.isSymbol('abc');
1087
+ * // => false
1088
+ */
1089
+ function isSymbol(value) {
1090
+ return typeof value == 'symbol' ||
1091
+ (isObjectLike(value) && baseGetTag(value) == symbolTag$2);
1092
+ }
1093
+
1094
+ /**
1095
+ * A specialized version of `_.map` for arrays without support for iteratee
1096
+ * shorthands.
1097
+ *
1098
+ * @private
1099
+ * @param {Array} [array] The array to iterate over.
1100
+ * @param {Function} iteratee The function invoked per iteration.
1101
+ * @returns {Array} Returns the new mapped array.
1102
+ */
1103
+ function arrayMap(array, iteratee) {
1104
+ var index = -1,
1105
+ length = array == null ? 0 : array.length,
1106
+ result = Array(length);
1107
+
1108
+ while (++index < length) {
1109
+ result[index] = iteratee(array[index], index, array);
1110
+ }
1111
+ return result;
1112
+ }
1113
+
1114
+ /**
1115
+ * Checks if `value` is classified as an `Array` object.
1116
+ *
1117
+ * @static
1118
+ * @memberOf _
1119
+ * @since 0.1.0
1120
+ * @category Lang
1121
+ * @param {*} value The value to check.
1122
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1123
+ * @example
1124
+ *
1125
+ * _.isArray([1, 2, 3]);
1126
+ * // => true
1127
+ *
1128
+ * _.isArray(document.body.children);
1129
+ * // => false
1130
+ *
1131
+ * _.isArray('abc');
1132
+ * // => false
1133
+ *
1134
+ * _.isArray(_.noop);
1135
+ * // => false
1136
+ */
1137
+ var isArray = Array.isArray;
1138
+
1139
+ /** Used to convert symbols to primitives and strings. */
1140
+ var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined,
1141
+ symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
1142
+
1143
+ /**
1144
+ * The base implementation of `_.toString` which doesn't convert nullish
1145
+ * values to empty strings.
1146
+ *
1147
+ * @private
1148
+ * @param {*} value The value to process.
1149
+ * @returns {string} Returns the string.
1150
+ */
1151
+ function baseToString(value) {
1152
+ // Exit early for strings to avoid a performance hit in some environments.
1153
+ if (typeof value == 'string') {
1154
+ return value;
1155
+ }
1156
+ if (isArray(value)) {
1157
+ // Recursively convert values (susceptible to call stack limits).
1158
+ return arrayMap(value, baseToString) + '';
1159
+ }
1160
+ if (isSymbol(value)) {
1161
+ return symbolToString ? symbolToString.call(value) : '';
1162
+ }
1163
+ var result = (value + '');
1164
+ return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
1165
+ }
1166
+
1167
+ /** Used to match a single whitespace character. */
1168
+ var reWhitespace = /\s/;
1169
+
1170
+ /**
1171
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
1172
+ * character of `string`.
1173
+ *
1174
+ * @private
1175
+ * @param {string} string The string to inspect.
1176
+ * @returns {number} Returns the index of the last non-whitespace character.
1177
+ */
1178
+ function trimmedEndIndex(string) {
1179
+ var index = string.length;
1180
+
1181
+ while (index-- && reWhitespace.test(string.charAt(index))) {}
1182
+ return index;
1183
+ }
1184
+
1185
+ /** Used to match leading whitespace. */
1186
+ var reTrimStart = /^\s+/;
1187
+
1188
+ /**
1189
+ * The base implementation of `_.trim`.
1190
+ *
1191
+ * @private
1192
+ * @param {string} string The string to trim.
1193
+ * @returns {string} Returns the trimmed string.
1194
+ */
1195
+ function baseTrim(string) {
1196
+ return string
1197
+ ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
1198
+ : string;
1199
+ }
1200
+
1201
+ /**
1202
+ * Checks if `value` is the
1203
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1204
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1205
+ *
1206
+ * @static
1207
+ * @memberOf _
1208
+ * @since 0.1.0
1209
+ * @category Lang
1210
+ * @param {*} value The value to check.
1211
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1212
+ * @example
1213
+ *
1214
+ * _.isObject({});
1215
+ * // => true
1216
+ *
1217
+ * _.isObject([1, 2, 3]);
1218
+ * // => true
1219
+ *
1220
+ * _.isObject(_.noop);
1221
+ * // => true
1222
+ *
1223
+ * _.isObject(null);
1224
+ * // => false
1225
+ */
1226
+ function isObject(value) {
1227
+ var type = typeof value;
1228
+ return value != null && (type == 'object' || type == 'function');
1229
+ }
1230
+
1231
+ /** Used as references for various `Number` constants. */
1232
+ var NAN = 0 / 0;
1233
+
1234
+ /** Used to detect bad signed hexadecimal string values. */
1235
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
1236
+
1237
+ /** Used to detect binary string values. */
1238
+ var reIsBinary = /^0b[01]+$/i;
1239
+
1240
+ /** Used to detect octal string values. */
1241
+ var reIsOctal = /^0o[0-7]+$/i;
1242
+
1243
+ /** Built-in method references without a dependency on `root`. */
1244
+ var freeParseInt = parseInt;
1245
+
1246
+ /**
1247
+ * Converts `value` to a number.
1248
+ *
1249
+ * @static
1250
+ * @memberOf _
1251
+ * @since 4.0.0
1252
+ * @category Lang
1253
+ * @param {*} value The value to process.
1254
+ * @returns {number} Returns the number.
1255
+ * @example
1256
+ *
1257
+ * _.toNumber(3.2);
1258
+ * // => 3.2
1259
+ *
1260
+ * _.toNumber(Number.MIN_VALUE);
1261
+ * // => 5e-324
687
1262
  *
688
1263
  * _.toNumber(Infinity);
689
1264
  * // => Infinity
@@ -3769,7 +4344,7 @@ var VcComponents = (function (exports, vue) {
3769
4344
  });
3770
4345
  }
3771
4346
 
3772
- const props$1b = {
4347
+ const props$1a = {
3773
4348
  wait: {
3774
4349
  type: Number,
3775
4350
  default: 250
@@ -3785,10 +4360,10 @@ var VcComponents = (function (exports, vue) {
3785
4360
  exclude: RegExp
3786
4361
  };
3787
4362
 
3788
- const COMPONENT_NAME$1r = "vc-debounce";
4363
+ const COMPONENT_NAME$1l = "vc-debounce";
3789
4364
  const Debounce = vue.defineComponent({
3790
- name: COMPONENT_NAME$1r,
3791
- props: props$1b,
4365
+ name: COMPONENT_NAME$1l,
4366
+ props: props$1a,
3792
4367
  /**
3793
4368
  * 不声明emits使得事件被透传放入attrs中, 这样可以让所有的事件透传
3794
4369
  * 如事件onClick
@@ -3829,7 +4404,7 @@ var VcComponents = (function (exports, vue) {
3829
4404
  }
3830
4405
  });
3831
4406
 
3832
- const props$1a = {
4407
+ const props$19 = {
3833
4408
  tag: {
3834
4409
  type: String,
3835
4410
  default: "button"
@@ -3859,11 +4434,11 @@ var VcComponents = (function (exports, vue) {
3859
4434
 
3860
4435
  /** @jsxImportSource vue */
3861
4436
 
3862
- const COMPONENT_NAME$1q = 'vc-button';
4437
+ const COMPONENT_NAME$1k = 'vc-button';
3863
4438
  const Button = /* @__PURE__ */ vue.defineComponent({
3864
- name: COMPONENT_NAME$1q,
4439
+ name: COMPONENT_NAME$1k,
3865
4440
  emits: ['click'],
3866
- props: props$1a,
4441
+ props: props$19,
3867
4442
  setup(props, {
3868
4443
  slots
3869
4444
  }) {
@@ -3920,7 +4495,7 @@ var VcComponents = (function (exports, vue) {
3920
4495
  }
3921
4496
  });
3922
4497
 
3923
- const props$19 = {
4498
+ const props$18 = {
3924
4499
  vertical: {
3925
4500
  type: Boolean,
3926
4501
  default: false
@@ -3941,10 +4516,10 @@ var VcComponents = (function (exports, vue) {
3941
4516
 
3942
4517
  /** @jsxImportSource vue */
3943
4518
 
3944
- const COMPONENT_NAME$1p = 'vc-button-group';
4519
+ const COMPONENT_NAME$1j = 'vc-button-group';
3945
4520
  const ButtonGroup = /* @__PURE__ */ vue.defineComponent({
3946
- name: COMPONENT_NAME$1p,
3947
- props: props$19,
4521
+ name: COMPONENT_NAME$1j,
4522
+ props: props$18,
3948
4523
  setup(props, {
3949
4524
  slots
3950
4525
  }) {
@@ -3968,7 +4543,7 @@ var VcComponents = (function (exports, vue) {
3968
4543
  const MButton = Button;
3969
4544
  const MButtonGroup = ButtonGroup;
3970
4545
 
3971
- const props$18 = {
4546
+ const props$17 = {
3972
4547
  tag: {
3973
4548
  type: String,
3974
4549
  default: "div"
@@ -3977,10 +4552,10 @@ var VcComponents = (function (exports, vue) {
3977
4552
 
3978
4553
  /** @jsxImportSource vue */
3979
4554
 
3980
- const COMPONENT_NAME$1o = 'vc-calendar';
4555
+ const COMPONENT_NAME$1i = 'vc-calendar';
3981
4556
  const Calendar = /* @__PURE__ */ vue.defineComponent({
3982
- name: COMPONENT_NAME$1o,
3983
- props: props$18,
4557
+ name: COMPONENT_NAME$1i,
4558
+ props: props$17,
3984
4559
  setup(props, {
3985
4560
  slots
3986
4561
  }) {
@@ -3994,33 +4569,59 @@ var VcComponents = (function (exports, vue) {
3994
4569
 
3995
4570
  const MCalendar = Calendar;
3996
4571
 
3997
- const props$17 = {
3998
- tag: {
3999
- type: String,
4000
- default: "div"
4572
+ const props$16 = {
4573
+ border: {
4574
+ type: Boolean,
4575
+ default: true
4576
+ },
4577
+ shadow: {
4578
+ type: Boolean,
4579
+ default: false
4580
+ },
4581
+ padding: {
4582
+ type: Number,
4583
+ default: 16
4584
+ },
4585
+ title: {
4586
+ type: String
4587
+ },
4588
+ icon: {
4589
+ type: String
4001
4590
  }
4002
4591
  };
4003
4592
 
4004
4593
  /** @jsxImportSource vue */
4005
4594
 
4006
- const COMPONENT_NAME$1n = 'vc-card';
4595
+ const COMPONENT_NAME$1h = 'vc-card';
4007
4596
  const Card = /* @__PURE__ */ vue.defineComponent({
4008
- name: COMPONENT_NAME$1n,
4009
- props: props$17,
4597
+ name: COMPONENT_NAME$1h,
4598
+ props: props$16,
4010
4599
  setup(props, {
4011
4600
  slots
4012
4601
  }) {
4013
4602
  return () => {
4014
4603
  return vue.createVNode("div", {
4015
- "class": "vc-card"
4016
- }, [slots?.default?.()]);
4604
+ "class": [{
4605
+ 'is-border': props.border,
4606
+ 'is-shadow': props.shadow
4607
+ }, 'vc-card']
4608
+ }, [(props.title || slots.title) && vue.createVNode("div", {
4609
+ "class": "vc-card__header"
4610
+ }, [slots.title ? slots.title?.() : props.title && vue.createVNode("p", null, [props.icon && vue.createVNode(Icon, {
4611
+ "type": props.icon
4612
+ }, null), vue.createVNode("span", null, [props.title])])]), slots.extra && vue.createVNode("div", {
4613
+ "class": "vc-card__extra"
4614
+ }, [slots.extra?.()]), vue.createVNode("div", {
4615
+ "style": `padding: ${props.padding}px`,
4616
+ "class": "vc-card__body"
4617
+ }, [slots.default?.()])]);
4017
4618
  };
4018
4619
  }
4019
4620
  });
4020
4621
 
4021
4622
  const MCard = Card;
4022
4623
 
4023
- const props$16 = {
4624
+ const props$15 = {
4024
4625
  tag: {
4025
4626
  type: String,
4026
4627
  default: "div"
@@ -4029,10 +4630,10 @@ var VcComponents = (function (exports, vue) {
4029
4630
 
4030
4631
  /** @jsxImportSource vue */
4031
4632
 
4032
- const COMPONENT_NAME$1m = 'vc-carousel';
4633
+ const COMPONENT_NAME$1g = 'vc-carousel';
4033
4634
  const Carousel = /* @__PURE__ */ vue.defineComponent({
4034
- name: COMPONENT_NAME$1m,
4035
- props: props$16,
4635
+ name: COMPONENT_NAME$1g,
4636
+ props: props$15,
4036
4637
  setup(props, {
4037
4638
  slots
4038
4639
  }) {
@@ -4046,7 +4647,7 @@ var VcComponents = (function (exports, vue) {
4046
4647
 
4047
4648
  const MCarousel = Carousel;
4048
4649
 
4049
- const props$15 = {
4650
+ const props$14 = {
4050
4651
  tag: {
4051
4652
  type: String,
4052
4653
  default: "div"
@@ -4055,10 +4656,10 @@ var VcComponents = (function (exports, vue) {
4055
4656
 
4056
4657
  /** @jsxImportSource vue */
4057
4658
 
4058
- const COMPONENT_NAME$1l = 'vc-cascader';
4659
+ const COMPONENT_NAME$1f = 'vc-cascader';
4059
4660
  const Cascader = /* @__PURE__ */ vue.defineComponent({
4060
- name: COMPONENT_NAME$1l,
4061
- props: props$15,
4661
+ name: COMPONENT_NAME$1f,
4662
+ props: props$14,
4062
4663
  setup(props, {
4063
4664
  slots
4064
4665
  }) {
@@ -4072,7 +4673,7 @@ var VcComponents = (function (exports, vue) {
4072
4673
 
4073
4674
  const MCascader = Cascader;
4074
4675
 
4075
- const props$14 = {
4676
+ const props$13 = {
4076
4677
  tag: {
4077
4678
  type: String,
4078
4679
  default: "div"
@@ -4081,10 +4682,10 @@ var VcComponents = (function (exports, vue) {
4081
4682
 
4082
4683
  /** @jsxImportSource vue */
4083
4684
 
4084
- const COMPONENT_NAME$1k = 'vc-chart';
4685
+ const COMPONENT_NAME$1e = 'vc-chart';
4085
4686
  const Chart = /* @__PURE__ */ vue.defineComponent({
4086
- name: COMPONENT_NAME$1k,
4087
- props: props$14,
4687
+ name: COMPONENT_NAME$1e,
4688
+ props: props$13,
4088
4689
  setup(props, {
4089
4690
  slots
4090
4691
  }) {
@@ -4098,7 +4699,7 @@ var VcComponents = (function (exports, vue) {
4098
4699
 
4099
4700
  const MChart = Chart;
4100
4701
 
4101
- const props$13 = {
4702
+ const props$12 = {
4102
4703
  tag: {
4103
4704
  type: String,
4104
4705
  default: "div"
@@ -4107,10 +4708,10 @@ var VcComponents = (function (exports, vue) {
4107
4708
 
4108
4709
  /** @jsxImportSource vue */
4109
4710
 
4110
- const COMPONENT_NAME$1j = 'vc-checkbox';
4711
+ const COMPONENT_NAME$1d = 'vc-checkbox';
4111
4712
  const Checkbox = /* @__PURE__ */ vue.defineComponent({
4112
- name: COMPONENT_NAME$1j,
4113
- props: props$13,
4713
+ name: COMPONENT_NAME$1d,
4714
+ props: props$12,
4114
4715
  setup(props, {
4115
4716
  slots
4116
4717
  }) {
@@ -4124,7 +4725,7 @@ var VcComponents = (function (exports, vue) {
4124
4725
 
4125
4726
  const MCheckbox = Checkbox;
4126
4727
 
4127
- const props$12 = {
4728
+ const props$11 = {
4128
4729
  tag: {
4129
4730
  type: String,
4130
4731
  default: "div"
@@ -4133,10 +4734,10 @@ var VcComponents = (function (exports, vue) {
4133
4734
 
4134
4735
  /** @jsxImportSource vue */
4135
4736
 
4136
- const COMPONENT_NAME$1i = 'vc-clipboard';
4737
+ const COMPONENT_NAME$1c = 'vc-clipboard';
4137
4738
  const Clipboard = /* @__PURE__ */ vue.defineComponent({
4138
- name: COMPONENT_NAME$1i,
4139
- props: props$12,
4739
+ name: COMPONENT_NAME$1c,
4740
+ props: props$11,
4140
4741
  setup(props, {
4141
4742
  slots
4142
4743
  }) {
@@ -4150,7 +4751,7 @@ var VcComponents = (function (exports, vue) {
4150
4751
 
4151
4752
  const MClipboard = Clipboard;
4152
4753
 
4153
- const props$11 = {
4754
+ const props$10 = {
4154
4755
  tag: {
4155
4756
  type: String,
4156
4757
  default: "div"
@@ -4159,10 +4760,10 @@ var VcComponents = (function (exports, vue) {
4159
4760
 
4160
4761
  /** @jsxImportSource vue */
4161
4762
 
4162
- const COMPONENT_NAME$1h = 'vc-collapse';
4763
+ const COMPONENT_NAME$1b = 'vc-collapse';
4163
4764
  const Collapse = /* @__PURE__ */ vue.defineComponent({
4164
- name: COMPONENT_NAME$1h,
4165
- props: props$11,
4765
+ name: COMPONENT_NAME$1b,
4766
+ props: props$10,
4166
4767
  setup(props, {
4167
4768
  slots
4168
4769
  }) {
@@ -4176,7 +4777,7 @@ var VcComponents = (function (exports, vue) {
4176
4777
 
4177
4778
  const MCollapse = Collapse;
4178
4779
 
4179
- const props$10 = {
4780
+ const props$$ = {
4180
4781
  tag: {
4181
4782
  type: String,
4182
4783
  default: "div"
@@ -4185,10 +4786,10 @@ var VcComponents = (function (exports, vue) {
4185
4786
 
4186
4787
  /** @jsxImportSource vue */
4187
4788
 
4188
- const COMPONENT_NAME$1g = 'vc-color-picker';
4789
+ const COMPONENT_NAME$1a = 'vc-color-picker';
4189
4790
  const ColorPicker = /* @__PURE__ */ vue.defineComponent({
4190
- name: COMPONENT_NAME$1g,
4191
- props: props$10,
4791
+ name: COMPONENT_NAME$1a,
4792
+ props: props$$,
4192
4793
  setup(props, {
4193
4794
  slots
4194
4795
  }) {
@@ -4202,7 +4803,7 @@ var VcComponents = (function (exports, vue) {
4202
4803
 
4203
4804
  const MColorPicker = ColorPicker;
4204
4805
 
4205
- const props$$ = {
4806
+ const props$_ = {
4206
4807
  tag: {
4207
4808
  type: String,
4208
4809
  default: "div"
@@ -4211,10 +4812,10 @@ var VcComponents = (function (exports, vue) {
4211
4812
 
4212
4813
  /** @jsxImportSource vue */
4213
4814
 
4214
- const COMPONENT_NAME$1f = 'vc-countdown';
4815
+ const COMPONENT_NAME$19 = 'vc-countdown';
4215
4816
  const Countdown = /* @__PURE__ */ vue.defineComponent({
4216
- name: COMPONENT_NAME$1f,
4217
- props: props$$,
4817
+ name: COMPONENT_NAME$19,
4818
+ props: props$_,
4218
4819
  setup(props, {
4219
4820
  slots
4220
4821
  }) {
@@ -4228,17 +4829,17 @@ var VcComponents = (function (exports, vue) {
4228
4829
 
4229
4830
  const MCountdown = Countdown;
4230
4831
 
4231
- const props$_ = {
4832
+ const props$Z = {
4232
4833
  render: {
4233
4834
  type: Function,
4234
4835
  default: () => null
4235
4836
  }
4236
4837
  };
4237
4838
 
4238
- const COMPONENT_NAME$1e = "vc-customer";
4839
+ const COMPONENT_NAME$18 = "vc-customer";
4239
4840
  const Customer = vue.defineComponent({
4240
- name: COMPONENT_NAME$1e,
4241
- props: props$_,
4841
+ name: COMPONENT_NAME$18,
4842
+ props: props$Z,
4242
4843
  setup(props, context) {
4243
4844
  return () => vue.h(() => {
4244
4845
  return props.render(context.attrs, context);
@@ -4248,7 +4849,7 @@ var VcComponents = (function (exports, vue) {
4248
4849
 
4249
4850
  const MCustomer = Customer;
4250
4851
 
4251
- const props$Z = {
4852
+ const props$Y = {
4252
4853
  tag: {
4253
4854
  type: String,
4254
4855
  default: "div"
@@ -4257,10 +4858,10 @@ var VcComponents = (function (exports, vue) {
4257
4858
 
4258
4859
  /** @jsxImportSource vue */
4259
4860
 
4260
- const COMPONENT_NAME$1d = 'vc-date-picker';
4861
+ const COMPONENT_NAME$17 = 'vc-date-picker';
4261
4862
  const DatePicker = /* @__PURE__ */ vue.defineComponent({
4262
- name: COMPONENT_NAME$1d,
4263
- props: props$Z,
4863
+ name: COMPONENT_NAME$17,
4864
+ props: props$Y,
4264
4865
  setup(props, {
4265
4866
  slots
4266
4867
  }) {
@@ -4274,7 +4875,7 @@ var VcComponents = (function (exports, vue) {
4274
4875
 
4275
4876
  const MDatePicker = DatePicker;
4276
4877
 
4277
- const props$Y = {
4878
+ const props$X = {
4278
4879
  tag: {
4279
4880
  type: String,
4280
4881
  default: "div"
@@ -4283,10 +4884,10 @@ var VcComponents = (function (exports, vue) {
4283
4884
 
4284
4885
  /** @jsxImportSource vue */
4285
4886
 
4286
- const COMPONENT_NAME$1c = 'vc-divider';
4887
+ const COMPONENT_NAME$16 = 'vc-divider';
4287
4888
  const Divider = /* @__PURE__ */ vue.defineComponent({
4288
- name: COMPONENT_NAME$1c,
4289
- props: props$Y,
4889
+ name: COMPONENT_NAME$16,
4890
+ props: props$X,
4290
4891
  setup(props, {
4291
4892
  slots
4292
4893
  }) {
@@ -4300,7 +4901,7 @@ var VcComponents = (function (exports, vue) {
4300
4901
 
4301
4902
  const MDivider = Divider;
4302
4903
 
4303
- const props$X = {
4904
+ const props$W = {
4304
4905
  tag: {
4305
4906
  type: String,
4306
4907
  default: "div"
@@ -4309,10 +4910,10 @@ var VcComponents = (function (exports, vue) {
4309
4910
 
4310
4911
  /** @jsxImportSource vue */
4311
4912
 
4312
- const COMPONENT_NAME$1b = 'vc-drawer';
4913
+ const COMPONENT_NAME$15 = 'vc-drawer';
4313
4914
  const Drawer = /* @__PURE__ */ vue.defineComponent({
4314
- name: COMPONENT_NAME$1b,
4315
- props: props$X,
4915
+ name: COMPONENT_NAME$15,
4916
+ props: props$W,
4316
4917
  setup(props, {
4317
4918
  slots
4318
4919
  }) {
@@ -4326,7 +4927,7 @@ var VcComponents = (function (exports, vue) {
4326
4927
 
4327
4928
  const MDrawer = Drawer;
4328
4929
 
4329
- const props$W = {
4930
+ const props$V = {
4330
4931
  tag: {
4331
4932
  type: String,
4332
4933
  default: "div"
@@ -4335,10 +4936,10 @@ var VcComponents = (function (exports, vue) {
4335
4936
 
4336
4937
  /** @jsxImportSource vue */
4337
4938
 
4338
- const COMPONENT_NAME$1a = 'vc-dropdown';
4939
+ const COMPONENT_NAME$14 = 'vc-dropdown';
4339
4940
  const Dropdown = /* @__PURE__ */ vue.defineComponent({
4340
- name: COMPONENT_NAME$1a,
4341
- props: props$W,
4941
+ name: COMPONENT_NAME$14,
4942
+ props: props$V,
4342
4943
  setup(props, {
4343
4944
  slots
4344
4945
  }) {
@@ -4352,7 +4953,7 @@ var VcComponents = (function (exports, vue) {
4352
4953
 
4353
4954
  const MDropdown = Dropdown;
4354
4955
 
4355
- const props$V = {
4956
+ const props$U = {
4356
4957
  tag: {
4357
4958
  type: String,
4358
4959
  default: "div"
@@ -4361,10 +4962,10 @@ var VcComponents = (function (exports, vue) {
4361
4962
 
4362
4963
  /** @jsxImportSource vue */
4363
4964
 
4364
- const COMPONENT_NAME$19 = 'vc-editor';
4965
+ const COMPONENT_NAME$13 = 'vc-editor';
4365
4966
  const Editor = /* @__PURE__ */ vue.defineComponent({
4366
- name: COMPONENT_NAME$19,
4367
- props: props$V,
4967
+ name: COMPONENT_NAME$13,
4968
+ props: props$U,
4368
4969
  setup(props, {
4369
4970
  slots
4370
4971
  }) {
@@ -4378,7 +4979,7 @@ var VcComponents = (function (exports, vue) {
4378
4979
 
4379
4980
  const MEditor = Editor;
4380
4981
 
4381
- const props$U = {
4982
+ const props$T = {
4382
4983
  tag: {
4383
4984
  type: String,
4384
4985
  default: "div"
@@ -4387,10 +4988,10 @@ var VcComponents = (function (exports, vue) {
4387
4988
 
4388
4989
  /** @jsxImportSource vue */
4389
4990
 
4390
- const COMPONENT_NAME$18 = 'vc-expand';
4991
+ const COMPONENT_NAME$12 = 'vc-expand';
4391
4992
  const Expand = /* @__PURE__ */ vue.defineComponent({
4392
- name: COMPONENT_NAME$18,
4393
- props: props$U,
4993
+ name: COMPONENT_NAME$12,
4994
+ props: props$T,
4394
4995
  setup(props, {
4395
4996
  slots
4396
4997
  }) {
@@ -4404,7 +5005,7 @@ var VcComponents = (function (exports, vue) {
4404
5005
 
4405
5006
  const MExpand = Expand;
4406
5007
 
4407
- const props$T = {
5008
+ const props$S = {
4408
5009
  tag: {
4409
5010
  type: String,
4410
5011
  default: "form"
@@ -4615,10 +5216,10 @@ var VcComponents = (function (exports, vue) {
4615
5216
  });
4616
5217
  };
4617
5218
 
4618
- const COMPONENT_NAME$17 = "vc-form";
5219
+ const COMPONENT_NAME$11 = "vc-form";
4619
5220
  const Form = vue.defineComponent({
4620
- name: COMPONENT_NAME$17,
4621
- props: props$T,
5221
+ name: COMPONENT_NAME$11,
5222
+ props: props$S,
4622
5223
  setup(props, { slots, expose }) {
4623
5224
  useForm(expose);
4624
5225
  return () => {
@@ -4634,7 +5235,7 @@ var VcComponents = (function (exports, vue) {
4634
5235
  }
4635
5236
  });
4636
5237
 
4637
- const props$S = {
5238
+ const props$R = {
4638
5239
  label: {
4639
5240
  type: String,
4640
5241
  default: ""
@@ -4944,602 +5545,130 @@ var VcComponents = (function (exports, vue) {
4944
5545
  }
4945
5546
  }
4946
5547
  validateState.value = "validating";
4947
- const descriptor = {};
4948
- descriptor[props.prop] = rules;
4949
- const validator = new Validator(descriptor);
4950
- const model = {};
4951
- model[props.prop] = filterEmpty(fieldValue.value);
4952
- try {
4953
- await validator.validate(model, { first: false });
4954
- validateState.value = "success";
4955
- validateMessage.value = "";
4956
- } catch (errors) {
4957
- validateState.value = "error";
4958
- validateMessage.value = errors[0].message;
4959
- throw {
4960
- prop: props.prop,
4961
- message: validateMessage.value
4962
- };
4963
- }
4964
- validateDisabled = false;
4965
- };
4966
- const handleFieldBlur = () => {
4967
- if (!props.prop) {
4968
- formItem.blur?.();
4969
- return;
4970
- }
4971
- validate("blur");
4972
- };
4973
- const handleFieldChange = () => {
4974
- if (!props.prop) {
4975
- formItem.change?.();
4976
- return;
4977
- }
4978
- if (validateDisabled) {
4979
- validateDisabled = false;
4980
- return;
4981
- }
4982
- validate("change");
4983
- };
4984
- const getPosition = async () => {
4985
- let el = instance.vnode.el;
4986
- try {
4987
- while (el && !el.getBoundingClientRect) {
4988
- el = el.nextSibling;
4989
- }
4990
- ;
4991
- const rect = el.getBoundingClientRect();
4992
- return {
4993
- top: rect.top,
4994
- left: rect.left
4995
- };
4996
- } catch (e) {
4997
- throw new VcError("form-item", "form-item位置计算错误");
4998
- }
4999
- };
5000
- const fields = vue.reactive([]);
5001
- vue.provide("form-item", {
5002
- fields,
5003
- blur: handleFieldBlur,
5004
- change: handleFieldChange,
5005
- message: validateMessage,
5006
- add: (field) => {
5007
- field && fields.push(field);
5008
- },
5009
- remove: (field) => {
5010
- field && fields.splice(fields.indexOf(field), 1);
5011
- }
5012
- });
5013
- vue.onMounted(() => {
5014
- if (props.prop) {
5015
- form.add?.(instance);
5016
- initialValue = cloneDeep(fieldValue.value);
5017
- }
5018
- formItem.add?.(instance);
5019
- });
5020
- vue.onBeforeUnmount(() => {
5021
- form.remove?.(instance);
5022
- formItem.remove?.(instance);
5023
- });
5024
- vue.watch(
5025
- () => props.rules,
5026
- () => {
5027
- props.resetByRulesChanged && reset();
5028
- }
5029
- );
5030
- vue.watch(
5031
- () => formItem.fields?.length,
5032
- async (v) => {
5033
- if (!isNest.value || !v) return isNestLast.value = false;
5034
- const fields$ = [...vue.toRaw(formItem.fields)];
5035
- const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
5036
- const sortFields = fields$.toSorted((a, b) => {
5037
- const aIndex = fields$.findIndex((i) => i === a);
5038
- const bIndex = fields$.findIndex((i) => i === b);
5039
- const aPosition = positions[aIndex];
5040
- const bPosition = positions[bIndex];
5041
- if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
5042
- return aPosition.left - bPosition.left;
5043
- });
5044
- isNestLast.value = sortFields[sortFields.length - 1] === instance;
5045
- }
5046
- );
5047
- expose({
5048
- validate,
5049
- reset,
5050
- getPosition
5051
- });
5052
- return {
5053
- isNest,
5054
- isStyleless,
5055
- isNestLast,
5056
- validateMessage,
5057
- classes,
5058
- labelStyle,
5059
- contentStyle,
5060
- showError,
5061
- labelPosition
5062
- };
5063
- };
5064
-
5065
- const props$R = {
5066
- /**
5067
- * 进入/离开持续时间
5068
- * {enter: 300, leave: 300}
5069
- */
5070
- duration: {
5071
- type: [Number, Object],
5072
- default: 300
5073
- },
5074
- /**
5075
- * 进入/离开延迟时间
5076
- */
5077
- delay: {
5078
- type: [Number, Object],
5079
- default: 0
5080
- },
5081
- /**
5082
- * `transition-group` component.
5083
- */
5084
- group: Boolean,
5085
- /**
5086
- * `transition-group` tag, v3版本默认值无
5087
- */
5088
- tag: {
5089
- type: String,
5090
- default: void 0
5091
- },
5092
- /**
5093
- * 变换的初始位置, 可以用style代替, 更短~~
5094
- */
5095
- origin: {
5096
- type: String,
5097
- default: ""
5098
- },
5099
- /**
5100
- * 在转换期间应用的元素样式。这些样式应用于@beforeEnter和@beforeLeave钩子
5101
- * inheritAttrs必须是false
5102
- */
5103
- style: {
5104
- type: Object,
5105
- default: () => {
5106
- return {
5107
- animationFillMode: "both",
5108
- animationTimingFunction: "ease-out"
5109
- };
5110
- }
5111
- },
5112
- prefix: {
5113
- type: String,
5114
- default: "vc-transition"
5115
- },
5116
- mode: {
5117
- type: String,
5118
- default: "none"
5119
- }
5120
- };
5121
-
5122
- const trim = (str) => str.trim().replace(/\s+/g, " ");
5123
- const useTransition = () => {
5124
- const instance = vue.getCurrentInstance();
5125
- const attrs = instance.attrs;
5126
- const props = instance.props;
5127
- const Wrapper = vue.computed(() => {
5128
- return props.group ? vue.TransitionGroup : vue.Transition;
5129
- });
5130
- const classes = vue.computed(() => {
5131
- const modeClass = props.mode !== "none" ? `is-${props.mode.replace(/-/g, " is-")}` : "";
5132
- return {
5133
- enterActiveClass: trim(`${attrs.enterActiveClass || ""} ${props.prefix} ${modeClass} is-in`),
5134
- leaveActiveClass: trim(`${attrs.leaveActiveClass || ""} ${props.prefix} ${modeClass} is-out`),
5135
- moveClass: props.group ? trim(`${attrs.moveClass || ""} ${props.prefix} ${modeClass} is-move`) : void 0
5136
- };
5137
- });
5138
- const clearStyles = (el) => {
5139
- Object.keys(props.style).forEach((key) => {
5140
- const v = props.style[key];
5141
- v && el.style.removeProperty(
5142
- key.replace(/([A-Z])/g, "-$1").toLowerCase()
5143
- );
5144
- });
5145
- el.style.removeProperty("animation-duration");
5146
- el.style.removeProperty("animation-delay");
5147
- };
5148
- const resetAbsolute = (el) => {
5149
- props.group && (el.style.position = "absolute");
5150
- };
5151
- const resetOrigin = (el) => {
5152
- props.origin && (el.style.transformOrigin = props.origin);
5153
- };
5154
- const resetStyles = (el) => {
5155
- resetOrigin(el);
5156
- Object.keys(props.style).forEach((key) => {
5157
- const v = props.style[key];
5158
- v && (el.style[key] = v);
5159
- });
5160
- };
5161
- const handleBeforeEnter = (el) => {
5162
- const duration = props.duration.enter || props.duration;
5163
- el.style.animationDuration = `${duration}ms`;
5164
- const delay = props.delay.enter || props.delay;
5165
- el.style.animationDelay = `${delay}ms`;
5166
- resetStyles(el);
5167
- attrs.onBeforeEnter?.(el);
5168
- };
5169
- const createNext = (callback, duration) => {
5170
- let hasDone = false;
5171
- return (immediate = true) => {
5172
- if (hasDone) return;
5173
- hasDone = true;
5174
- const done = () => callback?.();
5175
- immediate ? done() : setTimeout(done, duration);
5176
- };
5177
- };
5178
- const handleEnter = async (el, done) => {
5179
- const duration = props.duration.enter || props.duration;
5180
- const next = createNext(done, duration);
5181
- try {
5182
- await attrs.onEnter?.(el, next);
5183
- } finally {
5184
- next(false);
5185
- }
5186
- };
5187
- const handleAfterEnter = (el) => {
5188
- clearStyles(el);
5189
- attrs.onAfterEnter?.(el);
5190
- };
5191
- const handleBeforeLeave = (el) => {
5192
- const duration = props.duration.leave || props.duration;
5193
- el.style.animationDuration = `${duration}ms`;
5194
- const delay = props.delay.leave || props.delay;
5195
- el.style.animationDelay = `${delay}ms`;
5196
- resetStyles(el);
5197
- attrs.onBeforeLeave?.(el);
5198
- };
5199
- const handleLeave = async (el, done) => {
5200
- const duration = props.duration.leave || props.duration;
5201
- const next = createNext(done, duration);
5202
- try {
5203
- resetAbsolute(el);
5204
- await attrs.onLeave?.(el, next);
5205
- } finally {
5206
- next(props.group ? true : false);
5207
- }
5208
- };
5209
- const handleAfterLeave = (el) => {
5210
- clearStyles(el);
5211
- attrs.onAfterLeave?.(el);
5212
- };
5213
- return {
5214
- Wrapper,
5215
- resetStyles,
5216
- resetAbsolute,
5217
- classes,
5218
- createNext,
5219
- listeners: {
5220
- onBeforeEnter: handleBeforeEnter,
5221
- onEnter: handleEnter,
5222
- onAfterEnter: handleAfterEnter,
5223
- onBeforeLeave: handleBeforeLeave,
5224
- onLeave: handleLeave,
5225
- onAfterLeave: handleAfterLeave
5226
- }
5227
- };
5228
- };
5229
-
5230
- const COMPONENT_NAME$16 = "vc-transition";
5231
- const Transition = vue.defineComponent({
5232
- name: COMPONENT_NAME$16,
5233
- props: props$R,
5234
- // 当不声明emits的情况下,事件存在于attrs中
5235
- inheritAttrs: false,
5236
- setup(props, { slots, attrs }) {
5237
- const { Wrapper, listeners, classes } = useTransition();
5238
- return () => {
5239
- return vue.h(
5240
- Wrapper.value,
5241
- {
5242
- ...attrs,
5243
- ...listeners,
5244
- ...classes.value,
5245
- tag: props.tag
5246
- },
5247
- slots
5248
- );
5249
- };
5250
- }
5251
- });
5252
-
5253
- const COMPONENT_NAME$15 = "vc-transition-collapse";
5254
- const TransitionCollapse = vue.defineComponent({
5255
- name: COMPONENT_NAME$15,
5256
- props: props$R,
5257
- // 当不声明emits的情况下,事件存在于attrs中
5258
- inheritAttrs: false,
5259
- setup(props, { slots, attrs: _attrs }) {
5260
- const attrs = _attrs;
5261
- const { Wrapper, resetStyles, resetAbsolute, createNext } = useTransition();
5262
- const getTransitionStyle = (duration) => {
5263
- const style = `
5264
- ${duration}ms height ease-in-out,
5265
- ${duration}ms padding-top ease-in-out,
5266
- ${duration}ms padding-bottom ease-in-out
5267
- `;
5268
- return style;
5269
- };
5270
- const handleBeforeEnter = (el) => {
5271
- const duration = props.duration.enter || props.duration;
5272
- el.style.transition = getTransitionStyle(duration);
5273
- /* istanbul ignore next -- @preserve */
5274
- if (!el.dataset) {
5275
- el.dataset = {};
5276
- }
5277
- el.dataset.oldPaddingTop = el.style.paddingTop;
5278
- el.dataset.oldPaddingBottom = el.style.paddingBottom;
5279
- el.style.height = "0px";
5280
- el.style.paddingTop = "0px";
5281
- el.style.paddingBottom = "0px";
5282
- resetStyles(el);
5283
- attrs.onBeforeEnter?.(el);
5284
- };
5285
- const handleEnter = async (el, done) => {
5286
- const duration = props.duration.enter || props.duration;
5287
- const next = createNext(done, duration);
5288
- try {
5289
- el.dataset.oldOverflow = el.style.overflow;
5290
- /* istanbul ignore next -- @preserve */
5291
- if (el.scrollHeight !== 0) {
5292
- el.style.height = el.scrollHeight + "px";
5293
- el.style.paddingTop = el.dataset.oldPaddingTop + "px";
5294
- el.style.paddingBottom = el.dataset.oldPaddingBottom + "px";
5295
- } else {
5296
- el.style.height = "";
5297
- el.style.paddingTop = el.dataset.oldPaddingTop + "px";
5298
- el.style.paddingBottom = el.dataset.oldPaddingBottom + "px";
5299
- }
5300
- el.style.overflow = "hidden";
5301
- attrs.onEnter?.(el);
5302
- } finally {
5303
- next(false);
5304
- }
5305
- };
5306
- const handleAfterEnter = (el) => {
5307
- el.style.transition = "";
5308
- el.style.height = "";
5309
- el.style.overflow = el.dataset.oldOverflow || "";
5310
- attrs.onAfterEnter?.(el);
5311
- };
5312
- const handleBeforeLeave = (el) => {
5313
- /* istanbul ignore next -- @preserve */
5314
- if (!el.dataset) {
5315
- el.dataset = {};
5316
- }
5317
- el.dataset.oldPaddingTop = el.style.paddingTop;
5318
- el.dataset.oldPaddingBottom = el.style.paddingBottom;
5319
- el.dataset.oldOverflow = el.style.overflow;
5320
- el.style.height = el.scrollHeight + "px";
5321
- el.style.overflow = "hidden";
5322
- resetStyles(el);
5323
- attrs.onBeforeLeave?.(el);
5324
- };
5325
- const handleLeave = (el, done) => {
5326
- const duration = props.duration.leave || props.duration;
5327
- const next = createNext(done, duration);
5328
- try {
5329
- const leaveDuration = props.duration.leave || props.duration;
5330
- /* istanbul ignore next -- @preserve */
5331
- if (el.scrollHeight !== 0) {
5332
- el.style.transition = getTransitionStyle(leaveDuration);
5333
- el.style.height = "0px";
5334
- el.style.paddingTop = "0px";
5335
- el.style.paddingBottom = "0px";
5336
- }
5337
- resetAbsolute(el);
5338
- attrs.onLeave?.(el);
5339
- } finally {
5340
- next(props.group ? true : false);
5341
- }
5342
- };
5343
- const handleAfterLeave = (el) => {
5344
- el.style.transition = "";
5345
- el.style.height = "";
5346
- el.style.overflow = el.dataset.oldOverflow || "";
5347
- el.style.paddingTop = el.dataset.oldPaddingTop || "";
5348
- el.style.paddingBottom = el.dataset.oldPaddingBottom || "";
5349
- attrs.onAfterLeave?.(el);
5350
- };
5351
- const listeners = {
5352
- onBeforeEnter: handleBeforeEnter,
5353
- onEnter: handleEnter,
5354
- onAfterEnter: handleAfterEnter,
5355
- onBeforeLeave: handleBeforeLeave,
5356
- onLeave: handleLeave,
5357
- onAfterLeave: handleAfterLeave
5358
- };
5359
- return () => {
5360
- return vue.h(
5361
- Wrapper.value,
5362
- {
5363
- ...attrs,
5364
- ...listeners,
5365
- tag: props.tag,
5366
- moveClass: props.group ? `${attrs.moveClass || ""} vc-transition-collapse is-move` : void 0
5367
- },
5368
- slots
5369
- );
5370
- };
5371
- }
5372
- });
5373
-
5374
- const COMPONENT_NAME$14 = "vc-transition-fade";
5375
- const TransitionFade = vue.defineComponent({
5376
- name: COMPONENT_NAME$14,
5377
- props: {
5378
- ...props$R,
5379
- // inheritAttrs必须是false
5380
- style: {
5381
- type: Object,
5382
- default: () => ({
5383
- animationFillMode: "both",
5384
- animationTimingFunction: void 0
5385
- })
5386
- },
5387
- prefix: {
5388
- type: String,
5389
- default: "vc-transition-fade"
5548
+ const descriptor = {};
5549
+ descriptor[props.prop] = rules;
5550
+ const validator = new Validator(descriptor);
5551
+ const model = {};
5552
+ model[props.prop] = filterEmpty(fieldValue.value);
5553
+ try {
5554
+ await validator.validate(model, { first: false });
5555
+ validateState.value = "success";
5556
+ validateMessage.value = "";
5557
+ } catch (errors) {
5558
+ validateState.value = "error";
5559
+ validateMessage.value = errors[0].message;
5560
+ throw {
5561
+ prop: props.prop,
5562
+ message: validateMessage.value
5563
+ };
5390
5564
  }
5391
- },
5392
- // 当不声明emits的情况下,事件存在于attrs中
5393
- inheritAttrs: false,
5394
- setup(props, { slots, attrs }) {
5395
- const { Wrapper, listeners, classes } = useTransition();
5396
- return () => {
5397
- return vue.h(
5398
- Wrapper.value,
5399
- {
5400
- ...attrs,
5401
- ...listeners,
5402
- ...classes.value,
5403
- tag: props.tag
5404
- },
5405
- slots
5406
- );
5407
- };
5408
- }
5409
- });
5410
-
5411
- const COMPONENT_NAME$13 = "vc-transition-scale";
5412
- const TransitionScale = vue.defineComponent({
5413
- name: COMPONENT_NAME$13,
5414
- props: {
5415
- ...props$R,
5416
- mode: {
5417
- type: String,
5418
- default: "both",
5419
- validator: (v) => /(part|both|y|x|none)/.test(v)
5420
- },
5421
- // inheritAttrs必须是false
5422
- style: {
5423
- type: Object,
5424
- default: () => ({
5425
- animationFillMode: "both",
5426
- animationTimingFunction: void 0
5427
- })
5428
- },
5429
- prefix: {
5430
- type: String,
5431
- default: "vc-transition-scale"
5565
+ validateDisabled = false;
5566
+ };
5567
+ const handleFieldBlur = () => {
5568
+ if (!props.prop) {
5569
+ formItem.blur?.();
5570
+ return;
5432
5571
  }
5433
- },
5434
- // 当不声明emits的情况下,事件存在于attrs中
5435
- inheritAttrs: false,
5436
- setup(props, { slots, attrs }) {
5437
- const { Wrapper, listeners, classes } = useTransition();
5438
- return () => {
5439
- return vue.h(
5440
- Wrapper.value,
5441
- {
5442
- ...attrs,
5443
- ...listeners,
5444
- ...classes.value,
5445
- tag: props.tag
5446
- },
5447
- slots
5448
- );
5449
- };
5450
- }
5451
- });
5452
-
5453
- const COMPONENT_NAME$12 = "vc-transition-slide";
5454
- const TransitionSlide = vue.defineComponent({
5455
- name: COMPONENT_NAME$12,
5456
- props: {
5457
- ...props$R,
5458
- mode: {
5459
- type: String,
5460
- default: "left",
5461
- validator: (v) => /^(left|right|down|up|none)(|-part)$/.test(v)
5462
- },
5463
- // inheritAttrs必须是false
5464
- style: {
5465
- type: Object,
5466
- default: () => ({
5467
- animationFillMode: "both",
5468
- animationTimingFunction: void 0
5469
- })
5470
- },
5471
- prefix: {
5472
- type: String,
5473
- default: "vc-transition-slide"
5572
+ validate("blur");
5573
+ };
5574
+ const handleFieldChange = () => {
5575
+ if (!props.prop) {
5576
+ formItem.change?.();
5577
+ return;
5474
5578
  }
5475
- },
5476
- // 当不声明emits的情况下,事件存在于attrs中
5477
- inheritAttrs: false,
5478
- setup(props, { slots, attrs }) {
5479
- const { Wrapper, listeners, classes } = useTransition();
5480
- return () => {
5481
- return vue.h(
5482
- Wrapper.value,
5483
- {
5484
- ...attrs,
5485
- ...listeners,
5486
- ...classes.value,
5487
- tag: props.tag
5488
- },
5489
- slots
5490
- );
5491
- };
5492
- }
5493
- });
5494
-
5495
- const COMPONENT_NAME$11 = "vc-transition-zoom";
5496
- const TransitionZoom = vue.defineComponent({
5497
- name: COMPONENT_NAME$11,
5498
- props: {
5499
- ...props$R,
5500
- mode: {
5501
- type: String,
5502
- default: "x",
5503
- validator: (v) => /^(x|y|center|none)$/.test(v)
5504
- },
5505
- // inheritAttrs必须是false
5506
- style: {
5507
- type: Object,
5508
- default: () => ({
5509
- animationFillMode: "both",
5510
- animationTimingFunction: void 0
5511
- })
5579
+ if (validateDisabled) {
5580
+ validateDisabled = false;
5581
+ return;
5582
+ }
5583
+ validate("change");
5584
+ };
5585
+ const getPosition = async () => {
5586
+ let el = instance.vnode.el;
5587
+ try {
5588
+ while (el && !el.getBoundingClientRect) {
5589
+ el = el.nextSibling;
5590
+ }
5591
+ ;
5592
+ const rect = el.getBoundingClientRect();
5593
+ return {
5594
+ top: rect.top,
5595
+ left: rect.left
5596
+ };
5597
+ } catch (e) {
5598
+ throw new VcError("form-item", "form-item位置计算错误");
5599
+ }
5600
+ };
5601
+ const fields = vue.reactive([]);
5602
+ vue.provide("form-item", {
5603
+ fields,
5604
+ blur: handleFieldBlur,
5605
+ change: handleFieldChange,
5606
+ message: validateMessage,
5607
+ add: (field) => {
5608
+ field && fields.push(field);
5512
5609
  },
5513
- prefix: {
5514
- type: String,
5515
- default: "vc-transition-zoom"
5610
+ remove: (field) => {
5611
+ field && fields.splice(fields.indexOf(field), 1);
5516
5612
  }
5517
- },
5518
- // 当不声明emits的情况下,事件存在于attrs中
5519
- inheritAttrs: false,
5520
- setup(props, { slots, attrs }) {
5521
- const { Wrapper, listeners, classes } = useTransition();
5522
- return () => {
5523
- return vue.h(
5524
- Wrapper.value,
5525
- {
5526
- ...attrs,
5527
- ...listeners,
5528
- ...classes.value,
5529
- tag: props.tag
5530
- },
5531
- slots
5532
- );
5533
- };
5534
- }
5535
- });
5613
+ });
5614
+ vue.onMounted(() => {
5615
+ if (props.prop) {
5616
+ form.add?.(instance);
5617
+ initialValue = cloneDeep(fieldValue.value);
5618
+ }
5619
+ formItem.add?.(instance);
5620
+ });
5621
+ vue.onBeforeUnmount(() => {
5622
+ form.remove?.(instance);
5623
+ formItem.remove?.(instance);
5624
+ });
5625
+ vue.watch(
5626
+ () => props.rules,
5627
+ () => {
5628
+ props.resetByRulesChanged && reset();
5629
+ }
5630
+ );
5631
+ vue.watch(
5632
+ () => formItem.fields?.length,
5633
+ async (v) => {
5634
+ if (!isNest.value || !v) return isNestLast.value = false;
5635
+ const fields$ = [...vue.toRaw(formItem.fields)];
5636
+ const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
5637
+ const sortFields = fields$.toSorted((a, b) => {
5638
+ const aIndex = fields$.findIndex((i) => i === a);
5639
+ const bIndex = fields$.findIndex((i) => i === b);
5640
+ const aPosition = positions[aIndex];
5641
+ const bPosition = positions[bIndex];
5642
+ if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
5643
+ return aPosition.left - bPosition.left;
5644
+ });
5645
+ isNestLast.value = sortFields[sortFields.length - 1] === instance;
5646
+ }
5647
+ );
5648
+ expose({
5649
+ validate,
5650
+ reset,
5651
+ getPosition
5652
+ });
5653
+ return {
5654
+ isNest,
5655
+ isStyleless,
5656
+ isNestLast,
5657
+ validateMessage,
5658
+ classes,
5659
+ labelStyle,
5660
+ contentStyle,
5661
+ showError,
5662
+ labelPosition
5663
+ };
5664
+ };
5536
5665
 
5537
5666
  /** @jsxImportSource vue */
5538
5667
 
5539
5668
  const COMPONENT_NAME$10 = 'vc-form-item';
5540
5669
  const FormItem = /* @__PURE__ */ vue.defineComponent({
5541
5670
  name: COMPONENT_NAME$10,
5542
- props: props$S,
5671
+ props: props$R,
5543
5672
  setup(props, {
5544
5673
  slots,
5545
5674
  expose
@@ -5592,7 +5721,7 @@ var VcComponents = (function (exports, vue) {
5592
5721
  });
5593
5722
 
5594
5723
  const props$Q = {
5595
- ...props$T,
5724
+ ...props$S,
5596
5725
  showToast: {
5597
5726
  type: Boolean,
5598
5727
  default: false
@@ -6259,7 +6388,7 @@ var VcComponents = (function (exports, vue) {
6259
6388
  });
6260
6389
 
6261
6390
  const props$N = {
6262
- ...props$S,
6391
+ ...props$R,
6263
6392
  indent: {
6264
6393
  type: Number,
6265
6394
  default: 12
@@ -9133,7 +9262,8 @@ var VcComponents = (function (exports, vue) {
9133
9262
  emits: ['portal-fulfilled', 'close'],
9134
9263
  setup(props, {
9135
9264
  emit,
9136
- slots
9265
+ slots,
9266
+ expose
9137
9267
  }) {
9138
9268
  const {
9139
9269
  getPopupStyle,
@@ -9337,6 +9467,9 @@ var VcComponents = (function (exports, vue) {
9337
9467
  Resize.off(vnode.el, handleWrapperResize);
9338
9468
  props.alone && props.hover && removeEvents();
9339
9469
  });
9470
+ expose({
9471
+ isActive
9472
+ });
9340
9473
  return () => {
9341
9474
  let _slot;
9342
9475
  return vue.createVNode(TransitionScale, {