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