@deot/vc 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.
@@ -4967,48 +4967,32 @@
4967
4967
  });
4968
4968
  const MActionSheet = ActionSheet;
4969
4969
  const props$1f = {
4970
- tag: {
4970
+ modelValue: {
4971
+ type: Boolean,
4972
+ default: true
4973
+ },
4974
+ type: {
4971
4975
  type: String,
4972
- default: "div"
4973
- }
4974
- };
4975
- const COMPONENT_NAME$1v = "vc-alert";
4976
- const Alert = /* @__PURE__ */ vue.defineComponent({
4977
- name: COMPONENT_NAME$1v,
4978
- props: props$1f,
4979
- setup(props2, {
4980
- slots
4981
- }) {
4982
- return () => {
4983
- return vue.createVNode("div", {
4984
- "class": "vc-alert"
4985
- }, [slots?.default?.()]);
4986
- };
4987
- }
4988
- });
4989
- const MAlert = Alert;
4990
- const props$1e = {
4991
- tag: {
4976
+ default: "info"
4977
+ },
4978
+ title: {
4992
4979
  type: String,
4993
- default: "div"
4980
+ default: ""
4981
+ },
4982
+ desc: {
4983
+ type: String,
4984
+ default: ""
4985
+ },
4986
+ icon: {
4987
+ type: [String, Boolean],
4988
+ default: true
4989
+ },
4990
+ closable: {
4991
+ type: Boolean,
4992
+ default: false
4994
4993
  }
4995
4994
  };
4996
- const COMPONENT_NAME$1u = "vc-artboard";
4997
- const Artboard = /* @__PURE__ */ vue.defineComponent({
4998
- name: COMPONENT_NAME$1u,
4999
- props: props$1e,
5000
- setup(props2, {
5001
- slots
5002
- }) {
5003
- return () => {
5004
- return vue.createVNode("div", {
5005
- "class": "vc-artboard"
5006
- }, [slots?.default?.()]);
5007
- };
5008
- }
5009
- });
5010
- const MArtboard = Artboard;
5011
- const props$1d = {
4995
+ const props$1e = {
5012
4996
  type: String,
5013
4997
  inherit: {
5014
4998
  type: Boolean,
@@ -5149,10 +5133,10 @@
5149
5133
  }
5150
5134
  }
5151
5135
  const IconManager = new Manager();
5152
- const COMPONENT_NAME$1t = "vc-icon";
5136
+ const COMPONENT_NAME$1v = "vc-icon";
5153
5137
  const Icon = /* @__PURE__ */ vue.defineComponent({
5154
- name: COMPONENT_NAME$1t,
5155
- props: props$1d,
5138
+ name: COMPONENT_NAME$1v,
5139
+ props: props$1e,
5156
5140
  setup(props2) {
5157
5141
  const viewBox = vue.ref("0 0 1024 1024");
5158
5142
  const path = vue.ref([]);
@@ -5184,184 +5168,764 @@
5184
5168
  };
5185
5169
  }
5186
5170
  });
5187
- const props$1c = {
5188
- size: {
5189
- type: Number,
5190
- default: 28
5191
- },
5192
- foreground: {
5193
- type: String,
5194
- default: "#ccc"
5195
- },
5196
- background: {
5197
- type: String,
5198
- default: "var(--vc-color-primary)"
5199
- },
5171
+ const props$1d = {
5200
5172
  /**
5201
- * 待开发
5173
+ * 进入/离开持续时间
5174
+ * {enter: 300, leave: 300}
5202
5175
  */
5203
- fixed: {
5204
- type: Boolean,
5205
- default: false
5206
- }
5207
- };
5208
- const COMPONENT_NAME$1s = "vc-spin";
5209
- const Spin = /* @__PURE__ */ vue.defineComponent({
5210
- name: COMPONENT_NAME$1s,
5211
- props: props$1c,
5212
- setup(props2, {
5213
- slots
5214
- }) {
5215
- return () => {
5216
- return vue.createVNode("div", {
5217
- "class": "vc-spin"
5218
- }, [vue.createVNode("span", {
5219
- "style": {
5220
- fontSize: `${props2.size}px`
5221
- }
5222
- }, [slots?.loading?.() || vue.createVNode("svg", {
5223
- "xmlns": "http://www.w3.org/2000/svg",
5224
- "version": "1.1",
5225
- "viewBox": "0 0 32 32",
5226
- "width": "100%",
5227
- "height": "100%"
5228
- }, [vue.createVNode("path", {
5229
- "stroke": props2.foreground,
5230
- "d": "M 16 2 A 14 14 0 1 0 30 15",
5231
- "fill": "none",
5232
- "stroke-width": "2",
5233
- "stroke-linecap": "round"
5234
- }, null), vue.createVNode("path", {
5235
- "stroke": props2.background,
5236
- "d": "M 16 2 A 14 14 0 0 1 30 15",
5237
- "fill": "none",
5238
- "stroke-width": "2",
5239
- "stroke-linecap": "round"
5240
- }, null)])]), slots?.default?.()]);
5241
- };
5242
- }
5243
- });
5244
- const props$1b = {
5245
- wait: {
5246
- type: Number,
5247
- default: 250
5248
- },
5249
- tag: {
5250
- type: [String, Object],
5251
- default: "div"
5176
+ duration: {
5177
+ type: [Number, Object],
5178
+ default: 300
5252
5179
  },
5253
- include: {
5254
- type: RegExp,
5255
- default: () => /^on([A-Z])/
5180
+ /**
5181
+ * 进入/离开延迟时间
5182
+ */
5183
+ delay: {
5184
+ type: [Number, Object],
5185
+ default: 0
5256
5186
  },
5257
- exclude: RegExp
5258
- };
5259
- const COMPONENT_NAME$1r = "vc-debounce";
5260
- const Debounce = vue.defineComponent({
5261
- name: COMPONENT_NAME$1r,
5262
- props: props$1b,
5263
5187
  /**
5264
- * 不声明emits使得事件被透传放入attrs中, 这样可以让所有的事件透传
5265
- * 如事件onClick
5266
- * 当inheritAttrs为true时:因为emits为声明onClick会覆盖到`props.tag`上,使得我们重写的onClick无效
5267
- * 当inheritAttrs为false时: 透传的onClick不会被重载,这样我们就可以重写onClick
5188
+ * `transition-group` component.
5189
+ */
5190
+ group: Boolean,
5191
+ /**
5192
+ * `transition-group` tag, v3版本默认值无
5268
5193
  */
5269
- inheritAttrs: false,
5270
- setup(props2, { slots, attrs }) {
5271
- const listener = vue.ref({});
5272
- vue.watch(
5273
- [() => props2.wait, () => props2.exclude, () => props2.include],
5274
- () => {
5275
- const { wait, exclude, include } = props2;
5276
- const ons = Object.entries(attrs).reduce((pre, [key, callback]) => {
5277
- /* istanbul ignore else -- @preserve */
5278
- if ((!exclude || !exclude.test(key)) && (!include || include.test(key)) && typeof callback === "function") {
5279
- pre[key] = debounce$1(callback, wait, {
5280
- leading: true,
5281
- trailing: false
5282
- });
5283
- }
5284
- return pre;
5285
- }, {});
5286
- if (Object.keys(listener.value).length !== Object.keys(ons).length) {
5287
- listener.value = ons;
5288
- }
5289
- },
5290
- {
5291
- immediate: true
5292
- }
5293
- );
5294
- return () => {
5295
- return vue.h(props2.tag, {
5296
- ...attrs,
5297
- ...listener.value
5298
- }, slots.default?.());
5299
- };
5300
- }
5301
- });
5302
- const props$1a = {
5303
5194
  tag: {
5304
5195
  type: String,
5305
- default: "button"
5196
+ default: void 0
5306
5197
  },
5307
- type: {
5198
+ /**
5199
+ * 变换的初始位置, 可以用style代替, 更短~~
5200
+ */
5201
+ origin: {
5308
5202
  type: String,
5309
- default: "default"
5203
+ default: ""
5310
5204
  },
5311
- size: {
5312
- type: String,
5313
- default: "medium"
5205
+ /**
5206
+ * 在转换期间应用的元素样式。这些样式应用于@beforeEnter和@beforeLeave钩子
5207
+ * inheritAttrs必须是false
5208
+ */
5209
+ style: {
5210
+ type: Object,
5211
+ default: () => {
5212
+ return {
5213
+ animationFillMode: "both",
5214
+ animationTimingFunction: "ease-out"
5215
+ };
5216
+ }
5314
5217
  },
5315
- wait: {
5316
- type: Number,
5317
- default: 250
5218
+ prefix: {
5219
+ type: String,
5220
+ default: "vc-transition"
5318
5221
  },
5319
- icon: String,
5320
- disabled: Boolean,
5321
- circle: Boolean,
5322
- round: Boolean,
5323
- long: Boolean,
5324
- htmlType: {
5222
+ mode: {
5325
5223
  type: String,
5326
- default: "button"
5224
+ default: "none"
5327
5225
  }
5328
5226
  };
5329
- const COMPONENT_NAME$1q = "vc-button";
5330
- const Button = /* @__PURE__ */ vue.defineComponent({
5331
- name: COMPONENT_NAME$1q,
5332
- emits: ["click"],
5333
- props: props$1a,
5334
- setup(props2, {
5335
- slots
5336
- }) {
5337
- const vm = vue.getCurrentInstance();
5338
- const hasSlot = vue.ref(true);
5339
- const isLoading = vue.ref(false);
5340
- const group = vue.inject("button-group", {
5341
- size: "medium",
5342
- vertical: false,
5343
- circle: false
5344
- });
5345
- const classes = vue.computed(() => ({
5346
- "is-circle": props2.circle || group.circle,
5347
- "is-alone": !hasSlot.value,
5348
- "is-round": props2.round,
5349
- "is-long": props2.long,
5350
- "is-disabled": props2.disabled,
5351
- [`is-${props2.size}`]: true,
5352
- [`is-${props2.type}`]: true
5353
- }));
5354
- const handleClick = (...args) => {
5355
- const fn = vm.vnode.props?.["onClick"]?.(...args);
5356
- if (fn && fn.then) {
5357
- isLoading.value = true;
5358
- fn.finally(() => {
5359
- isLoading.value = false;
5360
- });
5361
- }
5362
- };
5363
- vue.onMounted(() => {
5364
- hasSlot.value = slots.default !== void 0;
5227
+ const trim = (str) => str.trim().replace(/\s+/g, " ");
5228
+ const useTransition = () => {
5229
+ const instance = vue.getCurrentInstance();
5230
+ const attrs = instance.attrs;
5231
+ const props2 = instance.props;
5232
+ const Wrapper = vue.computed(() => {
5233
+ return props2.group ? vue.TransitionGroup : vue.Transition;
5234
+ });
5235
+ const classes = vue.computed(() => {
5236
+ const modeClass = props2.mode !== "none" ? `is-${props2.mode.replace(/-/g, " is-")}` : "";
5237
+ return {
5238
+ enterActiveClass: trim(`${attrs.enterActiveClass || ""} ${props2.prefix} ${modeClass} is-in`),
5239
+ leaveActiveClass: trim(`${attrs.leaveActiveClass || ""} ${props2.prefix} ${modeClass} is-out`),
5240
+ moveClass: props2.group ? trim(`${attrs.moveClass || ""} ${props2.prefix} ${modeClass} is-move`) : void 0
5241
+ };
5242
+ });
5243
+ const clearStyles = (el2) => {
5244
+ Object.keys(props2.style).forEach((key) => {
5245
+ const v = props2.style[key];
5246
+ v && el2.style.removeProperty(
5247
+ key.replace(/([A-Z])/g, "-$1").toLowerCase()
5248
+ );
5249
+ });
5250
+ el2.style.removeProperty("animation-duration");
5251
+ el2.style.removeProperty("animation-delay");
5252
+ };
5253
+ const resetAbsolute = (el2) => {
5254
+ props2.group && (el2.style.position = "absolute");
5255
+ };
5256
+ const resetOrigin = (el2) => {
5257
+ props2.origin && (el2.style.transformOrigin = props2.origin);
5258
+ };
5259
+ const resetStyles = (el2) => {
5260
+ resetOrigin(el2);
5261
+ Object.keys(props2.style).forEach((key) => {
5262
+ const v = props2.style[key];
5263
+ v && (el2.style[key] = v);
5264
+ });
5265
+ };
5266
+ const handleBeforeEnter = (el2) => {
5267
+ const duration = props2.duration.enter || props2.duration;
5268
+ el2.style.animationDuration = `${duration}ms`;
5269
+ const delay = props2.delay.enter || props2.delay;
5270
+ el2.style.animationDelay = `${delay}ms`;
5271
+ resetStyles(el2);
5272
+ attrs.onBeforeEnter?.(el2);
5273
+ };
5274
+ const createNext = (callback, duration) => {
5275
+ let hasDone = false;
5276
+ return (immediate = true) => {
5277
+ if (hasDone) return;
5278
+ hasDone = true;
5279
+ const done = () => callback?.();
5280
+ immediate ? done() : setTimeout(done, duration);
5281
+ };
5282
+ };
5283
+ const handleEnter = async (el2, done) => {
5284
+ const duration = props2.duration.enter || props2.duration;
5285
+ const next = createNext(done, duration);
5286
+ try {
5287
+ await attrs.onEnter?.(el2, next);
5288
+ } finally {
5289
+ next(false);
5290
+ }
5291
+ };
5292
+ const handleAfterEnter = (el2) => {
5293
+ clearStyles(el2);
5294
+ attrs.onAfterEnter?.(el2);
5295
+ };
5296
+ const handleBeforeLeave = (el2) => {
5297
+ const duration = props2.duration.leave || props2.duration;
5298
+ el2.style.animationDuration = `${duration}ms`;
5299
+ const delay = props2.delay.leave || props2.delay;
5300
+ el2.style.animationDelay = `${delay}ms`;
5301
+ resetStyles(el2);
5302
+ attrs.onBeforeLeave?.(el2);
5303
+ };
5304
+ const handleLeave = async (el2, done) => {
5305
+ const duration = props2.duration.leave || props2.duration;
5306
+ const next = createNext(done, duration);
5307
+ try {
5308
+ resetAbsolute(el2);
5309
+ await attrs.onLeave?.(el2, next);
5310
+ } finally {
5311
+ next(props2.group ? true : false);
5312
+ }
5313
+ };
5314
+ const handleAfterLeave = (el2) => {
5315
+ clearStyles(el2);
5316
+ attrs.onAfterLeave?.(el2);
5317
+ };
5318
+ return {
5319
+ Wrapper,
5320
+ resetStyles,
5321
+ resetAbsolute,
5322
+ classes,
5323
+ createNext,
5324
+ listeners: {
5325
+ onBeforeEnter: handleBeforeEnter,
5326
+ onEnter: handleEnter,
5327
+ onAfterEnter: handleAfterEnter,
5328
+ onBeforeLeave: handleBeforeLeave,
5329
+ onLeave: handleLeave,
5330
+ onAfterLeave: handleAfterLeave
5331
+ }
5332
+ };
5333
+ };
5334
+ const COMPONENT_NAME$1u = "vc-transition";
5335
+ const Transition = vue.defineComponent({
5336
+ name: COMPONENT_NAME$1u,
5337
+ props: props$1d,
5338
+ // 当不声明emits的情况下,事件存在于attrs中
5339
+ inheritAttrs: false,
5340
+ setup(props2, { slots, attrs }) {
5341
+ const { Wrapper, listeners, classes } = useTransition();
5342
+ return () => {
5343
+ return vue.h(
5344
+ Wrapper.value,
5345
+ {
5346
+ ...attrs,
5347
+ ...listeners,
5348
+ ...classes.value,
5349
+ tag: props2.tag
5350
+ },
5351
+ slots
5352
+ );
5353
+ };
5354
+ }
5355
+ });
5356
+ const COMPONENT_NAME$1t = "vc-transition-collapse";
5357
+ const TransitionCollapse = vue.defineComponent({
5358
+ name: COMPONENT_NAME$1t,
5359
+ props: props$1d,
5360
+ // 当不声明emits的情况下,事件存在于attrs中
5361
+ inheritAttrs: false,
5362
+ setup(props2, { slots, attrs: _attrs }) {
5363
+ const attrs = _attrs;
5364
+ const { Wrapper, resetStyles, resetAbsolute, createNext } = useTransition();
5365
+ const getTransitionStyle = (duration) => {
5366
+ const style = `
5367
+ ${duration}ms height ease-in-out,
5368
+ ${duration}ms padding-top ease-in-out,
5369
+ ${duration}ms padding-bottom ease-in-out
5370
+ `;
5371
+ return style;
5372
+ };
5373
+ const handleBeforeEnter = (el2) => {
5374
+ const duration = props2.duration.enter || props2.duration;
5375
+ el2.style.transition = getTransitionStyle(duration);
5376
+ /* istanbul ignore next -- @preserve */
5377
+ if (!el2.dataset) {
5378
+ el2.dataset = {};
5379
+ }
5380
+ el2.dataset.oldPaddingTop = el2.style.paddingTop;
5381
+ el2.dataset.oldPaddingBottom = el2.style.paddingBottom;
5382
+ el2.style.height = "0px";
5383
+ el2.style.paddingTop = "0px";
5384
+ el2.style.paddingBottom = "0px";
5385
+ resetStyles(el2);
5386
+ attrs.onBeforeEnter?.(el2);
5387
+ };
5388
+ const handleEnter = async (el2, done) => {
5389
+ const duration = props2.duration.enter || props2.duration;
5390
+ const next = createNext(done, duration);
5391
+ try {
5392
+ el2.dataset.oldOverflow = el2.style.overflow;
5393
+ /* istanbul ignore next -- @preserve */
5394
+ if (el2.scrollHeight !== 0) {
5395
+ el2.style.height = el2.scrollHeight + "px";
5396
+ el2.style.paddingTop = el2.dataset.oldPaddingTop + "px";
5397
+ el2.style.paddingBottom = el2.dataset.oldPaddingBottom + "px";
5398
+ } else {
5399
+ el2.style.height = "";
5400
+ el2.style.paddingTop = el2.dataset.oldPaddingTop + "px";
5401
+ el2.style.paddingBottom = el2.dataset.oldPaddingBottom + "px";
5402
+ }
5403
+ el2.style.overflow = "hidden";
5404
+ attrs.onEnter?.(el2);
5405
+ } finally {
5406
+ next(false);
5407
+ }
5408
+ };
5409
+ const handleAfterEnter = (el2) => {
5410
+ el2.style.transition = "";
5411
+ el2.style.height = "";
5412
+ el2.style.overflow = el2.dataset.oldOverflow || "";
5413
+ attrs.onAfterEnter?.(el2);
5414
+ };
5415
+ const handleBeforeLeave = (el2) => {
5416
+ /* istanbul ignore next -- @preserve */
5417
+ if (!el2.dataset) {
5418
+ el2.dataset = {};
5419
+ }
5420
+ el2.dataset.oldPaddingTop = el2.style.paddingTop;
5421
+ el2.dataset.oldPaddingBottom = el2.style.paddingBottom;
5422
+ el2.dataset.oldOverflow = el2.style.overflow;
5423
+ el2.style.height = el2.scrollHeight + "px";
5424
+ el2.style.overflow = "hidden";
5425
+ resetStyles(el2);
5426
+ attrs.onBeforeLeave?.(el2);
5427
+ };
5428
+ const handleLeave = (el2, done) => {
5429
+ const duration = props2.duration.leave || props2.duration;
5430
+ const next = createNext(done, duration);
5431
+ try {
5432
+ const leaveDuration = props2.duration.leave || props2.duration;
5433
+ /* istanbul ignore next -- @preserve */
5434
+ if (el2.scrollHeight !== 0) {
5435
+ el2.style.transition = getTransitionStyle(leaveDuration);
5436
+ el2.style.height = "0px";
5437
+ el2.style.paddingTop = "0px";
5438
+ el2.style.paddingBottom = "0px";
5439
+ }
5440
+ resetAbsolute(el2);
5441
+ attrs.onLeave?.(el2);
5442
+ } finally {
5443
+ next(props2.group ? true : false);
5444
+ }
5445
+ };
5446
+ const handleAfterLeave = (el2) => {
5447
+ el2.style.transition = "";
5448
+ el2.style.height = "";
5449
+ el2.style.overflow = el2.dataset.oldOverflow || "";
5450
+ el2.style.paddingTop = el2.dataset.oldPaddingTop || "";
5451
+ el2.style.paddingBottom = el2.dataset.oldPaddingBottom || "";
5452
+ attrs.onAfterLeave?.(el2);
5453
+ };
5454
+ const listeners = {
5455
+ onBeforeEnter: handleBeforeEnter,
5456
+ onEnter: handleEnter,
5457
+ onAfterEnter: handleAfterEnter,
5458
+ onBeforeLeave: handleBeforeLeave,
5459
+ onLeave: handleLeave,
5460
+ onAfterLeave: handleAfterLeave
5461
+ };
5462
+ return () => {
5463
+ return vue.h(
5464
+ Wrapper.value,
5465
+ {
5466
+ ...attrs,
5467
+ ...listeners,
5468
+ tag: props2.tag,
5469
+ moveClass: props2.group ? `${attrs.moveClass || ""} vc-transition-collapse is-move` : void 0
5470
+ },
5471
+ slots
5472
+ );
5473
+ };
5474
+ }
5475
+ });
5476
+ const COMPONENT_NAME$1s = "vc-transition-fade";
5477
+ const TransitionFade = vue.defineComponent({
5478
+ name: COMPONENT_NAME$1s,
5479
+ props: {
5480
+ ...props$1d,
5481
+ // inheritAttrs必须是false
5482
+ style: {
5483
+ type: Object,
5484
+ default: () => ({
5485
+ animationFillMode: "both",
5486
+ animationTimingFunction: void 0
5487
+ })
5488
+ },
5489
+ prefix: {
5490
+ type: String,
5491
+ default: "vc-transition-fade"
5492
+ }
5493
+ },
5494
+ // 当不声明emits的情况下,事件存在于attrs中
5495
+ inheritAttrs: false,
5496
+ setup(props2, { slots, attrs }) {
5497
+ const { Wrapper, listeners, classes } = useTransition();
5498
+ return () => {
5499
+ return vue.h(
5500
+ Wrapper.value,
5501
+ {
5502
+ ...attrs,
5503
+ ...listeners,
5504
+ ...classes.value,
5505
+ tag: props2.tag
5506
+ },
5507
+ slots
5508
+ );
5509
+ };
5510
+ }
5511
+ });
5512
+ const COMPONENT_NAME$1r = "vc-transition-scale";
5513
+ const TransitionScale = vue.defineComponent({
5514
+ name: COMPONENT_NAME$1r,
5515
+ props: {
5516
+ ...props$1d,
5517
+ mode: {
5518
+ type: String,
5519
+ default: "both",
5520
+ validator: (v) => /(part|both|y|x|none)/.test(v)
5521
+ },
5522
+ // inheritAttrs必须是false
5523
+ style: {
5524
+ type: Object,
5525
+ default: () => ({
5526
+ animationFillMode: "both",
5527
+ animationTimingFunction: void 0
5528
+ })
5529
+ },
5530
+ prefix: {
5531
+ type: String,
5532
+ default: "vc-transition-scale"
5533
+ }
5534
+ },
5535
+ // 当不声明emits的情况下,事件存在于attrs中
5536
+ inheritAttrs: false,
5537
+ setup(props2, { slots, attrs }) {
5538
+ const { Wrapper, listeners, classes } = useTransition();
5539
+ return () => {
5540
+ return vue.h(
5541
+ Wrapper.value,
5542
+ {
5543
+ ...attrs,
5544
+ ...listeners,
5545
+ ...classes.value,
5546
+ tag: props2.tag
5547
+ },
5548
+ slots
5549
+ );
5550
+ };
5551
+ }
5552
+ });
5553
+ const COMPONENT_NAME$1q = "vc-transition-slide";
5554
+ const TransitionSlide = vue.defineComponent({
5555
+ name: COMPONENT_NAME$1q,
5556
+ props: {
5557
+ ...props$1d,
5558
+ mode: {
5559
+ type: String,
5560
+ default: "left",
5561
+ validator: (v) => /^(left|right|down|up|none)(|-part)$/.test(v)
5562
+ },
5563
+ // inheritAttrs必须是false
5564
+ style: {
5565
+ type: Object,
5566
+ default: () => ({
5567
+ animationFillMode: "both",
5568
+ animationTimingFunction: void 0
5569
+ })
5570
+ },
5571
+ prefix: {
5572
+ type: String,
5573
+ default: "vc-transition-slide"
5574
+ }
5575
+ },
5576
+ // 当不声明emits的情况下,事件存在于attrs中
5577
+ inheritAttrs: false,
5578
+ setup(props2, { slots, attrs }) {
5579
+ const { Wrapper, listeners, classes } = useTransition();
5580
+ return () => {
5581
+ return vue.h(
5582
+ Wrapper.value,
5583
+ {
5584
+ ...attrs,
5585
+ ...listeners,
5586
+ ...classes.value,
5587
+ tag: props2.tag
5588
+ },
5589
+ slots
5590
+ );
5591
+ };
5592
+ }
5593
+ });
5594
+ const COMPONENT_NAME$1p = "vc-transition-zoom";
5595
+ const TransitionZoom = vue.defineComponent({
5596
+ name: COMPONENT_NAME$1p,
5597
+ props: {
5598
+ ...props$1d,
5599
+ mode: {
5600
+ type: String,
5601
+ default: "x",
5602
+ validator: (v) => /^(x|y|center|none)$/.test(v)
5603
+ },
5604
+ // inheritAttrs必须是false
5605
+ style: {
5606
+ type: Object,
5607
+ default: () => ({
5608
+ animationFillMode: "both",
5609
+ animationTimingFunction: void 0
5610
+ })
5611
+ },
5612
+ prefix: {
5613
+ type: String,
5614
+ default: "vc-transition-zoom"
5615
+ }
5616
+ },
5617
+ // 当不声明emits的情况下,事件存在于attrs中
5618
+ inheritAttrs: false,
5619
+ setup(props2, { slots, attrs }) {
5620
+ const { Wrapper, listeners, classes } = useTransition();
5621
+ return () => {
5622
+ return vue.h(
5623
+ Wrapper.value,
5624
+ {
5625
+ ...attrs,
5626
+ ...listeners,
5627
+ ...classes.value,
5628
+ tag: props2.tag
5629
+ },
5630
+ slots
5631
+ );
5632
+ };
5633
+ }
5634
+ });
5635
+ const COMPONENT_NAME$1o = "vc-alert";
5636
+ const THEME_MAP = {
5637
+ info: ["#5495f6", "#91d5ff", "#e6f7ff"],
5638
+ success: ["#52c41a", "#b7eb8f", "#f6ffed"],
5639
+ error: ["#ed4014", "#ffb08f", "#fbe9e9"],
5640
+ warning: ["#ffbf00", "#ffe58f", "#fffbe6"]
5641
+ };
5642
+ const Alert = /* @__PURE__ */ vue.defineComponent({
5643
+ name: COMPONENT_NAME$1o,
5644
+ props: props$1f,
5645
+ setup(props2, {
5646
+ slots,
5647
+ emit
5648
+ }) {
5649
+ const isActive = vue.ref(false);
5650
+ const showIcon = vue.computed(() => props2.icon !== false);
5651
+ const containerStyle = vue.computed(() => {
5652
+ const [_, borderColor, backgroundColor] = THEME_MAP[props2.type];
5653
+ return {
5654
+ borderColor,
5655
+ backgroundColor
5656
+ };
5657
+ });
5658
+ const iconStyle = vue.computed(() => {
5659
+ const [color] = THEME_MAP[props2.type];
5660
+ return {
5661
+ color
5662
+ };
5663
+ });
5664
+ const titleStyle = vue.computed(() => {
5665
+ const [color] = THEME_MAP[props2.type];
5666
+ return props2.desc || slots.desc ? {
5667
+ marginBottom: "5px",
5668
+ fontSize: "14px",
5669
+ color
5670
+ } : {};
5671
+ });
5672
+ const descStyle = vue.computed(() => {
5673
+ const [color] = THEME_MAP[props2.type];
5674
+ return {
5675
+ color,
5676
+ opacity: ".7"
5677
+ };
5678
+ });
5679
+ const iconType = vue.computed(() => {
5680
+ return typeof props2.icon === "string" && props2.icon ? props2.icon : props2.type;
5681
+ });
5682
+ const handleClose = () => {
5683
+ isActive.value = false;
5684
+ emit("close");
5685
+ emit("update:modelValue", false);
5686
+ emit("visible-change", false);
5687
+ };
5688
+ vue.watch(() => props2.modelValue, (v) => {
5689
+ isActive.value = v;
5690
+ }, {
5691
+ immediate: true
5692
+ });
5693
+ return () => {
5694
+ return vue.createVNode(TransitionFade, null, {
5695
+ default: () => [isActive.value && vue.createVNode("div", {
5696
+ "class": [`is-${props2.type}`, {
5697
+ "has-icon": showIcon.value,
5698
+ "has-desc": props2.desc || slots.desc
5699
+ }, "vc-alert"],
5700
+ "style": containerStyle.value
5701
+ }, [showIcon.value && vue.createVNode(Icon, {
5702
+ "type": iconType.value,
5703
+ "style": iconStyle.value,
5704
+ "class": "vc-alert__icon"
5705
+ }, null), vue.createVNode("div", {
5706
+ "class": "vc-alert__content"
5707
+ }, [vue.createVNode("div", {
5708
+ "class": "vc-alert__message"
5709
+ }, [props2.title ? vue.createVNode("div", {
5710
+ "style": titleStyle.value,
5711
+ "innerHTML": props2.title
5712
+ }, null) : vue.createVNode("div", {
5713
+ "style": titleStyle.value
5714
+ }, [slots?.default?.()]), props2.desc ? vue.createVNode("div", {
5715
+ "style": descStyle.value,
5716
+ "innerHTML": props2.desc
5717
+ }, null) : slots.desc && vue.createVNode("div", {
5718
+ "style": descStyle.value
5719
+ }, [slots.desc?.()])]), props2.closable && vue.createVNode("div", {
5720
+ "class": "vc-alert__close",
5721
+ "onClick": handleClose
5722
+ }, [slots.close ? slots.close() : vue.createVNode(Icon, {
5723
+ "type": "close"
5724
+ }, null)])])])]
5725
+ });
5726
+ };
5727
+ }
5728
+ });
5729
+ const MAlert = Alert;
5730
+ const props$1c = {
5731
+ tag: {
5732
+ type: String,
5733
+ default: "div"
5734
+ }
5735
+ };
5736
+ const COMPONENT_NAME$1n = "vc-artboard";
5737
+ const Artboard = /* @__PURE__ */ vue.defineComponent({
5738
+ name: COMPONENT_NAME$1n,
5739
+ props: props$1c,
5740
+ setup(props2, {
5741
+ slots
5742
+ }) {
5743
+ return () => {
5744
+ return vue.createVNode("div", {
5745
+ "class": "vc-artboard"
5746
+ }, [slots?.default?.()]);
5747
+ };
5748
+ }
5749
+ });
5750
+ const MArtboard = Artboard;
5751
+ const props$1b = {
5752
+ size: {
5753
+ type: Number,
5754
+ default: 28
5755
+ },
5756
+ foreground: {
5757
+ type: String,
5758
+ default: "#ccc"
5759
+ },
5760
+ background: {
5761
+ type: String,
5762
+ default: "var(--vc-color-primary)"
5763
+ },
5764
+ /**
5765
+ * 待开发
5766
+ */
5767
+ fixed: {
5768
+ type: Boolean,
5769
+ default: false
5770
+ }
5771
+ };
5772
+ const COMPONENT_NAME$1m = "vc-spin";
5773
+ const Spin = /* @__PURE__ */ vue.defineComponent({
5774
+ name: COMPONENT_NAME$1m,
5775
+ props: props$1b,
5776
+ setup(props2, {
5777
+ slots
5778
+ }) {
5779
+ return () => {
5780
+ return vue.createVNode("div", {
5781
+ "class": "vc-spin"
5782
+ }, [vue.createVNode("span", {
5783
+ "style": {
5784
+ fontSize: `${props2.size}px`
5785
+ }
5786
+ }, [slots?.loading?.() || vue.createVNode("svg", {
5787
+ "xmlns": "http://www.w3.org/2000/svg",
5788
+ "version": "1.1",
5789
+ "viewBox": "0 0 32 32",
5790
+ "width": "100%",
5791
+ "height": "100%"
5792
+ }, [vue.createVNode("path", {
5793
+ "stroke": props2.foreground,
5794
+ "d": "M 16 2 A 14 14 0 1 0 30 15",
5795
+ "fill": "none",
5796
+ "stroke-width": "2",
5797
+ "stroke-linecap": "round"
5798
+ }, null), vue.createVNode("path", {
5799
+ "stroke": props2.background,
5800
+ "d": "M 16 2 A 14 14 0 0 1 30 15",
5801
+ "fill": "none",
5802
+ "stroke-width": "2",
5803
+ "stroke-linecap": "round"
5804
+ }, null)])]), slots?.default?.()]);
5805
+ };
5806
+ }
5807
+ });
5808
+ const props$1a = {
5809
+ wait: {
5810
+ type: Number,
5811
+ default: 250
5812
+ },
5813
+ tag: {
5814
+ type: [String, Object],
5815
+ default: "div"
5816
+ },
5817
+ include: {
5818
+ type: RegExp,
5819
+ default: () => /^on([A-Z])/
5820
+ },
5821
+ exclude: RegExp
5822
+ };
5823
+ const COMPONENT_NAME$1l = "vc-debounce";
5824
+ const Debounce = vue.defineComponent({
5825
+ name: COMPONENT_NAME$1l,
5826
+ props: props$1a,
5827
+ /**
5828
+ * 不声明emits使得事件被透传放入attrs中, 这样可以让所有的事件透传
5829
+ * 如事件onClick
5830
+ * 当inheritAttrs为true时:因为emits为声明onClick会覆盖到`props.tag`上,使得我们重写的onClick无效
5831
+ * 当inheritAttrs为false时: 透传的onClick不会被重载,这样我们就可以重写onClick
5832
+ */
5833
+ inheritAttrs: false,
5834
+ setup(props2, { slots, attrs }) {
5835
+ const listener = vue.ref({});
5836
+ vue.watch(
5837
+ [() => props2.wait, () => props2.exclude, () => props2.include],
5838
+ () => {
5839
+ const { wait, exclude, include } = props2;
5840
+ const ons = Object.entries(attrs).reduce((pre, [key, callback]) => {
5841
+ /* istanbul ignore else -- @preserve */
5842
+ if ((!exclude || !exclude.test(key)) && (!include || include.test(key)) && typeof callback === "function") {
5843
+ pre[key] = debounce$1(callback, wait, {
5844
+ leading: true,
5845
+ trailing: false
5846
+ });
5847
+ }
5848
+ return pre;
5849
+ }, {});
5850
+ if (Object.keys(listener.value).length !== Object.keys(ons).length) {
5851
+ listener.value = ons;
5852
+ }
5853
+ },
5854
+ {
5855
+ immediate: true
5856
+ }
5857
+ );
5858
+ return () => {
5859
+ return vue.h(props2.tag, {
5860
+ ...attrs,
5861
+ ...listener.value
5862
+ }, slots.default?.());
5863
+ };
5864
+ }
5865
+ });
5866
+ const props$19 = {
5867
+ tag: {
5868
+ type: String,
5869
+ default: "button"
5870
+ },
5871
+ type: {
5872
+ type: String,
5873
+ default: "default"
5874
+ },
5875
+ size: {
5876
+ type: String,
5877
+ default: "medium"
5878
+ },
5879
+ wait: {
5880
+ type: Number,
5881
+ default: 250
5882
+ },
5883
+ icon: String,
5884
+ disabled: Boolean,
5885
+ circle: Boolean,
5886
+ round: Boolean,
5887
+ long: Boolean,
5888
+ htmlType: {
5889
+ type: String,
5890
+ default: "button"
5891
+ }
5892
+ };
5893
+ const COMPONENT_NAME$1k = "vc-button";
5894
+ const Button = /* @__PURE__ */ vue.defineComponent({
5895
+ name: COMPONENT_NAME$1k,
5896
+ emits: ["click"],
5897
+ props: props$19,
5898
+ setup(props2, {
5899
+ slots
5900
+ }) {
5901
+ const vm = vue.getCurrentInstance();
5902
+ const hasSlot = vue.ref(true);
5903
+ const isLoading = vue.ref(false);
5904
+ const group = vue.inject("button-group", {
5905
+ size: "medium",
5906
+ vertical: false,
5907
+ circle: false
5908
+ });
5909
+ const classes = vue.computed(() => ({
5910
+ "is-circle": props2.circle || group.circle,
5911
+ "is-alone": !hasSlot.value,
5912
+ "is-round": props2.round,
5913
+ "is-long": props2.long,
5914
+ "is-disabled": props2.disabled,
5915
+ [`is-${props2.size}`]: true,
5916
+ [`is-${props2.type}`]: true
5917
+ }));
5918
+ const handleClick = (...args) => {
5919
+ const fn = vm.vnode.props?.["onClick"]?.(...args);
5920
+ if (fn && fn.then) {
5921
+ isLoading.value = true;
5922
+ fn.finally(() => {
5923
+ isLoading.value = false;
5924
+ });
5925
+ }
5926
+ };
5927
+ vue.onMounted(() => {
5928
+ hasSlot.value = slots.default !== void 0;
5365
5929
  });
5366
5930
  return () => {
5367
5931
  return vue.createVNode(Debounce, {
@@ -5386,7 +5950,7 @@
5386
5950
  };
5387
5951
  }
5388
5952
  });
5389
- const props$19 = {
5953
+ const props$18 = {
5390
5954
  vertical: {
5391
5955
  type: Boolean,
5392
5956
  default: false
@@ -5404,10 +5968,10 @@
5404
5968
  default: false
5405
5969
  }
5406
5970
  };
5407
- const COMPONENT_NAME$1p = "vc-button-group";
5971
+ const COMPONENT_NAME$1j = "vc-button-group";
5408
5972
  const ButtonGroup = /* @__PURE__ */ vue.defineComponent({
5409
- name: COMPONENT_NAME$1p,
5410
- props: props$19,
5973
+ name: COMPONENT_NAME$1j,
5974
+ props: props$18,
5411
5975
  setup(props2, {
5412
5976
  slots
5413
5977
  }) {
@@ -5429,16 +5993,16 @@
5429
5993
  });
5430
5994
  const MButton = Button;
5431
5995
  const MButtonGroup = ButtonGroup;
5432
- const props$18 = {
5996
+ const props$17 = {
5433
5997
  tag: {
5434
5998
  type: String,
5435
5999
  default: "div"
5436
6000
  }
5437
6001
  };
5438
- const COMPONENT_NAME$1o = "vc-calendar";
6002
+ const COMPONENT_NAME$1i = "vc-calendar";
5439
6003
  const Calendar = /* @__PURE__ */ vue.defineComponent({
5440
- name: COMPONENT_NAME$1o,
5441
- props: props$18,
6004
+ name: COMPONENT_NAME$1i,
6005
+ props: props$17,
5442
6006
  setup(props2, {
5443
6007
  slots
5444
6008
  }) {
@@ -5450,37 +6014,63 @@
5450
6014
  }
5451
6015
  });
5452
6016
  const MCalendar = Calendar;
5453
- const props$17 = {
5454
- tag: {
5455
- type: String,
5456
- default: "div"
6017
+ const props$16 = {
6018
+ border: {
6019
+ type: Boolean,
6020
+ default: true
6021
+ },
6022
+ shadow: {
6023
+ type: Boolean,
6024
+ default: false
6025
+ },
6026
+ padding: {
6027
+ type: Number,
6028
+ default: 16
6029
+ },
6030
+ title: {
6031
+ type: String
6032
+ },
6033
+ icon: {
6034
+ type: String
5457
6035
  }
5458
6036
  };
5459
- const COMPONENT_NAME$1n = "vc-card";
6037
+ const COMPONENT_NAME$1h = "vc-card";
5460
6038
  const Card = /* @__PURE__ */ vue.defineComponent({
5461
- name: COMPONENT_NAME$1n,
5462
- props: props$17,
6039
+ name: COMPONENT_NAME$1h,
6040
+ props: props$16,
5463
6041
  setup(props2, {
5464
6042
  slots
5465
6043
  }) {
5466
6044
  return () => {
5467
6045
  return vue.createVNode("div", {
5468
- "class": "vc-card"
5469
- }, [slots?.default?.()]);
6046
+ "class": [{
6047
+ "is-border": props2.border,
6048
+ "is-shadow": props2.shadow
6049
+ }, "vc-card"]
6050
+ }, [(props2.title || slots.title) && vue.createVNode("div", {
6051
+ "class": "vc-card__header"
6052
+ }, [slots.title ? slots.title?.() : props2.title && vue.createVNode("p", null, [props2.icon && vue.createVNode(Icon, {
6053
+ "type": props2.icon
6054
+ }, null), vue.createVNode("span", null, [props2.title])])]), slots.extra && vue.createVNode("div", {
6055
+ "class": "vc-card__extra"
6056
+ }, [slots.extra?.()]), vue.createVNode("div", {
6057
+ "style": `padding: ${props2.padding}px`,
6058
+ "class": "vc-card__body"
6059
+ }, [slots.default?.()])]);
5470
6060
  };
5471
6061
  }
5472
6062
  });
5473
6063
  const MCard = Card;
5474
- const props$16 = {
6064
+ const props$15 = {
5475
6065
  tag: {
5476
6066
  type: String,
5477
6067
  default: "div"
5478
6068
  }
5479
6069
  };
5480
- const COMPONENT_NAME$1m = "vc-carousel";
6070
+ const COMPONENT_NAME$1g = "vc-carousel";
5481
6071
  const Carousel = /* @__PURE__ */ vue.defineComponent({
5482
- name: COMPONENT_NAME$1m,
5483
- props: props$16,
6072
+ name: COMPONENT_NAME$1g,
6073
+ props: props$15,
5484
6074
  setup(props2, {
5485
6075
  slots
5486
6076
  }) {
@@ -5492,16 +6082,16 @@
5492
6082
  }
5493
6083
  });
5494
6084
  const MCarousel = Carousel;
5495
- const props$15 = {
6085
+ const props$14 = {
5496
6086
  tag: {
5497
6087
  type: String,
5498
6088
  default: "div"
5499
6089
  }
5500
6090
  };
5501
- const COMPONENT_NAME$1l = "vc-cascader";
6091
+ const COMPONENT_NAME$1f = "vc-cascader";
5502
6092
  const Cascader = /* @__PURE__ */ vue.defineComponent({
5503
- name: COMPONENT_NAME$1l,
5504
- props: props$15,
6093
+ name: COMPONENT_NAME$1f,
6094
+ props: props$14,
5505
6095
  setup(props2, {
5506
6096
  slots
5507
6097
  }) {
@@ -5513,16 +6103,16 @@
5513
6103
  }
5514
6104
  });
5515
6105
  const MCascader = Cascader;
5516
- const props$14 = {
6106
+ const props$13 = {
5517
6107
  tag: {
5518
6108
  type: String,
5519
6109
  default: "div"
5520
6110
  }
5521
6111
  };
5522
- const COMPONENT_NAME$1k = "vc-chart";
6112
+ const COMPONENT_NAME$1e = "vc-chart";
5523
6113
  const Chart = /* @__PURE__ */ vue.defineComponent({
5524
- name: COMPONENT_NAME$1k,
5525
- props: props$14,
6114
+ name: COMPONENT_NAME$1e,
6115
+ props: props$13,
5526
6116
  setup(props2, {
5527
6117
  slots
5528
6118
  }) {
@@ -5534,16 +6124,16 @@
5534
6124
  }
5535
6125
  });
5536
6126
  const MChart = Chart;
5537
- const props$13 = {
6127
+ const props$12 = {
5538
6128
  tag: {
5539
6129
  type: String,
5540
6130
  default: "div"
5541
6131
  }
5542
6132
  };
5543
- const COMPONENT_NAME$1j = "vc-checkbox";
6133
+ const COMPONENT_NAME$1d = "vc-checkbox";
5544
6134
  const Checkbox = /* @__PURE__ */ vue.defineComponent({
5545
- name: COMPONENT_NAME$1j,
5546
- props: props$13,
6135
+ name: COMPONENT_NAME$1d,
6136
+ props: props$12,
5547
6137
  setup(props2, {
5548
6138
  slots
5549
6139
  }) {
@@ -5555,16 +6145,16 @@
5555
6145
  }
5556
6146
  });
5557
6147
  const MCheckbox = Checkbox;
5558
- const props$12 = {
6148
+ const props$11 = {
5559
6149
  tag: {
5560
6150
  type: String,
5561
6151
  default: "div"
5562
6152
  }
5563
6153
  };
5564
- const COMPONENT_NAME$1i = "vc-clipboard";
6154
+ const COMPONENT_NAME$1c = "vc-clipboard";
5565
6155
  const Clipboard = /* @__PURE__ */ vue.defineComponent({
5566
- name: COMPONENT_NAME$1i,
5567
- props: props$12,
6156
+ name: COMPONENT_NAME$1c,
6157
+ props: props$11,
5568
6158
  setup(props2, {
5569
6159
  slots
5570
6160
  }) {
@@ -5576,16 +6166,16 @@
5576
6166
  }
5577
6167
  });
5578
6168
  const MClipboard = Clipboard;
5579
- const props$11 = {
6169
+ const props$10 = {
5580
6170
  tag: {
5581
6171
  type: String,
5582
6172
  default: "div"
5583
6173
  }
5584
6174
  };
5585
- const COMPONENT_NAME$1h = "vc-collapse";
6175
+ const COMPONENT_NAME$1b = "vc-collapse";
5586
6176
  const Collapse = /* @__PURE__ */ vue.defineComponent({
5587
- name: COMPONENT_NAME$1h,
5588
- props: props$11,
6177
+ name: COMPONENT_NAME$1b,
6178
+ props: props$10,
5589
6179
  setup(props2, {
5590
6180
  slots
5591
6181
  }) {
@@ -5597,16 +6187,16 @@
5597
6187
  }
5598
6188
  });
5599
6189
  const MCollapse = Collapse;
5600
- const props$10 = {
6190
+ const props$$ = {
5601
6191
  tag: {
5602
6192
  type: String,
5603
6193
  default: "div"
5604
6194
  }
5605
6195
  };
5606
- const COMPONENT_NAME$1g = "vc-color-picker";
6196
+ const COMPONENT_NAME$1a = "vc-color-picker";
5607
6197
  const ColorPicker = /* @__PURE__ */ vue.defineComponent({
5608
- name: COMPONENT_NAME$1g,
5609
- props: props$10,
6198
+ name: COMPONENT_NAME$1a,
6199
+ props: props$$,
5610
6200
  setup(props2, {
5611
6201
  slots
5612
6202
  }) {
@@ -5618,16 +6208,16 @@
5618
6208
  }
5619
6209
  });
5620
6210
  const MColorPicker = ColorPicker;
5621
- const props$$ = {
6211
+ const props$_ = {
5622
6212
  tag: {
5623
6213
  type: String,
5624
6214
  default: "div"
5625
6215
  }
5626
6216
  };
5627
- const COMPONENT_NAME$1f = "vc-countdown";
6217
+ const COMPONENT_NAME$19 = "vc-countdown";
5628
6218
  const Countdown = /* @__PURE__ */ vue.defineComponent({
5629
- name: COMPONENT_NAME$1f,
5630
- props: props$$,
6219
+ name: COMPONENT_NAME$19,
6220
+ props: props$_,
5631
6221
  setup(props2, {
5632
6222
  slots
5633
6223
  }) {
@@ -5639,16 +6229,16 @@
5639
6229
  }
5640
6230
  });
5641
6231
  const MCountdown = Countdown;
5642
- const props$_ = {
6232
+ const props$Z = {
5643
6233
  render: {
5644
6234
  type: Function,
5645
6235
  default: () => null
5646
6236
  }
5647
6237
  };
5648
- const COMPONENT_NAME$1e = "vc-customer";
6238
+ const COMPONENT_NAME$18 = "vc-customer";
5649
6239
  const Customer = vue.defineComponent({
5650
- name: COMPONENT_NAME$1e,
5651
- props: props$_,
6240
+ name: COMPONENT_NAME$18,
6241
+ props: props$Z,
5652
6242
  setup(props2, context) {
5653
6243
  return () => vue.h(() => {
5654
6244
  return props2.render(context.attrs, context);
@@ -5656,16 +6246,16 @@
5656
6246
  }
5657
6247
  });
5658
6248
  const MCustomer = Customer;
5659
- const props$Z = {
6249
+ const props$Y = {
5660
6250
  tag: {
5661
6251
  type: String,
5662
6252
  default: "div"
5663
6253
  }
5664
6254
  };
5665
- const COMPONENT_NAME$1d = "vc-date-picker";
6255
+ const COMPONENT_NAME$17 = "vc-date-picker";
5666
6256
  const DatePicker = /* @__PURE__ */ vue.defineComponent({
5667
- name: COMPONENT_NAME$1d,
5668
- props: props$Z,
6257
+ name: COMPONENT_NAME$17,
6258
+ props: props$Y,
5669
6259
  setup(props2, {
5670
6260
  slots
5671
6261
  }) {
@@ -5677,16 +6267,16 @@
5677
6267
  }
5678
6268
  });
5679
6269
  const MDatePicker = DatePicker;
5680
- const props$Y = {
6270
+ const props$X = {
5681
6271
  tag: {
5682
6272
  type: String,
5683
6273
  default: "div"
5684
6274
  }
5685
6275
  };
5686
- const COMPONENT_NAME$1c = "vc-divider";
6276
+ const COMPONENT_NAME$16 = "vc-divider";
5687
6277
  const Divider = /* @__PURE__ */ vue.defineComponent({
5688
- name: COMPONENT_NAME$1c,
5689
- props: props$Y,
6278
+ name: COMPONENT_NAME$16,
6279
+ props: props$X,
5690
6280
  setup(props2, {
5691
6281
  slots
5692
6282
  }) {
@@ -5698,16 +6288,16 @@
5698
6288
  }
5699
6289
  });
5700
6290
  const MDivider = Divider;
5701
- const props$X = {
6291
+ const props$W = {
5702
6292
  tag: {
5703
6293
  type: String,
5704
6294
  default: "div"
5705
6295
  }
5706
6296
  };
5707
- const COMPONENT_NAME$1b = "vc-drawer";
6297
+ const COMPONENT_NAME$15 = "vc-drawer";
5708
6298
  const Drawer = /* @__PURE__ */ vue.defineComponent({
5709
- name: COMPONENT_NAME$1b,
5710
- props: props$X,
6299
+ name: COMPONENT_NAME$15,
6300
+ props: props$W,
5711
6301
  setup(props2, {
5712
6302
  slots
5713
6303
  }) {
@@ -5719,16 +6309,16 @@
5719
6309
  }
5720
6310
  });
5721
6311
  const MDrawer = Drawer;
5722
- const props$W = {
6312
+ const props$V = {
5723
6313
  tag: {
5724
6314
  type: String,
5725
6315
  default: "div"
5726
6316
  }
5727
6317
  };
5728
- const COMPONENT_NAME$1a = "vc-dropdown";
6318
+ const COMPONENT_NAME$14 = "vc-dropdown";
5729
6319
  const Dropdown = /* @__PURE__ */ vue.defineComponent({
5730
- name: COMPONENT_NAME$1a,
5731
- props: props$W,
6320
+ name: COMPONENT_NAME$14,
6321
+ props: props$V,
5732
6322
  setup(props2, {
5733
6323
  slots
5734
6324
  }) {
@@ -5740,16 +6330,16 @@
5740
6330
  }
5741
6331
  });
5742
6332
  const MDropdown = Dropdown;
5743
- const props$V = {
6333
+ const props$U = {
5744
6334
  tag: {
5745
6335
  type: String,
5746
6336
  default: "div"
5747
6337
  }
5748
6338
  };
5749
- const COMPONENT_NAME$19 = "vc-editor";
6339
+ const COMPONENT_NAME$13 = "vc-editor";
5750
6340
  const Editor = /* @__PURE__ */ vue.defineComponent({
5751
- name: COMPONENT_NAME$19,
5752
- props: props$V,
6341
+ name: COMPONENT_NAME$13,
6342
+ props: props$U,
5753
6343
  setup(props2, {
5754
6344
  slots
5755
6345
  }) {
@@ -5761,16 +6351,16 @@
5761
6351
  }
5762
6352
  });
5763
6353
  const MEditor = Editor;
5764
- const props$U = {
6354
+ const props$T = {
5765
6355
  tag: {
5766
6356
  type: String,
5767
6357
  default: "div"
5768
6358
  }
5769
6359
  };
5770
- const COMPONENT_NAME$18 = "vc-expand";
6360
+ const COMPONENT_NAME$12 = "vc-expand";
5771
6361
  const Expand = /* @__PURE__ */ vue.defineComponent({
5772
- name: COMPONENT_NAME$18,
5773
- props: props$U,
6362
+ name: COMPONENT_NAME$12,
6363
+ props: props$T,
5774
6364
  setup(props2, {
5775
6365
  slots
5776
6366
  }) {
@@ -5782,7 +6372,7 @@
5782
6372
  }
5783
6373
  });
5784
6374
  const MExpand = Expand;
5785
- const props$T = {
6375
+ const props$S = {
5786
6376
  tag: {
5787
6377
  type: String,
5788
6378
  default: "form"
@@ -5808,885 +6398,421 @@
5808
6398
  type: String,
5809
6399
  default: "right"
5810
6400
  },
5811
- autocomplete: {
5812
- type: String,
5813
- default: "off"
5814
- },
5815
- styleless: {
5816
- type: Boolean,
5817
- default: false
5818
- }
5819
- };
5820
- const useForm = (expose, options = {}) => {
5821
- const instance = vue.getCurrentInstance();
5822
- const props2 = instance.props;
5823
- const fields = [];
5824
- vue.provide("form", {
5825
- props: props2,
5826
- add: (field) => {
5827
- field && fields.push(field);
5828
- },
5829
- remove: (field) => {
5830
- field && fields.splice(fields.indexOf(field), 1);
5831
- }
5832
- });
5833
- const filterFields = (fields$) => {
5834
- return !fields$ ? fields : fields.filter((item) => fields$.includes(item.props.prop));
5835
- };
5836
- const getField = (prop) => {
5837
- const field = fields.find((item) => item.props.prop === prop);
5838
- if (!field) throw new VcError("form", "请选择有用的prop值");
5839
- return field;
5840
- };
5841
- const showToast = (msg) => {
5842
- props2.showMessage && options.throwToast?.(msg);
5843
- };
5844
- const sortErrors = async (errors) => {
5845
- const positions = await Promise.all(fields.map((item) => item.exposed.getPosition()));
5846
- try {
5847
- return [...errors].toSorted((a, b) => {
5848
- const aIndex = fields.findIndex((i) => i.props.prop === a.prop);
5849
- const bIndex = fields.findIndex((i) => i.props.prop === b.prop);
5850
- const aPosition = positions[aIndex];
5851
- const bPosition = positions[bIndex];
5852
- if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
5853
- return aPosition.left - bPosition.left;
5854
- });
5855
- } catch (e) {
5856
- return errors;
5857
- }
5858
- };
5859
- const scrollIntoView = (prop) => {
5860
- const field = getField(prop);
5861
- field.vnode?.el?.scrollIntoView?.({
5862
- behavior: "smooth",
5863
- block: "center"
5864
- });
5865
- };
5866
- const reset = (options$ = {}) => {
5867
- const { fields: fields$, original = {} } = options$;
5868
- filterFields(fields$).forEach((field) => {
5869
- let v;
5870
- try {
5871
- v = getPropByPath(original, field.props.prop).v;
5872
- } catch (e) {
5873
- }
5874
- field.exposed.reset(v);
5875
- });
5876
- };
5877
- const validate = async (options$ = {}) => {
5878
- const { scroll = true, fields: fields$ } = options$;
5879
- if (!fields.length) {
5880
- return;
5881
- }
5882
- const results = await Promise.allSettled(
5883
- filterFields(fields$).map((item) => item.exposed.validate(""))
5884
- );
5885
- const originErrors = results.filter((i) => i.status === "rejected").map((i) => i.reason);
5886
- if (!originErrors.length) return;
5887
- const errors = await sortErrors(originErrors);
5888
- showToast(errors[0].msg || errors[0].message);
5889
- scroll && scrollIntoView(errors[0].prop);
5890
- throw errors;
5891
- };
5892
- const validateField = async (prop, options$ = {}) => {
5893
- try {
5894
- await validate({
5895
- ...options$,
5896
- fields: [prop]
5897
- });
5898
- } catch (e) {
5899
- throw e[0];
5900
- }
5901
- };
5902
- expose({
5903
- reset,
5904
- validate,
5905
- // 单个操作
5906
- getField,
5907
- validateField
5908
- });
5909
- };
5910
- const COMPONENT_NAME$17 = "vc-form";
5911
- const Form = vue.defineComponent({
5912
- name: COMPONENT_NAME$17,
5913
- props: props$T,
5914
- setup(props2, { slots, expose }) {
5915
- useForm(expose);
5916
- return () => {
5917
- return vue.h(
5918
- props2.tag,
5919
- {
5920
- class: "vc-form",
5921
- autocomplete: props2.autocomplete
5922
- },
5923
- slots
5924
- );
5925
- };
5926
- }
5927
- });
5928
- const props$S = {
5929
- label: {
5930
- type: String,
5931
- default: ""
5932
- },
5933
- labelWidth: {
5934
- type: Number
5935
- },
5936
- prop: {
5937
- type: String
5938
- },
5939
- required: {
5940
- type: [Boolean, String],
5941
- default: false
5942
- },
5943
- error: {
5944
- type: String
5945
- },
5946
- rules: {
5947
- type: [Array, Object]
5948
- },
5949
- resetByRulesChanged: {
5950
- type: Boolean,
5951
- default: false
5952
- },
5953
- showMessage: {
5954
- type: Boolean,
5955
- default: true
5956
- },
5957
- labelFor: {
5958
- type: String
5959
- },
5960
- styleless: {
5961
- type: Boolean,
5962
- default: false
5963
- },
5964
- labelPosition: {
5965
- type: String,
5966
- default: "right"
5967
- },
5968
- contentStyle: String
5969
- };
5970
- const filterEmpty = (val) => {
5971
- if (val instanceof Array) {
5972
- val = val.filter((i) => i !== "");
6401
+ autocomplete: {
6402
+ type: String,
6403
+ default: "off"
6404
+ },
6405
+ styleless: {
6406
+ type: Boolean,
6407
+ default: false
5973
6408
  }
5974
- return val;
5975
- };
5976
- const toRules = (rules) => {
5977
- return rules instanceof Array ? rules : rules ? [rules] : [];
5978
6409
  };
5979
- const useFormItem = (expose) => {
5980
- const form = vue.inject("form");
6410
+ const useForm = (expose, options = {}) => {
5981
6411
  const instance = vue.getCurrentInstance();
5982
6412
  const props2 = instance.props;
5983
- const { slots } = instance;
5984
- if (!form?.props) {
5985
- throw new VcError("form-item", "form-item需要在form内使用");
5986
- }
5987
- const formItem = vue.inject("form-item", {});
5988
- const validateState = vue.ref("");
5989
- const validateMessage = vue.ref("");
5990
- let validateDisabled = false;
5991
- let initialValue;
5992
- const currentRules = vue.computed(() => {
5993
- const formRules = form.props.rules;
5994
- const formItemBindRules = toRules(props2.rules);
5995
- let formItemRules = formItemBindRules;
5996
- if (!formItemRules.length && formRules && props2.prop) {
5997
- try {
5998
- const key = props2.prop.replace(/\.[0-9]+\./g, ".");
5999
- const { v } = getPropByPath(formRules, key);
6000
- formItemRules = toRules(v);
6001
- } catch {
6002
- const rules = formRules[props2.prop];
6003
- formItemRules = toRules(rules);
6004
- }
6005
- }
6006
- return formItemRules;
6007
- });
6008
- const isRequired = vue.computed(() => {
6009
- if (!currentRules.value.length) {
6010
- return !!props2.required;
6011
- }
6012
- let required = false;
6013
- for (let i = 0; i < currentRules.value.length; i++) {
6014
- const rule = currentRules.value[i];
6015
- required = !!rule.required;
6016
- if (required) break;
6017
- }
6018
- return required;
6019
- });
6020
- const labelPosition = vue.computed(() => {
6021
- return props2.labelPosition || form.props.labelPosition;
6022
- });
6023
- const classes = vue.computed(() => {
6024
- return {
6025
- "is-require": isRequired.value,
6026
- "is-error": validateState.value === "error",
6027
- "is-validating": validateState.value === "validating",
6028
- "is-inline": form.props.inline,
6029
- "is-nest": isNest.value,
6030
- [`is-${labelPosition.value}`]: true
6031
- };
6032
- });
6033
- const isNest = vue.computed(() => {
6034
- return !!formItem.change;
6035
- });
6036
- const isNestLast = vue.ref(false);
6037
- const hasLabel = vue.computed(() => {
6038
- return !!props2.label || slots.label;
6039
- });
6040
- const labelStyle = vue.computed(() => {
6041
- const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : isNest.value ? 0 : form.props.labelWidth;
6042
- return {
6043
- width: labelPosition.value !== "top" && labelWidth && labelWidth > 0 ? `${labelWidth}px` : "auto",
6044
- textAlign: labelPosition.value === "top" ? "left" : labelPosition.value
6045
- };
6046
- });
6047
- const contentStyle = vue.computed(() => {
6048
- const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : form.props.labelWidth;
6049
- return [
6050
- {
6051
- marginLeft: !hasLabel.value && isNest.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
6052
- marginBottom: isNest.value && !isNestLast.value ? `20px` : 0
6053
- },
6054
- props2.contentStyle
6055
- ];
6056
- });
6057
- const isStyleless = vue.computed(() => {
6058
- return props2.styleless || form.props.styleless;
6059
- });
6060
- const fieldValue = vue.computed(() => {
6061
- const model = form.props.model;
6062
- if (!model || !props2.prop) {
6063
- return;
6064
- }
6065
- let path = props2.prop;
6066
- if (path.includes(":")) {
6067
- path = path.replace(/:/, ".");
6413
+ const fields = [];
6414
+ vue.provide("form", {
6415
+ props: props2,
6416
+ add: (field) => {
6417
+ field && fields.push(field);
6418
+ },
6419
+ remove: (field) => {
6420
+ field && fields.splice(fields.indexOf(field), 1);
6068
6421
  }
6069
- return getPropByPath(model, path).v;
6070
- });
6071
- const showError = vue.computed(() => {
6072
- return validateState.value === "error" && props2.showMessage && form.props.showMessage;
6073
6422
  });
6074
- vue.watch(
6075
- () => props2.error,
6076
- (v) => {
6077
- validateMessage.value = v || "";
6078
- validateState.value = v === "" ? "" : "error";
6079
- }
6080
- );
6081
- const reset = (v) => {
6082
- validateState.value = "";
6083
- validateMessage.value = "";
6084
- const model = form.props.model;
6085
- if (!props2.prop) return;
6086
- const { o, k } = getPropByPath(model, props2.prop);
6087
- if (!k) return;
6088
- validateDisabled = true;
6089
- o[k] = v !== null && v !== void 0 ? v : Array.isArray(fieldValue.value) ? [].concat(initialValue) : initialValue;
6090
- };
6091
- const validate = async (trigger) => {
6092
- if (!props2.prop) return;
6093
- let rules = currentRules.value.filter((rule) => !rule.trigger || rule.trigger.includes(trigger));
6094
- if (!rules.length) {
6095
- if (!props2.required) {
6096
- return;
6097
- } else {
6098
- rules = [{
6099
- required: true,
6100
- message: typeof props2.required === "string" ? props2.required : void 0
6101
- }];
6102
- }
6103
- }
6104
- validateState.value = "validating";
6105
- const descriptor = {};
6106
- descriptor[props2.prop] = rules;
6107
- const validator = new Validator(descriptor);
6108
- const model = {};
6109
- model[props2.prop] = filterEmpty(fieldValue.value);
6110
- try {
6111
- await validator.validate(model, { first: false });
6112
- validateState.value = "success";
6113
- validateMessage.value = "";
6114
- } catch (errors) {
6115
- validateState.value = "error";
6116
- validateMessage.value = errors[0].message;
6117
- throw {
6118
- prop: props2.prop,
6119
- message: validateMessage.value
6120
- };
6121
- }
6122
- validateDisabled = false;
6423
+ const filterFields = (fields$) => {
6424
+ return !fields$ ? fields : fields.filter((item) => fields$.includes(item.props.prop));
6123
6425
  };
6124
- const handleFieldBlur = () => {
6125
- if (!props2.prop) {
6126
- formItem.blur?.();
6127
- return;
6128
- }
6129
- validate("blur");
6426
+ const getField = (prop) => {
6427
+ const field = fields.find((item) => item.props.prop === prop);
6428
+ if (!field) throw new VcError("form", "请选择有用的prop值");
6429
+ return field;
6130
6430
  };
6131
- const handleFieldChange = () => {
6132
- if (!props2.prop) {
6133
- formItem.change?.();
6134
- return;
6135
- }
6136
- if (validateDisabled) {
6137
- validateDisabled = false;
6138
- return;
6139
- }
6140
- validate("change");
6431
+ const showToast = (msg) => {
6432
+ props2.showMessage && options.throwToast?.(msg);
6141
6433
  };
6142
- const getPosition = async () => {
6143
- let el2 = instance.vnode.el;
6434
+ const sortErrors = async (errors) => {
6435
+ const positions = await Promise.all(fields.map((item) => item.exposed.getPosition()));
6144
6436
  try {
6145
- while (el2 && !el2.getBoundingClientRect) {
6146
- el2 = el2.nextSibling;
6147
- }
6148
- ;
6149
- const rect = el2.getBoundingClientRect();
6150
- return {
6151
- top: rect.top,
6152
- left: rect.left
6153
- };
6437
+ return [...errors].toSorted((a, b) => {
6438
+ const aIndex = fields.findIndex((i) => i.props.prop === a.prop);
6439
+ const bIndex = fields.findIndex((i) => i.props.prop === b.prop);
6440
+ const aPosition = positions[aIndex];
6441
+ const bPosition = positions[bIndex];
6442
+ if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
6443
+ return aPosition.left - bPosition.left;
6444
+ });
6154
6445
  } catch (e) {
6155
- throw new VcError("form-item", "form-item位置计算错误");
6446
+ return errors;
6156
6447
  }
6157
6448
  };
6158
- const fields = vue.reactive([]);
6159
- vue.provide("form-item", {
6160
- fields,
6161
- blur: handleFieldBlur,
6162
- change: handleFieldChange,
6163
- message: validateMessage,
6164
- add: (field) => {
6165
- field && fields.push(field);
6166
- },
6167
- remove: (field) => {
6168
- field && fields.splice(fields.indexOf(field), 1);
6169
- }
6170
- });
6171
- vue.onMounted(() => {
6172
- if (props2.prop) {
6173
- form.add?.(instance);
6174
- initialValue = cloneDeep(fieldValue.value);
6175
- }
6176
- formItem.add?.(instance);
6177
- });
6178
- vue.onBeforeUnmount(() => {
6179
- form.remove?.(instance);
6180
- formItem.remove?.(instance);
6181
- });
6182
- vue.watch(
6183
- () => props2.rules,
6184
- () => {
6185
- props2.resetByRulesChanged && reset();
6449
+ const scrollIntoView = (prop) => {
6450
+ const field = getField(prop);
6451
+ field.vnode?.el?.scrollIntoView?.({
6452
+ behavior: "smooth",
6453
+ block: "center"
6454
+ });
6455
+ };
6456
+ const reset = (options$ = {}) => {
6457
+ const { fields: fields$, original = {} } = options$;
6458
+ filterFields(fields$).forEach((field) => {
6459
+ let v;
6460
+ try {
6461
+ v = getPropByPath(original, field.props.prop).v;
6462
+ } catch (e) {
6463
+ }
6464
+ field.exposed.reset(v);
6465
+ });
6466
+ };
6467
+ const validate = async (options$ = {}) => {
6468
+ const { scroll = true, fields: fields$ } = options$;
6469
+ if (!fields.length) {
6470
+ return;
6186
6471
  }
6187
- );
6188
- vue.watch(
6189
- () => formItem.fields?.length,
6190
- async (v) => {
6191
- if (!isNest.value || !v) return isNestLast.value = false;
6192
- const fields$ = [...vue.toRaw(formItem.fields)];
6193
- const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
6194
- const sortFields = fields$.toSorted((a, b) => {
6195
- const aIndex = fields$.findIndex((i) => i === a);
6196
- const bIndex = fields$.findIndex((i) => i === b);
6197
- const aPosition = positions[aIndex];
6198
- const bPosition = positions[bIndex];
6199
- if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
6200
- return aPosition.left - bPosition.left;
6472
+ const results = await Promise.allSettled(
6473
+ filterFields(fields$).map((item) => item.exposed.validate(""))
6474
+ );
6475
+ const originErrors = results.filter((i) => i.status === "rejected").map((i) => i.reason);
6476
+ if (!originErrors.length) return;
6477
+ const errors = await sortErrors(originErrors);
6478
+ showToast(errors[0].msg || errors[0].message);
6479
+ scroll && scrollIntoView(errors[0].prop);
6480
+ throw errors;
6481
+ };
6482
+ const validateField = async (prop, options$ = {}) => {
6483
+ try {
6484
+ await validate({
6485
+ ...options$,
6486
+ fields: [prop]
6201
6487
  });
6202
- isNestLast.value = sortFields[sortFields.length - 1] === instance;
6488
+ } catch (e) {
6489
+ throw e[0];
6203
6490
  }
6204
- );
6491
+ };
6205
6492
  expose({
6206
- validate,
6207
6493
  reset,
6208
- getPosition
6494
+ validate,
6495
+ // 单个操作
6496
+ getField,
6497
+ validateField
6209
6498
  });
6210
- return {
6211
- isNest,
6212
- isStyleless,
6213
- isNestLast,
6214
- validateMessage,
6215
- classes,
6216
- labelStyle,
6217
- contentStyle,
6218
- showError,
6219
- labelPosition
6220
- };
6221
6499
  };
6500
+ const COMPONENT_NAME$11 = "vc-form";
6501
+ const Form = vue.defineComponent({
6502
+ name: COMPONENT_NAME$11,
6503
+ props: props$S,
6504
+ setup(props2, { slots, expose }) {
6505
+ useForm(expose);
6506
+ return () => {
6507
+ return vue.h(
6508
+ props2.tag,
6509
+ {
6510
+ class: "vc-form",
6511
+ autocomplete: props2.autocomplete
6512
+ },
6513
+ slots
6514
+ );
6515
+ };
6516
+ }
6517
+ });
6222
6518
  const props$R = {
6223
- /**
6224
- * 进入/离开持续时间
6225
- * {enter: 300, leave: 300}
6226
- */
6227
- duration: {
6228
- type: [Number, Object],
6229
- default: 300
6519
+ label: {
6520
+ type: String,
6521
+ default: ""
6230
6522
  },
6231
- /**
6232
- * 进入/离开延迟时间
6233
- */
6234
- delay: {
6235
- type: [Number, Object],
6236
- default: 0
6523
+ labelWidth: {
6524
+ type: Number
6237
6525
  },
6238
- /**
6239
- * `transition-group` component.
6240
- */
6241
- group: Boolean,
6242
- /**
6243
- * `transition-group` tag, v3版本默认值无
6244
- */
6245
- tag: {
6246
- type: String,
6247
- default: void 0
6526
+ prop: {
6527
+ type: String
6248
6528
  },
6249
- /**
6250
- * 变换的初始位置, 可以用style代替, 更短~~
6251
- */
6252
- origin: {
6253
- type: String,
6254
- default: ""
6529
+ required: {
6530
+ type: [Boolean, String],
6531
+ default: false
6255
6532
  },
6256
- /**
6257
- * 在转换期间应用的元素样式。这些样式应用于@beforeEnter和@beforeLeave钩子
6258
- * inheritAttrs必须是false
6259
- */
6260
- style: {
6261
- type: Object,
6262
- default: () => {
6263
- return {
6264
- animationFillMode: "both",
6265
- animationTimingFunction: "ease-out"
6266
- };
6267
- }
6533
+ error: {
6534
+ type: String
6268
6535
  },
6269
- prefix: {
6270
- type: String,
6271
- default: "vc-transition"
6536
+ rules: {
6537
+ type: [Array, Object]
6272
6538
  },
6273
- mode: {
6539
+ resetByRulesChanged: {
6540
+ type: Boolean,
6541
+ default: false
6542
+ },
6543
+ showMessage: {
6544
+ type: Boolean,
6545
+ default: true
6546
+ },
6547
+ labelFor: {
6548
+ type: String
6549
+ },
6550
+ styleless: {
6551
+ type: Boolean,
6552
+ default: false
6553
+ },
6554
+ labelPosition: {
6274
6555
  type: String,
6275
- default: "none"
6556
+ default: "right"
6557
+ },
6558
+ contentStyle: String
6559
+ };
6560
+ const filterEmpty = (val) => {
6561
+ if (val instanceof Array) {
6562
+ val = val.filter((i) => i !== "");
6276
6563
  }
6564
+ return val;
6277
6565
  };
6278
- const trim = (str) => str.trim().replace(/\s+/g, " ");
6279
- const useTransition = () => {
6566
+ const toRules = (rules) => {
6567
+ return rules instanceof Array ? rules : rules ? [rules] : [];
6568
+ };
6569
+ const useFormItem = (expose) => {
6570
+ const form = vue.inject("form");
6280
6571
  const instance = vue.getCurrentInstance();
6281
- const attrs = instance.attrs;
6282
6572
  const props2 = instance.props;
6283
- const Wrapper = vue.computed(() => {
6284
- return props2.group ? vue.TransitionGroup : vue.Transition;
6573
+ const { slots } = instance;
6574
+ if (!form?.props) {
6575
+ throw new VcError("form-item", "form-item需要在form内使用");
6576
+ }
6577
+ const formItem = vue.inject("form-item", {});
6578
+ const validateState = vue.ref("");
6579
+ const validateMessage = vue.ref("");
6580
+ let validateDisabled = false;
6581
+ let initialValue;
6582
+ const currentRules = vue.computed(() => {
6583
+ const formRules = form.props.rules;
6584
+ const formItemBindRules = toRules(props2.rules);
6585
+ let formItemRules = formItemBindRules;
6586
+ if (!formItemRules.length && formRules && props2.prop) {
6587
+ try {
6588
+ const key = props2.prop.replace(/\.[0-9]+\./g, ".");
6589
+ const { v } = getPropByPath(formRules, key);
6590
+ formItemRules = toRules(v);
6591
+ } catch {
6592
+ const rules = formRules[props2.prop];
6593
+ formItemRules = toRules(rules);
6594
+ }
6595
+ }
6596
+ return formItemRules;
6597
+ });
6598
+ const isRequired = vue.computed(() => {
6599
+ if (!currentRules.value.length) {
6600
+ return !!props2.required;
6601
+ }
6602
+ let required = false;
6603
+ for (let i = 0; i < currentRules.value.length; i++) {
6604
+ const rule = currentRules.value[i];
6605
+ required = !!rule.required;
6606
+ if (required) break;
6607
+ }
6608
+ return required;
6609
+ });
6610
+ const labelPosition = vue.computed(() => {
6611
+ return props2.labelPosition || form.props.labelPosition;
6285
6612
  });
6286
6613
  const classes = vue.computed(() => {
6287
- const modeClass = props2.mode !== "none" ? `is-${props2.mode.replace(/-/g, " is-")}` : "";
6288
6614
  return {
6289
- enterActiveClass: trim(`${attrs.enterActiveClass || ""} ${props2.prefix} ${modeClass} is-in`),
6290
- leaveActiveClass: trim(`${attrs.leaveActiveClass || ""} ${props2.prefix} ${modeClass} is-out`),
6291
- moveClass: props2.group ? trim(`${attrs.moveClass || ""} ${props2.prefix} ${modeClass} is-move`) : void 0
6615
+ "is-require": isRequired.value,
6616
+ "is-error": validateState.value === "error",
6617
+ "is-validating": validateState.value === "validating",
6618
+ "is-inline": form.props.inline,
6619
+ "is-nest": isNest.value,
6620
+ [`is-${labelPosition.value}`]: true
6292
6621
  };
6293
6622
  });
6294
- const clearStyles = (el2) => {
6295
- Object.keys(props2.style).forEach((key) => {
6296
- const v = props2.style[key];
6297
- v && el2.style.removeProperty(
6298
- key.replace(/([A-Z])/g, "-$1").toLowerCase()
6299
- );
6300
- });
6301
- el2.style.removeProperty("animation-duration");
6302
- el2.style.removeProperty("animation-delay");
6303
- };
6304
- const resetAbsolute = (el2) => {
6305
- props2.group && (el2.style.position = "absolute");
6306
- };
6307
- const resetOrigin = (el2) => {
6308
- props2.origin && (el2.style.transformOrigin = props2.origin);
6309
- };
6310
- const resetStyles = (el2) => {
6311
- resetOrigin(el2);
6312
- Object.keys(props2.style).forEach((key) => {
6313
- const v = props2.style[key];
6314
- v && (el2.style[key] = v);
6315
- });
6316
- };
6317
- const handleBeforeEnter = (el2) => {
6318
- const duration = props2.duration.enter || props2.duration;
6319
- el2.style.animationDuration = `${duration}ms`;
6320
- const delay = props2.delay.enter || props2.delay;
6321
- el2.style.animationDelay = `${delay}ms`;
6322
- resetStyles(el2);
6323
- attrs.onBeforeEnter?.(el2);
6324
- };
6325
- const createNext = (callback, duration) => {
6326
- let hasDone = false;
6327
- return (immediate = true) => {
6328
- if (hasDone) return;
6329
- hasDone = true;
6330
- const done = () => callback?.();
6331
- immediate ? done() : setTimeout(done, duration);
6623
+ const isNest = vue.computed(() => {
6624
+ return !!formItem.change;
6625
+ });
6626
+ const isNestLast = vue.ref(false);
6627
+ const hasLabel = vue.computed(() => {
6628
+ return !!props2.label || slots.label;
6629
+ });
6630
+ const labelStyle = vue.computed(() => {
6631
+ const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : isNest.value ? 0 : form.props.labelWidth;
6632
+ return {
6633
+ width: labelPosition.value !== "top" && labelWidth && labelWidth > 0 ? `${labelWidth}px` : "auto",
6634
+ textAlign: labelPosition.value === "top" ? "left" : labelPosition.value
6332
6635
  };
6333
- };
6334
- const handleEnter = async (el2, done) => {
6335
- const duration = props2.duration.enter || props2.duration;
6336
- const next = createNext(done, duration);
6337
- try {
6338
- await attrs.onEnter?.(el2, next);
6339
- } finally {
6340
- next(false);
6636
+ });
6637
+ const contentStyle = vue.computed(() => {
6638
+ const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : form.props.labelWidth;
6639
+ return [
6640
+ {
6641
+ marginLeft: !hasLabel.value && isNest.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
6642
+ marginBottom: isNest.value && !isNestLast.value ? `20px` : 0
6643
+ },
6644
+ props2.contentStyle
6645
+ ];
6646
+ });
6647
+ const isStyleless = vue.computed(() => {
6648
+ return props2.styleless || form.props.styleless;
6649
+ });
6650
+ const fieldValue = vue.computed(() => {
6651
+ const model = form.props.model;
6652
+ if (!model || !props2.prop) {
6653
+ return;
6341
6654
  }
6655
+ let path = props2.prop;
6656
+ if (path.includes(":")) {
6657
+ path = path.replace(/:/, ".");
6658
+ }
6659
+ return getPropByPath(model, path).v;
6660
+ });
6661
+ const showError = vue.computed(() => {
6662
+ return validateState.value === "error" && props2.showMessage && form.props.showMessage;
6663
+ });
6664
+ vue.watch(
6665
+ () => props2.error,
6666
+ (v) => {
6667
+ validateMessage.value = v || "";
6668
+ validateState.value = v === "" ? "" : "error";
6669
+ }
6670
+ );
6671
+ const reset = (v) => {
6672
+ validateState.value = "";
6673
+ validateMessage.value = "";
6674
+ const model = form.props.model;
6675
+ if (!props2.prop) return;
6676
+ const { o, k } = getPropByPath(model, props2.prop);
6677
+ if (!k) return;
6678
+ validateDisabled = true;
6679
+ o[k] = v !== null && v !== void 0 ? v : Array.isArray(fieldValue.value) ? [].concat(initialValue) : initialValue;
6342
6680
  };
6343
- const handleAfterEnter = (el2) => {
6344
- clearStyles(el2);
6345
- attrs.onAfterEnter?.(el2);
6346
- };
6347
- const handleBeforeLeave = (el2) => {
6348
- const duration = props2.duration.leave || props2.duration;
6349
- el2.style.animationDuration = `${duration}ms`;
6350
- const delay = props2.delay.leave || props2.delay;
6351
- el2.style.animationDelay = `${delay}ms`;
6352
- resetStyles(el2);
6353
- attrs.onBeforeLeave?.(el2);
6354
- };
6355
- const handleLeave = async (el2, done) => {
6356
- const duration = props2.duration.leave || props2.duration;
6357
- const next = createNext(done, duration);
6681
+ const validate = async (trigger) => {
6682
+ if (!props2.prop) return;
6683
+ let rules = currentRules.value.filter((rule) => !rule.trigger || rule.trigger.includes(trigger));
6684
+ if (!rules.length) {
6685
+ if (!props2.required) {
6686
+ return;
6687
+ } else {
6688
+ rules = [{
6689
+ required: true,
6690
+ message: typeof props2.required === "string" ? props2.required : void 0
6691
+ }];
6692
+ }
6693
+ }
6694
+ validateState.value = "validating";
6695
+ const descriptor = {};
6696
+ descriptor[props2.prop] = rules;
6697
+ const validator = new Validator(descriptor);
6698
+ const model = {};
6699
+ model[props2.prop] = filterEmpty(fieldValue.value);
6358
6700
  try {
6359
- resetAbsolute(el2);
6360
- await attrs.onLeave?.(el2, next);
6361
- } finally {
6362
- next(props2.group ? true : false);
6701
+ await validator.validate(model, { first: false });
6702
+ validateState.value = "success";
6703
+ validateMessage.value = "";
6704
+ } catch (errors) {
6705
+ validateState.value = "error";
6706
+ validateMessage.value = errors[0].message;
6707
+ throw {
6708
+ prop: props2.prop,
6709
+ message: validateMessage.value
6710
+ };
6363
6711
  }
6712
+ validateDisabled = false;
6364
6713
  };
6365
- const handleAfterLeave = (el2) => {
6366
- clearStyles(el2);
6367
- attrs.onAfterLeave?.(el2);
6714
+ const handleFieldBlur = () => {
6715
+ if (!props2.prop) {
6716
+ formItem.blur?.();
6717
+ return;
6718
+ }
6719
+ validate("blur");
6368
6720
  };
6369
- return {
6370
- Wrapper,
6371
- resetStyles,
6372
- resetAbsolute,
6373
- classes,
6374
- createNext,
6375
- listeners: {
6376
- onBeforeEnter: handleBeforeEnter,
6377
- onEnter: handleEnter,
6378
- onAfterEnter: handleAfterEnter,
6379
- onBeforeLeave: handleBeforeLeave,
6380
- onLeave: handleLeave,
6381
- onAfterLeave: handleAfterLeave
6721
+ const handleFieldChange = () => {
6722
+ if (!props2.prop) {
6723
+ formItem.change?.();
6724
+ return;
6725
+ }
6726
+ if (validateDisabled) {
6727
+ validateDisabled = false;
6728
+ return;
6382
6729
  }
6730
+ validate("change");
6383
6731
  };
6384
- };
6385
- const COMPONENT_NAME$16 = "vc-transition";
6386
- const Transition = vue.defineComponent({
6387
- name: COMPONENT_NAME$16,
6388
- props: props$R,
6389
- // 当不声明emits的情况下,事件存在于attrs中
6390
- inheritAttrs: false,
6391
- setup(props2, { slots, attrs }) {
6392
- const { Wrapper, listeners, classes } = useTransition();
6393
- return () => {
6394
- return vue.h(
6395
- Wrapper.value,
6396
- {
6397
- ...attrs,
6398
- ...listeners,
6399
- ...classes.value,
6400
- tag: props2.tag
6401
- },
6402
- slots
6403
- );
6404
- };
6405
- }
6406
- });
6407
- const COMPONENT_NAME$15 = "vc-transition-collapse";
6408
- const TransitionCollapse = vue.defineComponent({
6409
- name: COMPONENT_NAME$15,
6410
- props: props$R,
6411
- // 当不声明emits的情况下,事件存在于attrs中
6412
- inheritAttrs: false,
6413
- setup(props2, { slots, attrs: _attrs }) {
6414
- const attrs = _attrs;
6415
- const { Wrapper, resetStyles, resetAbsolute, createNext } = useTransition();
6416
- const getTransitionStyle = (duration) => {
6417
- const style = `
6418
- ${duration}ms height ease-in-out,
6419
- ${duration}ms padding-top ease-in-out,
6420
- ${duration}ms padding-bottom ease-in-out
6421
- `;
6422
- return style;
6423
- };
6424
- const handleBeforeEnter = (el2) => {
6425
- const duration = props2.duration.enter || props2.duration;
6426
- el2.style.transition = getTransitionStyle(duration);
6427
- /* istanbul ignore next -- @preserve */
6428
- if (!el2.dataset) {
6429
- el2.dataset = {};
6430
- }
6431
- el2.dataset.oldPaddingTop = el2.style.paddingTop;
6432
- el2.dataset.oldPaddingBottom = el2.style.paddingBottom;
6433
- el2.style.height = "0px";
6434
- el2.style.paddingTop = "0px";
6435
- el2.style.paddingBottom = "0px";
6436
- resetStyles(el2);
6437
- attrs.onBeforeEnter?.(el2);
6438
- };
6439
- const handleEnter = async (el2, done) => {
6440
- const duration = props2.duration.enter || props2.duration;
6441
- const next = createNext(done, duration);
6442
- try {
6443
- el2.dataset.oldOverflow = el2.style.overflow;
6444
- /* istanbul ignore next -- @preserve */
6445
- if (el2.scrollHeight !== 0) {
6446
- el2.style.height = el2.scrollHeight + "px";
6447
- el2.style.paddingTop = el2.dataset.oldPaddingTop + "px";
6448
- el2.style.paddingBottom = el2.dataset.oldPaddingBottom + "px";
6449
- } else {
6450
- el2.style.height = "";
6451
- el2.style.paddingTop = el2.dataset.oldPaddingTop + "px";
6452
- el2.style.paddingBottom = el2.dataset.oldPaddingBottom + "px";
6453
- }
6454
- el2.style.overflow = "hidden";
6455
- attrs.onEnter?.(el2);
6456
- } finally {
6457
- next(false);
6458
- }
6459
- };
6460
- const handleAfterEnter = (el2) => {
6461
- el2.style.transition = "";
6462
- el2.style.height = "";
6463
- el2.style.overflow = el2.dataset.oldOverflow || "";
6464
- attrs.onAfterEnter?.(el2);
6465
- };
6466
- const handleBeforeLeave = (el2) => {
6467
- /* istanbul ignore next -- @preserve */
6468
- if (!el2.dataset) {
6469
- el2.dataset = {};
6470
- }
6471
- el2.dataset.oldPaddingTop = el2.style.paddingTop;
6472
- el2.dataset.oldPaddingBottom = el2.style.paddingBottom;
6473
- el2.dataset.oldOverflow = el2.style.overflow;
6474
- el2.style.height = el2.scrollHeight + "px";
6475
- el2.style.overflow = "hidden";
6476
- resetStyles(el2);
6477
- attrs.onBeforeLeave?.(el2);
6478
- };
6479
- const handleLeave = (el2, done) => {
6480
- const duration = props2.duration.leave || props2.duration;
6481
- const next = createNext(done, duration);
6482
- try {
6483
- const leaveDuration = props2.duration.leave || props2.duration;
6484
- /* istanbul ignore next -- @preserve */
6485
- if (el2.scrollHeight !== 0) {
6486
- el2.style.transition = getTransitionStyle(leaveDuration);
6487
- el2.style.height = "0px";
6488
- el2.style.paddingTop = "0px";
6489
- el2.style.paddingBottom = "0px";
6490
- }
6491
- resetAbsolute(el2);
6492
- attrs.onLeave?.(el2);
6493
- } finally {
6494
- next(props2.group ? true : false);
6732
+ const getPosition = async () => {
6733
+ let el2 = instance.vnode.el;
6734
+ try {
6735
+ while (el2 && !el2.getBoundingClientRect) {
6736
+ el2 = el2.nextSibling;
6495
6737
  }
6496
- };
6497
- const handleAfterLeave = (el2) => {
6498
- el2.style.transition = "";
6499
- el2.style.height = "";
6500
- el2.style.overflow = el2.dataset.oldOverflow || "";
6501
- el2.style.paddingTop = el2.dataset.oldPaddingTop || "";
6502
- el2.style.paddingBottom = el2.dataset.oldPaddingBottom || "";
6503
- attrs.onAfterLeave?.(el2);
6504
- };
6505
- const listeners = {
6506
- onBeforeEnter: handleBeforeEnter,
6507
- onEnter: handleEnter,
6508
- onAfterEnter: handleAfterEnter,
6509
- onBeforeLeave: handleBeforeLeave,
6510
- onLeave: handleLeave,
6511
- onAfterLeave: handleAfterLeave
6512
- };
6513
- return () => {
6514
- return vue.h(
6515
- Wrapper.value,
6516
- {
6517
- ...attrs,
6518
- ...listeners,
6519
- tag: props2.tag,
6520
- moveClass: props2.group ? `${attrs.moveClass || ""} vc-transition-collapse is-move` : void 0
6521
- },
6522
- slots
6523
- );
6524
- };
6525
- }
6526
- });
6527
- const COMPONENT_NAME$14 = "vc-transition-fade";
6528
- const TransitionFade = vue.defineComponent({
6529
- name: COMPONENT_NAME$14,
6530
- props: {
6531
- ...props$R,
6532
- // inheritAttrs必须是false
6533
- style: {
6534
- type: Object,
6535
- default: () => ({
6536
- animationFillMode: "both",
6537
- animationTimingFunction: void 0
6538
- })
6539
- },
6540
- prefix: {
6541
- type: String,
6542
- default: "vc-transition-fade"
6738
+ ;
6739
+ const rect = el2.getBoundingClientRect();
6740
+ return {
6741
+ top: rect.top,
6742
+ left: rect.left
6743
+ };
6744
+ } catch (e) {
6745
+ throw new VcError("form-item", "form-item位置计算错误");
6543
6746
  }
6544
- },
6545
- // 当不声明emits的情况下,事件存在于attrs中
6546
- inheritAttrs: false,
6547
- setup(props2, { slots, attrs }) {
6548
- const { Wrapper, listeners, classes } = useTransition();
6549
- return () => {
6550
- return vue.h(
6551
- Wrapper.value,
6552
- {
6553
- ...attrs,
6554
- ...listeners,
6555
- ...classes.value,
6556
- tag: props2.tag
6557
- },
6558
- slots
6559
- );
6560
- };
6561
- }
6562
- });
6563
- const COMPONENT_NAME$13 = "vc-transition-scale";
6564
- const TransitionScale = vue.defineComponent({
6565
- name: COMPONENT_NAME$13,
6566
- props: {
6567
- ...props$R,
6568
- mode: {
6569
- type: String,
6570
- default: "both",
6571
- validator: (v) => /(part|both|y|x|none)/.test(v)
6572
- },
6573
- // inheritAttrs必须是false
6574
- style: {
6575
- type: Object,
6576
- default: () => ({
6577
- animationFillMode: "both",
6578
- animationTimingFunction: void 0
6579
- })
6747
+ };
6748
+ const fields = vue.reactive([]);
6749
+ vue.provide("form-item", {
6750
+ fields,
6751
+ blur: handleFieldBlur,
6752
+ change: handleFieldChange,
6753
+ message: validateMessage,
6754
+ add: (field) => {
6755
+ field && fields.push(field);
6580
6756
  },
6581
- prefix: {
6582
- type: String,
6583
- default: "vc-transition-scale"
6757
+ remove: (field) => {
6758
+ field && fields.splice(fields.indexOf(field), 1);
6584
6759
  }
6585
- },
6586
- // 当不声明emits的情况下,事件存在于attrs中
6587
- inheritAttrs: false,
6588
- setup(props2, { slots, attrs }) {
6589
- const { Wrapper, listeners, classes } = useTransition();
6590
- return () => {
6591
- return vue.h(
6592
- Wrapper.value,
6593
- {
6594
- ...attrs,
6595
- ...listeners,
6596
- ...classes.value,
6597
- tag: props2.tag
6598
- },
6599
- slots
6600
- );
6601
- };
6602
- }
6603
- });
6604
- const COMPONENT_NAME$12 = "vc-transition-slide";
6605
- const TransitionSlide = vue.defineComponent({
6606
- name: COMPONENT_NAME$12,
6607
- props: {
6608
- ...props$R,
6609
- mode: {
6610
- type: String,
6611
- default: "left",
6612
- validator: (v) => /^(left|right|down|up|none)(|-part)$/.test(v)
6613
- },
6614
- // inheritAttrs必须是false
6615
- style: {
6616
- type: Object,
6617
- default: () => ({
6618
- animationFillMode: "both",
6619
- animationTimingFunction: void 0
6620
- })
6621
- },
6622
- prefix: {
6623
- type: String,
6624
- default: "vc-transition-slide"
6760
+ });
6761
+ vue.onMounted(() => {
6762
+ if (props2.prop) {
6763
+ form.add?.(instance);
6764
+ initialValue = cloneDeep(fieldValue.value);
6625
6765
  }
6626
- },
6627
- // 当不声明emits的情况下,事件存在于attrs中
6628
- inheritAttrs: false,
6629
- setup(props2, { slots, attrs }) {
6630
- const { Wrapper, listeners, classes } = useTransition();
6631
- return () => {
6632
- return vue.h(
6633
- Wrapper.value,
6634
- {
6635
- ...attrs,
6636
- ...listeners,
6637
- ...classes.value,
6638
- tag: props2.tag
6639
- },
6640
- slots
6641
- );
6642
- };
6643
- }
6644
- });
6645
- const COMPONENT_NAME$11 = "vc-transition-zoom";
6646
- const TransitionZoom = vue.defineComponent({
6647
- name: COMPONENT_NAME$11,
6648
- props: {
6649
- ...props$R,
6650
- mode: {
6651
- type: String,
6652
- default: "x",
6653
- validator: (v) => /^(x|y|center|none)$/.test(v)
6654
- },
6655
- // inheritAttrs必须是false
6656
- style: {
6657
- type: Object,
6658
- default: () => ({
6659
- animationFillMode: "both",
6660
- animationTimingFunction: void 0
6661
- })
6662
- },
6663
- prefix: {
6664
- type: String,
6665
- default: "vc-transition-zoom"
6766
+ formItem.add?.(instance);
6767
+ });
6768
+ vue.onBeforeUnmount(() => {
6769
+ form.remove?.(instance);
6770
+ formItem.remove?.(instance);
6771
+ });
6772
+ vue.watch(
6773
+ () => props2.rules,
6774
+ () => {
6775
+ props2.resetByRulesChanged && reset();
6666
6776
  }
6667
- },
6668
- // 当不声明emits的情况下,事件存在于attrs中
6669
- inheritAttrs: false,
6670
- setup(props2, { slots, attrs }) {
6671
- const { Wrapper, listeners, classes } = useTransition();
6672
- return () => {
6673
- return vue.h(
6674
- Wrapper.value,
6675
- {
6676
- ...attrs,
6677
- ...listeners,
6678
- ...classes.value,
6679
- tag: props2.tag
6680
- },
6681
- slots
6682
- );
6683
- };
6684
- }
6685
- });
6777
+ );
6778
+ vue.watch(
6779
+ () => formItem.fields?.length,
6780
+ async (v) => {
6781
+ if (!isNest.value || !v) return isNestLast.value = false;
6782
+ const fields$ = [...vue.toRaw(formItem.fields)];
6783
+ const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
6784
+ const sortFields = fields$.toSorted((a, b) => {
6785
+ const aIndex = fields$.findIndex((i) => i === a);
6786
+ const bIndex = fields$.findIndex((i) => i === b);
6787
+ const aPosition = positions[aIndex];
6788
+ const bPosition = positions[bIndex];
6789
+ if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
6790
+ return aPosition.left - bPosition.left;
6791
+ });
6792
+ isNestLast.value = sortFields[sortFields.length - 1] === instance;
6793
+ }
6794
+ );
6795
+ expose({
6796
+ validate,
6797
+ reset,
6798
+ getPosition
6799
+ });
6800
+ return {
6801
+ isNest,
6802
+ isStyleless,
6803
+ isNestLast,
6804
+ validateMessage,
6805
+ classes,
6806
+ labelStyle,
6807
+ contentStyle,
6808
+ showError,
6809
+ labelPosition
6810
+ };
6811
+ };
6686
6812
  const COMPONENT_NAME$10 = "vc-form-item";
6687
6813
  const FormItem = /* @__PURE__ */ vue.defineComponent({
6688
6814
  name: COMPONENT_NAME$10,
6689
- props: props$S,
6815
+ props: props$R,
6690
6816
  setup(props2, {
6691
6817
  slots,
6692
6818
  expose
@@ -6738,7 +6864,7 @@
6738
6864
  }
6739
6865
  });
6740
6866
  const props$Q = {
6741
- ...props$T,
6867
+ ...props$S,
6742
6868
  showToast: {
6743
6869
  type: Boolean,
6744
6870
  default: false
@@ -7216,7 +7342,7 @@
7216
7342
  }
7217
7343
  });
7218
7344
  const props$N = {
7219
- ...props$S,
7345
+ ...props$R,
7220
7346
  indent: {
7221
7347
  type: Number,
7222
7348
  default: 12
@@ -9747,7 +9873,8 @@
9747
9873
  emits: ["portal-fulfilled", "close"],
9748
9874
  setup(props2, {
9749
9875
  emit,
9750
- slots
9876
+ slots,
9877
+ expose
9751
9878
  }) {
9752
9879
  const {
9753
9880
  getPopupStyle,
@@ -9920,6 +10047,9 @@
9920
10047
  Resize.off(vnode.el, handleWrapperResize);
9921
10048
  props2.alone && props2.hover && removeEvents();
9922
10049
  });
10050
+ expose({
10051
+ isActive
10052
+ });
9923
10053
  return () => {
9924
10054
  let _slot;
9925
10055
  return vue.createVNode(TransitionScale, {
@@ -12457,8 +12587,7 @@
12457
12587
  install: (app) => {
12458
12588
  app.config.globalProperties.$vc = VcInstance.configure(options);
12459
12589
  Object.keys(Components).forEach((key) => {
12460
- key = transfromComponentKey(key) || key;
12461
- app.component(key, Components[key]);
12590
+ app.component(transfromComponentKey(key) || key, Components[key]);
12462
12591
  });
12463
12592
  }
12464
12593
  };