@deot/vc 1.0.6 → 1.0.7

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.
@@ -3693,138 +3693,6 @@ var Vc = (function (exports, vue) {
3693
3693
  return flatten(value, JSON.parse);
3694
3694
  };
3695
3695
 
3696
- class Validator {
3697
- static falsy = [void 0, null, ""];
3698
- rules = {};
3699
- paths;
3700
- original;
3701
- constructor(rules, paths, original) {
3702
- this.updateRules(rules);
3703
- this.paths = paths || [];
3704
- this.original = original;
3705
- }
3706
- /**
3707
- * 构建统一规则类型的Rule[], 也可供外部使用
3708
- * @param rules ~
3709
- */
3710
- updateRules(rules) {
3711
- if (!rules)
3712
- return;
3713
- Object.keys(rules).forEach((field) => {
3714
- const rule = rules[field];
3715
- this.rules[field] = (Array.isArray(rule) ? rule : [rule]).map((rule$) => {
3716
- if (typeof rule$ === "function") {
3717
- return { validate: rule$ };
3718
- }
3719
- if (typeof rule$ === "string" || rule$ instanceof RegExp) {
3720
- rule$ = { pattern: rule$ };
3721
- }
3722
- if (typeof rule$ === "boolean") {
3723
- rule$ = { required: rule$ };
3724
- }
3725
- const { validate, pattern, required, enum: enum$ = [] } = rule$;
3726
- if (validate && rule$.fields) {
3727
- rule$.fields = void 0;
3728
- }
3729
- if (!validate && pattern) {
3730
- const pattern$ = typeof pattern === "string" ? new RegExp(pattern) : pattern;
3731
- return {
3732
- ...rule$,
3733
- validate: (v) => pattern$.test(v)
3734
- };
3735
- }
3736
- if (!validate && required) {
3737
- return {
3738
- ...rule$,
3739
- validate: (v) => Array.isArray(v) ? !!v.length && v.every((j) => Validator.falsy.every((i) => j !== i)) : Validator.falsy.every((i) => v !== i)
3740
- };
3741
- }
3742
- if (!validate && enum$.length) {
3743
- return {
3744
- ...rule$,
3745
- validate: (v) => enum$.some((i) => v === i)
3746
- };
3747
- }
3748
- return rule$;
3749
- });
3750
- });
3751
- }
3752
- async validate(source, options) {
3753
- options = options || {};
3754
- if (!Object.keys(this.rules).length) {
3755
- return;
3756
- }
3757
- const needCheckFields = options.fields || Object.keys(this.rules);
3758
- const errors = [];
3759
- for (let i = 0; i < needCheckFields.length; i++) {
3760
- const field = needCheckFields[i];
3761
- const rules = this.rules[field];
3762
- const value = source[field];
3763
- const original = this.original;
3764
- for (let j = 0; j < rules.length; j++) {
3765
- const rule = rules[j];
3766
- const { validate = () => {
3767
- }, transform = (x) => x, fields: fields$ } = rule;
3768
- const paths = [...this.paths, field];
3769
- if (typeof options._index !== "undefined") {
3770
- paths.splice(paths.length - 1, 0, options._index);
3771
- }
3772
- const value$ = transform(value, { field, source, paths, original });
3773
- if (fields$) {
3774
- const isArray = Array.isArray(value$);
3775
- const value$$ = isArray ? value$ : [value$];
3776
- if (value$$.every((v) => v && typeof v === "object")) {
3777
- const validator = new Validator(fields$, paths);
3778
- for (let k = 0; k < value$$.length; k++) {
3779
- try {
3780
- await validator.validate(value$$[k], { _index: isArray ? k : void 0, first: options.first, original });
3781
- } catch (errors$) {
3782
- errors.push(...errors$);
3783
- if (errors$.length && options.first)
3784
- break;
3785
- }
3786
- }
3787
- continue;
3788
- }
3789
- }
3790
- let result = validate(value$, { field, source, paths, original });
3791
- let message$ = "";
3792
- if (result instanceof Promise) {
3793
- try {
3794
- await result;
3795
- } catch (e) {
3796
- result = false;
3797
- message$ = e.message || e;
3798
- }
3799
- } else if (typeof result === "string") {
3800
- message$ = result;
3801
- result = false;
3802
- }
3803
- if (result === false) {
3804
- errors.push({
3805
- paths,
3806
- message: message$ || rule.message || "",
3807
- field,
3808
- value: value$
3809
- });
3810
- if (options.first)
3811
- break;
3812
- }
3813
- }
3814
- if (errors.length && options.first)
3815
- break;
3816
- }
3817
- if (errors.length) {
3818
- const errors$ = errors.map((i) => {
3819
- const { message, ...extra } = i;
3820
- i.message = typeof message === "function" ? message(extra) : message;
3821
- return i;
3822
- });
3823
- return Promise.reject(errors$);
3824
- }
3825
- }
3826
- }
3827
-
3828
3696
  const IS_SERVER$2 = typeof window === "undefined";
3829
3697
 
3830
3698
  const composedPath = (e) => {
@@ -3966,6 +3834,138 @@ var Vc = (function (exports, vue) {
3966
3834
  };
3967
3835
  };
3968
3836
 
3837
+ class Validator {
3838
+ static falsy = [void 0, null, ""];
3839
+ rules = {};
3840
+ paths;
3841
+ original;
3842
+ constructor(rules, paths, original) {
3843
+ this.updateRules(rules);
3844
+ this.paths = paths || [];
3845
+ this.original = original;
3846
+ }
3847
+ /**
3848
+ * 构建统一规则类型的Rule[], 也可供外部使用
3849
+ * @param rules ~
3850
+ */
3851
+ updateRules(rules) {
3852
+ if (!rules)
3853
+ return;
3854
+ Object.keys(rules).forEach((field) => {
3855
+ const rule = rules[field];
3856
+ this.rules[field] = (Array.isArray(rule) ? rule : [rule]).map((rule$) => {
3857
+ if (typeof rule$ === "function") {
3858
+ return { validate: rule$ };
3859
+ }
3860
+ if (typeof rule$ === "string" || rule$ instanceof RegExp) {
3861
+ rule$ = { pattern: rule$ };
3862
+ }
3863
+ if (typeof rule$ === "boolean") {
3864
+ rule$ = { required: rule$ };
3865
+ }
3866
+ const { validate, pattern, required, enum: enum$ = [] } = rule$;
3867
+ if (validate && rule$.fields) {
3868
+ rule$.fields = void 0;
3869
+ }
3870
+ if (!validate && pattern) {
3871
+ const pattern$ = typeof pattern === "string" ? new RegExp(pattern) : pattern;
3872
+ return {
3873
+ ...rule$,
3874
+ validate: (v) => pattern$.test(v)
3875
+ };
3876
+ }
3877
+ if (!validate && required) {
3878
+ return {
3879
+ ...rule$,
3880
+ validate: (v) => Array.isArray(v) ? !!v.length && v.every((j) => Validator.falsy.every((i) => j !== i)) : Validator.falsy.every((i) => v !== i)
3881
+ };
3882
+ }
3883
+ if (!validate && enum$.length) {
3884
+ return {
3885
+ ...rule$,
3886
+ validate: (v) => enum$.some((i) => v === i)
3887
+ };
3888
+ }
3889
+ return rule$;
3890
+ });
3891
+ });
3892
+ }
3893
+ async validate(source, options) {
3894
+ options = options || {};
3895
+ if (!Object.keys(this.rules).length) {
3896
+ return;
3897
+ }
3898
+ const needCheckFields = options.fields || Object.keys(this.rules);
3899
+ const errors = [];
3900
+ for (let i = 0; i < needCheckFields.length; i++) {
3901
+ const field = needCheckFields[i];
3902
+ const rules = this.rules[field];
3903
+ const value = source[field];
3904
+ const original = this.original;
3905
+ for (let j = 0; j < rules.length; j++) {
3906
+ const rule = rules[j];
3907
+ const { validate = () => {
3908
+ }, transform = (x) => x, fields: fields$ } = rule;
3909
+ const paths = [...this.paths, field];
3910
+ if (typeof options._index !== "undefined") {
3911
+ paths.splice(paths.length - 1, 0, options._index);
3912
+ }
3913
+ const value$ = transform(value, { field, source, paths, original });
3914
+ if (fields$) {
3915
+ const isArray = Array.isArray(value$);
3916
+ const value$$ = isArray ? value$ : [value$];
3917
+ if (value$$.every((v) => v && typeof v === "object")) {
3918
+ const validator = new Validator(fields$, paths);
3919
+ for (let k = 0; k < value$$.length; k++) {
3920
+ try {
3921
+ await validator.validate(value$$[k], { _index: isArray ? k : void 0, first: options.first, original });
3922
+ } catch (errors$) {
3923
+ errors.push(...errors$);
3924
+ if (errors$.length && options.first)
3925
+ break;
3926
+ }
3927
+ }
3928
+ continue;
3929
+ }
3930
+ }
3931
+ let result = validate(value$, { field, source, paths, original });
3932
+ let message$ = "";
3933
+ if (result instanceof Promise) {
3934
+ try {
3935
+ await result;
3936
+ } catch (e) {
3937
+ result = false;
3938
+ message$ = e.message || e;
3939
+ }
3940
+ } else if (typeof result === "string") {
3941
+ message$ = result;
3942
+ result = false;
3943
+ }
3944
+ if (result === false) {
3945
+ errors.push({
3946
+ paths,
3947
+ message: message$ || rule.message || "",
3948
+ field,
3949
+ value: value$
3950
+ });
3951
+ if (options.first)
3952
+ break;
3953
+ }
3954
+ }
3955
+ if (errors.length && options.first)
3956
+ break;
3957
+ }
3958
+ if (errors.length) {
3959
+ const errors$ = errors.map((i) => {
3960
+ const { message, ...extra } = i;
3961
+ i.message = typeof message === "function" ? message(extra) : message;
3962
+ return i;
3963
+ });
3964
+ return Promise.reject(errors$);
3965
+ }
3966
+ }
3967
+ }
3968
+
3969
3969
  class ACache {
3970
3970
  options;
3971
3971
  constructor() {
@@ -5412,16 +5412,16 @@ var Vc = (function (exports, vue) {
5412
5412
  }
5413
5413
  }
5414
5414
  const VcInstance = new Instance();
5415
- const props$1h = {
5415
+ const props$1j = {
5416
5416
  tag: {
5417
5417
  type: String,
5418
5418
  default: "div"
5419
5419
  }
5420
5420
  };
5421
- const COMPONENT_NAME$1x = "vc-action-sheet";
5421
+ const COMPONENT_NAME$1A = "vc-action-sheet";
5422
5422
  const ActionSheet = /* @__PURE__ */ vue.defineComponent({
5423
- name: COMPONENT_NAME$1x,
5424
- props: props$1h,
5423
+ name: COMPONENT_NAME$1A,
5424
+ props: props$1j,
5425
5425
  setup(props2, {
5426
5426
  slots
5427
5427
  }) {
@@ -5433,7 +5433,7 @@ var Vc = (function (exports, vue) {
5433
5433
  }
5434
5434
  });
5435
5435
  const MActionSheet = ActionSheet;
5436
- const props$1g = {
5436
+ const props$1i = {
5437
5437
  modelValue: {
5438
5438
  type: Boolean,
5439
5439
  default: true
@@ -5459,7 +5459,7 @@ var Vc = (function (exports, vue) {
5459
5459
  default: false
5460
5460
  }
5461
5461
  };
5462
- const props$1f = {
5462
+ const props$1h = {
5463
5463
  type: String,
5464
5464
  inherit: {
5465
5465
  type: Boolean,
@@ -5511,7 +5511,7 @@ var Vc = (function (exports, vue) {
5511
5511
  icons = await this.parser(data, url);
5512
5512
  try {
5513
5513
  window.localStorage.setItem(key, JSON.stringify(icons));
5514
- } catch (e) {
5514
+ } catch {
5515
5515
  setTimeout(() => {
5516
5516
  this.clearResource();
5517
5517
  window.localStorage.setItem(key, JSON.stringify(icons));
@@ -5600,10 +5600,10 @@ var Vc = (function (exports, vue) {
5600
5600
  }
5601
5601
  }
5602
5602
  const IconManager = new Manager();
5603
- const COMPONENT_NAME$1w = "vc-icon";
5603
+ const COMPONENT_NAME$1z = "vc-icon";
5604
5604
  const Icon = /* @__PURE__ */ vue.defineComponent({
5605
- name: COMPONENT_NAME$1w,
5606
- props: props$1f,
5605
+ name: COMPONENT_NAME$1z,
5606
+ props: props$1h,
5607
5607
  setup(props2) {
5608
5608
  const viewBox = vue.ref("0 0 1024 1024");
5609
5609
  const path = vue.ref([]);
@@ -5635,7 +5635,7 @@ var Vc = (function (exports, vue) {
5635
5635
  };
5636
5636
  }
5637
5637
  });
5638
- const props$1e = {
5638
+ const props$1g = {
5639
5639
  /**
5640
5640
  * 进入/离开持续时间
5641
5641
  * {enter: 300, leave: 300}
@@ -5798,10 +5798,10 @@ var Vc = (function (exports, vue) {
5798
5798
  }
5799
5799
  };
5800
5800
  };
5801
- const COMPONENT_NAME$1v = "vc-transition";
5801
+ const COMPONENT_NAME$1y = "vc-transition";
5802
5802
  const Transition = vue.defineComponent({
5803
- name: COMPONENT_NAME$1v,
5804
- props: props$1e,
5803
+ name: COMPONENT_NAME$1y,
5804
+ props: props$1g,
5805
5805
  // 当不声明emits的情况下,事件存在于attrs中
5806
5806
  inheritAttrs: false,
5807
5807
  setup(props2, { slots, attrs }) {
@@ -5820,10 +5820,10 @@ var Vc = (function (exports, vue) {
5820
5820
  };
5821
5821
  }
5822
5822
  });
5823
- const COMPONENT_NAME$1u = "vc-transition-collapse";
5823
+ const COMPONENT_NAME$1x = "vc-transition-collapse";
5824
5824
  const TransitionCollapse = vue.defineComponent({
5825
- name: COMPONENT_NAME$1u,
5826
- props: props$1e,
5825
+ name: COMPONENT_NAME$1x,
5826
+ props: props$1g,
5827
5827
  // 当不声明emits的情况下,事件存在于attrs中
5828
5828
  inheritAttrs: false,
5829
5829
  setup(props2, { slots, attrs: _attrs }) {
@@ -5940,11 +5940,11 @@ var Vc = (function (exports, vue) {
5940
5940
  };
5941
5941
  }
5942
5942
  });
5943
- const COMPONENT_NAME$1t = "vc-transition-fade";
5943
+ const COMPONENT_NAME$1w = "vc-transition-fade";
5944
5944
  const TransitionFade = vue.defineComponent({
5945
- name: COMPONENT_NAME$1t,
5945
+ name: COMPONENT_NAME$1w,
5946
5946
  props: {
5947
- ...props$1e,
5947
+ ...props$1g,
5948
5948
  // inheritAttrs必须是false
5949
5949
  style: {
5950
5950
  type: Object,
@@ -5976,11 +5976,11 @@ var Vc = (function (exports, vue) {
5976
5976
  };
5977
5977
  }
5978
5978
  });
5979
- const COMPONENT_NAME$1s = "vc-transition-scale";
5979
+ const COMPONENT_NAME$1v = "vc-transition-scale";
5980
5980
  const TransitionScale = vue.defineComponent({
5981
- name: COMPONENT_NAME$1s,
5981
+ name: COMPONENT_NAME$1v,
5982
5982
  props: {
5983
- ...props$1e,
5983
+ ...props$1g,
5984
5984
  mode: {
5985
5985
  type: String,
5986
5986
  default: "both",
@@ -6017,15 +6017,15 @@ var Vc = (function (exports, vue) {
6017
6017
  };
6018
6018
  }
6019
6019
  });
6020
- const COMPONENT_NAME$1r = "vc-transition-slide";
6020
+ const COMPONENT_NAME$1u = "vc-transition-slide";
6021
6021
  const TransitionSlide = vue.defineComponent({
6022
- name: COMPONENT_NAME$1r,
6022
+ name: COMPONENT_NAME$1u,
6023
6023
  props: {
6024
- ...props$1e,
6024
+ ...props$1g,
6025
6025
  mode: {
6026
6026
  type: String,
6027
6027
  default: "left",
6028
- validator: (v) => /^(left|right|down|up|none)(|-part)$/.test(v)
6028
+ validator: (v) => /^(left|right|top|bottom|none)(|-part)$/.test(v)
6029
6029
  },
6030
6030
  // inheritAttrs必须是false
6031
6031
  style: {
@@ -6058,11 +6058,11 @@ var Vc = (function (exports, vue) {
6058
6058
  };
6059
6059
  }
6060
6060
  });
6061
- const COMPONENT_NAME$1q = "vc-transition-zoom";
6061
+ const COMPONENT_NAME$1t = "vc-transition-zoom";
6062
6062
  const TransitionZoom = vue.defineComponent({
6063
- name: COMPONENT_NAME$1q,
6063
+ name: COMPONENT_NAME$1t,
6064
6064
  props: {
6065
- ...props$1e,
6065
+ ...props$1g,
6066
6066
  mode: {
6067
6067
  type: String,
6068
6068
  default: "x",
@@ -6099,7 +6099,7 @@ var Vc = (function (exports, vue) {
6099
6099
  };
6100
6100
  }
6101
6101
  });
6102
- const COMPONENT_NAME$1p = "vc-alert";
6102
+ const COMPONENT_NAME$1s = "vc-alert";
6103
6103
  const THEME_MAP = {
6104
6104
  info: ["#5495f6", "#91d5ff", "#e6f7ff"],
6105
6105
  success: ["#52c41a", "#b7eb8f", "#f6ffed"],
@@ -6107,8 +6107,8 @@ var Vc = (function (exports, vue) {
6107
6107
  warning: ["#ffbf00", "#ffe58f", "#fffbe6"]
6108
6108
  };
6109
6109
  const Alert = /* @__PURE__ */ vue.defineComponent({
6110
- name: COMPONENT_NAME$1p,
6111
- props: props$1g,
6110
+ name: COMPONENT_NAME$1s,
6111
+ props: props$1i,
6112
6112
  setup(props2, {
6113
6113
  slots,
6114
6114
  emit
@@ -6194,16 +6194,16 @@ var Vc = (function (exports, vue) {
6194
6194
  }
6195
6195
  });
6196
6196
  const MAlert = Alert;
6197
- const props$1d = {
6197
+ const props$1f = {
6198
6198
  tag: {
6199
6199
  type: String,
6200
6200
  default: "div"
6201
6201
  }
6202
6202
  };
6203
- const COMPONENT_NAME$1o = "vc-artboard";
6203
+ const COMPONENT_NAME$1r = "vc-artboard";
6204
6204
  const Artboard = /* @__PURE__ */ vue.defineComponent({
6205
- name: COMPONENT_NAME$1o,
6206
- props: props$1d,
6205
+ name: COMPONENT_NAME$1r,
6206
+ props: props$1f,
6207
6207
  setup(props2, {
6208
6208
  slots
6209
6209
  }) {
@@ -6215,7 +6215,7 @@ var Vc = (function (exports, vue) {
6215
6215
  }
6216
6216
  });
6217
6217
  const MArtboard = Artboard;
6218
- const props$1c = {
6218
+ const props$1e = {
6219
6219
  size: {
6220
6220
  type: Number,
6221
6221
  default: 28
@@ -6236,10 +6236,10 @@ var Vc = (function (exports, vue) {
6236
6236
  default: false
6237
6237
  }
6238
6238
  };
6239
- const COMPONENT_NAME$1n = "vc-spin";
6239
+ const COMPONENT_NAME$1q = "vc-spin";
6240
6240
  const Spin = /* @__PURE__ */ vue.defineComponent({
6241
- name: COMPONENT_NAME$1n,
6242
- props: props$1c,
6241
+ name: COMPONENT_NAME$1q,
6242
+ props: props$1e,
6243
6243
  setup(props2, {
6244
6244
  slots
6245
6245
  }) {
@@ -6272,7 +6272,7 @@ var Vc = (function (exports, vue) {
6272
6272
  };
6273
6273
  }
6274
6274
  });
6275
- const props$1b = {
6275
+ const props$1d = {
6276
6276
  wait: {
6277
6277
  type: Number,
6278
6278
  default: 250
@@ -6287,10 +6287,10 @@ var Vc = (function (exports, vue) {
6287
6287
  },
6288
6288
  exclude: RegExp
6289
6289
  };
6290
- const COMPONENT_NAME$1m = "vc-debounce";
6290
+ const COMPONENT_NAME$1p = "vc-debounce";
6291
6291
  const Debounce = vue.defineComponent({
6292
- name: COMPONENT_NAME$1m,
6293
- props: props$1b,
6292
+ name: COMPONENT_NAME$1p,
6293
+ props: props$1d,
6294
6294
  /**
6295
6295
  * 不声明emits使得事件被透传放入attrs中, 这样可以让所有的事件透传
6296
6296
  * 如事件onClick
@@ -6330,7 +6330,7 @@ var Vc = (function (exports, vue) {
6330
6330
  };
6331
6331
  }
6332
6332
  });
6333
- const props$1a = {
6333
+ const props$1c = {
6334
6334
  tag: {
6335
6335
  type: String,
6336
6336
  default: "button"
@@ -6357,18 +6357,18 @@ var Vc = (function (exports, vue) {
6357
6357
  default: "button"
6358
6358
  }
6359
6359
  };
6360
- const COMPONENT_NAME$1l = "vc-button";
6360
+ const COMPONENT_NAME$1o = "vc-button";
6361
6361
  const Button = /* @__PURE__ */ vue.defineComponent({
6362
- name: COMPONENT_NAME$1l,
6362
+ name: COMPONENT_NAME$1o,
6363
6363
  emits: ["click"],
6364
- props: props$1a,
6364
+ props: props$1c,
6365
6365
  setup(props2, {
6366
6366
  slots
6367
6367
  }) {
6368
6368
  const vm = vue.getCurrentInstance();
6369
6369
  const hasSlot = vue.ref(true);
6370
6370
  const isLoading = vue.ref(false);
6371
- const group = vue.inject("button-group", {
6371
+ const group = vue.inject("vc-button-group", {
6372
6372
  size: "medium",
6373
6373
  vertical: false,
6374
6374
  circle: false
@@ -6417,7 +6417,7 @@ var Vc = (function (exports, vue) {
6417
6417
  };
6418
6418
  }
6419
6419
  });
6420
- const props$19 = {
6420
+ const props$1b = {
6421
6421
  vertical: {
6422
6422
  type: Boolean,
6423
6423
  default: false
@@ -6435,14 +6435,14 @@ var Vc = (function (exports, vue) {
6435
6435
  default: false
6436
6436
  }
6437
6437
  };
6438
- const COMPONENT_NAME$1k = "vc-button-group";
6438
+ const COMPONENT_NAME$1n = "vc-button-group";
6439
6439
  const ButtonGroup = /* @__PURE__ */ vue.defineComponent({
6440
- name: COMPONENT_NAME$1k,
6441
- props: props$19,
6440
+ name: COMPONENT_NAME$1n,
6441
+ props: props$1b,
6442
6442
  setup(props2, {
6443
6443
  slots
6444
6444
  }) {
6445
- vue.provide("button-group", props2);
6445
+ vue.provide("vc-button-group", props2);
6446
6446
  const classes = vue.computed(() => ({
6447
6447
  "is-vertical": props2.vertical,
6448
6448
  "is-circle": props2.circle,
@@ -6460,16 +6460,16 @@ var Vc = (function (exports, vue) {
6460
6460
  });
6461
6461
  const MButton = Button;
6462
6462
  const MButtonGroup = ButtonGroup;
6463
- const props$18 = {
6463
+ const props$1a = {
6464
6464
  tag: {
6465
6465
  type: String,
6466
6466
  default: "div"
6467
6467
  }
6468
6468
  };
6469
- const COMPONENT_NAME$1j = "vc-calendar";
6469
+ const COMPONENT_NAME$1m = "vc-calendar";
6470
6470
  const Calendar$1 = /* @__PURE__ */ vue.defineComponent({
6471
- name: COMPONENT_NAME$1j,
6472
- props: props$18,
6471
+ name: COMPONENT_NAME$1m,
6472
+ props: props$1a,
6473
6473
  setup(props2, {
6474
6474
  slots
6475
6475
  }) {
@@ -6481,7 +6481,7 @@ var Vc = (function (exports, vue) {
6481
6481
  }
6482
6482
  });
6483
6483
  const MCalendar = Calendar$1;
6484
- const props$17 = {
6484
+ const props$19 = {
6485
6485
  border: {
6486
6486
  type: Boolean,
6487
6487
  default: true
@@ -6501,10 +6501,10 @@ var Vc = (function (exports, vue) {
6501
6501
  type: String
6502
6502
  }
6503
6503
  };
6504
- const COMPONENT_NAME$1i = "vc-card";
6504
+ const COMPONENT_NAME$1l = "vc-card";
6505
6505
  const Card = /* @__PURE__ */ vue.defineComponent({
6506
- name: COMPONENT_NAME$1i,
6507
- props: props$17,
6506
+ name: COMPONENT_NAME$1l,
6507
+ props: props$19,
6508
6508
  setup(props2, {
6509
6509
  slots
6510
6510
  }) {
@@ -6528,16 +6528,16 @@ var Vc = (function (exports, vue) {
6528
6528
  }
6529
6529
  });
6530
6530
  const MCard = Card;
6531
- const props$16 = {
6531
+ const props$18 = {
6532
6532
  tag: {
6533
6533
  type: String,
6534
6534
  default: "div"
6535
6535
  }
6536
6536
  };
6537
- const COMPONENT_NAME$1h = "vc-carousel";
6537
+ const COMPONENT_NAME$1k = "vc-carousel";
6538
6538
  const Carousel = /* @__PURE__ */ vue.defineComponent({
6539
- name: COMPONENT_NAME$1h,
6540
- props: props$16,
6539
+ name: COMPONENT_NAME$1k,
6540
+ props: props$18,
6541
6541
  setup(props2, {
6542
6542
  slots
6543
6543
  }) {
@@ -6549,16 +6549,16 @@ var Vc = (function (exports, vue) {
6549
6549
  }
6550
6550
  });
6551
6551
  const MCarousel = Carousel;
6552
- const props$15 = {
6552
+ const props$17 = {
6553
6553
  tag: {
6554
6554
  type: String,
6555
6555
  default: "div"
6556
6556
  }
6557
6557
  };
6558
- const COMPONENT_NAME$1g = "vc-cascader";
6558
+ const COMPONENT_NAME$1j = "vc-cascader";
6559
6559
  const Cascader = /* @__PURE__ */ vue.defineComponent({
6560
- name: COMPONENT_NAME$1g,
6561
- props: props$15,
6560
+ name: COMPONENT_NAME$1j,
6561
+ props: props$17,
6562
6562
  setup(props2, {
6563
6563
  slots
6564
6564
  }) {
@@ -6608,7 +6608,7 @@ var Vc = (function (exports, vue) {
6608
6608
  "globalout",
6609
6609
  "contextmenu"
6610
6610
  ];
6611
- const props$14 = {
6611
+ const props$16 = {
6612
6612
  options: Object,
6613
6613
  pluginOptions: Object,
6614
6614
  theme: [String, Object],
@@ -6617,10 +6617,10 @@ var Vc = (function (exports, vue) {
6617
6617
  watchShallow: Boolean,
6618
6618
  manualUpdate: Boolean
6619
6619
  };
6620
- const COMPONENT_NAME$1f = "vc-chart";
6620
+ const COMPONENT_NAME$1i = "vc-chart";
6621
6621
  const Chart = /* @__PURE__ */ vue.defineComponent({
6622
- name: COMPONENT_NAME$1f,
6623
- props: props$14,
6622
+ name: COMPONENT_NAME$1i,
6623
+ props: props$16,
6624
6624
  emits: [...EVENTS, "ready"],
6625
6625
  setup(props2, {
6626
6626
  emit,
@@ -6728,16 +6728,16 @@ var Vc = (function (exports, vue) {
6728
6728
  }
6729
6729
  });
6730
6730
  const MChart = Chart;
6731
- const props$13 = {
6731
+ const props$15 = {
6732
6732
  tag: {
6733
6733
  type: String,
6734
6734
  default: "div"
6735
6735
  }
6736
6736
  };
6737
- const COMPONENT_NAME$1e = "vc-checkbox";
6737
+ const COMPONENT_NAME$1h = "vc-checkbox";
6738
6738
  const Checkbox = /* @__PURE__ */ vue.defineComponent({
6739
- name: COMPONENT_NAME$1e,
6740
- props: props$13,
6739
+ name: COMPONENT_NAME$1h,
6740
+ props: props$15,
6741
6741
  setup(props2, {
6742
6742
  slots
6743
6743
  }) {
@@ -6749,16 +6749,16 @@ var Vc = (function (exports, vue) {
6749
6749
  }
6750
6750
  });
6751
6751
  const MCheckbox = Checkbox;
6752
- const props$12 = {
6752
+ const props$14 = {
6753
6753
  tag: {
6754
6754
  type: String,
6755
6755
  default: "div"
6756
6756
  }
6757
6757
  };
6758
- const COMPONENT_NAME$1d = "vc-clipboard";
6758
+ const COMPONENT_NAME$1g = "vc-clipboard";
6759
6759
  const Clipboard = /* @__PURE__ */ vue.defineComponent({
6760
- name: COMPONENT_NAME$1d,
6761
- props: props$12,
6760
+ name: COMPONENT_NAME$1g,
6761
+ props: props$14,
6762
6762
  setup(props2, {
6763
6763
  slots
6764
6764
  }) {
@@ -6770,36 +6770,246 @@ var Vc = (function (exports, vue) {
6770
6770
  }
6771
6771
  });
6772
6772
  const MClipboard = Clipboard;
6773
+ const props$13 = {
6774
+ tag: {
6775
+ type: String,
6776
+ default: "div"
6777
+ },
6778
+ accordion: {
6779
+ type: Boolean,
6780
+ default: false
6781
+ },
6782
+ modelValue: {
6783
+ type: [Array, String, Number]
6784
+ },
6785
+ alive: {
6786
+ type: Boolean,
6787
+ default: true
6788
+ },
6789
+ // TODO: 添加默认样式
6790
+ styleless: {
6791
+ type: Boolean,
6792
+ default: false
6793
+ }
6794
+ };
6795
+ const COMPONENT_NAME$1f = "vc-collapse";
6796
+ const Collapse = vue.defineComponent({
6797
+ name: COMPONENT_NAME$1f,
6798
+ props: props$13,
6799
+ emits: ["update:moodelValue", "change"],
6800
+ setup(props2, { slots, emit }) {
6801
+ const instance = vue.getCurrentInstance();
6802
+ const currentValue = vue.ref();
6803
+ const items = vue.ref([]);
6804
+ const sync = () => {
6805
+ const v = props2.accordion ? currentValue.value[0] : currentValue.value;
6806
+ emit("update:moodelValue", v);
6807
+ emit("change", v);
6808
+ };
6809
+ const setActive = () => {
6810
+ const activeKey = currentValue.value;
6811
+ vue.nextTick(() => {
6812
+ items.value.forEach((child, index) => {
6813
+ const value = typeof child.props.value !== "undefined" ? child.props.value : index;
6814
+ child.exposed.toggle(activeKey.indexOf(value) > -1);
6815
+ });
6816
+ });
6817
+ };
6818
+ const toggle = (item) => {
6819
+ const activeKey = currentValue.value;
6820
+ const index = activeKey.indexOf(item.value);
6821
+ if (!item.visible) {
6822
+ if (index > -1) {
6823
+ activeKey.splice(index, 1);
6824
+ }
6825
+ } else if (index < 0) {
6826
+ activeKey.push(item.value);
6827
+ }
6828
+ currentValue.value = props2.accordion ? activeKey.slice(-1) : activeKey;
6829
+ sync();
6830
+ };
6831
+ const add = (item, setValue) => {
6832
+ if (!item) return;
6833
+ vue.nextTick(() => {
6834
+ if (instance.vnode.el) {
6835
+ const index = Array.from(instance.vnode.el.children).filter((i) => /vcm?-collapse-item/.test(i.className)).indexOf(item.vnode.el);
6836
+ if (index != -1) {
6837
+ items.value.splice(index, 0, item);
6838
+ typeof item.props.value === "undefined" && setValue(index);
6839
+ return;
6840
+ }
6841
+ }
6842
+ items.value.push(item);
6843
+ typeof item.props.value === "undefined" && setValue(items.value.length - 1);
6844
+ });
6845
+ };
6846
+ const remove = (item, setValue) => {
6847
+ if (!item) return;
6848
+ items.value.splice(items.value.indexOf(item), 1);
6849
+ items.value.forEach((_, index) => setValue(index));
6850
+ };
6851
+ vue.provide("vc-collapse", {
6852
+ props: props2,
6853
+ toggle,
6854
+ add,
6855
+ remove
6856
+ });
6857
+ vue.watch(
6858
+ () => props2.modelValue,
6859
+ (v) => {
6860
+ if (v === currentValue.value) return;
6861
+ currentValue.value = props2.accordion && typeof v !== "undefined" ? Array.isArray(v) ? v : [v] : Array.isArray(v) ? v : [];
6862
+ },
6863
+ { immediate: true }
6864
+ );
6865
+ vue.watch(
6866
+ () => currentValue.value,
6867
+ setActive,
6868
+ { deep: true }
6869
+ );
6870
+ vue.onMounted(setActive);
6871
+ return () => {
6872
+ return vue.h(
6873
+ props2.tag,
6874
+ {
6875
+ class: [{ "vc-collapse": !props2.styleless }]
6876
+ },
6877
+ slots.default?.()
6878
+ );
6879
+ };
6880
+ }
6881
+ });
6882
+ const props$12 = {
6883
+ tag: {
6884
+ type: String,
6885
+ default: "div"
6886
+ },
6887
+ value: {
6888
+ type: [String, Number]
6889
+ }
6890
+ };
6773
6891
  const props$11 = {
6774
6892
  tag: {
6775
6893
  type: String,
6776
6894
  default: "div"
6895
+ },
6896
+ modelValue: {
6897
+ type: Boolean,
6898
+ default: false
6899
+ },
6900
+ // 子节点每次toggle不销毁
6901
+ alive: {
6902
+ type: Boolean,
6903
+ default: true
6777
6904
  }
6778
6905
  };
6779
- const COMPONENT_NAME$1c = "vc-collapse";
6780
- const Collapse = /* @__PURE__ */ vue.defineComponent({
6781
- name: COMPONENT_NAME$1c,
6906
+ function _isSlot$2(s) {
6907
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
6908
+ }
6909
+ const COMPONENT_NAME$1e = "vc-expand";
6910
+ const Expand = /* @__PURE__ */ vue.defineComponent({
6911
+ name: COMPONENT_NAME$1e,
6782
6912
  props: props$11,
6783
6913
  setup(props2, {
6784
6914
  slots
6785
6915
  }) {
6916
+ const isActive = vue.ref(false);
6917
+ const Content = props2.tag;
6918
+ vue.watch(() => props2.modelValue, (v) => {
6919
+ isActive.value = v;
6920
+ }, {
6921
+ immediate: true
6922
+ });
6786
6923
  return () => {
6787
- return vue.createVNode("div", {
6788
- "class": "vc-collapse"
6789
- }, [slots?.default?.()]);
6924
+ let _slot;
6925
+ return vue.createVNode(TransitionCollapse, {
6926
+ "duration": {
6927
+ enter: 200,
6928
+ leave: 200
6929
+ }
6930
+ }, _isSlot$2(_slot = vue.withDirectives(vue.createVNode(Content, null, {
6931
+ default: () => [(props2.alive || !props2.alive && isActive.value) && slots.default?.()]
6932
+ }), [[vue.vShow, isActive.value]])) ? _slot : {
6933
+ default: () => [_slot]
6934
+ });
6935
+ };
6936
+ }
6937
+ });
6938
+ const COMPONENT_NAME$1d = "vc-collapse-item";
6939
+ const CollapseItem = /* @__PURE__ */ vue.defineComponent({
6940
+ name: COMPONENT_NAME$1d,
6941
+ props: props$12,
6942
+ setup(props2, {
6943
+ slots,
6944
+ expose
6945
+ }) {
6946
+ const Content = props2.tag;
6947
+ const instance = vue.getCurrentInstance();
6948
+ const isActive = vue.ref(false);
6949
+ const current = vue.ref();
6950
+ const collapse = vue.inject("vc-collapse");
6951
+ const handleToggle = () => {
6952
+ collapse.toggle({
6953
+ value: typeof props2.value !== "undefined" ? props2.value : current.value,
6954
+ visible: !isActive.value
6955
+ });
6956
+ };
6957
+ const alive = vue.computed(() => {
6958
+ return collapse.props.alive;
6959
+ });
6960
+ const styleless = vue.computed(() => {
6961
+ return collapse.props.styleless;
6962
+ });
6963
+ const setValue = (v) => current.value = v;
6964
+ vue.onBeforeMount(() => {
6965
+ collapse.add?.(instance, setValue);
6966
+ });
6967
+ vue.onBeforeUnmount(() => {
6968
+ collapse.remove?.(instance, setValue);
6969
+ });
6970
+ expose({
6971
+ isActive,
6972
+ toggle: (v) => isActive.value = v
6973
+ });
6974
+ return () => {
6975
+ return vue.createVNode(Content, {
6976
+ "class": [{
6977
+ "vc-collapse-item": !styleless.value
6978
+ }]
6979
+ }, {
6980
+ default: () => [vue.createVNode("div", {
6981
+ "class": [{
6982
+ "vc-collapse-item__title": !styleless.value
6983
+ }],
6984
+ "onClick": handleToggle
6985
+ }, [slots.default?.(), slots.icon?.({
6986
+ visible: isActive.value
6987
+ })]), vue.createVNode(Expand, {
6988
+ "modelValue": isActive.value,
6989
+ "alive": alive.value,
6990
+ "onChange": (v) => isActive.value = v
6991
+ }, {
6992
+ default: () => [vue.createVNode("div", {
6993
+ "class": [{
6994
+ "vc-collapse-item__content": !styleless.value
6995
+ }]
6996
+ }, [slots.content?.()])]
6997
+ })]
6998
+ });
6790
6999
  };
6791
7000
  }
6792
7001
  });
6793
7002
  const MCollapse = Collapse;
7003
+ const MCollapseItem = CollapseItem;
6794
7004
  const props$10 = {
6795
7005
  tag: {
6796
7006
  type: String,
6797
7007
  default: "div"
6798
7008
  }
6799
7009
  };
6800
- const COMPONENT_NAME$1b = "vc-color-picker";
7010
+ const COMPONENT_NAME$1c = "vc-color-picker";
6801
7011
  const ColorPicker = /* @__PURE__ */ vue.defineComponent({
6802
- name: COMPONENT_NAME$1b,
7012
+ name: COMPONENT_NAME$1c,
6803
7013
  props: props$10,
6804
7014
  setup(props2, {
6805
7015
  slots
@@ -6818,9 +7028,9 @@ var Vc = (function (exports, vue) {
6818
7028
  default: "div"
6819
7029
  }
6820
7030
  };
6821
- const COMPONENT_NAME$1a = "vc-countdown";
7031
+ const COMPONENT_NAME$1b = "vc-countdown";
6822
7032
  const Countdown = /* @__PURE__ */ vue.defineComponent({
6823
- name: COMPONENT_NAME$1a,
7033
+ name: COMPONENT_NAME$1b,
6824
7034
  props: props$$,
6825
7035
  setup(props2, {
6826
7036
  slots
@@ -6839,9 +7049,9 @@ var Vc = (function (exports, vue) {
6839
7049
  default: () => null
6840
7050
  }
6841
7051
  };
6842
- const COMPONENT_NAME$19 = "vc-customer";
7052
+ const COMPONENT_NAME$1a = "vc-customer";
6843
7053
  const Customer = vue.defineComponent({
6844
- name: COMPONENT_NAME$19,
7054
+ name: COMPONENT_NAME$1a,
6845
7055
  props: props$_,
6846
7056
  setup(props2, context) {
6847
7057
  return () => vue.h(() => {
@@ -6856,9 +7066,9 @@ var Vc = (function (exports, vue) {
6856
7066
  default: "div"
6857
7067
  }
6858
7068
  };
6859
- const COMPONENT_NAME$18 = "vc-date-picker";
7069
+ const COMPONENT_NAME$19 = "vc-date-picker";
6860
7070
  const DatePicker = /* @__PURE__ */ vue.defineComponent({
6861
- name: COMPONENT_NAME$18,
7071
+ name: COMPONENT_NAME$19,
6862
7072
  props: props$Z,
6863
7073
  setup(props2, {
6864
7074
  slots
@@ -6877,9 +7087,9 @@ var Vc = (function (exports, vue) {
6877
7087
  default: "div"
6878
7088
  }
6879
7089
  };
6880
- const COMPONENT_NAME$17 = "vc-divider";
7090
+ const COMPONENT_NAME$18 = "vc-divider";
6881
7091
  const Divider = /* @__PURE__ */ vue.defineComponent({
6882
- name: COMPONENT_NAME$17,
7092
+ name: COMPONENT_NAME$18,
6883
7093
  props: props$Y,
6884
7094
  setup(props2, {
6885
7095
  slots
@@ -6892,178 +7102,714 @@ var Vc = (function (exports, vue) {
6892
7102
  }
6893
7103
  });
6894
7104
  const MDivider = Divider;
6895
- const props$X = {
6896
- tag: {
6897
- type: String,
6898
- default: "div"
6899
- }
7105
+ const defaults$2 = {
7106
+ tag: "div",
7107
+ el: "body",
7108
+ alive: false,
7109
+ multiple: false,
7110
+ aliveRegExp: { className: /(vc-hack-alive|vc-hack-cp)/ },
7111
+ aliveVisibleKey: "isVisible",
7112
+ aliveUpdateKey: "update",
7113
+ leaveDelay: 300,
7114
+ autoDestroy: true,
7115
+ components: {},
7116
+ uses: {},
7117
+ fragment: false,
7118
+ insertion: "last"
6900
7119
  };
6901
- const COMPONENT_NAME$16 = "vc-drawer";
6902
- const Drawer = /* @__PURE__ */ vue.defineComponent({
6903
- name: COMPONENT_NAME$16,
6904
- props: props$X,
6905
- setup(props2, {
6906
- slots
6907
- }) {
6908
- return () => {
6909
- return vue.createVNode("div", {
6910
- "class": "vc-drawer"
6911
- }, [slots?.default?.()]);
7120
+ class PortalLeaf {
7121
+ app;
7122
+ /**
7123
+ * 目标的实例,挂载到app上
7124
+ */
7125
+ wrapper;
7126
+ propsData;
7127
+ /**
7128
+ * 销毁的函数,挂载到app上,避免冲突
7129
+ */
7130
+ destroy;
7131
+ /**
7132
+ * 自动销毁的标记,挂载到app上,避免冲突
7133
+ */
7134
+ autoDestroy;
7135
+ target;
7136
+ constructor(target) {
7137
+ this.target = target;
7138
+ this.autoDestroy = false;
7139
+ this.destroy = /* istanbul ignore next */
7140
+ () => {
7141
+ throw new VcError("portal", "未注册的destroy方法");
6912
7142
  };
6913
7143
  }
6914
- });
6915
- const MDrawer = Drawer;
6916
- const props$W = {
6917
- tag: {
6918
- type: String,
6919
- default: "div"
7144
+ then(resolve, reject) {
7145
+ return this.target.then(resolve, reject);
6920
7146
  }
6921
- };
6922
- const COMPONENT_NAME$15 = "vc-dropdown";
6923
- const Dropdown = /* @__PURE__ */ vue.defineComponent({
6924
- name: COMPONENT_NAME$15,
6925
- props: props$W,
6926
- setup(props2, {
6927
- slots
6928
- }) {
6929
- return () => {
6930
- return vue.createVNode("div", {
6931
- "class": "vc-dropdown"
6932
- }, [slots?.default?.()]);
6933
- };
7147
+ catch(callback) {
7148
+ return this.target.catch(callback);
6934
7149
  }
6935
- });
6936
- const MDropdown = Dropdown;
6937
- const props$V = {
6938
- tag: {
6939
- type: String,
6940
- default: "div"
7150
+ finally(callback) {
7151
+ return this.target.finally(callback);
6941
7152
  }
6942
- };
6943
- const COMPONENT_NAME$14 = "vc-editor";
6944
- const Editor = /* @__PURE__ */ vue.defineComponent({
6945
- name: COMPONENT_NAME$14,
6946
- props: props$V,
6947
- setup(props2, {
6948
- slots
6949
- }) {
6950
- return () => {
6951
- return vue.createVNode("div", {
6952
- "class": "vc-editor"
6953
- }, [slots?.default?.()]);
6954
- };
7153
+ }
7154
+ const COMPONENT_NAME$17 = "vc-portal";
7155
+ class Portal {
7156
+ /**
7157
+ * 清理Portals类型组件
7158
+ * @param name 清理的组件名, boolean表示全部leafs是否强制清理
7159
+ */
7160
+ static clear(name) {
7161
+ try {
7162
+ let force = false;
7163
+ let target = /* @__PURE__ */ new Map();
7164
+ if (name && typeof name !== "boolean") {
7165
+ let names = [];
7166
+ if (typeof name === "string") {
7167
+ names = [name];
7168
+ } else if (name instanceof Array && name.length > 0) {
7169
+ names = name;
7170
+ }
7171
+ names.forEach((i) => target.set(i, ""));
7172
+ force = true;
7173
+ } else {
7174
+ force = !!name;
7175
+ target = Portal.leafs;
7176
+ }
7177
+ for (const key of target.keys()) {
7178
+ const leaf = Portal.leafs.get(key);
7179
+ if (leaf && (force === true || leaf.autoDestroy === true)) {
7180
+ leaf.destroy();
7181
+ }
7182
+ }
7183
+ } catch (e) {
7184
+ /* istanbul ignore next -- @preserve */
7185
+ throw new VcError("instance", e);
7186
+ }
6955
7187
  }
6956
- });
6957
- const MEditor = Editor;
6958
- const props$U = {
6959
- tag: {
6960
- type: String,
6961
- default: "div"
7188
+ /**
7189
+ * 清理全部Portals
7190
+ */
7191
+ static clearAll() {
7192
+ try {
7193
+ Portal.leafs.forEach((leaf) => leaf.destroy());
7194
+ } catch (e) {
7195
+ /* istanbul ignore next -- @preserve */
7196
+ throw new VcError("instance", e);
7197
+ }
6962
7198
  }
6963
- };
6964
- const COMPONENT_NAME$13 = "vc-expand";
6965
- const Expand = /* @__PURE__ */ vue.defineComponent({
6966
- name: COMPONENT_NAME$13,
6967
- props: props$U,
6968
- setup(props2, {
6969
- slots
6970
- }) {
6971
- return () => {
6972
- return vue.createVNode("div", {
6973
- "class": "vc-expand"
6974
- }, [slots?.default?.()]);
7199
+ static leafs = /* @__PURE__ */ new Map();
7200
+ wrapper;
7201
+ globalOptions;
7202
+ constructor(wrapper, options) {
7203
+ this.wrapper = wrapper;
7204
+ this.globalOptions = {
7205
+ ...options,
7206
+ name: options?.name || wrapper.name || getUid(COMPONENT_NAME$17)
6975
7207
  };
6976
7208
  }
6977
- });
6978
- const MExpand = Expand;
6979
- const props$T = {
6980
- tag: {
6981
- type: String,
6982
- default: "form"
6983
- },
6984
- model: {
6985
- type: Object
6986
- },
6987
- rules: {
6988
- type: Object
6989
- },
6990
- labelWidth: {
6991
- type: Number
6992
- },
6993
- showMessage: {
6994
- type: Boolean,
6995
- default: true
6996
- },
6997
- inline: {
6998
- type: Boolean,
6999
- default: false
7000
- },
7001
- labelPosition: {
7002
- type: String,
7003
- default: "right"
7004
- },
7005
- autocomplete: {
7006
- type: String,
7007
- default: "off"
7008
- },
7009
- styleless: {
7010
- type: Boolean,
7011
- default: false
7012
- }
7013
- };
7014
- const useForm = (expose, options = {}) => {
7015
- const instance = vue.getCurrentInstance();
7016
- const props2 = instance.props;
7017
- const fields = [];
7018
- vue.provide("form", {
7019
- props: props2,
7020
- add: (field) => {
7021
- field && fields.push(field);
7022
- },
7023
- remove: (field) => {
7024
- field && fields.splice(fields.indexOf(field), 1);
7209
+ popup(propsData, options) {
7210
+ if (!options) {
7211
+ options = propsData || {};
7212
+ } else {
7213
+ options.propsData = propsData;
7025
7214
  }
7026
- });
7027
- const filterFields = (fields$) => {
7028
- return !fields$ ? fields : fields.filter((item) => fields$.includes(item.props.prop));
7029
- };
7030
- const getField = (prop) => {
7031
- const field = fields.find((item) => item.props.prop === prop);
7032
- if (!field) throw new VcError("form", "请选择有用的prop值");
7033
- return field;
7034
- };
7035
- const showToast = (msg) => {
7036
- props2.showMessage && options.throwToast?.(msg);
7037
- };
7038
- const sortErrors = async (errors) => {
7039
- const positions = await Promise.all(fields.map((item) => item.exposed.getPosition()));
7040
- try {
7041
- return [...errors].toSorted((a, b) => {
7042
- const aIndex = fields.findIndex((i) => i.props.prop === a.prop);
7043
- const bIndex = fields.findIndex((i) => i.props.prop === b.prop);
7044
- const aPosition = positions[aIndex];
7045
- const bPosition = positions[bIndex];
7046
- if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
7047
- return aPosition.left - bPosition.left;
7215
+ const $options = { ...this.getDefaultOptions(), ...options };
7216
+ const { onFulfilled, onRejected, ...rest } = $options;
7217
+ let onFulfilled$ = (
7218
+ /* istanbul ignore next -- @preserve */
7219
+ () => {
7220
+ }
7221
+ );
7222
+ let onRejected$ = (
7223
+ /* istanbul ignore next -- @preserve */
7224
+ () => {
7225
+ }
7226
+ );
7227
+ const target = new Promise((resolve, reject) => {
7228
+ onFulfilled$ = (v) => {
7229
+ onFulfilled?.(v);
7230
+ resolve(v);
7231
+ };
7232
+ onRejected$ = (v) => {
7233
+ onRejected?.(v);
7234
+ reject(v);
7235
+ };
7236
+ });
7237
+ return this.render(rest, target, onFulfilled$, onRejected$);
7238
+ }
7239
+ /**
7240
+ * 销毁当前Portal下的节点
7241
+ * @param target [description]
7242
+ */
7243
+ destroy = (target) => {
7244
+ const { multiple, name } = this.getDefaultOptions();
7245
+ target = target || name;
7246
+ const instance = typeof target === "object" ? target : Portal.leafs.get(target);
7247
+ if (instance) {
7248
+ instance.destroy();
7249
+ } else if (multiple) {
7250
+ Portal.leafs.forEach((item, key) => {
7251
+ if (key.includes(name)) {
7252
+ item.destroy();
7253
+ }
7048
7254
  });
7049
- } catch (e) {
7050
- return errors;
7051
7255
  }
7052
7256
  };
7053
- const scrollIntoView = (prop) => {
7054
- const field = getField(prop);
7055
- field.vnode?.el?.scrollIntoView?.({
7056
- behavior: "smooth",
7057
- block: "center"
7058
- });
7059
- };
7060
- const reset = (options$ = {}) => {
7061
- const { fields: fields$, original = {} } = options$;
7062
- filterFields(fields$).forEach((field) => {
7257
+ getDefaultOptions() {
7258
+ return {
7259
+ ...defaults$2,
7260
+ ...VcInstance.options.Portal,
7261
+ ...this.globalOptions
7262
+ };
7263
+ }
7264
+ createCallback(getLeaf, delay, callback) {
7265
+ return (...args) => {
7266
+ const done = () => {
7267
+ const leaf = getLeaf();
7268
+ /* istanbul ignore next -- @preserve */
7269
+ if (!leaf) {
7270
+ throw new VcError("portal", "实例不存在或已卸载");
7271
+ }
7272
+ leaf.destroy();
7273
+ };
7274
+ delay ? setTimeout(done, delay) : done();
7275
+ callback?.(...args);
7276
+ };
7277
+ }
7278
+ render(options, target, onFulfilled, onRejected) {
7279
+ const {
7280
+ el: el2,
7281
+ tag,
7282
+ alive,
7283
+ aliveRegExp,
7284
+ aliveVisibleKey,
7285
+ aliveUpdateKey,
7286
+ name: name$,
7287
+ leaveDelay,
7288
+ autoDestroy,
7289
+ multiple,
7290
+ fragment,
7291
+ onDestroyed,
7292
+ onBeforeCreate,
7293
+ insertion,
7294
+ // 全局注册
7295
+ globalProperties,
7296
+ install,
7297
+ components,
7298
+ uses,
7299
+ slots,
7300
+ parent,
7301
+ propsData,
7302
+ ...rest
7303
+ } = options;
7304
+ let useAllNodes = fragment;
7305
+ const name = multiple ? `${name$}__${getUid(COMPONENT_NAME$17)}` : name$;
7306
+ const container = document.createElement(tag);
7307
+ const root = typeof el2 === "object" ? el2 : document.querySelector(el2 || "body");
7308
+ !alive && Portal.leafs.get(name)?.destroy();
7309
+ const propsData$ = propsData || rest;
7310
+ let leaf = new PortalLeaf(target);
7311
+ const isDestroyed = () => {
7312
+ const leaf$ = Portal.leafs.get(name);
7313
+ return !leaf$ || leaf$ !== leaf;
7314
+ };
7315
+ const $onDestroyed = (...args) => {
7316
+ if (isDestroyed()) return;
7317
+ onDestroyed?.(...args);
7318
+ leaf.app?.unmount();
7319
+ /* istanbul ignore else -- @preserve */
7320
+ if (useAllNodes) {
7321
+ root?.contains(container) && root.removeChild(container);
7322
+ } else if (container && container._children) {
7323
+ container._children.forEach((i) => {
7324
+ root?.contains(i) && root.removeChild(i);
7325
+ });
7326
+ }
7327
+ Portal.leafs.delete(name);
7328
+ };
7329
+ const $onRejected = this.createCallback(() => leaf, leaveDelay, onRejected);
7330
+ const $onFulfilled = this.createCallback(() => leaf, leaveDelay, onFulfilled);
7331
+ if (alive && Portal.leafs.has(name)) {
7332
+ leaf = Portal.leafs.get(name);
7333
+ leaf.target = target;
7334
+ leaf.propsData.value = propsData$;
7335
+ leaf.wrapper?.[aliveUpdateKey]?.(options);
7336
+ } else {
7337
+ const wrapper = this.wrapper;
7338
+ const app = vue.createApp({
7339
+ name: COMPONENT_NAME$17,
7340
+ parent,
7341
+ setup() {
7342
+ if (alive) {
7343
+ const handleExtra = (e) => {
7344
+ try {
7345
+ const path = e.path || composedPath(e);
7346
+ /* istanbul ignore else -- @preserve */
7347
+ if (container && e.target && !container.contains(e.target) && !path?.some((item) => utils.eleInRegExp(item, aliveRegExp))) {
7348
+ /* istanbul ignore else -- @preserve */
7349
+ if (leaf.wrapper && leaf.wrapper?.[aliveVisibleKey]) {
7350
+ leaf.wrapper[aliveVisibleKey] = false;
7351
+ }
7352
+ leaveDelay ? setTimeout($onDestroyed, leaveDelay) : $onDestroyed();
7353
+ }
7354
+ } catch (error2) {
7355
+ /* istanbul ignore next -- @preserve */
7356
+ throw new VcError("portal", error2);
7357
+ }
7358
+ };
7359
+ vue.onMounted(() => {
7360
+ document.addEventListener("click", handleExtra, true);
7361
+ });
7362
+ vue.onBeforeUnmount(() => {
7363
+ document.removeEventListener("click", handleExtra, true);
7364
+ });
7365
+ }
7366
+ const propsData1 = vue.ref(propsData$);
7367
+ const propsData2 = vue.ref();
7368
+ leaf.propsData = propsData1;
7369
+ const allowMounted = vue.ref(typeof onBeforeCreate !== "function");
7370
+ if (!allowMounted.value) {
7371
+ const result = onBeforeCreate(propsData$);
7372
+ if (result && result.then) {
7373
+ result.then((response) => {
7374
+ if (isDestroyed()) return;
7375
+ allowMounted.value = true;
7376
+ propsData2.value = response;
7377
+ }).catch((error2) => {
7378
+ $onDestroyed(error2);
7379
+ });
7380
+ } else {
7381
+ allowMounted.value = true;
7382
+ propsData2.value = result;
7383
+ }
7384
+ }
7385
+ return () => allowMounted.value && vue.h(
7386
+ wrapper,
7387
+ {
7388
+ ...propsData1.value,
7389
+ ...propsData2.value,
7390
+ ref: (vm) => leaf.wrapper = vm,
7391
+ onPortalFulfilled: (...args) => $onFulfilled(...args),
7392
+ onPortalRejected: (...args) => $onRejected(...args),
7393
+ onPortalDestroyed: (...args) => $onDestroyed(...args)
7394
+ },
7395
+ slots || void 0
7396
+ );
7397
+ }
7398
+ });
7399
+ leaf.app = app;
7400
+ if (globalProperties) {
7401
+ app.config.globalProperties = globalProperties;
7402
+ }
7403
+ for (const key in components) {
7404
+ app.component(key, components[key]);
7405
+ }
7406
+ for (const key in uses) {
7407
+ app.use(uses[key]);
7408
+ }
7409
+ install?.(app);
7410
+ app.mount(container);
7411
+ }
7412
+ leaf.destroy = $onDestroyed;
7413
+ leaf.autoDestroy = !!autoDestroy;
7414
+ Portal.leafs.set(name, leaf);
7415
+ const append = (root$, child$) => {
7416
+ if (!root$ || !child$) return;
7417
+ if (insertion === "first") {
7418
+ const firstEl = root$.firstElementChild;
7419
+ if (firstEl) {
7420
+ root$.insertBefore(child$, firstEl);
7421
+ return;
7422
+ }
7423
+ }
7424
+ root$.appendChild(child$);
7425
+ };
7426
+ if (fragment || typeof container._children === "undefined" && !Array.from(container.children).length) {
7427
+ useAllNodes = true;
7428
+ container.parentElement === null && append(root, container);
7429
+ } else if (!container._children) {
7430
+ container._children = [];
7431
+ let childs = Array.from(container.children);
7432
+ if (insertion === "first") {
7433
+ childs = childs.reverse();
7434
+ }
7435
+ childs.forEach((i) => {
7436
+ append(root, i);
7437
+ container._children?.push?.(i);
7438
+ });
7439
+ }
7440
+ return leaf;
7441
+ }
7442
+ }
7443
+ const props$X = {
7444
+ tag: {
7445
+ type: String,
7446
+ default: "div"
7447
+ }
7448
+ };
7449
+ const COMPONENT_NAME$16 = "vc-portal-view";
7450
+ const PortalView = /* @__PURE__ */ vue.defineComponent({
7451
+ name: COMPONENT_NAME$16,
7452
+ props: props$X,
7453
+ setup(props2, {
7454
+ slots
7455
+ }) {
7456
+ return () => {
7457
+ return vue.h(vue.Fragment, [vue.h(props2.tag, {
7458
+ class: "vc-portal-view"
7459
+ }, slots?.default?.()), vue.h(vue.Teleport, {
7460
+ to: "body"
7461
+ }, slots?.content?.())]);
7462
+ };
7463
+ }
7464
+ });
7465
+ const props$W = {
7466
+ title: String,
7467
+ content: {
7468
+ type: [String, Function],
7469
+ default: ""
7470
+ },
7471
+ modelValue: {
7472
+ type: Boolean,
7473
+ default: false
7474
+ },
7475
+ width: {
7476
+ type: Number,
7477
+ default: 300
7478
+ },
7479
+ height: {
7480
+ type: Number,
7481
+ default: 300
7482
+ },
7483
+ mask: {
7484
+ type: Boolean,
7485
+ default: true
7486
+ },
7487
+ maskClosable: {
7488
+ type: Boolean,
7489
+ default: true
7490
+ },
7491
+ scrollable: {
7492
+ type: Boolean,
7493
+ default: false
7494
+ },
7495
+ placement: {
7496
+ type: String,
7497
+ default: "right"
7498
+ // top/right/left/bottom
7499
+ },
7500
+ maskStyle: [Object, String],
7501
+ wrapperClass: [Object, String],
7502
+ wrapperStyle: [Object, String],
7503
+ closeWithCancel: {
7504
+ type: Boolean,
7505
+ default: true
7506
+ // 如果关闭, cancel只能是取消的按钮
7507
+ },
7508
+ okText: {
7509
+ type: [String, Boolean],
7510
+ default: "确定"
7511
+ },
7512
+ cancelText: {
7513
+ type: [String, Boolean],
7514
+ default: "取消"
7515
+ },
7516
+ footer: {
7517
+ type: Boolean,
7518
+ default: true
7519
+ },
7520
+ /**
7521
+ * 兼容portal设计, 实现Promise方式
7522
+ */
7523
+ onOk: {
7524
+ type: Function
7525
+ },
7526
+ onCancel: {
7527
+ type: Function
7528
+ }
7529
+ };
7530
+ function _isSlot$1(s) {
7531
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
7532
+ }
7533
+ const COMPONENT_NAME$15 = "vc-drawer";
7534
+ const DrawerView = /* @__PURE__ */ vue.defineComponent({
7535
+ name: COMPONENT_NAME$15,
7536
+ props: props$W,
7537
+ emits: ["close", "update:modelValue", "visible-change"],
7538
+ setup(props2, {
7539
+ emit,
7540
+ slots,
7541
+ expose
7542
+ }) {
7543
+ const instance = vue.getCurrentInstance();
7544
+ const isActive = vue.ref(false);
7545
+ const classes = vue.computed(() => {
7546
+ return {
7547
+ [`is-${props2.placement}`]: true
7548
+ };
7549
+ });
7550
+ const style = vue.computed(() => {
7551
+ return props2.placement === "top" || props2.placement === "bottom" ? {
7552
+ height: `${props2.height}px`
7553
+ } : {
7554
+ width: `${props2.width}px`
7555
+ };
7556
+ });
7557
+ vue.watch(() => props2.modelValue, (v) => {
7558
+ isActive.value = v;
7559
+ }, {
7560
+ immediate: true
7561
+ });
7562
+ const handleBefore = (e, hook) => {
7563
+ if (!isActive.value) return;
7564
+ const fn = hook && hook(e);
7565
+ if (fn && fn.then) {
7566
+ return fn.then((res) => {
7567
+ isActive.value = false;
7568
+ return res;
7569
+ });
7570
+ } else if (!fn || fn === true) {
7571
+ isActive.value = false;
7572
+ }
7573
+ };
7574
+ const handleClose = (e, closable) => {
7575
+ if (closable || props2.maskClosable && e.target.classList.contains("vc-drawer__wrapper")) {
7576
+ if (props2.closeWithCancel) {
7577
+ handleBefore(e, handleCancel);
7578
+ } else {
7579
+ isActive.value = false;
7580
+ }
7581
+ }
7582
+ };
7583
+ const handleRemove = () => {
7584
+ !instance.isUnmounted && (emit("close"), emit("update:modelValue", false), emit("visible-change", false));
7585
+ };
7586
+ const handleOk = (...rest) => {
7587
+ const ok = instance.vnode.props?.onOk || props2.onOk || (() => {
7588
+ });
7589
+ return ok(...rest);
7590
+ };
7591
+ const handleCancel = (...rest) => {
7592
+ const cancel = instance.vnode.props?.onCancel || props2.onCancel || (() => {
7593
+ });
7594
+ return cancel(...rest);
7595
+ };
7596
+ useScrollbar(isActive);
7597
+ expose({
7598
+ isActive,
7599
+ // for portal
7600
+ toggle(v) {
7601
+ v = typeof v === "boolean" ? v : !isActive.value;
7602
+ isActive.value = v;
7603
+ }
7604
+ });
7605
+ return () => {
7606
+ let _slot, _slot2;
7607
+ return vue.createVNode("div", {
7608
+ "class": [classes.value, "vc-drawer"]
7609
+ }, [vue.createVNode(TransitionFade, {
7610
+ "delay": 50
7611
+ }, _isSlot$1(_slot = vue.withDirectives(vue.createVNode("div", {
7612
+ "style": props2.maskStyle,
7613
+ "class": "vc-drawer__mask",
7614
+ "onClick": (e) => handleClose(e, props2.maskClosable)
7615
+ }, null), [[vue.vShow, props2.mask && isActive.value]])) ? _slot : {
7616
+ default: () => [_slot]
7617
+ }), vue.createVNode(TransitionSlide, {
7618
+ "mode": props2.placement,
7619
+ "onAfterLeave": handleRemove
7620
+ }, _isSlot$1(_slot2 = vue.withDirectives(vue.createVNode("div", {
7621
+ "class": [props2.wrapperClass, "vc-drawer__wrapper"],
7622
+ "style": [style.value, props2.wrapperStyle]
7623
+ }, [vue.createVNode("div", {
7624
+ "class": "vc-drawer__container"
7625
+ }, [vue.createVNode("div", {
7626
+ "class": "vc-drawer__header"
7627
+ }, [slots.header ? slots.header() : typeof props2.title === "string" ? vue.createVNode("div", {
7628
+ "class": "vc-drawer__title",
7629
+ "innerHTML": props2.title
7630
+ }, null) : typeof props2.title === "function" && vue.createVNode(Customer, {
7631
+ "render": props2.title
7632
+ }, null), vue.createVNode("a", {
7633
+ "class": "vc-drawer__close",
7634
+ "onClick": (e) => handleClose(e, true)
7635
+ }, [vue.createVNode(Icon, {
7636
+ "type": "close"
7637
+ }, null)])]), vue.createVNode("div", {
7638
+ "class": ["vc-drawer__content"]
7639
+ }, [typeof props2.content === "string" ? vue.createVNode("div", {
7640
+ "innerHTML": props2.content
7641
+ }, null) : typeof props2.content === "function" ? vue.createVNode(Customer, {
7642
+ "render": props2.content
7643
+ }, null) : null, slots.default?.()]), props2.footer && (props2.cancelText || props2.okText) && vue.createVNode("div", {
7644
+ "class": ["vc-drawer__footer"]
7645
+ }, [slots["footer-extra"]?.(), !slots.footer ? vue.createVNode(vue.Fragment, null, [props2.cancelText && vue.createVNode(Button, {
7646
+ "style": "margin-right: 8px;",
7647
+ "onClick": (e) => handleBefore(e, handleCancel)
7648
+ }, {
7649
+ default: () => [props2.cancelText]
7650
+ }), props2.okText && vue.createVNode(Button, {
7651
+ "type": "primary",
7652
+ "onClick": (e) => handleBefore(e, handleOk)
7653
+ }, {
7654
+ default: () => [props2.okText]
7655
+ })]) : slots.footer?.()])])]), [[vue.vShow, isActive.value]])) ? _slot2 : {
7656
+ default: () => [_slot2]
7657
+ })]);
7658
+ };
7659
+ }
7660
+ });
7661
+ const Drawer = new Portal(DrawerView, {
7662
+ leaveDelay: 0,
7663
+ multiple: true
7664
+ });
7665
+ const destroy$5 = () => Drawer.destroy();
7666
+ const open$1 = (options) => {
7667
+ const leaf = Drawer.popup({
7668
+ ...options,
7669
+ onFulfilled: options.onClose,
7670
+ // 当组件内使用emit('close'),避免重复触发
7671
+ onClose: null
7672
+ });
7673
+ leaf.wrapper.toggle?.(true);
7674
+ return leaf;
7675
+ };
7676
+ const drawer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7677
+ __proto__: null,
7678
+ destroy: destroy$5,
7679
+ open: open$1
7680
+ }, Symbol.toStringTag, { value: "Module" }));
7681
+ const MDrawerView = DrawerView;
7682
+ const props$V = {
7683
+ tag: {
7684
+ type: String,
7685
+ default: "div"
7686
+ }
7687
+ };
7688
+ const COMPONENT_NAME$14 = "vc-dropdown";
7689
+ const Dropdown = /* @__PURE__ */ vue.defineComponent({
7690
+ name: COMPONENT_NAME$14,
7691
+ props: props$V,
7692
+ setup(props2, {
7693
+ slots
7694
+ }) {
7695
+ return () => {
7696
+ return vue.createVNode("div", {
7697
+ "class": "vc-dropdown"
7698
+ }, [slots?.default?.()]);
7699
+ };
7700
+ }
7701
+ });
7702
+ const MDropdown = Dropdown;
7703
+ const props$U = {
7704
+ tag: {
7705
+ type: String,
7706
+ default: "div"
7707
+ }
7708
+ };
7709
+ const COMPONENT_NAME$13 = "vc-editor";
7710
+ const Editor = /* @__PURE__ */ vue.defineComponent({
7711
+ name: COMPONENT_NAME$13,
7712
+ props: props$U,
7713
+ setup(props2, {
7714
+ slots
7715
+ }) {
7716
+ return () => {
7717
+ return vue.createVNode("div", {
7718
+ "class": "vc-editor"
7719
+ }, [slots?.default?.()]);
7720
+ };
7721
+ }
7722
+ });
7723
+ const MEditor = Editor;
7724
+ const MExpand = Expand;
7725
+ const props$T = {
7726
+ tag: {
7727
+ type: String,
7728
+ default: "form"
7729
+ },
7730
+ model: {
7731
+ type: Object
7732
+ },
7733
+ rules: {
7734
+ type: Object
7735
+ },
7736
+ labelWidth: {
7737
+ type: Number
7738
+ },
7739
+ showMessage: {
7740
+ type: Boolean,
7741
+ default: true
7742
+ },
7743
+ inline: {
7744
+ type: Boolean,
7745
+ default: false
7746
+ },
7747
+ labelPosition: {
7748
+ type: String,
7749
+ default: "right"
7750
+ },
7751
+ autocomplete: {
7752
+ type: String,
7753
+ default: "off"
7754
+ },
7755
+ styleless: {
7756
+ type: Boolean,
7757
+ default: false
7758
+ }
7759
+ };
7760
+ const useForm = (expose, options = {}) => {
7761
+ const instance = vue.getCurrentInstance();
7762
+ const props2 = instance.props;
7763
+ const fields = [];
7764
+ vue.provide("form", {
7765
+ props: props2,
7766
+ add: (field) => {
7767
+ field && fields.push(field);
7768
+ },
7769
+ remove: (field) => {
7770
+ field && fields.splice(fields.indexOf(field), 1);
7771
+ }
7772
+ });
7773
+ const filterFields = (fields$) => {
7774
+ return !fields$ ? fields : fields.filter((item) => fields$.includes(item.props.prop));
7775
+ };
7776
+ const getField = (prop) => {
7777
+ const field = fields.find((item) => item.props.prop === prop);
7778
+ if (!field) throw new VcError("form", "请选择有用的prop值");
7779
+ return field;
7780
+ };
7781
+ const showToast = (msg) => {
7782
+ props2.showMessage && options.throwToast?.(msg);
7783
+ };
7784
+ const sortErrors = async (errors) => {
7785
+ const positions = await Promise.all(fields.map((item) => item.exposed.getPosition()));
7786
+ try {
7787
+ return [...errors].toSorted((a, b) => {
7788
+ const aIndex = fields.findIndex((i) => i.props.prop === a.prop);
7789
+ const bIndex = fields.findIndex((i) => i.props.prop === b.prop);
7790
+ const aPosition = positions[aIndex];
7791
+ const bPosition = positions[bIndex];
7792
+ if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
7793
+ return aPosition.left - bPosition.left;
7794
+ });
7795
+ } catch {
7796
+ return errors;
7797
+ }
7798
+ };
7799
+ const scrollIntoView = (prop) => {
7800
+ const field = getField(prop);
7801
+ field.vnode?.el?.scrollIntoView?.({
7802
+ behavior: "smooth",
7803
+ block: "center"
7804
+ });
7805
+ };
7806
+ const reset = (options$ = {}) => {
7807
+ const { fields: fields$, original = {} } = options$;
7808
+ filterFields(fields$).forEach((field) => {
7063
7809
  let v;
7064
7810
  try {
7065
7811
  v = getPropByPath(original, field.props.prop).v;
7066
- } catch (e) {
7812
+ } catch {
7067
7813
  }
7068
7814
  field.exposed.reset(v);
7069
7815
  });
@@ -7134,6 +7880,11 @@ var Vc = (function (exports, vue) {
7134
7880
  type: [Boolean, String],
7135
7881
  default: false
7136
7882
  },
7883
+ // 控制`*`是否展示
7884
+ asterisk: {
7885
+ type: Boolean,
7886
+ default: true
7887
+ },
7137
7888
  error: {
7138
7889
  type: String
7139
7890
  },
@@ -7178,7 +7929,7 @@ var Vc = (function (exports, vue) {
7178
7929
  if (!form?.props) {
7179
7930
  throw new VcError("form-item", "form-item需要在form内使用");
7180
7931
  }
7181
- const formItem = vue.inject("form-item", {});
7932
+ const formItem = vue.inject("vc-form-item", {});
7182
7933
  const validateState = vue.ref("");
7183
7934
  const validateMessage = vue.ref("");
7184
7935
  let validateDisabled = false;
@@ -7216,7 +7967,7 @@ var Vc = (function (exports, vue) {
7216
7967
  });
7217
7968
  const classes = vue.computed(() => {
7218
7969
  return {
7219
- "is-require": isRequired.value,
7970
+ "is-require": isRequired.value && props2.asterisk,
7220
7971
  "is-error": validateState.value === "error",
7221
7972
  "is-validating": validateState.value === "validating",
7222
7973
  "is-inline": form.props.inline,
@@ -7268,667 +8019,313 @@ var Vc = (function (exports, vue) {
7268
8019
  vue.watch(
7269
8020
  () => props2.error,
7270
8021
  (v) => {
7271
- validateMessage.value = v || "";
7272
- validateState.value = v === "" ? "" : "error";
7273
- }
7274
- );
7275
- const reset = (v) => {
7276
- validateState.value = "";
7277
- validateMessage.value = "";
7278
- const model = form.props.model;
7279
- if (!props2.prop) return;
7280
- const { o, k } = getPropByPath(model, props2.prop);
7281
- if (!k) return;
7282
- validateDisabled = true;
7283
- o[k] = v !== null && v !== void 0 ? v : Array.isArray(fieldValue.value) ? [].concat(initialValue) : initialValue;
7284
- };
7285
- const validate = async (trigger) => {
7286
- if (!props2.prop) return;
7287
- let rules = currentRules.value.filter((rule) => !rule.trigger || rule.trigger.includes(trigger));
7288
- if (!rules.length) {
7289
- if (!props2.required) {
7290
- return;
7291
- } else {
7292
- rules = [{
7293
- required: true,
7294
- message: typeof props2.required === "string" ? props2.required : void 0
7295
- }];
7296
- }
7297
- }
7298
- validateState.value = "validating";
7299
- const descriptor = {};
7300
- descriptor[props2.prop] = rules;
7301
- const validator = new Validator(descriptor);
7302
- const model = {};
7303
- model[props2.prop] = filterEmpty(fieldValue.value);
7304
- try {
7305
- await validator.validate(model, { first: false });
7306
- validateState.value = "success";
7307
- validateMessage.value = "";
7308
- } catch (errors) {
7309
- validateState.value = "error";
7310
- validateMessage.value = errors[0].message;
7311
- throw {
7312
- prop: props2.prop,
7313
- message: validateMessage.value
7314
- };
7315
- }
7316
- validateDisabled = false;
7317
- };
7318
- const handleFieldBlur = () => {
7319
- if (!props2.prop) {
7320
- formItem.blur?.();
7321
- return;
7322
- }
7323
- validate("blur");
7324
- };
7325
- const handleFieldChange = () => {
7326
- if (!props2.prop) {
7327
- formItem.change?.();
7328
- return;
7329
- }
7330
- if (validateDisabled) {
7331
- validateDisabled = false;
7332
- return;
7333
- }
7334
- validate("change");
7335
- };
7336
- const getPosition = async () => {
7337
- let el2 = instance.vnode.el;
7338
- try {
7339
- while (el2 && !el2.getBoundingClientRect) {
7340
- el2 = el2.nextSibling;
7341
- }
7342
- ;
7343
- const rect = el2.getBoundingClientRect();
7344
- return {
7345
- top: rect.top,
7346
- left: rect.left
7347
- };
7348
- } catch (e) {
7349
- throw new VcError("form-item", "form-item位置计算错误");
7350
- }
7351
- };
7352
- const fields = vue.reactive([]);
7353
- vue.provide("form-item", {
7354
- fields,
7355
- blur: handleFieldBlur,
7356
- change: handleFieldChange,
7357
- message: validateMessage,
7358
- add: (field) => {
7359
- field && fields.push(field);
7360
- },
7361
- remove: (field) => {
7362
- field && fields.splice(fields.indexOf(field), 1);
7363
- }
7364
- });
7365
- vue.onMounted(() => {
7366
- if (props2.prop) {
7367
- form.add?.(instance);
7368
- initialValue = cloneDeep(fieldValue.value);
7369
- }
7370
- formItem.add?.(instance);
7371
- });
7372
- vue.onBeforeUnmount(() => {
7373
- form.remove?.(instance);
7374
- formItem.remove?.(instance);
7375
- });
7376
- vue.watch(
7377
- () => props2.rules,
7378
- () => {
7379
- props2.resetByRulesChanged && reset();
7380
- }
7381
- );
7382
- vue.watch(
7383
- () => formItem.fields?.length,
7384
- async (v) => {
7385
- if (!isNest.value || !v) return isNestLast.value = false;
7386
- const fields$ = [...vue.toRaw(formItem.fields)];
7387
- const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
7388
- const sortFields = fields$.toSorted((a, b) => {
7389
- const aIndex = fields$.findIndex((i) => i === a);
7390
- const bIndex = fields$.findIndex((i) => i === b);
7391
- const aPosition = positions[aIndex];
7392
- const bPosition = positions[bIndex];
7393
- if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
7394
- return aPosition.left - bPosition.left;
7395
- });
7396
- isNestLast.value = sortFields[sortFields.length - 1] === instance;
7397
- }
7398
- );
7399
- expose({
7400
- validate,
7401
- reset,
7402
- getPosition
7403
- });
7404
- return {
7405
- isNest,
7406
- isStyleless,
7407
- isNestLast,
7408
- validateMessage,
7409
- classes,
7410
- labelStyle,
7411
- contentStyle,
7412
- showError,
7413
- labelPosition
7414
- };
7415
- };
7416
- const COMPONENT_NAME$11 = "vc-form-item";
7417
- const FormItem = /* @__PURE__ */ vue.defineComponent({
7418
- name: COMPONENT_NAME$11,
7419
- props: props$S,
7420
- setup(props2, {
7421
- slots,
7422
- expose
7423
- }) {
7424
- const it = useFormItem(expose);
7425
- const {
7426
- isStyleless,
7427
- isNest,
7428
- classes,
7429
- labelStyle,
7430
- contentStyle,
7431
- showError,
7432
- validateMessage
7433
- } = it;
7434
- const {
7435
- label,
7436
- labelFor
7437
- } = props2;
7438
- const errorColorClass = "vc-form-item__error";
7439
- return () => {
7440
- if (isStyleless.value) return [slots.default?.(), slots.error?.({
7441
- show: showError.value,
7442
- nest: isNest.value,
7443
- message: validateMessage.value,
7444
- class: errorColorClass
7445
- })];
7446
- return vue.createVNode("div", {
7447
- "class": ["vc-form-item", classes.value]
7448
- }, [vue.createVNode("div", {
7449
- "style": labelStyle.value,
7450
- "class": "vc-form-item__label",
7451
- "for": labelFor
7452
- }, [vue.createVNode("label", null, [label || slots.label?.()])]), vue.createVNode("div", {
7453
- "class": "vc-form-item__wrapper"
7454
- }, [vue.createVNode("div", {
7455
- "class": "vc-form-item__content",
7456
- "style": contentStyle.value
7457
- }, [slots.default?.(), slots.error ? slots.error({
7458
- show: showError.value,
7459
- nest: isNest.value,
7460
- message: validateMessage.value,
7461
- class: errorColorClass
7462
- }) : vue.createVNode(TransitionFade, null, {
7463
- default: () => [vue.withDirectives(vue.createVNode("div", {
7464
- "class": ["vc-form-item__tip", isNest.value ? "is-nest" : "", errorColorClass]
7465
- }, [validateMessage.value]), [[vue.vShow, showError.value]])]
7466
- })])])]);
7467
- };
7468
- }
7469
- });
7470
- const props$R = {
7471
- ...props$T,
7472
- showToast: {
7473
- type: Boolean,
7474
- default: false
7475
- },
7476
- border: {
7477
- type: Boolean,
7478
- default: false
7479
- }
7480
- };
7481
- const props$Q = {
7482
- content: [String, Function],
7483
- maskClosable: {
7484
- type: Boolean,
7485
- default: true
7486
- },
7487
- // 单位ms
7488
- duration: {
7489
- type: Number,
7490
- default: 3e3
7491
- },
7492
- mode: {
7493
- type: String,
7494
- default: "info",
7495
- validator: (val) => ["info", "loading", "success", "warning", "error"].includes(val)
7496
- }
7497
- };
7498
- const MSpin = Spin;
7499
- const MTransition = Transition;
7500
- const MTransitionCollapse = TransitionCollapse;
7501
- const MTransitionFade = TransitionFade;
7502
- const MTransitionScale = TransitionScale;
7503
- const MTransitionSlide = TransitionSlide;
7504
- const MTransitionZoom = TransitionZoom;
7505
- const COMPONENT_NAME$10 = "vcm-toast";
7506
- const MToastView = /* @__PURE__ */ vue.defineComponent({
7507
- name: COMPONENT_NAME$10,
7508
- emits: ["close", "portal-fulfilled"],
7509
- props: props$Q,
7510
- setup(props2, {
7511
- emit,
7512
- expose
7513
- }) {
7514
- const isActive = vue.ref(false);
7515
- const currentContent = vue.ref();
7516
- const setContent = (v) => {
7517
- currentContent.value = v;
7518
- };
7519
- const handleRemove = () => {
7520
- emit("close");
7521
- emit("portal-fulfilled");
7522
- };
7523
- const handleClose = () => {
7524
- if (props2.maskClosable) {
7525
- isActive.value = false;
7526
- }
7527
- };
7528
- vue.watch(() => props2.content, setContent, {
7529
- immediate: true
7530
- });
7531
- let timer;
7532
- vue.onMounted(() => {
7533
- isActive.value = true;
7534
- if (props2.duration !== 0) {
7535
- timer = setTimeout(() => isActive.value = false, props2.duration);
7536
- }
7537
- });
7538
- vue.onUnmounted(() => {
7539
- timer && clearTimeout(timer);
7540
- });
7541
- const exposes = ["destroy", "remove", "close", "hide"].reduce((pre, key) => {
7542
- pre[key] = handleRemove;
7543
- return pre;
7544
- }, {});
7545
- expose(exposes);
7546
- return () => {
7547
- return vue.createVNode("div", {
7548
- "class": "vcm-toast"
7549
- }, [vue.createVNode("div", {
7550
- "class": "vcm-toast__bg",
7551
- "onClick": handleClose,
7552
- "onTouchmove": vue.withModifiers(() => {
7553
- }, ["prevent"])
7554
- }, null), vue.createVNode(MTransitionFade, {
7555
- "duration": {
7556
- enter: 300,
7557
- leave: 150
7558
- },
7559
- "onAfterLeave": handleRemove
7560
- }, {
7561
- default: () => [vue.withDirectives(vue.createVNode("div", {
7562
- "class": "vcm-toast__wrapper"
7563
- }, [props2.mode === "loading" && vue.createVNode(MSpin, {
7564
- "class": "vcm-toast__loading"
7565
- }, null), typeof currentContent.value === "string" ? vue.createVNode("div", {
7566
- "class": "vcm-toast__content",
7567
- "innerHTML": currentContent.value
7568
- }, null) : typeof currentContent.value === "function" ? vue.createVNode(MCustomer, {
7569
- "render": currentContent.value
7570
- }, null) : null]), [[vue.vShow, isActive.value]])]
7571
- })]);
7572
- };
7573
- }
7574
- });
7575
- const defaults$2 = {
7576
- tag: "div",
7577
- el: "body",
7578
- alive: false,
7579
- multiple: false,
7580
- aliveRegExp: { className: /(vc-hack-alive|vc-hack-cp)/ },
7581
- aliveVisibleKey: "isVisible",
7582
- aliveUpdateKey: "update",
7583
- leaveDelay: 300,
7584
- autoDestroy: true,
7585
- components: {},
7586
- uses: {},
7587
- fragment: false,
7588
- insertion: "last"
7589
- };
7590
- class PortalLeaf {
7591
- app;
7592
- /**
7593
- * 目标的实例,挂载到app上
7594
- */
7595
- wrapper;
7596
- propsData;
7597
- /**
7598
- * 销毁的函数,挂载到app上,避免冲突
7599
- */
7600
- destroy;
7601
- /**
7602
- * 自动销毁的标记,挂载到app上,避免冲突
7603
- */
7604
- autoDestroy;
7605
- target;
7606
- constructor(target) {
7607
- this.target = target;
7608
- this.autoDestroy = false;
7609
- this.destroy = /* istanbul ignore next */
7610
- () => {
7611
- throw new VcError("portal", "未注册的destroy方法");
7612
- };
7613
- }
7614
- then(resolve, reject) {
7615
- return this.target.then(resolve, reject);
7616
- }
7617
- catch(callback) {
7618
- return this.target.catch(callback);
7619
- }
7620
- finally(callback) {
7621
- return this.target.finally(callback);
7622
- }
7623
- }
7624
- const COMPONENT_NAME$$ = "vc-portal";
7625
- class Portal {
7626
- /**
7627
- * 清理Portals类型组件
7628
- * @param name 清理的组件名, boolean表示全部leafs是否强制清理
7629
- */
7630
- static clear(name) {
7631
- try {
7632
- let force = false;
7633
- let target = /* @__PURE__ */ new Map();
7634
- if (name && typeof name !== "boolean") {
7635
- let names = [];
7636
- if (typeof name === "string") {
7637
- names = [name];
7638
- } else if (name instanceof Array && name.length > 0) {
7639
- names = name;
7640
- }
7641
- names.forEach((i) => target.set(i, ""));
7642
- force = true;
7643
- } else {
7644
- force = !!name;
7645
- target = Portal.leafs;
7646
- }
7647
- for (const key of target.keys()) {
7648
- const leaf = Portal.leafs.get(key);
7649
- if (leaf && (force === true || leaf.autoDestroy === true)) {
7650
- leaf.destroy();
7651
- }
7652
- }
7653
- } catch (e) {
7654
- /* istanbul ignore next -- @preserve */
7655
- throw new VcError("instance", e);
7656
- }
7657
- }
7658
- /**
7659
- * 清理全部Portals
7660
- */
7661
- static clearAll() {
7662
- try {
7663
- Portal.leafs.forEach((leaf) => leaf.destroy());
7664
- } catch (e) {
7665
- /* istanbul ignore next -- @preserve */
7666
- throw new VcError("instance", e);
7667
- }
7668
- }
7669
- static leafs = /* @__PURE__ */ new Map();
7670
- wrapper;
7671
- globalOptions;
7672
- constructor(wrapper, options) {
7673
- this.wrapper = wrapper;
7674
- this.globalOptions = {
7675
- ...options,
7676
- name: options?.name || wrapper.name || getUid(COMPONENT_NAME$$)
7677
- };
7678
- }
7679
- popup(propsData, options) {
7680
- if (!options) {
7681
- options = propsData || {};
7682
- } else {
7683
- options.propsData = propsData;
7684
- }
7685
- const $options = { ...this.getDefaultOptions(), ...options };
7686
- const { onFulfilled, onRejected, ...rest } = $options;
7687
- let onFulfilled$ = (
7688
- /* istanbul ignore next -- @preserve */
7689
- () => {
7690
- }
7691
- );
7692
- let onRejected$ = (
7693
- /* istanbul ignore next -- @preserve */
7694
- () => {
7695
- }
7696
- );
7697
- const target = new Promise((resolve, reject) => {
7698
- onFulfilled$ = (v) => {
7699
- onFulfilled?.(v);
7700
- resolve(v);
7701
- };
7702
- onRejected$ = (v) => {
7703
- onRejected?.(v);
7704
- reject(v);
7705
- };
7706
- });
7707
- return this.render(rest, target, onFulfilled$, onRejected$);
7708
- }
7709
- /**
7710
- * 销毁当前Portal下的节点
7711
- * @param target [description]
7712
- */
7713
- destroy = (target) => {
7714
- const { multiple, name } = this.getDefaultOptions();
7715
- target = target || name;
7716
- const instance = typeof target === "object" ? target : Portal.leafs.get(target);
7717
- if (instance) {
7718
- instance.destroy();
7719
- } else if (multiple) {
7720
- Portal.leafs.forEach((item, key) => {
7721
- if (key.includes(name)) {
7722
- item.destroy();
7723
- }
7724
- });
7725
- }
7726
- };
7727
- getDefaultOptions() {
7728
- return {
7729
- ...defaults$2,
7730
- ...VcInstance.options.Portal,
7731
- ...this.globalOptions
7732
- };
7733
- }
7734
- createCallback(getLeaf, delay, callback) {
7735
- return (...args) => {
7736
- const done = () => {
7737
- const leaf = getLeaf();
7738
- /* istanbul ignore next -- @preserve */
7739
- if (!leaf) {
7740
- throw new VcError("portal", "实例不存在或已卸载");
7741
- }
7742
- leaf.destroy();
7743
- };
7744
- delay ? setTimeout(done, delay) : done();
7745
- callback?.(...args);
7746
- };
7747
- }
7748
- render(options, target, onFulfilled, onRejected) {
7749
- const {
7750
- el: el2,
7751
- tag,
7752
- alive,
7753
- aliveRegExp,
7754
- aliveVisibleKey,
7755
- aliveUpdateKey,
7756
- name: name$,
7757
- leaveDelay,
7758
- autoDestroy,
7759
- multiple,
7760
- fragment,
7761
- onDestroyed,
7762
- onBeforeCreate,
7763
- insertion,
7764
- // 全局注册
7765
- globalProperties,
7766
- install,
7767
- components,
7768
- uses,
7769
- slots,
7770
- parent,
7771
- propsData,
7772
- ...rest
7773
- } = options;
7774
- let useAllNodes = fragment;
7775
- const name = multiple ? `${name$}__${getUid(COMPONENT_NAME$$)}` : name$;
7776
- const container = document.createElement(tag);
7777
- const root = typeof el2 === "object" ? el2 : document.querySelector(el2 || "body");
7778
- !alive && Portal.leafs.get(name)?.destroy();
7779
- const propsData$ = propsData || rest;
7780
- let leaf = new PortalLeaf(target);
7781
- const isDestroyed = () => {
7782
- const leaf$ = Portal.leafs.get(name);
7783
- return !leaf$ || leaf$ !== leaf;
7784
- };
7785
- const $onDestroyed = (...args) => {
7786
- if (isDestroyed()) return;
7787
- onDestroyed?.(...args);
7788
- leaf.app?.unmount();
7789
- /* istanbul ignore else -- @preserve */
7790
- if (useAllNodes) {
7791
- root?.contains(container) && root.removeChild(container);
7792
- } else if (container && container._children) {
7793
- container._children.forEach((i) => {
7794
- root?.contains(i) && root.removeChild(i);
7795
- });
7796
- }
7797
- Portal.leafs.delete(name);
7798
- };
7799
- const $onRejected = this.createCallback(() => leaf, leaveDelay, onRejected);
7800
- const $onFulfilled = this.createCallback(() => leaf, leaveDelay, onFulfilled);
7801
- if (alive && Portal.leafs.has(name)) {
7802
- leaf = Portal.leafs.get(name);
7803
- leaf.target = target;
7804
- leaf.propsData.value = propsData$;
7805
- leaf.wrapper?.[aliveUpdateKey]?.(options);
7806
- } else {
7807
- const wrapper = this.wrapper;
7808
- const app = vue.createApp({
7809
- name: COMPONENT_NAME$$,
7810
- parent,
7811
- setup() {
7812
- if (alive) {
7813
- const handleExtra = (e) => {
7814
- try {
7815
- const path = e.path || composedPath(e);
7816
- /* istanbul ignore else -- @preserve */
7817
- if (container && e.target && !container.contains(e.target) && !path?.some((item) => utils.eleInRegExp(item, aliveRegExp))) {
7818
- /* istanbul ignore else -- @preserve */
7819
- if (leaf.wrapper && leaf.wrapper?.[aliveVisibleKey]) {
7820
- leaf.wrapper[aliveVisibleKey] = false;
7821
- }
7822
- leaveDelay ? setTimeout($onDestroyed, leaveDelay) : $onDestroyed();
7823
- }
7824
- } catch (error2) {
7825
- /* istanbul ignore next -- @preserve */
7826
- throw new VcError("portal", error2);
7827
- }
7828
- };
7829
- vue.onMounted(() => {
7830
- document.addEventListener("click", handleExtra, true);
7831
- });
7832
- vue.onBeforeUnmount(() => {
7833
- document.removeEventListener("click", handleExtra, true);
7834
- });
7835
- }
7836
- const propsData1 = vue.ref(propsData$);
7837
- const propsData2 = vue.ref();
7838
- leaf.propsData = propsData1;
7839
- const allowMounted = vue.ref(typeof onBeforeCreate !== "function");
7840
- if (!allowMounted.value) {
7841
- const result = onBeforeCreate(propsData$);
7842
- if (result && result.then) {
7843
- result.then((response) => {
7844
- if (isDestroyed()) return;
7845
- allowMounted.value = true;
7846
- propsData2.value = response;
7847
- }).catch((error2) => {
7848
- $onDestroyed(error2);
7849
- });
7850
- } else {
7851
- allowMounted.value = true;
7852
- propsData2.value = result;
7853
- }
7854
- }
7855
- return () => allowMounted.value && vue.h(
7856
- wrapper,
7857
- {
7858
- ...propsData1.value,
7859
- ...propsData2.value,
7860
- ref: (vm) => leaf.wrapper = vm,
7861
- onPortalFulfilled: (...args) => $onFulfilled(...args),
7862
- onPortalRejected: (...args) => $onRejected(...args),
7863
- onPortalDestroyed: (...args) => $onDestroyed(...args)
7864
- },
7865
- slots || void 0
7866
- );
7867
- }
7868
- });
7869
- leaf.app = app;
7870
- if (globalProperties) {
7871
- app.config.globalProperties = globalProperties;
7872
- }
7873
- for (const key in components) {
7874
- app.component(key, components[key]);
7875
- }
7876
- for (const key in uses) {
7877
- app.use(uses[key]);
7878
- }
7879
- install?.(app);
7880
- app.mount(container);
8022
+ validateMessage.value = v || "";
8023
+ validateState.value = v === "" ? "" : "error";
7881
8024
  }
7882
- leaf.destroy = $onDestroyed;
7883
- leaf.autoDestroy = !!autoDestroy;
7884
- Portal.leafs.set(name, leaf);
7885
- const append = (root$, child$) => {
7886
- if (!root$ || !child$) return;
7887
- if (insertion === "first") {
7888
- const firstEl = root$.firstElementChild;
7889
- if (firstEl) {
7890
- root$.insertBefore(child$, firstEl);
7891
- return;
7892
- }
8025
+ );
8026
+ const reset = (v) => {
8027
+ validateState.value = "";
8028
+ validateMessage.value = "";
8029
+ const model = form.props.model;
8030
+ if (!props2.prop) return;
8031
+ const { o, k } = getPropByPath(model, props2.prop);
8032
+ if (!k) return;
8033
+ validateDisabled = true;
8034
+ o[k] = v !== null && v !== void 0 ? v : Array.isArray(fieldValue.value) ? [].concat(initialValue) : initialValue;
8035
+ };
8036
+ const validate = async (trigger) => {
8037
+ if (!props2.prop) return;
8038
+ let rules = currentRules.value.filter((rule) => !rule.trigger || rule.trigger.includes(trigger));
8039
+ if (!rules.length) {
8040
+ if (!props2.required) {
8041
+ return;
8042
+ } else {
8043
+ rules = [{
8044
+ required: true,
8045
+ message: typeof props2.required === "string" ? props2.required : void 0
8046
+ }];
7893
8047
  }
7894
- root$.appendChild(child$);
7895
- };
7896
- if (fragment || typeof container._children === "undefined" && !Array.from(container.children).length) {
7897
- useAllNodes = true;
7898
- container.parentElement === null && append(root, container);
7899
- } else if (!container._children) {
7900
- container._children = [];
7901
- let childs = Array.from(container.children);
7902
- if (insertion === "first") {
7903
- childs = childs.reverse();
8048
+ }
8049
+ validateState.value = "validating";
8050
+ const descriptor = {};
8051
+ descriptor[props2.prop] = rules;
8052
+ const validator = new Validator(descriptor);
8053
+ const model = {};
8054
+ model[props2.prop] = filterEmpty(fieldValue.value);
8055
+ try {
8056
+ await validator.validate(model, { first: false });
8057
+ validateState.value = "success";
8058
+ validateMessage.value = "";
8059
+ } catch (errors) {
8060
+ validateState.value = "error";
8061
+ validateMessage.value = errors[0].message;
8062
+ throw {
8063
+ prop: props2.prop,
8064
+ message: validateMessage.value
8065
+ };
8066
+ }
8067
+ validateDisabled = false;
8068
+ };
8069
+ const handleFieldBlur = () => {
8070
+ if (!props2.prop) {
8071
+ formItem.blur?.();
8072
+ return;
8073
+ }
8074
+ validate("blur");
8075
+ };
8076
+ const handleFieldChange = () => {
8077
+ if (!props2.prop) {
8078
+ formItem.change?.();
8079
+ return;
8080
+ }
8081
+ if (validateDisabled) {
8082
+ validateDisabled = false;
8083
+ return;
8084
+ }
8085
+ validate("change");
8086
+ };
8087
+ const getPosition = async () => {
8088
+ let el2 = instance.vnode.el;
8089
+ try {
8090
+ while (el2 && !el2.getBoundingClientRect) {
8091
+ el2 = el2.nextSibling;
7904
8092
  }
7905
- childs.forEach((i) => {
7906
- append(root, i);
7907
- container._children?.push?.(i);
8093
+ ;
8094
+ const rect = el2.getBoundingClientRect();
8095
+ return {
8096
+ top: rect.top,
8097
+ left: rect.left
8098
+ };
8099
+ } catch {
8100
+ throw new VcError("form-item", "form-item位置计算错误");
8101
+ }
8102
+ };
8103
+ const fields = vue.reactive([]);
8104
+ vue.provide("vc-form-item", {
8105
+ fields,
8106
+ blur: handleFieldBlur,
8107
+ change: handleFieldChange,
8108
+ message: validateMessage,
8109
+ add: (field) => {
8110
+ field && fields.push(field);
8111
+ },
8112
+ remove: (field) => {
8113
+ field && fields.splice(fields.indexOf(field), 1);
8114
+ }
8115
+ });
8116
+ vue.onMounted(() => {
8117
+ if (props2.prop) {
8118
+ form.add?.(instance);
8119
+ initialValue = cloneDeep(fieldValue.value);
8120
+ }
8121
+ formItem.add?.(instance);
8122
+ });
8123
+ vue.onBeforeUnmount(() => {
8124
+ form.remove?.(instance);
8125
+ formItem.remove?.(instance);
8126
+ });
8127
+ vue.watch(
8128
+ () => props2.rules,
8129
+ () => {
8130
+ props2.resetByRulesChanged && reset();
8131
+ }
8132
+ );
8133
+ vue.watch(
8134
+ () => formItem.fields?.length,
8135
+ async (v) => {
8136
+ if (!isNest.value || !v) return isNestLast.value = false;
8137
+ const fields$ = [...vue.toRaw(formItem.fields)];
8138
+ const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
8139
+ const sortFields = fields$.toSorted((a, b) => {
8140
+ const aIndex = fields$.findIndex((i) => i === a);
8141
+ const bIndex = fields$.findIndex((i) => i === b);
8142
+ const aPosition = positions[aIndex];
8143
+ const bPosition = positions[bIndex];
8144
+ if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
8145
+ return aPosition.left - bPosition.left;
7908
8146
  });
8147
+ isNestLast.value = sortFields[sortFields.length - 1] === instance;
7909
8148
  }
7910
- return leaf;
8149
+ );
8150
+ expose({
8151
+ validate,
8152
+ reset,
8153
+ getPosition
8154
+ });
8155
+ return {
8156
+ isNest,
8157
+ isStyleless,
8158
+ isNestLast,
8159
+ validateMessage,
8160
+ classes,
8161
+ labelStyle,
8162
+ contentStyle,
8163
+ showError,
8164
+ labelPosition
8165
+ };
8166
+ };
8167
+ const COMPONENT_NAME$11 = "vc-form-item";
8168
+ const FormItem = /* @__PURE__ */ vue.defineComponent({
8169
+ name: COMPONENT_NAME$11,
8170
+ props: props$S,
8171
+ setup(props2, {
8172
+ slots,
8173
+ expose
8174
+ }) {
8175
+ const it = useFormItem(expose);
8176
+ const {
8177
+ isStyleless,
8178
+ isNest,
8179
+ classes,
8180
+ labelStyle,
8181
+ contentStyle,
8182
+ showError,
8183
+ validateMessage
8184
+ } = it;
8185
+ const {
8186
+ label,
8187
+ labelFor
8188
+ } = props2;
8189
+ const errorColorClass = "vc-form-item__error";
8190
+ return () => {
8191
+ if (isStyleless.value) return [slots.default?.(), slots.error?.({
8192
+ show: showError.value,
8193
+ nest: isNest.value,
8194
+ message: validateMessage.value,
8195
+ class: errorColorClass
8196
+ })];
8197
+ return vue.createVNode("div", {
8198
+ "class": ["vc-form-item", classes.value]
8199
+ }, [vue.createVNode("div", {
8200
+ "style": labelStyle.value,
8201
+ "class": "vc-form-item__label",
8202
+ "for": labelFor
8203
+ }, [vue.createVNode("label", null, [label || slots.label?.()])]), vue.createVNode("div", {
8204
+ "class": "vc-form-item__wrapper"
8205
+ }, [vue.createVNode("div", {
8206
+ "class": "vc-form-item__content",
8207
+ "style": contentStyle.value
8208
+ }, [slots.default?.(), slots.error ? slots.error({
8209
+ show: showError.value,
8210
+ nest: isNest.value,
8211
+ message: validateMessage.value,
8212
+ class: errorColorClass
8213
+ }) : vue.createVNode(TransitionFade, null, {
8214
+ default: () => [vue.withDirectives(vue.createVNode("div", {
8215
+ "class": ["vc-form-item__tip", isNest.value ? "is-nest" : "", errorColorClass]
8216
+ }, [validateMessage.value]), [[vue.vShow, showError.value]])]
8217
+ })])])]);
8218
+ };
7911
8219
  }
7912
- }
7913
- const props$P = {
7914
- tag: {
8220
+ });
8221
+ const props$R = {
8222
+ ...props$T,
8223
+ showToast: {
8224
+ type: Boolean,
8225
+ default: false
8226
+ },
8227
+ border: {
8228
+ type: Boolean,
8229
+ default: false
8230
+ }
8231
+ };
8232
+ const props$Q = {
8233
+ content: [String, Function],
8234
+ maskClosable: {
8235
+ type: Boolean,
8236
+ default: true
8237
+ },
8238
+ // 单位ms
8239
+ duration: {
8240
+ type: Number,
8241
+ default: 3e3
8242
+ },
8243
+ mode: {
7915
8244
  type: String,
7916
- default: "div"
8245
+ default: "info",
8246
+ validator: (val) => ["info", "loading", "success", "warning", "error"].includes(val)
7917
8247
  }
7918
8248
  };
7919
- const COMPONENT_NAME$_ = "vc-portal-view";
7920
- const PortalView = /* @__PURE__ */ vue.defineComponent({
7921
- name: COMPONENT_NAME$_,
7922
- props: props$P,
8249
+ const MSpin = Spin;
8250
+ const MTransition = Transition;
8251
+ const MTransitionCollapse = TransitionCollapse;
8252
+ const MTransitionFade = TransitionFade;
8253
+ const MTransitionScale = TransitionScale;
8254
+ const MTransitionSlide = TransitionSlide;
8255
+ const MTransitionZoom = TransitionZoom;
8256
+ const COMPONENT_NAME$10 = "vcm-toast";
8257
+ const MToastView = /* @__PURE__ */ vue.defineComponent({
8258
+ name: COMPONENT_NAME$10,
8259
+ emits: ["close", "portal-fulfilled"],
8260
+ props: props$Q,
7923
8261
  setup(props2, {
7924
- slots
8262
+ emit,
8263
+ expose
7925
8264
  }) {
8265
+ const isActive = vue.ref(false);
8266
+ const currentContent = vue.ref();
8267
+ let timer;
8268
+ const setDuration = (v) => {
8269
+ timer && clearTimeout(timer);
8270
+ if (v === 0) return;
8271
+ timer = setTimeout(() => isActive.value = false, v);
8272
+ };
8273
+ const setContent = (v) => {
8274
+ currentContent.value = v;
8275
+ };
8276
+ const handleRemove = () => {
8277
+ emit("close");
8278
+ emit("portal-fulfilled");
8279
+ };
8280
+ const handleClose = () => {
8281
+ if (props2.maskClosable) {
8282
+ isActive.value = false;
8283
+ }
8284
+ };
8285
+ vue.watch(() => props2.content, setContent, {
8286
+ immediate: true
8287
+ });
8288
+ vue.onMounted(() => {
8289
+ isActive.value = true;
8290
+ setDuration(props2.duration);
8291
+ });
8292
+ vue.onUnmounted(() => {
8293
+ timer && clearTimeout(timer);
8294
+ });
8295
+ const exposes = ["destroy", "remove", "close", "hide"].reduce((pre, key) => {
8296
+ pre[key] = handleRemove;
8297
+ return pre;
8298
+ }, {
8299
+ setContent,
8300
+ setDuration
8301
+ });
8302
+ expose(exposes);
7926
8303
  return () => {
7927
- return vue.h(vue.Fragment, [vue.h(props2.tag, {
7928
- class: "vc-portal-view"
7929
- }, slots?.default?.()), vue.h(vue.Teleport, {
7930
- to: "body"
7931
- }, slots?.content?.())]);
8304
+ return vue.createVNode("div", {
8305
+ "class": "vcm-toast"
8306
+ }, [vue.createVNode("div", {
8307
+ "class": "vcm-toast__bg",
8308
+ "onClick": handleClose,
8309
+ "onTouchmove": vue.withModifiers(() => {
8310
+ }, ["prevent"])
8311
+ }, null), vue.createVNode(MTransitionFade, {
8312
+ "duration": {
8313
+ enter: 300,
8314
+ leave: 150
8315
+ },
8316
+ "onAfterLeave": handleRemove
8317
+ }, {
8318
+ default: () => [vue.withDirectives(vue.createVNode("div", {
8319
+ "class": "vcm-toast__wrapper"
8320
+ }, [props2.mode === "loading" && vue.createVNode(MSpin, {
8321
+ "class": "vcm-toast__loading"
8322
+ }, null), typeof currentContent.value === "string" ? vue.createVNode("div", {
8323
+ "class": "vcm-toast__content",
8324
+ "innerHTML": currentContent.value
8325
+ }, null) : typeof currentContent.value === "function" ? vue.createVNode(MCustomer, {
8326
+ "render": currentContent.value
8327
+ }, null) : null]), [[vue.vShow, isActive.value]])]
8328
+ })]);
7932
8329
  };
7933
8330
  }
7934
8331
  });
@@ -7965,9 +8362,9 @@ var Vc = (function (exports, vue) {
7965
8362
  success: success$3,
7966
8363
  warning: warning$3
7967
8364
  }, Symbol.toStringTag, { value: "Module" }));
7968
- const COMPONENT_NAME$Z = "vcm-form";
8365
+ const COMPONENT_NAME$$ = "vcm-form";
7969
8366
  const MForm = vue.defineComponent({
7970
- name: COMPONENT_NAME$Z,
8367
+ name: COMPONENT_NAME$$,
7971
8368
  props: props$R,
7972
8369
  setup(props2, { slots, expose }) {
7973
8370
  useForm(expose, {
@@ -7987,17 +8384,17 @@ var Vc = (function (exports, vue) {
7987
8384
  };
7988
8385
  }
7989
8386
  });
7990
- const props$O = {
8387
+ const props$P = {
7991
8388
  ...props$S,
7992
8389
  indent: {
7993
8390
  type: Number,
7994
8391
  default: 12
7995
8392
  }
7996
8393
  };
7997
- const COMPONENT_NAME$Y = "vcm-form-item";
8394
+ const COMPONENT_NAME$_ = "vcm-form-item";
7998
8395
  const MFormItem = /* @__PURE__ */ vue.defineComponent({
7999
- name: COMPONENT_NAME$Y,
8000
- props: props$O,
8396
+ name: COMPONENT_NAME$_,
8397
+ props: props$P,
8001
8398
  setup(props2, {
8002
8399
  slots,
8003
8400
  expose
@@ -8049,24 +8446,24 @@ var Vc = (function (exports, vue) {
8049
8446
  };
8050
8447
  }
8051
8448
  });
8052
- const COMPONENT_NAME$X = "vc-fragment";
8449
+ const COMPONENT_NAME$Z = "vc-fragment";
8053
8450
  const Fragment = vue.defineComponent({
8054
- name: COMPONENT_NAME$X,
8451
+ name: COMPONENT_NAME$Z,
8055
8452
  setup(_, { slots }) {
8056
8453
  return () => vue.h(vue.Fragment, slots.default?.());
8057
8454
  }
8058
8455
  });
8059
8456
  const MFragment = Fragment;
8060
- const props$N = {
8457
+ const props$O = {
8061
8458
  tag: {
8062
8459
  type: String,
8063
8460
  default: "div"
8064
8461
  }
8065
8462
  };
8066
- const COMPONENT_NAME$W = "vc-html-to-image";
8463
+ const COMPONENT_NAME$Y = "vc-html-to-image";
8067
8464
  const HTMLToImage = /* @__PURE__ */ vue.defineComponent({
8068
- name: COMPONENT_NAME$W,
8069
- props: props$N,
8465
+ name: COMPONENT_NAME$Y,
8466
+ props: props$O,
8070
8467
  setup(props2, {
8071
8468
  slots
8072
8469
  }) {
@@ -8079,7 +8476,7 @@ var Vc = (function (exports, vue) {
8079
8476
  });
8080
8477
  const MHTMLToImage = HTMLToImage;
8081
8478
  const MIcon = Icon;
8082
- const props$M = {
8479
+ const props$N = {
8083
8480
  src: String,
8084
8481
  fit: String,
8085
8482
  lazy: Boolean,
@@ -8134,7 +8531,7 @@ var Vc = (function (exports, vue) {
8134
8531
  }
8135
8532
  }
8136
8533
  const IMGStore$1 = new IMGStore();
8137
- const COMPONENT_NAME$V = "vc-image";
8534
+ const COMPONENT_NAME$X = "vc-image";
8138
8535
  let isSupportObjectFit = false;
8139
8536
  window.addEventListener("DOMContentLoaded", () => {
8140
8537
  isSupportObjectFit = !IS_SERVER$3 && document.documentElement.style.objectFit !== void 0;
@@ -8147,9 +8544,9 @@ var Vc = (function (exports, vue) {
8147
8544
  SCALE_DOWN: "scale-down"
8148
8545
  };
8149
8546
  const Image$1 = /* @__PURE__ */ vue.defineComponent({
8150
- name: COMPONENT_NAME$V,
8547
+ name: COMPONENT_NAME$X,
8151
8548
  inheritAttrs: false,
8152
- props: props$M,
8549
+ props: props$N,
8153
8550
  setup(props2, {
8154
8551
  slots,
8155
8552
  emit
@@ -8336,16 +8733,16 @@ var Vc = (function (exports, vue) {
8336
8733
  }
8337
8734
  });
8338
8735
  const MImage = Image$1;
8339
- const props$L = {
8736
+ const props$M = {
8340
8737
  tag: {
8341
8738
  type: String,
8342
8739
  default: "div"
8343
8740
  }
8344
8741
  };
8345
- const COMPONENT_NAME$U = "vc-image-crop";
8742
+ const COMPONENT_NAME$W = "vc-image-crop";
8346
8743
  const ImageCrop = /* @__PURE__ */ vue.defineComponent({
8347
- name: COMPONENT_NAME$U,
8348
- props: props$L,
8744
+ name: COMPONENT_NAME$W,
8745
+ props: props$M,
8349
8746
  setup(props2, {
8350
8747
  slots
8351
8748
  }) {
@@ -8357,16 +8754,16 @@ var Vc = (function (exports, vue) {
8357
8754
  }
8358
8755
  });
8359
8756
  const MImageCrop = ImageCrop;
8360
- const props$K = {
8757
+ const props$L = {
8361
8758
  tag: {
8362
8759
  type: String,
8363
8760
  default: "div"
8364
8761
  }
8365
8762
  };
8366
- const COMPONENT_NAME$T = "vc-image-preview";
8763
+ const COMPONENT_NAME$V = "vc-image-preview";
8367
8764
  const ImagePreview = /* @__PURE__ */ vue.defineComponent({
8368
- name: COMPONENT_NAME$T,
8369
- props: props$K,
8765
+ name: COMPONENT_NAME$V,
8766
+ props: props$L,
8370
8767
  setup(props2, {
8371
8768
  slots
8372
8769
  }) {
@@ -8378,16 +8775,16 @@ var Vc = (function (exports, vue) {
8378
8775
  }
8379
8776
  });
8380
8777
  const MImagePreview = ImagePreview;
8381
- const props$J = {
8778
+ const props$K = {
8382
8779
  tag: {
8383
8780
  type: String,
8384
8781
  default: "div"
8385
8782
  }
8386
8783
  };
8387
- const COMPONENT_NAME$S = "vc-image-processing";
8784
+ const COMPONENT_NAME$U = "vc-image-processing";
8388
8785
  const ImageProcessing = /* @__PURE__ */ vue.defineComponent({
8389
- name: COMPONENT_NAME$S,
8390
- props: props$J,
8786
+ name: COMPONENT_NAME$U,
8787
+ props: props$K,
8391
8788
  setup(props2, {
8392
8789
  slots
8393
8790
  }) {
@@ -8399,7 +8796,7 @@ var Vc = (function (exports, vue) {
8399
8796
  }
8400
8797
  });
8401
8798
  const MImageProcessing = ImageProcessing;
8402
- const props$I = {
8799
+ const props$J = {
8403
8800
  // Array, 作为select等数组存放临时值
8404
8801
  modelValue: {
8405
8802
  type: [String, Number, Array],
@@ -8496,7 +8893,7 @@ var Vc = (function (exports, vue) {
8496
8893
  const isFocus = vue.ref(false);
8497
8894
  const isClearing = vue.ref(false);
8498
8895
  const isOnComposition = vue.ref(false);
8499
- const formItem = vue.inject("form-item", {});
8896
+ const formItem = vue.inject("vc-form-item", {});
8500
8897
  vue.watch(
8501
8898
  () => props2.modelValue,
8502
8899
  (v) => {
@@ -8647,12 +9044,12 @@ var Vc = (function (exports, vue) {
8647
9044
  expose?.(exposed);
8648
9045
  return exposed;
8649
9046
  };
8650
- const COMPONENT_NAME$R = "vc-input";
9047
+ const COMPONENT_NAME$T = "vc-input";
8651
9048
  const Input = /* @__PURE__ */ vue.defineComponent({
8652
- name: COMPONENT_NAME$R,
9049
+ name: COMPONENT_NAME$T,
8653
9050
  inheritAttrs: false,
8654
9051
  props: {
8655
- ...props$I,
9052
+ ...props$J,
8656
9053
  indicator: {
8657
9054
  type: [Boolean, Object],
8658
9055
  default: false
@@ -8753,8 +9150,8 @@ var Vc = (function (exports, vue) {
8753
9150
  };
8754
9151
  }
8755
9152
  });
8756
- const props$H = {
8757
- ...props$I,
9153
+ const props$I = {
9154
+ ...props$J,
8758
9155
  min: {
8759
9156
  type: Number,
8760
9157
  default: 0
@@ -8965,10 +9362,10 @@ var Vc = (function (exports, vue) {
8965
9362
  handleStepper
8966
9363
  };
8967
9364
  };
8968
- const COMPONENT_NAME$Q = "vc-input-number";
9365
+ const COMPONENT_NAME$S = "vc-input-number";
8969
9366
  const InputNumber = /* @__PURE__ */ vue.defineComponent({
8970
- name: COMPONENT_NAME$Q,
8971
- props: props$H,
9367
+ name: COMPONENT_NAME$S,
9368
+ props: props$I,
8972
9369
  inheritAttrs: false,
8973
9370
  setup(props2, {
8974
9371
  slots,
@@ -9018,17 +9415,17 @@ var Vc = (function (exports, vue) {
9018
9415
  };
9019
9416
  }
9020
9417
  });
9021
- const props$G = {
9022
- ...props$I,
9418
+ const props$H = {
9419
+ ...props$J,
9023
9420
  enterText: {
9024
9421
  type: [Boolean, String],
9025
9422
  default: true
9026
9423
  }
9027
9424
  };
9028
- const COMPONENT_NAME$P = "vc-input-search";
9425
+ const COMPONENT_NAME$R = "vc-input-search";
9029
9426
  const InputSearch = /* @__PURE__ */ vue.defineComponent({
9030
- name: COMPONENT_NAME$P,
9031
- props: props$G,
9427
+ name: COMPONENT_NAME$R,
9428
+ props: props$H,
9032
9429
  inheritAttrs: false,
9033
9430
  setup(props2, {
9034
9431
  emit,
@@ -9059,12 +9456,12 @@ var Vc = (function (exports, vue) {
9059
9456
  };
9060
9457
  }
9061
9458
  });
9062
- const COMPONENT_NAME$O = "vcm-input";
9459
+ const COMPONENT_NAME$Q = "vcm-input";
9063
9460
  const MInput = /* @__PURE__ */ vue.defineComponent({
9064
- name: COMPONENT_NAME$O,
9461
+ name: COMPONENT_NAME$Q,
9065
9462
  inheritAttrs: false,
9066
9463
  props: {
9067
- ...props$I,
9464
+ ...props$J,
9068
9465
  right: {
9069
9466
  type: Boolean,
9070
9467
  default: false
@@ -9148,10 +9545,10 @@ var Vc = (function (exports, vue) {
9148
9545
  };
9149
9546
  }
9150
9547
  });
9151
- const COMPONENT_NAME$N = "vcm-input-number";
9548
+ const COMPONENT_NAME$P = "vcm-input-number";
9152
9549
  const MInputNumber = /* @__PURE__ */ vue.defineComponent({
9153
- name: COMPONENT_NAME$N,
9154
- props: props$H,
9550
+ name: COMPONENT_NAME$P,
9551
+ props: props$I,
9155
9552
  inheritAttrs: false,
9156
9553
  setup(props2, {
9157
9554
  slots,
@@ -9196,11 +9593,11 @@ var Vc = (function (exports, vue) {
9196
9593
  };
9197
9594
  }
9198
9595
  });
9199
- const COMPONENT_NAME$M = "vcm-input-search";
9596
+ const COMPONENT_NAME$O = "vcm-input-search";
9200
9597
  const MInputSearch = /* @__PURE__ */ vue.defineComponent({
9201
- name: COMPONENT_NAME$M,
9598
+ name: COMPONENT_NAME$O,
9202
9599
  props: {
9203
- ...props$G,
9600
+ ...props$H,
9204
9601
  cancelText: {
9205
9602
  type: String,
9206
9603
  default: "取消"
@@ -9258,7 +9655,7 @@ var Vc = (function (exports, vue) {
9258
9655
  };
9259
9656
  }
9260
9657
  });
9261
- const props$F = {
9658
+ const props$G = {
9262
9659
  tag: {
9263
9660
  type: String,
9264
9661
  default: "div"
@@ -9272,12 +9669,12 @@ var Vc = (function (exports, vue) {
9272
9669
  default: true
9273
9670
  }
9274
9671
  };
9275
- const COMPONENT_NAME$L = "vcm-list";
9672
+ const COMPONENT_NAME$N = "vcm-list";
9276
9673
  const MList = vue.defineComponent({
9277
- name: COMPONENT_NAME$L,
9278
- props: props$F,
9674
+ name: COMPONENT_NAME$N,
9675
+ props: props$G,
9279
9676
  setup(props2, { slots }) {
9280
- vue.provide("list", { props: props2 });
9677
+ vue.provide("vc-list", { props: props2 });
9281
9678
  return () => {
9282
9679
  return vue.h(
9283
9680
  props2.tag,
@@ -9294,7 +9691,7 @@ var Vc = (function (exports, vue) {
9294
9691
  };
9295
9692
  }
9296
9693
  });
9297
- const props$E = {
9694
+ const props$F = {
9298
9695
  tag: {
9299
9696
  type: String,
9300
9697
  default: "div"
@@ -9325,17 +9722,17 @@ var Vc = (function (exports, vue) {
9325
9722
  // MListItem是否独立存在
9326
9723
  alone: Boolean
9327
9724
  };
9328
- const COMPONENT_NAME$K = "vcm-list-item";
9725
+ const COMPONENT_NAME$M = "vcm-list-item";
9329
9726
  const HTTP_REGEX = /[a-zA-z]+:\/\/[^\s]*/;
9330
9727
  const MListItem = /* @__PURE__ */ vue.defineComponent({
9331
- name: COMPONENT_NAME$K,
9332
- props: props$E,
9728
+ name: COMPONENT_NAME$M,
9729
+ props: props$F,
9333
9730
  emits: ["click"],
9334
9731
  setup(props2, {
9335
9732
  slots,
9336
9733
  emit
9337
9734
  }) {
9338
- const list = vue.inject("list", {});
9735
+ const list = vue.inject("vc-list", {});
9339
9736
  const classes = vue.computed(() => {
9340
9737
  const hasList = !!list.props;
9341
9738
  return {
@@ -9396,16 +9793,16 @@ var Vc = (function (exports, vue) {
9396
9793
  };
9397
9794
  }
9398
9795
  });
9399
- const props$D = {
9796
+ const props$E = {
9400
9797
  tag: {
9401
9798
  type: String,
9402
9799
  default: "div"
9403
9800
  }
9404
9801
  };
9405
- const COMPONENT_NAME$J = "vc-marquee";
9802
+ const COMPONENT_NAME$L = "vc-marquee";
9406
9803
  const Marquee = /* @__PURE__ */ vue.defineComponent({
9407
- name: COMPONENT_NAME$J,
9408
- props: props$D,
9804
+ name: COMPONENT_NAME$L,
9805
+ props: props$E,
9409
9806
  setup(props2, {
9410
9807
  slots
9411
9808
  }) {
@@ -9417,7 +9814,7 @@ var Vc = (function (exports, vue) {
9417
9814
  }
9418
9815
  });
9419
9816
  const MMarquee = Marquee;
9420
- const props$C = {
9817
+ const props$D = {
9421
9818
  content: [String, Function],
9422
9819
  mask: {
9423
9820
  type: Boolean,
@@ -9452,11 +9849,11 @@ var Vc = (function (exports, vue) {
9452
9849
  // 这个相当于Modal中的onCancel,支持Promise
9453
9850
  onBeforeClose: Function
9454
9851
  };
9455
- const COMPONENT_NAME$I = "vc-message";
9852
+ const COMPONENT_NAME$K = "vc-message";
9456
9853
  const MessageView = /* @__PURE__ */ vue.defineComponent({
9457
- name: COMPONENT_NAME$I,
9854
+ name: COMPONENT_NAME$K,
9458
9855
  emits: ["before-close", "close", "portal-fulfilled"],
9459
- props: props$C,
9856
+ props: props$D,
9460
9857
  setup(props2, {
9461
9858
  emit,
9462
9859
  expose
@@ -9464,6 +9861,12 @@ var Vc = (function (exports, vue) {
9464
9861
  const instance = vue.getCurrentInstance();
9465
9862
  const isActive = vue.ref(false);
9466
9863
  const currentContent = vue.ref();
9864
+ let timer;
9865
+ const setDuration = (v) => {
9866
+ timer && clearTimeout(timer);
9867
+ if (v === 0) return;
9868
+ timer = setTimeout(() => isActive.value = false, v);
9869
+ };
9467
9870
  const setContent = (v) => {
9468
9871
  currentContent.value = v;
9469
9872
  };
@@ -9488,12 +9891,9 @@ var Vc = (function (exports, vue) {
9488
9891
  vue.watch(() => props2.content, setContent, {
9489
9892
  immediate: true
9490
9893
  });
9491
- let timer;
9492
9894
  vue.onMounted(() => {
9493
9895
  isActive.value = true;
9494
- if (props2.duration !== 0) {
9495
- timer = setTimeout(() => isActive.value = false, props2.duration);
9496
- }
9896
+ setDuration(props2.duration);
9497
9897
  });
9498
9898
  vue.onUnmounted(() => {
9499
9899
  timer && clearTimeout(timer);
@@ -9502,7 +9902,8 @@ var Vc = (function (exports, vue) {
9502
9902
  pre[key] = handleRemove;
9503
9903
  return pre;
9504
9904
  }, {
9505
- setContent
9905
+ setContent,
9906
+ setDuration
9506
9907
  });
9507
9908
  expose(exposes);
9508
9909
  return () => {
@@ -9512,7 +9913,7 @@ var Vc = (function (exports, vue) {
9512
9913
  "class": "vc-message__mask",
9513
9914
  "onClick": (e) => handleClose(e, props2.maskClosable)
9514
9915
  }, null), vue.createVNode(TransitionSlide, {
9515
- "mode": "up",
9916
+ "mode": "bottom",
9516
9917
  "onAfterLeave": handleRemove
9517
9918
  }, {
9518
9919
  default: () => [vue.withDirectives(vue.createVNode("div", {
@@ -9588,7 +9989,7 @@ var Vc = (function (exports, vue) {
9588
9989
  warning: warning$2
9589
9990
  }, Symbol.toStringTag, { value: "Module" }));
9590
9991
  const MMessage = Message$1;
9591
- const props$B = {
9992
+ const props$C = {
9592
9993
  modelValue: {
9593
9994
  type: Boolean,
9594
9995
  default: false
@@ -9665,12 +10066,12 @@ var Vc = (function (exports, vue) {
9665
10066
  type: Function
9666
10067
  }
9667
10068
  };
9668
- const COMPONENT_NAME$H = "vc-modal";
10069
+ const COMPONENT_NAME$J = "vc-modal";
9669
10070
  let zIndexNumber = 1002;
9670
10071
  const ModalView = /* @__PURE__ */ vue.defineComponent({
9671
- name: COMPONENT_NAME$H,
10072
+ name: COMPONENT_NAME$J,
9672
10073
  emits: ["update:modelValue", "close", "portal-fulfilled", "visible-change", "ok", "cancel"],
9673
- props: props$B,
10074
+ props: props$C,
9674
10075
  setup(props2, {
9675
10076
  slots,
9676
10077
  emit,
@@ -9858,6 +10259,10 @@ var Vc = (function (exports, vue) {
9858
10259
  expose({
9859
10260
  isActive,
9860
10261
  // for portal
10262
+ toggle(v) {
10263
+ v = typeof v === "boolean" ? v : !isActive.value;
10264
+ isActive.value = v;
10265
+ },
9861
10266
  resetOrigin
9862
10267
  });
9863
10268
  return () => {
@@ -9947,7 +10352,7 @@ var Vc = (function (exports, vue) {
9947
10352
  // 当组件内使用emit('close'),避免重复触发
9948
10353
  onClose: null
9949
10354
  });
9950
- leaf.wrapper.isActive = true;
10355
+ leaf.wrapper.toggle?.(true);
9951
10356
  return leaf;
9952
10357
  };
9953
10358
  const destroy$2 = () => Modal.destroy();
@@ -9963,7 +10368,7 @@ var Vc = (function (exports, vue) {
9963
10368
  success: success$1,
9964
10369
  warning: warning$1
9965
10370
  }, Symbol.toStringTag, { value: "Module" }));
9966
- const props$A = {
10371
+ const props$B = {
9967
10372
  mode: {
9968
10373
  type: String,
9969
10374
  validator: (v) => /(alert|operation)/.test(v),
@@ -10022,11 +10427,11 @@ var Vc = (function (exports, vue) {
10022
10427
  type: Function
10023
10428
  }
10024
10429
  };
10025
- const COMPONENT_NAME$G = "vc-modal";
10430
+ const COMPONENT_NAME$I = "vc-modal";
10026
10431
  const MModalView = /* @__PURE__ */ vue.defineComponent({
10027
- name: COMPONENT_NAME$G,
10432
+ name: COMPONENT_NAME$I,
10028
10433
  emits: ["update:modelValue", "portal-fulfilled", "close", "ok", "cancel"],
10029
- props: props$A,
10434
+ props: props$B,
10030
10435
  setup(props2, {
10031
10436
  slots,
10032
10437
  emit,
@@ -10186,7 +10591,7 @@ var Vc = (function (exports, vue) {
10186
10591
  destroy: destroy$1,
10187
10592
  operation
10188
10593
  }, Symbol.toStringTag, { value: "Module" }));
10189
- const props$z = {
10594
+ const props$A = {
10190
10595
  title: [String, Function],
10191
10596
  content: [String, Function],
10192
10597
  // 单位ms
@@ -10213,40 +10618,31 @@ var Vc = (function (exports, vue) {
10213
10618
  // 这个相当于Modal中的onCancel,支持Promise
10214
10619
  onBeforeClose: Function
10215
10620
  };
10216
- const COMPONENT_NAME$F = "vc-notice";
10621
+ const COMPONENT_NAME$H = "vc-notice";
10217
10622
  const NoticeView = /* @__PURE__ */ vue.defineComponent({
10218
- name: COMPONENT_NAME$F,
10219
- props: props$z,
10623
+ name: COMPONENT_NAME$H,
10624
+ props: props$A,
10220
10625
  emits: ["portal-fulfilled", "close", "before-close"],
10221
10626
  setup(props2, {
10222
- emit
10627
+ emit,
10628
+ expose
10223
10629
  }) {
10224
10630
  const instance = vue.getCurrentInstance();
10225
10631
  const isActive = vue.ref(false);
10226
10632
  const currentTitle = vue.ref();
10227
10633
  const currentContent = vue.ref();
10634
+ let timer;
10635
+ const setDuration = (v) => {
10636
+ timer && clearTimeout(timer);
10637
+ if (v === 0) return;
10638
+ timer = setTimeout(() => isActive.value = false, v);
10639
+ };
10228
10640
  const setTitle = (v) => {
10229
10641
  currentTitle.value = v;
10230
10642
  };
10231
10643
  const setContent = (v) => {
10232
10644
  currentContent.value = v;
10233
10645
  };
10234
- vue.watch(() => props2.title, setTitle, {
10235
- immediate: true
10236
- });
10237
- vue.watch(() => props2.content, setContent, {
10238
- immediate: true
10239
- });
10240
- let timer;
10241
- vue.onMounted(() => {
10242
- isActive.value = true;
10243
- if (props2.duration !== 0) {
10244
- timer = setTimeout(() => isActive.value = false, props2.duration);
10245
- }
10246
- });
10247
- vue.onUnmounted(() => {
10248
- timer && clearTimeout(timer);
10249
- });
10250
10646
  const handleRemove = () => {
10251
10647
  emit("close");
10252
10648
  emit("portal-fulfilled");
@@ -10265,6 +10661,27 @@ var Vc = (function (exports, vue) {
10265
10661
  isActive.value = false;
10266
10662
  }
10267
10663
  };
10664
+ vue.watch(() => props2.title, setTitle, {
10665
+ immediate: true
10666
+ });
10667
+ vue.watch(() => props2.content, setContent, {
10668
+ immediate: true
10669
+ });
10670
+ vue.onMounted(() => {
10671
+ isActive.value = true;
10672
+ setDuration(props2.duration);
10673
+ });
10674
+ vue.onUnmounted(() => {
10675
+ timer && clearTimeout(timer);
10676
+ });
10677
+ const exposes = ["destroy", "remove", "close", "hide"].reduce((pre, key) => {
10678
+ pre[key] = handleRemove;
10679
+ return pre;
10680
+ }, {
10681
+ setContent,
10682
+ setDuration
10683
+ });
10684
+ expose(exposes);
10268
10685
  return () => {
10269
10686
  return vue.createVNode("div", {
10270
10687
  "class": ["vc-notice", {
@@ -10371,16 +10788,16 @@ var Vc = (function (exports, vue) {
10371
10788
  warning
10372
10789
  }, Symbol.toStringTag, { value: "Module" }));
10373
10790
  const MNotice = Notice$1;
10374
- const props$y = {
10791
+ const props$z = {
10375
10792
  tag: {
10376
10793
  type: String,
10377
10794
  default: "div"
10378
10795
  }
10379
10796
  };
10380
- const COMPONENT_NAME$E = "vc-option";
10797
+ const COMPONENT_NAME$G = "vc-option";
10381
10798
  const Option = /* @__PURE__ */ vue.defineComponent({
10382
- name: COMPONENT_NAME$E,
10383
- props: props$y,
10799
+ name: COMPONENT_NAME$G,
10800
+ props: props$z,
10384
10801
  setup(props2, {
10385
10802
  slots
10386
10803
  }) {
@@ -10392,16 +10809,16 @@ var Vc = (function (exports, vue) {
10392
10809
  }
10393
10810
  });
10394
10811
  const MOption = Option;
10395
- const props$x = {
10812
+ const props$y = {
10396
10813
  tag: {
10397
10814
  type: String,
10398
10815
  default: "div"
10399
10816
  }
10400
10817
  };
10401
- const COMPONENT_NAME$D = "vc-page";
10818
+ const COMPONENT_NAME$F = "vc-page";
10402
10819
  const Page = /* @__PURE__ */ vue.defineComponent({
10403
- name: COMPONENT_NAME$D,
10404
- props: props$x,
10820
+ name: COMPONENT_NAME$F,
10821
+ props: props$y,
10405
10822
  setup(props2, {
10406
10823
  slots
10407
10824
  }) {
@@ -10413,16 +10830,16 @@ var Vc = (function (exports, vue) {
10413
10830
  }
10414
10831
  });
10415
10832
  const MPage = Page;
10416
- const props$w = {
10833
+ const props$x = {
10417
10834
  tag: {
10418
10835
  type: String,
10419
10836
  default: "div"
10420
10837
  }
10421
10838
  };
10422
- const COMPONENT_NAME$C = "vc-picker";
10839
+ const COMPONENT_NAME$E = "vc-picker";
10423
10840
  const Picker = /* @__PURE__ */ vue.defineComponent({
10424
- name: COMPONENT_NAME$C,
10425
- props: props$w,
10841
+ name: COMPONENT_NAME$E,
10842
+ props: props$x,
10426
10843
  setup(props2, {
10427
10844
  slots
10428
10845
  }) {
@@ -10434,16 +10851,16 @@ var Vc = (function (exports, vue) {
10434
10851
  }
10435
10852
  });
10436
10853
  const MPicker = Picker;
10437
- const props$v = {
10854
+ const props$w = {
10438
10855
  tag: {
10439
10856
  type: String,
10440
10857
  default: "div"
10441
10858
  }
10442
10859
  };
10443
- const COMPONENT_NAME$B = "vc-popconfirm";
10860
+ const COMPONENT_NAME$D = "vc-popconfirm";
10444
10861
  const Popconfirm = /* @__PURE__ */ vue.defineComponent({
10445
- name: COMPONENT_NAME$B,
10446
- props: props$v,
10862
+ name: COMPONENT_NAME$D,
10863
+ props: props$w,
10447
10864
  setup(props2, {
10448
10865
  slots
10449
10866
  }) {
@@ -10455,7 +10872,7 @@ var Vc = (function (exports, vue) {
10455
10872
  }
10456
10873
  });
10457
10874
  const MPopconfirm = Popconfirm;
10458
- const props$u = {
10875
+ const props$v = {
10459
10876
  modelValue: Boolean,
10460
10877
  animation: String,
10461
10878
  placement: {
@@ -10533,7 +10950,7 @@ var Vc = (function (exports, vue) {
10533
10950
  "autoWidth",
10534
10951
  "always"
10535
10952
  ];
10536
- const props$t = {
10953
+ const props$u = {
10537
10954
  trigger: {
10538
10955
  type: String,
10539
10956
  default: "hover",
@@ -10551,7 +10968,7 @@ var Vc = (function (exports, vue) {
10551
10968
  type: Boolean,
10552
10969
  default: true
10553
10970
  },
10554
- ...pick(props$u, wrapperKeys)
10971
+ ...pick(props$v, wrapperKeys)
10555
10972
  };
10556
10973
  const EXTRA_DISTANCE = 4;
10557
10974
  const HALF_ARROW = 12.73 / 2;
@@ -10808,10 +11225,10 @@ var Vc = (function (exports, vue) {
10808
11225
  function _isSlot(s) {
10809
11226
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
10810
11227
  }
10811
- const COMPONENT_NAME$A = "vc-popover-wrapper";
11228
+ const COMPONENT_NAME$C = "vc-popover-wrapper";
10812
11229
  const PopoverWrapper = /* @__PURE__ */ vue.defineComponent({
10813
- name: COMPONENT_NAME$A,
10814
- props: props$u,
11230
+ name: COMPONENT_NAME$C,
11231
+ props: props$v,
10815
11232
  emits: ["portal-fulfilled", "close"],
10816
11233
  setup(props2, {
10817
11234
  emit,
@@ -10990,7 +11407,11 @@ var Vc = (function (exports, vue) {
10990
11407
  props2.alone && props2.hover && removeEvents();
10991
11408
  });
10992
11409
  expose({
10993
- isActive
11410
+ isActive,
11411
+ toggle(v) {
11412
+ v = typeof v === "boolean" ? v : !isActive.value;
11413
+ isActive.value = v;
11414
+ }
10994
11415
  });
10995
11416
  return () => {
10996
11417
  let _slot;
@@ -11027,10 +11448,10 @@ var Vc = (function (exports, vue) {
11027
11448
  }
11028
11449
  });
11029
11450
  const PopoverPortal = new Portal(PopoverWrapper);
11030
- const COMPONENT_NAME$z = "vc-popover";
11451
+ const COMPONENT_NAME$B = "vc-popover";
11031
11452
  const Popover = /* @__PURE__ */ vue.defineComponent({
11032
- name: COMPONENT_NAME$z,
11033
- props: props$t,
11453
+ name: COMPONENT_NAME$B,
11454
+ props: props$u,
11034
11455
  emits: ["update:modelValue", "visible-change", "ready", "close"],
11035
11456
  open: PopoverPortal.popup.bind(PopoverPortal),
11036
11457
  setup(props2, {
@@ -11112,7 +11533,7 @@ var Vc = (function (exports, vue) {
11112
11533
  portalClass
11113
11534
  });
11114
11535
  } else if (popperInstance && popperInstance.wrapper) {
11115
- popperInstance.wrapper.isActive = false;
11536
+ popperInstance.wrapper.toggle(false);
11116
11537
  }
11117
11538
  };
11118
11539
  vue.watch(() => props2.modelValue, (v) => {
@@ -11153,16 +11574,16 @@ var Vc = (function (exports, vue) {
11153
11574
  }
11154
11575
  });
11155
11576
  const MPopover = Popover;
11156
- const props$s = {
11577
+ const props$t = {
11157
11578
  tag: {
11158
11579
  type: String,
11159
11580
  default: "div"
11160
11581
  }
11161
11582
  };
11162
- const COMPONENT_NAME$y = "vc-popup";
11583
+ const COMPONENT_NAME$A = "vc-popup";
11163
11584
  const Popup = /* @__PURE__ */ vue.defineComponent({
11164
- name: COMPONENT_NAME$y,
11165
- props: props$s,
11585
+ name: COMPONENT_NAME$A,
11586
+ props: props$t,
11166
11587
  setup(props2, {
11167
11588
  slots
11168
11589
  }) {
@@ -11175,16 +11596,16 @@ var Vc = (function (exports, vue) {
11175
11596
  });
11176
11597
  const MPopup = Popup;
11177
11598
  const MPortal = Portal;
11178
- const props$r = {
11599
+ const props$s = {
11179
11600
  tag: {
11180
11601
  type: String,
11181
11602
  default: "div"
11182
11603
  }
11183
11604
  };
11184
- const COMPONENT_NAME$x = "vc-print";
11605
+ const COMPONENT_NAME$z = "vc-print";
11185
11606
  const Print = /* @__PURE__ */ vue.defineComponent({
11186
- name: COMPONENT_NAME$x,
11187
- props: props$r,
11607
+ name: COMPONENT_NAME$z,
11608
+ props: props$s,
11188
11609
  setup(props2, {
11189
11610
  slots
11190
11611
  }) {
@@ -11196,16 +11617,16 @@ var Vc = (function (exports, vue) {
11196
11617
  }
11197
11618
  });
11198
11619
  const MPrint = Print;
11199
- const props$q = {
11620
+ const props$r = {
11200
11621
  tag: {
11201
11622
  type: String,
11202
11623
  default: "div"
11203
11624
  }
11204
11625
  };
11205
- const COMPONENT_NAME$w = "vc-progress";
11626
+ const COMPONENT_NAME$y = "vc-progress";
11206
11627
  const Progress = /* @__PURE__ */ vue.defineComponent({
11207
- name: COMPONENT_NAME$w,
11208
- props: props$q,
11628
+ name: COMPONENT_NAME$y,
11629
+ props: props$r,
11209
11630
  setup(props2, {
11210
11631
  slots
11211
11632
  }) {
@@ -11217,16 +11638,16 @@ var Vc = (function (exports, vue) {
11217
11638
  }
11218
11639
  });
11219
11640
  const MProgress = Progress;
11220
- const props$p = {
11641
+ const props$q = {
11221
11642
  tag: {
11222
11643
  type: String,
11223
11644
  default: "div"
11224
11645
  }
11225
11646
  };
11226
- const COMPONENT_NAME$v = "vc-radio";
11647
+ const COMPONENT_NAME$x = "vc-radio";
11227
11648
  const Radio = /* @__PURE__ */ vue.defineComponent({
11228
- name: COMPONENT_NAME$v,
11229
- props: props$p,
11649
+ name: COMPONENT_NAME$x,
11650
+ props: props$q,
11230
11651
  setup(props2, {
11231
11652
  slots
11232
11653
  }) {
@@ -11238,16 +11659,16 @@ var Vc = (function (exports, vue) {
11238
11659
  }
11239
11660
  });
11240
11661
  const MRadio = Radio;
11241
- const props$o = {
11662
+ const props$p = {
11242
11663
  tag: {
11243
11664
  type: String,
11244
11665
  default: "div"
11245
11666
  }
11246
11667
  };
11247
- const COMPONENT_NAME$u = "vc-rate";
11668
+ const COMPONENT_NAME$w = "vc-rate";
11248
11669
  const Rate = /* @__PURE__ */ vue.defineComponent({
11249
- name: COMPONENT_NAME$u,
11250
- props: props$o,
11670
+ name: COMPONENT_NAME$w,
11671
+ props: props$p,
11251
11672
  setup(props2, {
11252
11673
  slots
11253
11674
  }) {
@@ -11259,7 +11680,7 @@ var Vc = (function (exports, vue) {
11259
11680
  }
11260
11681
  });
11261
11682
  const MRate = Rate;
11262
- const props$n = {
11683
+ const props$o = {
11263
11684
  data: {
11264
11685
  type: Array,
11265
11686
  default: () => []
@@ -11309,7 +11730,7 @@ var Vc = (function (exports, vue) {
11309
11730
  renderPlaceholder: Function,
11310
11731
  renderRefresh: Function
11311
11732
  };
11312
- const props$m = {
11733
+ const props$n = {
11313
11734
  vertical: Boolean,
11314
11735
  wrapperSize: {
11315
11736
  type: Number,
@@ -11362,7 +11783,7 @@ var Vc = (function (exports, vue) {
11362
11783
  "thumbStyle",
11363
11784
  "thumbClass"
11364
11785
  ];
11365
- const props$l = {
11786
+ const props$m = {
11366
11787
  // 如果存在滚动条宽度为false, 不存在则为true
11367
11788
  // 为false的情况下才能使用track-offset
11368
11789
  native: {
@@ -11393,7 +11814,7 @@ var Vc = (function (exports, vue) {
11393
11814
  scrollX: Number,
11394
11815
  scrollY: Number,
11395
11816
  fit: Boolean,
11396
- ...pick(props$m, barKeys$1)
11817
+ ...pick(props$n, barKeys$1)
11397
11818
  };
11398
11819
  const barKeys = [
11399
11820
  "always",
@@ -11407,7 +11828,7 @@ var Vc = (function (exports, vue) {
11407
11828
  "autoResize",
11408
11829
  "native"
11409
11830
  ];
11410
- const props$k = {
11831
+ const props$l = {
11411
11832
  tag: {
11412
11833
  type: String,
11413
11834
  default: "div"
@@ -11440,10 +11861,10 @@ var Vc = (function (exports, vue) {
11440
11861
  type: Boolean,
11441
11862
  default: true
11442
11863
  },
11443
- barTo: props$l.to,
11444
- ...pick(props$l, barKeys)
11864
+ barTo: props$m.to,
11865
+ ...pick(props$m, barKeys)
11445
11866
  };
11446
- const COMPONENT_NAME$t = "vc-scroller-track";
11867
+ const COMPONENT_NAME$v = "vc-scroller-track";
11447
11868
  const BAR_MAP = {
11448
11869
  vertical: {
11449
11870
  scroll: "scrollTop",
@@ -11463,8 +11884,8 @@ var Vc = (function (exports, vue) {
11463
11884
  }
11464
11885
  };
11465
11886
  const Track$1 = /* @__PURE__ */ vue.defineComponent({
11466
- name: COMPONENT_NAME$t,
11467
- props: props$m,
11887
+ name: COMPONENT_NAME$v,
11888
+ props: props$n,
11468
11889
  emits: ["change"],
11469
11890
  setup(props2, {
11470
11891
  emit,
@@ -11621,10 +12042,10 @@ var Vc = (function (exports, vue) {
11621
12042
  };
11622
12043
  }
11623
12044
  });
11624
- const COMPONENT_NAME$s = "vc-scroller-bar";
12045
+ const COMPONENT_NAME$u = "vc-scroller-bar";
11625
12046
  const Bar = /* @__PURE__ */ vue.defineComponent({
11626
- name: COMPONENT_NAME$s,
11627
- props: props$l,
12047
+ name: COMPONENT_NAME$u,
12048
+ props: props$m,
11628
12049
  emits: ["change"],
11629
12050
  setup(props2, {
11630
12051
  emit,
@@ -11833,10 +12254,10 @@ var Vc = (function (exports, vue) {
11833
12254
  refreshPosition
11834
12255
  };
11835
12256
  };
11836
- const COMPONENT_NAME$r = "vc-scroller";
12257
+ const COMPONENT_NAME$t = "vc-scroller";
11837
12258
  const Scroller = /* @__PURE__ */ vue.defineComponent({
11838
- name: COMPONENT_NAME$r,
11839
- props: props$k,
12259
+ name: COMPONENT_NAME$t,
12260
+ props: props$l,
11840
12261
  emits: ["scroll"],
11841
12262
  setup(props2, {
11842
12263
  slots,
@@ -11893,10 +12314,10 @@ var Vc = (function (exports, vue) {
11893
12314
  };
11894
12315
  }
11895
12316
  });
11896
- const COMPONENT_NAME$q = "vc-scroller-wheel";
12317
+ const COMPONENT_NAME$s = "vc-scroller-wheel";
11897
12318
  const ScrollerWheel = /* @__PURE__ */ vue.defineComponent({
11898
- name: COMPONENT_NAME$q,
11899
- props: props$k,
12319
+ name: COMPONENT_NAME$s,
12320
+ props: props$l,
11900
12321
  emits: ["scroll"],
11901
12322
  setup(props2, {
11902
12323
  slots,
@@ -11993,9 +12414,9 @@ var Vc = (function (exports, vue) {
11993
12414
  };
11994
12415
  }
11995
12416
  });
11996
- const COMPONENT_NAME$p = "vc-recycle-list-scroll-state";
12417
+ const COMPONENT_NAME$r = "vc-recycle-list-scroll-state";
11997
12418
  const ScrollState = /* @__PURE__ */ vue.defineComponent({
11998
- name: COMPONENT_NAME$p,
12419
+ name: COMPONENT_NAME$r,
11999
12420
  setup(_, {
12000
12421
  slots
12001
12422
  }) {
@@ -12064,7 +12485,7 @@ var Vc = (function (exports, vue) {
12064
12485
  [REFRESH]: "加载中..."
12065
12486
  }
12066
12487
  };
12067
- const props$j = {
12488
+ const props$k = {
12068
12489
  inverted: {
12069
12490
  type: Boolean,
12070
12491
  default: false
@@ -12119,11 +12540,11 @@ var Vc = (function (exports, vue) {
12119
12540
  );
12120
12541
  return keys;
12121
12542
  };
12122
- const COMPONENT_NAME$o = "vc-recycle-list-container";
12543
+ const COMPONENT_NAME$q = "vc-recycle-list-container";
12123
12544
  const transformKey = prefixStyle("transform").camel;
12124
12545
  const Container = /* @__PURE__ */ vue.defineComponent({
12125
- name: COMPONENT_NAME$o,
12126
- props: props$j,
12546
+ name: COMPONENT_NAME$q,
12547
+ props: props$k,
12127
12548
  emits: ["refresh"],
12128
12549
  setup(props2, {
12129
12550
  slots
@@ -12215,16 +12636,16 @@ var Vc = (function (exports, vue) {
12215
12636
  };
12216
12637
  }
12217
12638
  });
12218
- const COMPONENT_NAME$n = "vc-recycle-list-item";
12639
+ const COMPONENT_NAME$p = "vc-recycle-list-item";
12219
12640
  const Item = /* @__PURE__ */ vue.defineComponent({
12220
- name: COMPONENT_NAME$n,
12641
+ name: COMPONENT_NAME$p,
12221
12642
  props: {
12222
12643
  vertical: {
12223
12644
  type: Boolean,
12224
12645
  default: true
12225
12646
  }
12226
12647
  },
12227
- emits: ["resize"],
12648
+ emits: ["resize", "change"],
12228
12649
  setup(_, {
12229
12650
  emit,
12230
12651
  slots
@@ -12236,9 +12657,10 @@ var Vc = (function (exports, vue) {
12236
12657
  const handleResize = () => {
12237
12658
  const v = current.value.getBoundingClientRect()[K.size];
12238
12659
  const changed = offsetSize.value != v;
12239
- if (hasInitial && changed) {
12660
+ if (changed) {
12240
12661
  offsetSize.value = v;
12241
- emit("resize");
12662
+ hasInitial && emit("resize", v);
12663
+ emit("change", v);
12242
12664
  }
12243
12665
  hasInitial = true;
12244
12666
  };
@@ -12256,10 +12678,10 @@ var Vc = (function (exports, vue) {
12256
12678
  };
12257
12679
  }
12258
12680
  });
12259
- const COMPONENT_NAME$m = "vc-recycle-list";
12681
+ const COMPONENT_NAME$o = "vc-recycle-list";
12260
12682
  const RecycleList = /* @__PURE__ */ vue.defineComponent({
12261
- name: COMPONENT_NAME$m,
12262
- props: props$n,
12683
+ name: COMPONENT_NAME$o,
12684
+ props: props$o,
12263
12685
  emits: ["scroll"],
12264
12686
  setup(props2, {
12265
12687
  slots,
@@ -12760,17 +13182,17 @@ var Vc = (function (exports, vue) {
12760
13182
  }
12761
13183
  });
12762
13184
  const MRecycleList = RecycleList;
12763
- const props$i = {
13185
+ const props$j = {
12764
13186
  tag: {
12765
13187
  type: String,
12766
13188
  default: "div"
12767
13189
  }
12768
13190
  };
12769
- const COMPONENT_NAME$l = "vc-resizer";
13191
+ const COMPONENT_NAME$n = "vc-resizer";
12770
13192
  const Resizer = vue.defineComponent({
12771
- name: COMPONENT_NAME$l,
12772
- props: props$i,
12773
- emit: ["resize"],
13193
+ name: COMPONENT_NAME$n,
13194
+ props: props$j,
13195
+ emit: ["resize", "change"],
12774
13196
  setup(props2, { emit, slots }) {
12775
13197
  const width = vue.ref(0);
12776
13198
  const height = vue.ref(0);
@@ -12796,8 +13218,9 @@ var Vc = (function (exports, vue) {
12796
13218
  const widthChanged = width.value != width$;
12797
13219
  heightChanged && (height.value = height$);
12798
13220
  widthChanged && (width.value = width$);
12799
- if (hasInitial && (heightChanged || widthChanged)) {
12800
- emit("resize", currentExposed.value);
13221
+ if (heightChanged || widthChanged) {
13222
+ hasInitial && emit("resize", currentExposed.value);
13223
+ emit("change", currentExposed.value);
12801
13224
  }
12802
13225
  hasInitial = true;
12803
13226
  };
@@ -12821,16 +13244,16 @@ var Vc = (function (exports, vue) {
12821
13244
  });
12822
13245
  const MResizer = Resizer;
12823
13246
  const MScroller = Scroller;
12824
- const props$h = {
13247
+ const props$i = {
12825
13248
  tag: {
12826
13249
  type: String,
12827
13250
  default: "div"
12828
13251
  }
12829
13252
  };
12830
- const COMPONENT_NAME$k = "vc-select";
13253
+ const COMPONENT_NAME$m = "vc-select";
12831
13254
  const Select = /* @__PURE__ */ vue.defineComponent({
12832
- name: COMPONENT_NAME$k,
12833
- props: props$h,
13255
+ name: COMPONENT_NAME$m,
13256
+ props: props$i,
12834
13257
  setup(props2, {
12835
13258
  slots
12836
13259
  }) {
@@ -12842,16 +13265,16 @@ var Vc = (function (exports, vue) {
12842
13265
  }
12843
13266
  });
12844
13267
  const MSelect = Select;
12845
- const props$g = {
13268
+ const props$h = {
12846
13269
  tag: {
12847
13270
  type: String,
12848
13271
  default: "div"
12849
13272
  }
12850
13273
  };
12851
- const COMPONENT_NAME$j = "vc-slider";
13274
+ const COMPONENT_NAME$l = "vc-slider";
12852
13275
  const Slider = /* @__PURE__ */ vue.defineComponent({
12853
- name: COMPONENT_NAME$j,
12854
- props: props$g,
13276
+ name: COMPONENT_NAME$l,
13277
+ props: props$h,
12855
13278
  setup(props2, {
12856
13279
  slots
12857
13280
  }) {
@@ -12863,16 +13286,16 @@ var Vc = (function (exports, vue) {
12863
13286
  }
12864
13287
  });
12865
13288
  const MSlider = Slider;
12866
- const props$f = {
13289
+ const props$g = {
12867
13290
  tag: {
12868
13291
  type: String,
12869
13292
  default: "div"
12870
13293
  }
12871
13294
  };
12872
- const COMPONENT_NAME$i = "vc-sort-list";
13295
+ const COMPONENT_NAME$k = "vc-sort-list";
12873
13296
  const SortList = /* @__PURE__ */ vue.defineComponent({
12874
- name: COMPONENT_NAME$i,
12875
- props: props$f,
13297
+ name: COMPONENT_NAME$k,
13298
+ props: props$g,
12876
13299
  setup(props2, {
12877
13300
  slots
12878
13301
  }) {
@@ -12884,16 +13307,16 @@ var Vc = (function (exports, vue) {
12884
13307
  }
12885
13308
  });
12886
13309
  const MSortList = SortList;
12887
- const props$e = {
13310
+ const props$f = {
12888
13311
  tag: {
12889
13312
  type: String,
12890
13313
  default: "div"
12891
13314
  }
12892
13315
  };
12893
- const COMPONENT_NAME$h = "vc-steps";
13316
+ const COMPONENT_NAME$j = "vc-steps";
12894
13317
  const Steps = /* @__PURE__ */ vue.defineComponent({
12895
- name: COMPONENT_NAME$h,
12896
- props: props$e,
13318
+ name: COMPONENT_NAME$j,
13319
+ props: props$f,
12897
13320
  setup(props2, {
12898
13321
  slots
12899
13322
  }) {
@@ -12905,16 +13328,16 @@ var Vc = (function (exports, vue) {
12905
13328
  }
12906
13329
  });
12907
13330
  const MSteps = Steps;
12908
- const props$d = {
13331
+ const props$e = {
12909
13332
  tag: {
12910
13333
  type: String,
12911
13334
  default: "div"
12912
13335
  }
12913
13336
  };
12914
- const COMPONENT_NAME$g = "vc-switch";
13337
+ const COMPONENT_NAME$i = "vc-switch";
12915
13338
  const Switch = /* @__PURE__ */ vue.defineComponent({
12916
- name: COMPONENT_NAME$g,
12917
- props: props$d,
13339
+ name: COMPONENT_NAME$i,
13340
+ props: props$e,
12918
13341
  setup(props2, {
12919
13342
  slots
12920
13343
  }) {
@@ -12926,16 +13349,16 @@ var Vc = (function (exports, vue) {
12926
13349
  }
12927
13350
  });
12928
13351
  const MSwitch = Switch;
12929
- const props$c = {
13352
+ const props$d = {
12930
13353
  tag: {
12931
13354
  type: String,
12932
13355
  default: "div"
12933
13356
  }
12934
13357
  };
12935
- const COMPONENT_NAME$f = "vc-table";
13358
+ const COMPONENT_NAME$h = "vc-table";
12936
13359
  const Table = /* @__PURE__ */ vue.defineComponent({
12937
- name: COMPONENT_NAME$f,
12938
- props: props$c,
13360
+ name: COMPONENT_NAME$h,
13361
+ props: props$d,
12939
13362
  setup(props2, {
12940
13363
  slots
12941
13364
  }) {
@@ -12947,7 +13370,7 @@ var Vc = (function (exports, vue) {
12947
13370
  }
12948
13371
  });
12949
13372
  const MTable = Table;
12950
- const props$b = {
13373
+ const props$c = {
12951
13374
  type: {
12952
13375
  type: String,
12953
13376
  validator: (v) => /^(line|card)$/.test(v),
@@ -13054,7 +13477,7 @@ var Vc = (function (exports, vue) {
13054
13477
  if (!item) return;
13055
13478
  list.value.splice(list.value.indexOf(item.props), 1);
13056
13479
  };
13057
- vue.provide("tabs", {
13480
+ vue.provide("vc-tabs", {
13058
13481
  props: props2,
13059
13482
  currentValue,
13060
13483
  refresh,
@@ -13098,10 +13521,10 @@ var Vc = (function (exports, vue) {
13098
13521
  handleChange
13099
13522
  };
13100
13523
  };
13101
- const COMPONENT_NAME$e = "vc-tabs";
13524
+ const COMPONENT_NAME$g = "vc-tabs";
13102
13525
  const Tabs = /* @__PURE__ */ vue.defineComponent({
13103
- name: COMPONENT_NAME$e,
13104
- props: props$b,
13526
+ name: COMPONENT_NAME$g,
13527
+ props: props$c,
13105
13528
  emits: ["update:modelValue", "change", "click"],
13106
13529
  setup(props2, {
13107
13530
  slots
@@ -13246,7 +13669,7 @@ var Vc = (function (exports, vue) {
13246
13669
  };
13247
13670
  }
13248
13671
  });
13249
- const props$a = {
13672
+ const props$b = {
13250
13673
  value: {
13251
13674
  type: [String, Number]
13252
13675
  },
@@ -13272,7 +13695,7 @@ var Vc = (function (exports, vue) {
13272
13695
  const { props: props2 } = instance;
13273
13696
  const currentValue = vue.ref(void 0);
13274
13697
  const isLoaded = vue.ref(false);
13275
- const tabs = vue.inject("tabs", {});
13698
+ const tabs = vue.inject("vc-tabs", {});
13276
13699
  const isActive = vue.computed(() => {
13277
13700
  const state = tabs.currentValue.value === (props2.value || currentValue.value);
13278
13701
  if (!isLoaded.value && state) {
@@ -13324,10 +13747,10 @@ var Vc = (function (exports, vue) {
13324
13747
  currentValue
13325
13748
  };
13326
13749
  };
13327
- const COMPONENT_NAME$d = "vc-tabs-pane";
13750
+ const COMPONENT_NAME$f = "vc-tabs-pane";
13328
13751
  const TabsPane = /* @__PURE__ */ vue.defineComponent({
13329
- name: COMPONENT_NAME$d,
13330
- props: props$a,
13752
+ name: COMPONENT_NAME$f,
13753
+ props: props$b,
13331
13754
  setup(_, {
13332
13755
  slots
13333
13756
  }) {
@@ -13341,8 +13764,289 @@ var Vc = (function (exports, vue) {
13341
13764
  };
13342
13765
  }
13343
13766
  });
13344
- const MTabs = Tabs;
13345
- const MTabsPane = TabsPane;
13767
+ const props$a = {
13768
+ ...props$c,
13769
+ theme: {
13770
+ type: String,
13771
+ default: "light",
13772
+ validator: (v) => /(light|dark)/.test(v)
13773
+ },
13774
+ barStyle: {
13775
+ type: [Object, Array],
13776
+ default: () => ({})
13777
+ },
13778
+ autoAfloatWidth: {
13779
+ type: Boolean,
13780
+ default: true
13781
+ },
13782
+ average: {
13783
+ type: Boolean,
13784
+ default: true
13785
+ },
13786
+ showWrapper: {
13787
+ type: Boolean,
13788
+ default: true
13789
+ },
13790
+ sticky: {
13791
+ type: Boolean,
13792
+ default: false
13793
+ },
13794
+ offsetTop: {
13795
+ type: Number,
13796
+ default: 0
13797
+ },
13798
+ showStep: {
13799
+ type: Boolean,
13800
+ default: false
13801
+ }
13802
+ };
13803
+ const COMPONENT_NAME$e = "vcm-tabs";
13804
+ const MTabs = /* @__PURE__ */ vue.defineComponent({
13805
+ name: COMPONENT_NAME$e,
13806
+ props: props$a,
13807
+ emits: ["update:modelValue", "change", "click"],
13808
+ setup(props2, {
13809
+ slots
13810
+ }) {
13811
+ const instance = vue.getCurrentInstance();
13812
+ const wrapper = vue.ref(null);
13813
+ const content = vue.ref(null);
13814
+ const scroll = vue.ref(null);
13815
+ const nav = vue.ref(null);
13816
+ const top = vue.ref(0);
13817
+ const isFixed = vue.ref(false);
13818
+ const placeholderH = vue.ref(53);
13819
+ const startX = vue.ref(0);
13820
+ const isTouching = vue.ref(false);
13821
+ const scrollViewW = vue.ref(0);
13822
+ const scrollContentW = vue.ref(0);
13823
+ const baseX = vue.ref(0);
13824
+ const isDark = vue.computed(() => {
13825
+ return props2.theme === "dark";
13826
+ });
13827
+ const fixedStyle = vue.computed(() => {
13828
+ return isFixed.value ? {
13829
+ top: `${props2.offsetTop}px`
13830
+ } : {};
13831
+ });
13832
+ let tabs;
13833
+ const handleScroll = throttle$2(() => {
13834
+ isFixed.value = document.scrollingElement.scrollTop + props2.offsetTop > top.value;
13835
+ }, 100);
13836
+ const handleTouchstart = (e) => {
13837
+ isTouching.value = true;
13838
+ startX.value = e.touches[0].pageX;
13839
+ baseX.value = tabs.scrollOffset.value;
13840
+ };
13841
+ const handleTouchmove = throttle$2((e) => {
13842
+ const touchPageX = e.touches[0].pageX;
13843
+ const changedX = touchPageX - startX.value;
13844
+ if (changedX > 0) {
13845
+ if (tabs.scrollOffset.value >= 0) {
13846
+ tabs.scrollOffset.value = 0;
13847
+ return;
13848
+ }
13849
+ } else if (Math.abs(tabs.scrollOffset.value) + scrollViewW.value >= scrollContentW.value) {
13850
+ tabs.scrollOffset.value = -(scrollContentW.value - scrollViewW.value);
13851
+ return;
13852
+ }
13853
+ tabs.scrollOffset.value = baseX.value + touchPageX - startX.value;
13854
+ }, 17);
13855
+ const handleTouchend = () => {
13856
+ isTouching.value = false;
13857
+ };
13858
+ const handleStep = (flag) => {
13859
+ if (!tabs.scrollable.value) return;
13860
+ const moveX = flag * scrollViewW.value;
13861
+ let offsetX = tabs.scrollOffset.value + moveX;
13862
+ if (offsetX < -(scrollContentW.value - scrollViewW.value) || offsetX > 0) {
13863
+ offsetX = flag === -1 ? -(scrollContentW.value - scrollViewW.value) : 0;
13864
+ }
13865
+ tabs.scrollOffset.value = offsetX;
13866
+ };
13867
+ const refreshTop = debounce$1(() => {
13868
+ if (props2.sticky) {
13869
+ top.value = content.value.offsetTop - placeholderH.value;
13870
+ isFixed.value = document.scrollingElement.scrollTop + props2.offsetTop > top.value;
13871
+ }
13872
+ }, 250, {
13873
+ leading: true,
13874
+ trailing: true
13875
+ });
13876
+ const scrollToActive = () => {
13877
+ if (!tabs.scrollable.value) return;
13878
+ const activeEl = instance.vnode.el.querySelector(`.vcm-tabs__item[data-id="${tabs.currentValue.value}"]`);
13879
+ if (!activeEl) return;
13880
+ const contentEl = nav.value;
13881
+ const activeRect = activeEl.getBoundingClientRect();
13882
+ const viewRect = scroll.value.getBoundingClientRect();
13883
+ const contentRect = contentEl.getBoundingClientRect();
13884
+ let offset = 0;
13885
+ if (activeRect.width < viewRect.width) {
13886
+ const targetOffset = (viewRect.width - activeRect.width) / 2;
13887
+ const offsetLeft = activeRect.left - contentRect.left;
13888
+ if (offsetLeft - viewRect.left <= targetOffset) {
13889
+ offset = 0;
13890
+ } else if (contentRect.right - activeRect.right <= targetOffset) {
13891
+ offset = viewRect.width - contentRect.width;
13892
+ } else {
13893
+ offset = targetOffset - offsetLeft;
13894
+ }
13895
+ }
13896
+ tabs.scrollOffset.value = offset;
13897
+ };
13898
+ const operateDOMScrollEvents = (type) => {
13899
+ const fn = type === "add" ? window.addEventListener : window.removeEventListener;
13900
+ fn("scroll", handleScroll);
13901
+ fn("touchstart", handleTouchstart, false);
13902
+ fn("touchmove", handleTouchmove, false);
13903
+ fn("touchend", handleTouchend, false);
13904
+ };
13905
+ const refreshScroll = () => {
13906
+ const viewEl = scroll.value;
13907
+ scrollViewW.value = viewEl.offsetWidth;
13908
+ scrollContentW.value = nav.value.offsetWidth;
13909
+ if (scrollContentW.value > scrollViewW.value) {
13910
+ operateDOMScrollEvents("remove");
13911
+ operateDOMScrollEvents("add");
13912
+ tabs.scrollable.value = true;
13913
+ } else if (tabs.scrollable.value) {
13914
+ operateDOMScrollEvents("remove");
13915
+ tabs.scrollable.value = false;
13916
+ }
13917
+ tabs.scrollable.value && scrollToActive();
13918
+ };
13919
+ const refreshAfloat = () => {
13920
+ if (!props2.showWrapper) return;
13921
+ vue.nextTick(() => {
13922
+ const index = tabs.getTabIndex(tabs.currentValue.value);
13923
+ if (instance.isUnmounted) return;
13924
+ const items = nav.value.querySelectorAll(`.vcm-tabs__item`);
13925
+ const $2 = items[index];
13926
+ tabs.afloatWidth.value = $2 ? isDark.value ? 20 : props2.autoAfloatWidth ? $2.querySelector("span").offsetWidth : $2.offsetWidth : 0;
13927
+ if (!Array.from(items).length) return;
13928
+ let offset = 0;
13929
+ const basicOffset = $2 ? ($2.offsetWidth - tabs.afloatWidth.value) / 2 : 0;
13930
+ if (index > 0) {
13931
+ for (let i = 0; i < index; i++) {
13932
+ offset += parseFloat(items[i].offsetWidth);
13933
+ }
13934
+ }
13935
+ tabs.afloatOffset.value = offset + basicOffset;
13936
+ refreshScroll();
13937
+ });
13938
+ };
13939
+ const operateDOMEvents = (type) => {
13940
+ if (!props2.sticky) return;
13941
+ const fn = type === "add" ? window.addEventListener : window.removeEventListener;
13942
+ fn("scroll", handleScroll);
13943
+ };
13944
+ tabs = useTabs({
13945
+ content,
13946
+ wrapper,
13947
+ refreshAfloat,
13948
+ refreshScroll,
13949
+ scrollToActive
13950
+ });
13951
+ const scrollStyle = vue.computed(() => {
13952
+ return {
13953
+ transition: isTouching.value ? "" : "transform 300ms ease-in-out",
13954
+ transform: `translate3d(${tabs.scrollOffset.value}px, 0, 0)`
13955
+ };
13956
+ });
13957
+ vue.onMounted(() => {
13958
+ refreshTop();
13959
+ operateDOMEvents("add");
13960
+ vue.nextTick(refreshScroll);
13961
+ });
13962
+ vue.onUpdated(refreshTop);
13963
+ vue.onUnmounted(() => {
13964
+ operateDOMEvents("remove");
13965
+ operateDOMScrollEvents("remove");
13966
+ });
13967
+ vue.watch(() => props2.theme, refreshAfloat);
13968
+ vue.watch(() => props2.average, refreshAfloat);
13969
+ vue.watch(() => props2.showStep, () => vue.nextTick(refreshScroll));
13970
+ return () => {
13971
+ return vue.createVNode("div", {
13972
+ "class": [tabs.classes.value, "vcm-tabs"]
13973
+ }, [props2.showWrapper && vue.createVNode("div", {
13974
+ "ref": wrapper,
13975
+ "style": [props2.barStyle, fixedStyle.value],
13976
+ "class": [{
13977
+ "is-fixed": isFixed
13978
+ }, "vcm-tabs__bar"]
13979
+ }, [vue.createVNode("slot", {
13980
+ "name": "prepend"
13981
+ }, null), slots.prepend?.(), props2.showStep && tabs.scrollable.value && vue.createVNode("div", {
13982
+ "class": "vcm-tabs__step is-left",
13983
+ "onClick": () => handleStep(1)
13984
+ }, [vue.createVNode(Icon, {
13985
+ "type": "left"
13986
+ }, null)]), vue.createVNode("div", {
13987
+ "ref": scroll,
13988
+ "class": "vcm-tabs__scroll"
13989
+ }, [vue.createVNode("div", {
13990
+ "ref": nav,
13991
+ "style": scrollStyle.value,
13992
+ "class": "vcm-tabs__nav"
13993
+ }, [props2.afloat && vue.createVNode("div", {
13994
+ "style": tabs.afloatStyle.value,
13995
+ "class": "vcm-tabs__afloat"
13996
+ }, null), tabs.list.value.map((item, index) => {
13997
+ return vue.createVNode("div", {
13998
+ "key": index,
13999
+ "data-id": item.value,
14000
+ "class": [{
14001
+ "is-active": (item.value || index) == tabs.currentValue.value,
14002
+ "is-average": props2.average
14003
+ }, "vcm-tabs__item"],
14004
+ "onClick": () => tabs.handleChange(index)
14005
+ }, [slots.label ? slots.label({
14006
+ it: item,
14007
+ index
14008
+ }) : typeof item.label === "string" ? vue.createVNode("span", {
14009
+ "innerHTML": item.label
14010
+ }, null) : typeof item.label === "function" && vue.createVNode(Customer, {
14011
+ "render": item.label,
14012
+ "it": item,
14013
+ "index": index
14014
+ }, null)]);
14015
+ })])]), props2.showStep && tabs.scrollable.value && vue.createVNode("div", {
14016
+ "class": "vcm-tabs__step is-right",
14017
+ "onClick": () => handleStep(-1)
14018
+ }, [vue.createVNode(Icon, {
14019
+ "type": "right"
14020
+ }, null)]), slots.append?.()]), isFixed.value && vue.createVNode("div", {
14021
+ "style": {
14022
+ height: `${placeholderH.value}px`
14023
+ },
14024
+ "class": "vcm-tabs__placeholder"
14025
+ }, null), vue.createVNode("div", {
14026
+ "ref": content,
14027
+ "style": tabs.contentStyle.value,
14028
+ "class": "vcm-tabs__content"
14029
+ }, [slots.default?.()])]);
14030
+ };
14031
+ }
14032
+ });
14033
+ const COMPONENT_NAME$d = "vcm-tabs-pane";
14034
+ const MTabsPane = /* @__PURE__ */ vue.defineComponent({
14035
+ name: COMPONENT_NAME$d,
14036
+ props: props$b,
14037
+ setup(_, {
14038
+ slots
14039
+ }) {
14040
+ const tabsPane = useTabsPane();
14041
+ return () => {
14042
+ return vue.createVNode("div", {
14043
+ "class": "vcm-tabs-pane",
14044
+ "style": tabsPane.style.value,
14045
+ "name": tabsPane.currentValue.value
14046
+ }, [tabsPane.isReady && slots.default?.()]);
14047
+ };
14048
+ }
14049
+ });
13346
14050
  const props$9 = {
13347
14051
  tag: {
13348
14052
  type: String,
@@ -13764,8 +14468,8 @@ var Vc = (function (exports, vue) {
13764
14468
  MDebounce: Debounce,
13765
14469
  Divider,
13766
14470
  MDivider,
13767
- Drawer,
13768
- MDrawer,
14471
+ DrawerView,
14472
+ MDrawerView,
13769
14473
  Dropdown,
13770
14474
  MDropdown,
13771
14475
  // DropdownItem,
@@ -13808,8 +14512,8 @@ var Vc = (function (exports, vue) {
13808
14512
  MListItem,
13809
14513
  Marquee,
13810
14514
  MMarquee,
13811
- Modal: modal$1,
13812
- MModal: modal,
14515
+ ModalView,
14516
+ MModalView,
13813
14517
  Notice: Notice$1,
13814
14518
  MNotice,
13815
14519
  Option,
@@ -94043,6 +94747,7 @@ var Vc = (function (exports, vue) {
94043
94747
  exports.Checkbox = Checkbox;
94044
94748
  exports.Clipboard = Clipboard;
94045
94749
  exports.Collapse = Collapse;
94750
+ exports.CollapseItem = CollapseItem;
94046
94751
  exports.ColorPicker = ColorPicker;
94047
94752
  exports.Components = Components;
94048
94753
  exports.Countdown = Countdown;
@@ -94050,7 +94755,8 @@ var Vc = (function (exports, vue) {
94050
94755
  exports.DatePicker = DatePicker;
94051
94756
  exports.Debounce = Debounce;
94052
94757
  exports.Divider = Divider;
94053
- exports.Drawer = Drawer;
94758
+ exports.Drawer = drawer;
94759
+ exports.DrawerView = DrawerView;
94054
94760
  exports.Dropdown = Dropdown;
94055
94761
  exports.Editor = Editor;
94056
94762
  exports.Expand = Expand;
@@ -94082,13 +94788,14 @@ var Vc = (function (exports, vue) {
94082
94788
  exports.MCheckbox = MCheckbox;
94083
94789
  exports.MClipboard = MClipboard;
94084
94790
  exports.MCollapse = MCollapse;
94791
+ exports.MCollapseItem = MCollapseItem;
94085
94792
  exports.MColorPicker = MColorPicker;
94086
94793
  exports.MCountdown = MCountdown;
94087
94794
  exports.MCustomer = MCustomer;
94088
94795
  exports.MDatePicker = MDatePicker;
94089
94796
  exports.MDebounce = Debounce;
94090
94797
  exports.MDivider = MDivider;
94091
- exports.MDrawer = MDrawer;
94798
+ exports.MDrawerView = MDrawerView;
94092
94799
  exports.MDropdown = MDropdown;
94093
94800
  exports.MEditor = MEditor;
94094
94801
  exports.MExpand = MExpand;