@deot/vc 1.0.5 → 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,
@@ -7263,666 +8014,318 @@ var Vc = (function (exports, vue) {
7263
8014
  return getPropByPath(model, path).v;
7264
8015
  });
7265
8016
  const showError = vue.computed(() => {
7266
- return validateState.value === "error" && props2.showMessage && form.props.showMessage;
7267
- });
7268
- vue.watch(
7269
- () => props2.error,
7270
- (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
- duration: {
7488
- type: Number,
7489
- default: 3e3
7490
- },
7491
- mode: {
7492
- type: String,
7493
- default: "info",
7494
- validator: (val) => ["info", "loading", "success", "warning", "error"].includes(val)
7495
- }
7496
- };
7497
- const MSpin = Spin;
7498
- const MTransition = Transition;
7499
- const MTransitionCollapse = TransitionCollapse;
7500
- const MTransitionFade = TransitionFade;
7501
- const MTransitionScale = TransitionScale;
7502
- const MTransitionSlide = TransitionSlide;
7503
- const MTransitionZoom = TransitionZoom;
7504
- const COMPONENT_NAME$10 = "vcm-toast";
7505
- const MToastView = /* @__PURE__ */ vue.defineComponent({
7506
- name: COMPONENT_NAME$10,
7507
- emits: ["close", "portal-fulfilled"],
7508
- props: props$Q,
7509
- setup(props2, {
7510
- emit,
7511
- expose
7512
- }) {
7513
- const isVisible = vue.ref(false);
7514
- const handleRemove = () => {
7515
- emit("close");
7516
- emit("portal-fulfilled");
7517
- };
7518
- const handleClose = () => {
7519
- if (props2.maskClosable) {
7520
- isVisible.value = false;
7521
- }
7522
- };
7523
- let timer;
7524
- vue.onMounted(() => {
7525
- isVisible.value = true;
7526
- if (props2.duration !== 0) {
7527
- timer = setTimeout(() => {
7528
- isVisible.value = false;
7529
- }, props2.duration - 300);
7530
- }
7531
- });
7532
- vue.onUnmounted(() => {
7533
- timer && clearTimeout(timer);
7534
- });
7535
- const exposes = ["destroy", "remove", "close", "hide"].reduce((pre, key) => {
7536
- pre[key] = handleRemove;
7537
- return pre;
7538
- }, {});
7539
- expose(exposes);
7540
- return () => {
7541
- return vue.createVNode("div", {
7542
- "class": "vcm-toast"
7543
- }, [vue.createVNode("div", {
7544
- "class": "vcm-toast__bg",
7545
- "onClick": handleClose,
7546
- "onTouchmove": vue.withModifiers(() => {
7547
- }, ["prevent"])
7548
- }, null), vue.createVNode(MTransitionFade, {
7549
- "duration": {
7550
- enter: 300,
7551
- leave: 150
7552
- },
7553
- "onAfterLeave": handleRemove
7554
- }, {
7555
- default: () => [vue.withDirectives(vue.createVNode("div", {
7556
- "class": "vcm-toast__wrapper"
7557
- }, [props2.mode === "loading" && vue.createVNode(MSpin, {
7558
- "class": "vcm-toast__loading"
7559
- }, null), typeof props2.content === "string" ? vue.createVNode("div", {
7560
- "class": "vcm-toast__content",
7561
- "innerHTML": props2.content
7562
- }, null) : typeof props2.content === "function" ? vue.createVNode(MCustomer, {
7563
- "render": props2.content
7564
- }, null) : null]), [[vue.vShow, isVisible.value]])]
7565
- })]);
7566
- };
7567
- }
7568
- });
7569
- const defaults$2 = {
7570
- tag: "div",
7571
- el: "body",
7572
- alive: false,
7573
- multiple: false,
7574
- aliveRegExp: { className: /(vc-hack-alive|vc-hack-cp)/ },
7575
- aliveVisibleKey: "isVisible",
7576
- aliveUpdateKey: "update",
7577
- leaveDelay: 300,
7578
- autoDestroy: true,
7579
- components: {},
7580
- uses: {},
7581
- fragment: false,
7582
- insertion: "last"
7583
- };
7584
- class PortalLeaf {
7585
- app;
7586
- /**
7587
- * 目标的实例,挂载到app上
7588
- */
7589
- wrapper;
7590
- propsData;
7591
- /**
7592
- * 销毁的函数,挂载到app上,避免冲突
7593
- */
7594
- destroy;
7595
- /**
7596
- * 自动销毁的标记,挂载到app上,避免冲突
7597
- */
7598
- autoDestroy;
7599
- target;
7600
- constructor(target) {
7601
- this.target = target;
7602
- this.autoDestroy = false;
7603
- this.destroy = /* istanbul ignore next */
7604
- () => {
7605
- throw new VcError("portal", "未注册的destroy方法");
7606
- };
7607
- }
7608
- then(resolve, reject) {
7609
- return this.target.then(resolve, reject);
7610
- }
7611
- catch(callback) {
7612
- return this.target.catch(callback);
7613
- }
7614
- finally(callback) {
7615
- return this.target.finally(callback);
7616
- }
7617
- }
7618
- const COMPONENT_NAME$$ = "vc-portal";
7619
- class Portal {
7620
- /**
7621
- * 清理Portals类型组件
7622
- * @param name 清理的组件名, boolean表示全部leafs是否强制清理
7623
- */
7624
- static clear(name) {
7625
- try {
7626
- let force = false;
7627
- let target = /* @__PURE__ */ new Map();
7628
- if (name && typeof name !== "boolean") {
7629
- let names = [];
7630
- if (typeof name === "string") {
7631
- names = [name];
7632
- } else if (name instanceof Array && name.length > 0) {
7633
- names = name;
7634
- }
7635
- names.forEach((i) => target.set(i, ""));
7636
- force = true;
7637
- } else {
7638
- force = !!name;
7639
- target = Portal.leafs;
7640
- }
7641
- for (const key of target.keys()) {
7642
- const leaf = Portal.leafs.get(key);
7643
- if (leaf && (force === true || leaf.autoDestroy === true)) {
7644
- leaf.destroy();
7645
- }
7646
- }
7647
- } catch (e) {
7648
- /* istanbul ignore next -- @preserve */
7649
- throw new VcError("instance", e);
7650
- }
7651
- }
7652
- /**
7653
- * 清理全部Portals
7654
- */
7655
- static clearAll() {
7656
- try {
7657
- Portal.leafs.forEach((leaf) => leaf.destroy());
7658
- } catch (e) {
7659
- /* istanbul ignore next -- @preserve */
7660
- throw new VcError("instance", e);
7661
- }
7662
- }
7663
- static leafs = /* @__PURE__ */ new Map();
7664
- wrapper;
7665
- globalOptions;
7666
- constructor(wrapper, options) {
7667
- this.wrapper = wrapper;
7668
- this.globalOptions = {
7669
- ...options,
7670
- name: options?.name || wrapper.name || getUid(COMPONENT_NAME$$)
7671
- };
7672
- }
7673
- popup(propsData, options) {
7674
- if (!options) {
7675
- options = propsData || {};
7676
- } else {
7677
- options.propsData = propsData;
7678
- }
7679
- const $options = { ...this.getDefaultOptions(), ...options };
7680
- const { onFulfilled, onRejected, ...rest } = $options;
7681
- let onFulfilled$ = (
7682
- /* istanbul ignore next -- @preserve */
7683
- () => {
7684
- }
7685
- );
7686
- let onRejected$ = (
7687
- /* istanbul ignore next -- @preserve */
7688
- () => {
7689
- }
7690
- );
7691
- const target = new Promise((resolve, reject) => {
7692
- onFulfilled$ = (v) => {
7693
- onFulfilled?.(v);
7694
- resolve(v);
7695
- };
7696
- onRejected$ = (v) => {
7697
- onRejected?.(v);
7698
- reject(v);
7699
- };
7700
- });
7701
- return this.render(rest, target, onFulfilled$, onRejected$);
7702
- }
7703
- /**
7704
- * 销毁当前Portal下的节点
7705
- * @param target [description]
7706
- */
7707
- destroy = (target) => {
7708
- const { multiple, name } = this.getDefaultOptions();
7709
- target = target || name;
7710
- const instance = typeof target === "object" ? target : Portal.leafs.get(target);
7711
- if (instance) {
7712
- instance.destroy();
7713
- } else if (multiple) {
7714
- Portal.leafs.forEach((item, key) => {
7715
- if (key.includes(name)) {
7716
- item.destroy();
7717
- }
7718
- });
7719
- }
7720
- };
7721
- getDefaultOptions() {
7722
- return {
7723
- ...defaults$2,
7724
- ...VcInstance.options.Portal,
7725
- ...this.globalOptions
7726
- };
7727
- }
7728
- createCallback(getLeaf, delay, callback) {
7729
- return (...args) => {
7730
- const done = () => {
7731
- const leaf = getLeaf();
7732
- /* istanbul ignore next -- @preserve */
7733
- if (!leaf) {
7734
- throw new VcError("portal", "实例不存在或已卸载");
7735
- }
7736
- leaf.destroy();
7737
- };
7738
- delay ? setTimeout(done, delay) : done();
7739
- callback?.(...args);
7740
- };
7741
- }
7742
- render(options, target, onFulfilled, onRejected) {
7743
- const {
7744
- el: el2,
7745
- tag,
7746
- alive,
7747
- aliveRegExp,
7748
- aliveVisibleKey,
7749
- aliveUpdateKey,
7750
- name: name$,
7751
- leaveDelay,
7752
- autoDestroy,
7753
- multiple,
7754
- fragment,
7755
- onDestroyed,
7756
- onBeforeCreate,
7757
- insertion,
7758
- // 全局注册
7759
- globalProperties,
7760
- install,
7761
- components,
7762
- uses,
7763
- slots,
7764
- parent,
7765
- propsData,
7766
- ...rest
7767
- } = options;
7768
- let useAllNodes = fragment;
7769
- const name = multiple ? `${name$}__${getUid(COMPONENT_NAME$$)}` : name$;
7770
- const container = document.createElement(tag);
7771
- const root = typeof el2 === "object" ? el2 : document.querySelector(el2 || "body");
7772
- !alive && Portal.leafs.get(name)?.destroy();
7773
- const propsData$ = propsData || rest;
7774
- let leaf = new PortalLeaf(target);
7775
- const isDestroyed = () => {
7776
- const leaf$ = Portal.leafs.get(name);
7777
- return !leaf$ || leaf$ !== leaf;
7778
- };
7779
- const $onDestroyed = (...args) => {
7780
- if (isDestroyed()) return;
7781
- onDestroyed?.(...args);
7782
- leaf.app?.unmount();
7783
- /* istanbul ignore else -- @preserve */
7784
- if (useAllNodes) {
7785
- root?.contains(container) && root.removeChild(container);
7786
- } else if (container && container._children) {
7787
- container._children.forEach((i) => {
7788
- root?.contains(i) && root.removeChild(i);
7789
- });
7790
- }
7791
- Portal.leafs.delete(name);
7792
- };
7793
- const $onRejected = this.createCallback(() => leaf, leaveDelay, onRejected);
7794
- const $onFulfilled = this.createCallback(() => leaf, leaveDelay, onFulfilled);
7795
- if (alive && Portal.leafs.has(name)) {
7796
- leaf = Portal.leafs.get(name);
7797
- leaf.target = target;
7798
- leaf.propsData.value = propsData$;
7799
- leaf.wrapper?.[aliveUpdateKey]?.(options);
7800
- } else {
7801
- const wrapper = this.wrapper;
7802
- const app = vue.createApp({
7803
- name: COMPONENT_NAME$$,
7804
- parent,
7805
- setup() {
7806
- if (alive) {
7807
- const handleExtra = (e) => {
7808
- try {
7809
- const path = e.path || composedPath(e);
7810
- /* istanbul ignore else -- @preserve */
7811
- if (container && e.target && !container.contains(e.target) && !path?.some((item) => utils.eleInRegExp(item, aliveRegExp))) {
7812
- /* istanbul ignore else -- @preserve */
7813
- if (leaf.wrapper && leaf.wrapper?.[aliveVisibleKey]) {
7814
- leaf.wrapper[aliveVisibleKey] = false;
7815
- }
7816
- leaveDelay ? setTimeout($onDestroyed, leaveDelay) : $onDestroyed();
7817
- }
7818
- } catch (error2) {
7819
- /* istanbul ignore next -- @preserve */
7820
- throw new VcError("portal", error2);
7821
- }
7822
- };
7823
- vue.onMounted(() => {
7824
- document.addEventListener("click", handleExtra, true);
7825
- });
7826
- vue.onBeforeUnmount(() => {
7827
- document.removeEventListener("click", handleExtra, true);
7828
- });
7829
- }
7830
- const propsData1 = vue.ref(propsData$);
7831
- const propsData2 = vue.ref();
7832
- leaf.propsData = propsData1;
7833
- const allowMounted = vue.ref(typeof onBeforeCreate !== "function");
7834
- if (!allowMounted.value) {
7835
- const result = onBeforeCreate(propsData$);
7836
- if (result && result.then) {
7837
- result.then((response) => {
7838
- if (isDestroyed()) return;
7839
- allowMounted.value = true;
7840
- propsData2.value = response;
7841
- }).catch((error2) => {
7842
- $onDestroyed(error2);
7843
- });
7844
- } else {
7845
- allowMounted.value = true;
7846
- propsData2.value = result;
7847
- }
7848
- }
7849
- return () => allowMounted.value && vue.h(
7850
- wrapper,
7851
- {
7852
- ...propsData1.value,
7853
- ...propsData2.value,
7854
- ref: (vm) => leaf.wrapper = vm,
7855
- onPortalFulfilled: (...args) => $onFulfilled(...args),
7856
- onPortalRejected: (...args) => $onRejected(...args),
7857
- onPortalDestroyed: (...args) => $onDestroyed(...args)
7858
- },
7859
- slots || void 0
7860
- );
7861
- }
7862
- });
7863
- leaf.app = app;
7864
- if (globalProperties) {
7865
- app.config.globalProperties = globalProperties;
7866
- }
7867
- for (const key in components) {
7868
- app.component(key, components[key]);
7869
- }
7870
- for (const key in uses) {
7871
- app.use(uses[key]);
7872
- }
7873
- install?.(app);
7874
- app.mount(container);
8017
+ return validateState.value === "error" && props2.showMessage && form.props.showMessage;
8018
+ });
8019
+ vue.watch(
8020
+ () => props2.error,
8021
+ (v) => {
8022
+ validateMessage.value = v || "";
8023
+ validateState.value = v === "" ? "" : "error";
7875
8024
  }
7876
- leaf.destroy = $onDestroyed;
7877
- leaf.autoDestroy = !!autoDestroy;
7878
- Portal.leafs.set(name, leaf);
7879
- const append = (root$, child$) => {
7880
- if (!root$ || !child$) return;
7881
- if (insertion === "first") {
7882
- const firstEl = root$.firstElementChild;
7883
- if (firstEl) {
7884
- root$.insertBefore(child$, firstEl);
7885
- return;
7886
- }
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
+ }];
7887
8047
  }
7888
- root$.appendChild(child$);
7889
- };
7890
- if (fragment || typeof container._children === "undefined" && !Array.from(container.children).length) {
7891
- useAllNodes = true;
7892
- container.parentElement === null && append(root, container);
7893
- } else if (!container._children) {
7894
- container._children = [];
7895
- let childs = Array.from(container.children);
7896
- if (insertion === "first") {
7897
- 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;
7898
8092
  }
7899
- childs.forEach((i) => {
7900
- append(root, i);
7901
- 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;
7902
8146
  });
8147
+ isNestLast.value = sortFields[sortFields.length - 1] === instance;
7903
8148
  }
7904
- 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
+ };
7905
8219
  }
7906
- }
7907
- const props$P = {
7908
- 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: {
7909
8244
  type: String,
7910
- default: "div"
8245
+ default: "info",
8246
+ validator: (val) => ["info", "loading", "success", "warning", "error"].includes(val)
7911
8247
  }
7912
8248
  };
7913
- const COMPONENT_NAME$_ = "vc-portal-view";
7914
- const PortalView = /* @__PURE__ */ vue.defineComponent({
7915
- name: COMPONENT_NAME$_,
7916
- 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,
7917
8261
  setup(props2, {
7918
- slots
8262
+ emit,
8263
+ expose
7919
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);
7920
8303
  return () => {
7921
- return vue.h(vue.Fragment, [vue.h(props2.tag, {
7922
- class: "vc-portal-view"
7923
- }, slots?.default?.()), vue.h(vue.Teleport, {
7924
- to: "body"
7925
- }, 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
+ })]);
7926
8329
  };
7927
8330
  }
7928
8331
  });
@@ -7959,9 +8362,9 @@ var Vc = (function (exports, vue) {
7959
8362
  success: success$3,
7960
8363
  warning: warning$3
7961
8364
  }, Symbol.toStringTag, { value: "Module" }));
7962
- const COMPONENT_NAME$Z = "vcm-form";
8365
+ const COMPONENT_NAME$$ = "vcm-form";
7963
8366
  const MForm = vue.defineComponent({
7964
- name: COMPONENT_NAME$Z,
8367
+ name: COMPONENT_NAME$$,
7965
8368
  props: props$R,
7966
8369
  setup(props2, { slots, expose }) {
7967
8370
  useForm(expose, {
@@ -7981,17 +8384,17 @@ var Vc = (function (exports, vue) {
7981
8384
  };
7982
8385
  }
7983
8386
  });
7984
- const props$O = {
8387
+ const props$P = {
7985
8388
  ...props$S,
7986
8389
  indent: {
7987
8390
  type: Number,
7988
8391
  default: 12
7989
8392
  }
7990
8393
  };
7991
- const COMPONENT_NAME$Y = "vcm-form-item";
8394
+ const COMPONENT_NAME$_ = "vcm-form-item";
7992
8395
  const MFormItem = /* @__PURE__ */ vue.defineComponent({
7993
- name: COMPONENT_NAME$Y,
7994
- props: props$O,
8396
+ name: COMPONENT_NAME$_,
8397
+ props: props$P,
7995
8398
  setup(props2, {
7996
8399
  slots,
7997
8400
  expose
@@ -8043,24 +8446,24 @@ var Vc = (function (exports, vue) {
8043
8446
  };
8044
8447
  }
8045
8448
  });
8046
- const COMPONENT_NAME$X = "vc-fragment";
8449
+ const COMPONENT_NAME$Z = "vc-fragment";
8047
8450
  const Fragment = vue.defineComponent({
8048
- name: COMPONENT_NAME$X,
8451
+ name: COMPONENT_NAME$Z,
8049
8452
  setup(_, { slots }) {
8050
8453
  return () => vue.h(vue.Fragment, slots.default?.());
8051
8454
  }
8052
8455
  });
8053
8456
  const MFragment = Fragment;
8054
- const props$N = {
8457
+ const props$O = {
8055
8458
  tag: {
8056
8459
  type: String,
8057
8460
  default: "div"
8058
8461
  }
8059
8462
  };
8060
- const COMPONENT_NAME$W = "vc-html-to-image";
8463
+ const COMPONENT_NAME$Y = "vc-html-to-image";
8061
8464
  const HTMLToImage = /* @__PURE__ */ vue.defineComponent({
8062
- name: COMPONENT_NAME$W,
8063
- props: props$N,
8465
+ name: COMPONENT_NAME$Y,
8466
+ props: props$O,
8064
8467
  setup(props2, {
8065
8468
  slots
8066
8469
  }) {
@@ -8073,7 +8476,7 @@ var Vc = (function (exports, vue) {
8073
8476
  });
8074
8477
  const MHTMLToImage = HTMLToImage;
8075
8478
  const MIcon = Icon;
8076
- const props$M = {
8479
+ const props$N = {
8077
8480
  src: String,
8078
8481
  fit: String,
8079
8482
  lazy: Boolean,
@@ -8128,7 +8531,7 @@ var Vc = (function (exports, vue) {
8128
8531
  }
8129
8532
  }
8130
8533
  const IMGStore$1 = new IMGStore();
8131
- const COMPONENT_NAME$V = "vc-image";
8534
+ const COMPONENT_NAME$X = "vc-image";
8132
8535
  let isSupportObjectFit = false;
8133
8536
  window.addEventListener("DOMContentLoaded", () => {
8134
8537
  isSupportObjectFit = !IS_SERVER$3 && document.documentElement.style.objectFit !== void 0;
@@ -8141,9 +8544,9 @@ var Vc = (function (exports, vue) {
8141
8544
  SCALE_DOWN: "scale-down"
8142
8545
  };
8143
8546
  const Image$1 = /* @__PURE__ */ vue.defineComponent({
8144
- name: COMPONENT_NAME$V,
8547
+ name: COMPONENT_NAME$X,
8145
8548
  inheritAttrs: false,
8146
- props: props$M,
8549
+ props: props$N,
8147
8550
  setup(props2, {
8148
8551
  slots,
8149
8552
  emit
@@ -8330,16 +8733,16 @@ var Vc = (function (exports, vue) {
8330
8733
  }
8331
8734
  });
8332
8735
  const MImage = Image$1;
8333
- const props$L = {
8736
+ const props$M = {
8334
8737
  tag: {
8335
8738
  type: String,
8336
8739
  default: "div"
8337
8740
  }
8338
8741
  };
8339
- const COMPONENT_NAME$U = "vc-image-crop";
8742
+ const COMPONENT_NAME$W = "vc-image-crop";
8340
8743
  const ImageCrop = /* @__PURE__ */ vue.defineComponent({
8341
- name: COMPONENT_NAME$U,
8342
- props: props$L,
8744
+ name: COMPONENT_NAME$W,
8745
+ props: props$M,
8343
8746
  setup(props2, {
8344
8747
  slots
8345
8748
  }) {
@@ -8351,16 +8754,16 @@ var Vc = (function (exports, vue) {
8351
8754
  }
8352
8755
  });
8353
8756
  const MImageCrop = ImageCrop;
8354
- const props$K = {
8757
+ const props$L = {
8355
8758
  tag: {
8356
8759
  type: String,
8357
8760
  default: "div"
8358
8761
  }
8359
8762
  };
8360
- const COMPONENT_NAME$T = "vc-image-preview";
8763
+ const COMPONENT_NAME$V = "vc-image-preview";
8361
8764
  const ImagePreview = /* @__PURE__ */ vue.defineComponent({
8362
- name: COMPONENT_NAME$T,
8363
- props: props$K,
8765
+ name: COMPONENT_NAME$V,
8766
+ props: props$L,
8364
8767
  setup(props2, {
8365
8768
  slots
8366
8769
  }) {
@@ -8372,16 +8775,16 @@ var Vc = (function (exports, vue) {
8372
8775
  }
8373
8776
  });
8374
8777
  const MImagePreview = ImagePreview;
8375
- const props$J = {
8778
+ const props$K = {
8376
8779
  tag: {
8377
8780
  type: String,
8378
8781
  default: "div"
8379
8782
  }
8380
8783
  };
8381
- const COMPONENT_NAME$S = "vc-image-processing";
8784
+ const COMPONENT_NAME$U = "vc-image-processing";
8382
8785
  const ImageProcessing = /* @__PURE__ */ vue.defineComponent({
8383
- name: COMPONENT_NAME$S,
8384
- props: props$J,
8786
+ name: COMPONENT_NAME$U,
8787
+ props: props$K,
8385
8788
  setup(props2, {
8386
8789
  slots
8387
8790
  }) {
@@ -8393,7 +8796,7 @@ var Vc = (function (exports, vue) {
8393
8796
  }
8394
8797
  });
8395
8798
  const MImageProcessing = ImageProcessing;
8396
- const props$I = {
8799
+ const props$J = {
8397
8800
  // Array, 作为select等数组存放临时值
8398
8801
  modelValue: {
8399
8802
  type: [String, Number, Array],
@@ -8490,7 +8893,7 @@ var Vc = (function (exports, vue) {
8490
8893
  const isFocus = vue.ref(false);
8491
8894
  const isClearing = vue.ref(false);
8492
8895
  const isOnComposition = vue.ref(false);
8493
- const formItem = vue.inject("form-item", {});
8896
+ const formItem = vue.inject("vc-form-item", {});
8494
8897
  vue.watch(
8495
8898
  () => props2.modelValue,
8496
8899
  (v) => {
@@ -8641,12 +9044,12 @@ var Vc = (function (exports, vue) {
8641
9044
  expose?.(exposed);
8642
9045
  return exposed;
8643
9046
  };
8644
- const COMPONENT_NAME$R = "vc-input";
9047
+ const COMPONENT_NAME$T = "vc-input";
8645
9048
  const Input = /* @__PURE__ */ vue.defineComponent({
8646
- name: COMPONENT_NAME$R,
9049
+ name: COMPONENT_NAME$T,
8647
9050
  inheritAttrs: false,
8648
9051
  props: {
8649
- ...props$I,
9052
+ ...props$J,
8650
9053
  indicator: {
8651
9054
  type: [Boolean, Object],
8652
9055
  default: false
@@ -8747,8 +9150,8 @@ var Vc = (function (exports, vue) {
8747
9150
  };
8748
9151
  }
8749
9152
  });
8750
- const props$H = {
8751
- ...props$I,
9153
+ const props$I = {
9154
+ ...props$J,
8752
9155
  min: {
8753
9156
  type: Number,
8754
9157
  default: 0
@@ -8959,10 +9362,10 @@ var Vc = (function (exports, vue) {
8959
9362
  handleStepper
8960
9363
  };
8961
9364
  };
8962
- const COMPONENT_NAME$Q = "vc-input-number";
9365
+ const COMPONENT_NAME$S = "vc-input-number";
8963
9366
  const InputNumber = /* @__PURE__ */ vue.defineComponent({
8964
- name: COMPONENT_NAME$Q,
8965
- props: props$H,
9367
+ name: COMPONENT_NAME$S,
9368
+ props: props$I,
8966
9369
  inheritAttrs: false,
8967
9370
  setup(props2, {
8968
9371
  slots,
@@ -9012,17 +9415,17 @@ var Vc = (function (exports, vue) {
9012
9415
  };
9013
9416
  }
9014
9417
  });
9015
- const props$G = {
9016
- ...props$I,
9418
+ const props$H = {
9419
+ ...props$J,
9017
9420
  enterText: {
9018
9421
  type: [Boolean, String],
9019
9422
  default: true
9020
9423
  }
9021
9424
  };
9022
- const COMPONENT_NAME$P = "vc-input-search";
9425
+ const COMPONENT_NAME$R = "vc-input-search";
9023
9426
  const InputSearch = /* @__PURE__ */ vue.defineComponent({
9024
- name: COMPONENT_NAME$P,
9025
- props: props$G,
9427
+ name: COMPONENT_NAME$R,
9428
+ props: props$H,
9026
9429
  inheritAttrs: false,
9027
9430
  setup(props2, {
9028
9431
  emit,
@@ -9053,12 +9456,12 @@ var Vc = (function (exports, vue) {
9053
9456
  };
9054
9457
  }
9055
9458
  });
9056
- const COMPONENT_NAME$O = "vcm-input";
9459
+ const COMPONENT_NAME$Q = "vcm-input";
9057
9460
  const MInput = /* @__PURE__ */ vue.defineComponent({
9058
- name: COMPONENT_NAME$O,
9461
+ name: COMPONENT_NAME$Q,
9059
9462
  inheritAttrs: false,
9060
9463
  props: {
9061
- ...props$I,
9464
+ ...props$J,
9062
9465
  right: {
9063
9466
  type: Boolean,
9064
9467
  default: false
@@ -9142,10 +9545,10 @@ var Vc = (function (exports, vue) {
9142
9545
  };
9143
9546
  }
9144
9547
  });
9145
- const COMPONENT_NAME$N = "vcm-input-number";
9548
+ const COMPONENT_NAME$P = "vcm-input-number";
9146
9549
  const MInputNumber = /* @__PURE__ */ vue.defineComponent({
9147
- name: COMPONENT_NAME$N,
9148
- props: props$H,
9550
+ name: COMPONENT_NAME$P,
9551
+ props: props$I,
9149
9552
  inheritAttrs: false,
9150
9553
  setup(props2, {
9151
9554
  slots,
@@ -9190,11 +9593,11 @@ var Vc = (function (exports, vue) {
9190
9593
  };
9191
9594
  }
9192
9595
  });
9193
- const COMPONENT_NAME$M = "vcm-input-search";
9596
+ const COMPONENT_NAME$O = "vcm-input-search";
9194
9597
  const MInputSearch = /* @__PURE__ */ vue.defineComponent({
9195
- name: COMPONENT_NAME$M,
9598
+ name: COMPONENT_NAME$O,
9196
9599
  props: {
9197
- ...props$G,
9600
+ ...props$H,
9198
9601
  cancelText: {
9199
9602
  type: String,
9200
9603
  default: "取消"
@@ -9252,7 +9655,7 @@ var Vc = (function (exports, vue) {
9252
9655
  };
9253
9656
  }
9254
9657
  });
9255
- const props$F = {
9658
+ const props$G = {
9256
9659
  tag: {
9257
9660
  type: String,
9258
9661
  default: "div"
@@ -9266,12 +9669,12 @@ var Vc = (function (exports, vue) {
9266
9669
  default: true
9267
9670
  }
9268
9671
  };
9269
- const COMPONENT_NAME$L = "vcm-list";
9672
+ const COMPONENT_NAME$N = "vcm-list";
9270
9673
  const MList = vue.defineComponent({
9271
- name: COMPONENT_NAME$L,
9272
- props: props$F,
9674
+ name: COMPONENT_NAME$N,
9675
+ props: props$G,
9273
9676
  setup(props2, { slots }) {
9274
- vue.provide("list", { props: props2 });
9677
+ vue.provide("vc-list", { props: props2 });
9275
9678
  return () => {
9276
9679
  return vue.h(
9277
9680
  props2.tag,
@@ -9288,7 +9691,7 @@ var Vc = (function (exports, vue) {
9288
9691
  };
9289
9692
  }
9290
9693
  });
9291
- const props$E = {
9694
+ const props$F = {
9292
9695
  tag: {
9293
9696
  type: String,
9294
9697
  default: "div"
@@ -9319,17 +9722,17 @@ var Vc = (function (exports, vue) {
9319
9722
  // MListItem是否独立存在
9320
9723
  alone: Boolean
9321
9724
  };
9322
- const COMPONENT_NAME$K = "vcm-list-item";
9725
+ const COMPONENT_NAME$M = "vcm-list-item";
9323
9726
  const HTTP_REGEX = /[a-zA-z]+:\/\/[^\s]*/;
9324
9727
  const MListItem = /* @__PURE__ */ vue.defineComponent({
9325
- name: COMPONENT_NAME$K,
9326
- props: props$E,
9728
+ name: COMPONENT_NAME$M,
9729
+ props: props$F,
9327
9730
  emits: ["click"],
9328
9731
  setup(props2, {
9329
9732
  slots,
9330
9733
  emit
9331
9734
  }) {
9332
- const list = vue.inject("list", {});
9735
+ const list = vue.inject("vc-list", {});
9333
9736
  const classes = vue.computed(() => {
9334
9737
  const hasList = !!list.props;
9335
9738
  return {
@@ -9390,16 +9793,16 @@ var Vc = (function (exports, vue) {
9390
9793
  };
9391
9794
  }
9392
9795
  });
9393
- const props$D = {
9796
+ const props$E = {
9394
9797
  tag: {
9395
9798
  type: String,
9396
9799
  default: "div"
9397
9800
  }
9398
9801
  };
9399
- const COMPONENT_NAME$J = "vc-marquee";
9802
+ const COMPONENT_NAME$L = "vc-marquee";
9400
9803
  const Marquee = /* @__PURE__ */ vue.defineComponent({
9401
- name: COMPONENT_NAME$J,
9402
- props: props$D,
9804
+ name: COMPONENT_NAME$L,
9805
+ props: props$E,
9403
9806
  setup(props2, {
9404
9807
  slots
9405
9808
  }) {
@@ -9411,7 +9814,7 @@ var Vc = (function (exports, vue) {
9411
9814
  }
9412
9815
  });
9413
9816
  const MMarquee = Marquee;
9414
- const props$C = {
9817
+ const props$D = {
9415
9818
  content: [String, Function],
9416
9819
  mask: {
9417
9820
  type: Boolean,
@@ -9425,6 +9828,7 @@ var Vc = (function (exports, vue) {
9425
9828
  type: Boolean,
9426
9829
  default: true
9427
9830
  },
9831
+ // 单位ms
9428
9832
  duration: {
9429
9833
  type: Number,
9430
9834
  default: 1500
@@ -9445,17 +9849,27 @@ var Vc = (function (exports, vue) {
9445
9849
  // 这个相当于Modal中的onCancel,支持Promise
9446
9850
  onBeforeClose: Function
9447
9851
  };
9448
- const COMPONENT_NAME$I = "vc-message";
9852
+ const COMPONENT_NAME$K = "vc-message";
9449
9853
  const MessageView = /* @__PURE__ */ vue.defineComponent({
9450
- name: COMPONENT_NAME$I,
9854
+ name: COMPONENT_NAME$K,
9451
9855
  emits: ["before-close", "close", "portal-fulfilled"],
9452
- props: props$C,
9856
+ props: props$D,
9453
9857
  setup(props2, {
9454
9858
  emit,
9455
9859
  expose
9456
9860
  }) {
9457
9861
  const instance = vue.getCurrentInstance();
9458
9862
  const isActive = vue.ref(false);
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
+ };
9870
+ const setContent = (v) => {
9871
+ currentContent.value = v;
9872
+ };
9459
9873
  const handleRemove = () => {
9460
9874
  emit("close");
9461
9875
  emit("portal-fulfilled");
@@ -9474,14 +9888,12 @@ var Vc = (function (exports, vue) {
9474
9888
  isActive.value = false;
9475
9889
  }
9476
9890
  };
9477
- let timer;
9891
+ vue.watch(() => props2.content, setContent, {
9892
+ immediate: true
9893
+ });
9478
9894
  vue.onMounted(() => {
9479
9895
  isActive.value = true;
9480
- if (props2.duration !== 0) {
9481
- timer = setTimeout(() => {
9482
- isActive.value = false;
9483
- }, props2.duration * 1e3 - 300);
9484
- }
9896
+ setDuration(props2.duration);
9485
9897
  });
9486
9898
  vue.onUnmounted(() => {
9487
9899
  timer && clearTimeout(timer);
@@ -9489,7 +9901,10 @@ var Vc = (function (exports, vue) {
9489
9901
  const exposes = ["destroy", "remove", "close", "hide"].reduce((pre, key) => {
9490
9902
  pre[key] = handleRemove;
9491
9903
  return pre;
9492
- }, {});
9904
+ }, {
9905
+ setContent,
9906
+ setDuration
9907
+ });
9493
9908
  expose(exposes);
9494
9909
  return () => {
9495
9910
  return vue.createVNode("div", {
@@ -9498,7 +9913,7 @@ var Vc = (function (exports, vue) {
9498
9913
  "class": "vc-message__mask",
9499
9914
  "onClick": (e) => handleClose(e, props2.maskClosable)
9500
9915
  }, null), vue.createVNode(TransitionSlide, {
9501
- "mode": "up",
9916
+ "mode": "bottom",
9502
9917
  "onAfterLeave": handleRemove
9503
9918
  }, {
9504
9919
  default: () => [vue.withDirectives(vue.createVNode("div", {
@@ -9516,11 +9931,11 @@ var Vc = (function (exports, vue) {
9516
9931
  }, null) : vue.createVNode(Icon, {
9517
9932
  "type": props2.mode,
9518
9933
  "class": [`is-${props2.mode}`, "vc-message__icon"]
9519
- }, null), typeof props2.content === "string" ? vue.createVNode("div", {
9934
+ }, null), typeof currentContent.value === "string" ? vue.createVNode("div", {
9520
9935
  "class": "vc-message__content",
9521
- "innerHTML": props2.content
9522
- }, null) : typeof props2.content === "function" ? vue.createVNode(Customer, {
9523
- "render": props2.content
9936
+ "innerHTML": currentContent.value
9937
+ }, null) : typeof currentContent.value === "function" ? vue.createVNode(Customer, {
9938
+ "render": currentContent.value
9524
9939
  }, null) : null, props2.closable && vue.createVNode(Icon, {
9525
9940
  "type": "close",
9526
9941
  "class": "vc-message__close",
@@ -9574,7 +9989,7 @@ var Vc = (function (exports, vue) {
9574
9989
  warning: warning$2
9575
9990
  }, Symbol.toStringTag, { value: "Module" }));
9576
9991
  const MMessage = Message$1;
9577
- const props$B = {
9992
+ const props$C = {
9578
9993
  modelValue: {
9579
9994
  type: Boolean,
9580
9995
  default: false
@@ -9651,12 +10066,12 @@ var Vc = (function (exports, vue) {
9651
10066
  type: Function
9652
10067
  }
9653
10068
  };
9654
- const COMPONENT_NAME$H = "vc-modal";
10069
+ const COMPONENT_NAME$J = "vc-modal";
9655
10070
  let zIndexNumber = 1002;
9656
10071
  const ModalView = /* @__PURE__ */ vue.defineComponent({
9657
- name: COMPONENT_NAME$H,
10072
+ name: COMPONENT_NAME$J,
9658
10073
  emits: ["update:modelValue", "close", "portal-fulfilled", "visible-change", "ok", "cancel"],
9659
- props: props$B,
10074
+ props: props$C,
9660
10075
  setup(props2, {
9661
10076
  slots,
9662
10077
  emit,
@@ -9844,6 +10259,10 @@ var Vc = (function (exports, vue) {
9844
10259
  expose({
9845
10260
  isActive,
9846
10261
  // for portal
10262
+ toggle(v) {
10263
+ v = typeof v === "boolean" ? v : !isActive.value;
10264
+ isActive.value = v;
10265
+ },
9847
10266
  resetOrigin
9848
10267
  });
9849
10268
  return () => {
@@ -9933,7 +10352,7 @@ var Vc = (function (exports, vue) {
9933
10352
  // 当组件内使用emit('close'),避免重复触发
9934
10353
  onClose: null
9935
10354
  });
9936
- leaf.wrapper.isActive = true;
10355
+ leaf.wrapper.toggle?.(true);
9937
10356
  return leaf;
9938
10357
  };
9939
10358
  const destroy$2 = () => Modal.destroy();
@@ -9949,7 +10368,7 @@ var Vc = (function (exports, vue) {
9949
10368
  success: success$1,
9950
10369
  warning: warning$1
9951
10370
  }, Symbol.toStringTag, { value: "Module" }));
9952
- const props$A = {
10371
+ const props$B = {
9953
10372
  mode: {
9954
10373
  type: String,
9955
10374
  validator: (v) => /(alert|operation)/.test(v),
@@ -10008,11 +10427,11 @@ var Vc = (function (exports, vue) {
10008
10427
  type: Function
10009
10428
  }
10010
10429
  };
10011
- const COMPONENT_NAME$G = "vc-modal";
10430
+ const COMPONENT_NAME$I = "vc-modal";
10012
10431
  const MModalView = /* @__PURE__ */ vue.defineComponent({
10013
- name: COMPONENT_NAME$G,
10432
+ name: COMPONENT_NAME$I,
10014
10433
  emits: ["update:modelValue", "portal-fulfilled", "close", "ok", "cancel"],
10015
- props: props$A,
10434
+ props: props$B,
10016
10435
  setup(props2, {
10017
10436
  slots,
10018
10437
  emit,
@@ -10172,12 +10591,13 @@ var Vc = (function (exports, vue) {
10172
10591
  destroy: destroy$1,
10173
10592
  operation
10174
10593
  }, Symbol.toStringTag, { value: "Module" }));
10175
- const props$z = {
10594
+ const props$A = {
10176
10595
  title: [String, Function],
10177
10596
  content: [String, Function],
10597
+ // 单位ms
10178
10598
  duration: {
10179
10599
  type: Number,
10180
- default: 450
10600
+ default: 4500
10181
10601
  },
10182
10602
  closable: {
10183
10603
  type: Boolean,
@@ -10198,28 +10618,31 @@ var Vc = (function (exports, vue) {
10198
10618
  // 这个相当于Modal中的onCancel,支持Promise
10199
10619
  onBeforeClose: Function
10200
10620
  };
10201
- const COMPONENT_NAME$F = "vc-notice";
10621
+ const COMPONENT_NAME$H = "vc-notice";
10202
10622
  const NoticeView = /* @__PURE__ */ vue.defineComponent({
10203
- name: COMPONENT_NAME$F,
10204
- props: props$z,
10623
+ name: COMPONENT_NAME$H,
10624
+ props: props$A,
10205
10625
  emits: ["portal-fulfilled", "close", "before-close"],
10206
10626
  setup(props2, {
10207
- emit
10627
+ emit,
10628
+ expose
10208
10629
  }) {
10209
10630
  const instance = vue.getCurrentInstance();
10210
10631
  const isActive = vue.ref(false);
10632
+ const currentTitle = vue.ref();
10633
+ const currentContent = vue.ref();
10211
10634
  let timer;
10212
- vue.onMounted(() => {
10213
- isActive.value = true;
10214
- if (props2.duration !== 0) {
10215
- timer = setTimeout(() => {
10216
- isActive.value = false;
10217
- }, props2.duration * 1e3 - 300);
10218
- }
10219
- });
10220
- vue.onUnmounted(() => {
10635
+ const setDuration = (v) => {
10221
10636
  timer && clearTimeout(timer);
10222
- });
10637
+ if (v === 0) return;
10638
+ timer = setTimeout(() => isActive.value = false, v);
10639
+ };
10640
+ const setTitle = (v) => {
10641
+ currentTitle.value = v;
10642
+ };
10643
+ const setContent = (v) => {
10644
+ currentContent.value = v;
10645
+ };
10223
10646
  const handleRemove = () => {
10224
10647
  emit("close");
10225
10648
  emit("portal-fulfilled");
@@ -10238,6 +10661,27 @@ var Vc = (function (exports, vue) {
10238
10661
  isActive.value = false;
10239
10662
  }
10240
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);
10241
10685
  return () => {
10242
10686
  return vue.createVNode("div", {
10243
10687
  "class": ["vc-notice", {
@@ -10257,21 +10701,21 @@ var Vc = (function (exports, vue) {
10257
10701
  }, [props2.mode && vue.createVNode(Icon, {
10258
10702
  "type": `o-${props2.mode}`,
10259
10703
  "class": [`is-${props2.mode}`, "vc-notice__icon"]
10260
- }, null), vue.createVNode("div", null, [props2.title && vue.createVNode("div", {
10704
+ }, null), vue.createVNode("div", null, [currentTitle.value && vue.createVNode("div", {
10261
10705
  "style": [{
10262
- marginBottom: props2.content ? "8px" : ""
10706
+ marginBottom: currentContent.value ? "8px" : ""
10263
10707
  }],
10264
10708
  "class": "vc-notice__title"
10265
- }, [typeof props2.title === "string" ? vue.createVNode("div", {
10266
- "innerHTML": props2.title
10267
- }, null) : typeof props2.title === "function" ? vue.createVNode(Customer, {
10268
- "render": props2.title
10269
- }, null) : null]), props2.content && vue.createVNode("div", {
10709
+ }, [typeof currentTitle.value === "string" ? vue.createVNode("div", {
10710
+ "innerHTML": currentTitle.value
10711
+ }, null) : typeof currentTitle.value === "function" ? vue.createVNode(Customer, {
10712
+ "render": currentTitle.value
10713
+ }, null) : null]), currentContent.value && vue.createVNode("div", {
10270
10714
  "class": "vc-notice__content"
10271
- }, [typeof props2.content === "string" ? vue.createVNode("div", {
10272
- "innerHTML": props2.content
10273
- }, null) : typeof props2.content === "function" ? vue.createVNode(Customer, {
10274
- "render": props2.content
10715
+ }, [typeof currentContent.value === "string" ? vue.createVNode("div", {
10716
+ "innerHTML": currentContent.value
10717
+ }, null) : typeof currentContent.value === "function" ? vue.createVNode(Customer, {
10718
+ "render": currentContent.value
10275
10719
  }, null) : null])]), props2.closable && vue.createVNode(Icon, {
10276
10720
  "type": "close",
10277
10721
  "style": "font-size: 12px",
@@ -10344,16 +10788,16 @@ var Vc = (function (exports, vue) {
10344
10788
  warning
10345
10789
  }, Symbol.toStringTag, { value: "Module" }));
10346
10790
  const MNotice = Notice$1;
10347
- const props$y = {
10791
+ const props$z = {
10348
10792
  tag: {
10349
10793
  type: String,
10350
10794
  default: "div"
10351
10795
  }
10352
10796
  };
10353
- const COMPONENT_NAME$E = "vc-option";
10797
+ const COMPONENT_NAME$G = "vc-option";
10354
10798
  const Option = /* @__PURE__ */ vue.defineComponent({
10355
- name: COMPONENT_NAME$E,
10356
- props: props$y,
10799
+ name: COMPONENT_NAME$G,
10800
+ props: props$z,
10357
10801
  setup(props2, {
10358
10802
  slots
10359
10803
  }) {
@@ -10365,16 +10809,16 @@ var Vc = (function (exports, vue) {
10365
10809
  }
10366
10810
  });
10367
10811
  const MOption = Option;
10368
- const props$x = {
10812
+ const props$y = {
10369
10813
  tag: {
10370
10814
  type: String,
10371
10815
  default: "div"
10372
10816
  }
10373
10817
  };
10374
- const COMPONENT_NAME$D = "vc-page";
10818
+ const COMPONENT_NAME$F = "vc-page";
10375
10819
  const Page = /* @__PURE__ */ vue.defineComponent({
10376
- name: COMPONENT_NAME$D,
10377
- props: props$x,
10820
+ name: COMPONENT_NAME$F,
10821
+ props: props$y,
10378
10822
  setup(props2, {
10379
10823
  slots
10380
10824
  }) {
@@ -10386,16 +10830,16 @@ var Vc = (function (exports, vue) {
10386
10830
  }
10387
10831
  });
10388
10832
  const MPage = Page;
10389
- const props$w = {
10833
+ const props$x = {
10390
10834
  tag: {
10391
10835
  type: String,
10392
10836
  default: "div"
10393
10837
  }
10394
10838
  };
10395
- const COMPONENT_NAME$C = "vc-picker";
10839
+ const COMPONENT_NAME$E = "vc-picker";
10396
10840
  const Picker = /* @__PURE__ */ vue.defineComponent({
10397
- name: COMPONENT_NAME$C,
10398
- props: props$w,
10841
+ name: COMPONENT_NAME$E,
10842
+ props: props$x,
10399
10843
  setup(props2, {
10400
10844
  slots
10401
10845
  }) {
@@ -10407,16 +10851,16 @@ var Vc = (function (exports, vue) {
10407
10851
  }
10408
10852
  });
10409
10853
  const MPicker = Picker;
10410
- const props$v = {
10854
+ const props$w = {
10411
10855
  tag: {
10412
10856
  type: String,
10413
10857
  default: "div"
10414
10858
  }
10415
10859
  };
10416
- const COMPONENT_NAME$B = "vc-popconfirm";
10860
+ const COMPONENT_NAME$D = "vc-popconfirm";
10417
10861
  const Popconfirm = /* @__PURE__ */ vue.defineComponent({
10418
- name: COMPONENT_NAME$B,
10419
- props: props$v,
10862
+ name: COMPONENT_NAME$D,
10863
+ props: props$w,
10420
10864
  setup(props2, {
10421
10865
  slots
10422
10866
  }) {
@@ -10428,7 +10872,7 @@ var Vc = (function (exports, vue) {
10428
10872
  }
10429
10873
  });
10430
10874
  const MPopconfirm = Popconfirm;
10431
- const props$u = {
10875
+ const props$v = {
10432
10876
  modelValue: Boolean,
10433
10877
  animation: String,
10434
10878
  placement: {
@@ -10506,7 +10950,7 @@ var Vc = (function (exports, vue) {
10506
10950
  "autoWidth",
10507
10951
  "always"
10508
10952
  ];
10509
- const props$t = {
10953
+ const props$u = {
10510
10954
  trigger: {
10511
10955
  type: String,
10512
10956
  default: "hover",
@@ -10524,7 +10968,7 @@ var Vc = (function (exports, vue) {
10524
10968
  type: Boolean,
10525
10969
  default: true
10526
10970
  },
10527
- ...pick(props$u, wrapperKeys)
10971
+ ...pick(props$v, wrapperKeys)
10528
10972
  };
10529
10973
  const EXTRA_DISTANCE = 4;
10530
10974
  const HALF_ARROW = 12.73 / 2;
@@ -10781,10 +11225,10 @@ var Vc = (function (exports, vue) {
10781
11225
  function _isSlot(s) {
10782
11226
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
10783
11227
  }
10784
- const COMPONENT_NAME$A = "vc-popover-wrapper";
11228
+ const COMPONENT_NAME$C = "vc-popover-wrapper";
10785
11229
  const PopoverWrapper = /* @__PURE__ */ vue.defineComponent({
10786
- name: COMPONENT_NAME$A,
10787
- props: props$u,
11230
+ name: COMPONENT_NAME$C,
11231
+ props: props$v,
10788
11232
  emits: ["portal-fulfilled", "close"],
10789
11233
  setup(props2, {
10790
11234
  emit,
@@ -10963,7 +11407,11 @@ var Vc = (function (exports, vue) {
10963
11407
  props2.alone && props2.hover && removeEvents();
10964
11408
  });
10965
11409
  expose({
10966
- isActive
11410
+ isActive,
11411
+ toggle(v) {
11412
+ v = typeof v === "boolean" ? v : !isActive.value;
11413
+ isActive.value = v;
11414
+ }
10967
11415
  });
10968
11416
  return () => {
10969
11417
  let _slot;
@@ -11000,10 +11448,10 @@ var Vc = (function (exports, vue) {
11000
11448
  }
11001
11449
  });
11002
11450
  const PopoverPortal = new Portal(PopoverWrapper);
11003
- const COMPONENT_NAME$z = "vc-popover";
11451
+ const COMPONENT_NAME$B = "vc-popover";
11004
11452
  const Popover = /* @__PURE__ */ vue.defineComponent({
11005
- name: COMPONENT_NAME$z,
11006
- props: props$t,
11453
+ name: COMPONENT_NAME$B,
11454
+ props: props$u,
11007
11455
  emits: ["update:modelValue", "visible-change", "ready", "close"],
11008
11456
  open: PopoverPortal.popup.bind(PopoverPortal),
11009
11457
  setup(props2, {
@@ -11085,7 +11533,7 @@ var Vc = (function (exports, vue) {
11085
11533
  portalClass
11086
11534
  });
11087
11535
  } else if (popperInstance && popperInstance.wrapper) {
11088
- popperInstance.wrapper.isActive = false;
11536
+ popperInstance.wrapper.toggle(false);
11089
11537
  }
11090
11538
  };
11091
11539
  vue.watch(() => props2.modelValue, (v) => {
@@ -11126,16 +11574,16 @@ var Vc = (function (exports, vue) {
11126
11574
  }
11127
11575
  });
11128
11576
  const MPopover = Popover;
11129
- const props$s = {
11577
+ const props$t = {
11130
11578
  tag: {
11131
11579
  type: String,
11132
11580
  default: "div"
11133
11581
  }
11134
11582
  };
11135
- const COMPONENT_NAME$y = "vc-popup";
11583
+ const COMPONENT_NAME$A = "vc-popup";
11136
11584
  const Popup = /* @__PURE__ */ vue.defineComponent({
11137
- name: COMPONENT_NAME$y,
11138
- props: props$s,
11585
+ name: COMPONENT_NAME$A,
11586
+ props: props$t,
11139
11587
  setup(props2, {
11140
11588
  slots
11141
11589
  }) {
@@ -11148,16 +11596,16 @@ var Vc = (function (exports, vue) {
11148
11596
  });
11149
11597
  const MPopup = Popup;
11150
11598
  const MPortal = Portal;
11151
- const props$r = {
11599
+ const props$s = {
11152
11600
  tag: {
11153
11601
  type: String,
11154
11602
  default: "div"
11155
11603
  }
11156
11604
  };
11157
- const COMPONENT_NAME$x = "vc-print";
11605
+ const COMPONENT_NAME$z = "vc-print";
11158
11606
  const Print = /* @__PURE__ */ vue.defineComponent({
11159
- name: COMPONENT_NAME$x,
11160
- props: props$r,
11607
+ name: COMPONENT_NAME$z,
11608
+ props: props$s,
11161
11609
  setup(props2, {
11162
11610
  slots
11163
11611
  }) {
@@ -11169,16 +11617,16 @@ var Vc = (function (exports, vue) {
11169
11617
  }
11170
11618
  });
11171
11619
  const MPrint = Print;
11172
- const props$q = {
11620
+ const props$r = {
11173
11621
  tag: {
11174
11622
  type: String,
11175
11623
  default: "div"
11176
11624
  }
11177
11625
  };
11178
- const COMPONENT_NAME$w = "vc-progress";
11626
+ const COMPONENT_NAME$y = "vc-progress";
11179
11627
  const Progress = /* @__PURE__ */ vue.defineComponent({
11180
- name: COMPONENT_NAME$w,
11181
- props: props$q,
11628
+ name: COMPONENT_NAME$y,
11629
+ props: props$r,
11182
11630
  setup(props2, {
11183
11631
  slots
11184
11632
  }) {
@@ -11190,16 +11638,16 @@ var Vc = (function (exports, vue) {
11190
11638
  }
11191
11639
  });
11192
11640
  const MProgress = Progress;
11193
- const props$p = {
11641
+ const props$q = {
11194
11642
  tag: {
11195
11643
  type: String,
11196
11644
  default: "div"
11197
11645
  }
11198
11646
  };
11199
- const COMPONENT_NAME$v = "vc-radio";
11647
+ const COMPONENT_NAME$x = "vc-radio";
11200
11648
  const Radio = /* @__PURE__ */ vue.defineComponent({
11201
- name: COMPONENT_NAME$v,
11202
- props: props$p,
11649
+ name: COMPONENT_NAME$x,
11650
+ props: props$q,
11203
11651
  setup(props2, {
11204
11652
  slots
11205
11653
  }) {
@@ -11211,16 +11659,16 @@ var Vc = (function (exports, vue) {
11211
11659
  }
11212
11660
  });
11213
11661
  const MRadio = Radio;
11214
- const props$o = {
11662
+ const props$p = {
11215
11663
  tag: {
11216
11664
  type: String,
11217
11665
  default: "div"
11218
11666
  }
11219
11667
  };
11220
- const COMPONENT_NAME$u = "vc-rate";
11668
+ const COMPONENT_NAME$w = "vc-rate";
11221
11669
  const Rate = /* @__PURE__ */ vue.defineComponent({
11222
- name: COMPONENT_NAME$u,
11223
- props: props$o,
11670
+ name: COMPONENT_NAME$w,
11671
+ props: props$p,
11224
11672
  setup(props2, {
11225
11673
  slots
11226
11674
  }) {
@@ -11232,7 +11680,7 @@ var Vc = (function (exports, vue) {
11232
11680
  }
11233
11681
  });
11234
11682
  const MRate = Rate;
11235
- const props$n = {
11683
+ const props$o = {
11236
11684
  data: {
11237
11685
  type: Array,
11238
11686
  default: () => []
@@ -11282,7 +11730,7 @@ var Vc = (function (exports, vue) {
11282
11730
  renderPlaceholder: Function,
11283
11731
  renderRefresh: Function
11284
11732
  };
11285
- const props$m = {
11733
+ const props$n = {
11286
11734
  vertical: Boolean,
11287
11735
  wrapperSize: {
11288
11736
  type: Number,
@@ -11335,7 +11783,7 @@ var Vc = (function (exports, vue) {
11335
11783
  "thumbStyle",
11336
11784
  "thumbClass"
11337
11785
  ];
11338
- const props$l = {
11786
+ const props$m = {
11339
11787
  // 如果存在滚动条宽度为false, 不存在则为true
11340
11788
  // 为false的情况下才能使用track-offset
11341
11789
  native: {
@@ -11366,7 +11814,7 @@ var Vc = (function (exports, vue) {
11366
11814
  scrollX: Number,
11367
11815
  scrollY: Number,
11368
11816
  fit: Boolean,
11369
- ...pick(props$m, barKeys$1)
11817
+ ...pick(props$n, barKeys$1)
11370
11818
  };
11371
11819
  const barKeys = [
11372
11820
  "always",
@@ -11380,7 +11828,7 @@ var Vc = (function (exports, vue) {
11380
11828
  "autoResize",
11381
11829
  "native"
11382
11830
  ];
11383
- const props$k = {
11831
+ const props$l = {
11384
11832
  tag: {
11385
11833
  type: String,
11386
11834
  default: "div"
@@ -11413,10 +11861,10 @@ var Vc = (function (exports, vue) {
11413
11861
  type: Boolean,
11414
11862
  default: true
11415
11863
  },
11416
- barTo: props$l.to,
11417
- ...pick(props$l, barKeys)
11864
+ barTo: props$m.to,
11865
+ ...pick(props$m, barKeys)
11418
11866
  };
11419
- const COMPONENT_NAME$t = "vc-scroller-track";
11867
+ const COMPONENT_NAME$v = "vc-scroller-track";
11420
11868
  const BAR_MAP = {
11421
11869
  vertical: {
11422
11870
  scroll: "scrollTop",
@@ -11436,8 +11884,8 @@ var Vc = (function (exports, vue) {
11436
11884
  }
11437
11885
  };
11438
11886
  const Track$1 = /* @__PURE__ */ vue.defineComponent({
11439
- name: COMPONENT_NAME$t,
11440
- props: props$m,
11887
+ name: COMPONENT_NAME$v,
11888
+ props: props$n,
11441
11889
  emits: ["change"],
11442
11890
  setup(props2, {
11443
11891
  emit,
@@ -11594,10 +12042,10 @@ var Vc = (function (exports, vue) {
11594
12042
  };
11595
12043
  }
11596
12044
  });
11597
- const COMPONENT_NAME$s = "vc-scroller-bar";
12045
+ const COMPONENT_NAME$u = "vc-scroller-bar";
11598
12046
  const Bar = /* @__PURE__ */ vue.defineComponent({
11599
- name: COMPONENT_NAME$s,
11600
- props: props$l,
12047
+ name: COMPONENT_NAME$u,
12048
+ props: props$m,
11601
12049
  emits: ["change"],
11602
12050
  setup(props2, {
11603
12051
  emit,
@@ -11806,10 +12254,10 @@ var Vc = (function (exports, vue) {
11806
12254
  refreshPosition
11807
12255
  };
11808
12256
  };
11809
- const COMPONENT_NAME$r = "vc-scroller";
12257
+ const COMPONENT_NAME$t = "vc-scroller";
11810
12258
  const Scroller = /* @__PURE__ */ vue.defineComponent({
11811
- name: COMPONENT_NAME$r,
11812
- props: props$k,
12259
+ name: COMPONENT_NAME$t,
12260
+ props: props$l,
11813
12261
  emits: ["scroll"],
11814
12262
  setup(props2, {
11815
12263
  slots,
@@ -11866,10 +12314,10 @@ var Vc = (function (exports, vue) {
11866
12314
  };
11867
12315
  }
11868
12316
  });
11869
- const COMPONENT_NAME$q = "vc-scroller-wheel";
12317
+ const COMPONENT_NAME$s = "vc-scroller-wheel";
11870
12318
  const ScrollerWheel = /* @__PURE__ */ vue.defineComponent({
11871
- name: COMPONENT_NAME$q,
11872
- props: props$k,
12319
+ name: COMPONENT_NAME$s,
12320
+ props: props$l,
11873
12321
  emits: ["scroll"],
11874
12322
  setup(props2, {
11875
12323
  slots,
@@ -11966,9 +12414,9 @@ var Vc = (function (exports, vue) {
11966
12414
  };
11967
12415
  }
11968
12416
  });
11969
- const COMPONENT_NAME$p = "vc-recycle-list-scroll-state";
12417
+ const COMPONENT_NAME$r = "vc-recycle-list-scroll-state";
11970
12418
  const ScrollState = /* @__PURE__ */ vue.defineComponent({
11971
- name: COMPONENT_NAME$p,
12419
+ name: COMPONENT_NAME$r,
11972
12420
  setup(_, {
11973
12421
  slots
11974
12422
  }) {
@@ -12037,7 +12485,7 @@ var Vc = (function (exports, vue) {
12037
12485
  [REFRESH]: "加载中..."
12038
12486
  }
12039
12487
  };
12040
- const props$j = {
12488
+ const props$k = {
12041
12489
  inverted: {
12042
12490
  type: Boolean,
12043
12491
  default: false
@@ -12092,11 +12540,11 @@ var Vc = (function (exports, vue) {
12092
12540
  );
12093
12541
  return keys;
12094
12542
  };
12095
- const COMPONENT_NAME$o = "vc-recycle-list-container";
12543
+ const COMPONENT_NAME$q = "vc-recycle-list-container";
12096
12544
  const transformKey = prefixStyle("transform").camel;
12097
12545
  const Container = /* @__PURE__ */ vue.defineComponent({
12098
- name: COMPONENT_NAME$o,
12099
- props: props$j,
12546
+ name: COMPONENT_NAME$q,
12547
+ props: props$k,
12100
12548
  emits: ["refresh"],
12101
12549
  setup(props2, {
12102
12550
  slots
@@ -12188,16 +12636,16 @@ var Vc = (function (exports, vue) {
12188
12636
  };
12189
12637
  }
12190
12638
  });
12191
- const COMPONENT_NAME$n = "vc-recycle-list-item";
12639
+ const COMPONENT_NAME$p = "vc-recycle-list-item";
12192
12640
  const Item = /* @__PURE__ */ vue.defineComponent({
12193
- name: COMPONENT_NAME$n,
12641
+ name: COMPONENT_NAME$p,
12194
12642
  props: {
12195
12643
  vertical: {
12196
12644
  type: Boolean,
12197
12645
  default: true
12198
12646
  }
12199
12647
  },
12200
- emits: ["resize"],
12648
+ emits: ["resize", "change"],
12201
12649
  setup(_, {
12202
12650
  emit,
12203
12651
  slots
@@ -12209,9 +12657,10 @@ var Vc = (function (exports, vue) {
12209
12657
  const handleResize = () => {
12210
12658
  const v = current.value.getBoundingClientRect()[K.size];
12211
12659
  const changed = offsetSize.value != v;
12212
- if (hasInitial && changed) {
12660
+ if (changed) {
12213
12661
  offsetSize.value = v;
12214
- emit("resize");
12662
+ hasInitial && emit("resize", v);
12663
+ emit("change", v);
12215
12664
  }
12216
12665
  hasInitial = true;
12217
12666
  };
@@ -12229,10 +12678,10 @@ var Vc = (function (exports, vue) {
12229
12678
  };
12230
12679
  }
12231
12680
  });
12232
- const COMPONENT_NAME$m = "vc-recycle-list";
12681
+ const COMPONENT_NAME$o = "vc-recycle-list";
12233
12682
  const RecycleList = /* @__PURE__ */ vue.defineComponent({
12234
- name: COMPONENT_NAME$m,
12235
- props: props$n,
12683
+ name: COMPONENT_NAME$o,
12684
+ props: props$o,
12236
12685
  emits: ["scroll"],
12237
12686
  setup(props2, {
12238
12687
  slots,
@@ -12733,17 +13182,17 @@ var Vc = (function (exports, vue) {
12733
13182
  }
12734
13183
  });
12735
13184
  const MRecycleList = RecycleList;
12736
- const props$i = {
13185
+ const props$j = {
12737
13186
  tag: {
12738
13187
  type: String,
12739
13188
  default: "div"
12740
13189
  }
12741
13190
  };
12742
- const COMPONENT_NAME$l = "vc-resizer";
13191
+ const COMPONENT_NAME$n = "vc-resizer";
12743
13192
  const Resizer = vue.defineComponent({
12744
- name: COMPONENT_NAME$l,
12745
- props: props$i,
12746
- emit: ["resize"],
13193
+ name: COMPONENT_NAME$n,
13194
+ props: props$j,
13195
+ emit: ["resize", "change"],
12747
13196
  setup(props2, { emit, slots }) {
12748
13197
  const width = vue.ref(0);
12749
13198
  const height = vue.ref(0);
@@ -12769,8 +13218,9 @@ var Vc = (function (exports, vue) {
12769
13218
  const widthChanged = width.value != width$;
12770
13219
  heightChanged && (height.value = height$);
12771
13220
  widthChanged && (width.value = width$);
12772
- if (hasInitial && (heightChanged || widthChanged)) {
12773
- emit("resize", currentExposed.value);
13221
+ if (heightChanged || widthChanged) {
13222
+ hasInitial && emit("resize", currentExposed.value);
13223
+ emit("change", currentExposed.value);
12774
13224
  }
12775
13225
  hasInitial = true;
12776
13226
  };
@@ -12794,16 +13244,16 @@ var Vc = (function (exports, vue) {
12794
13244
  });
12795
13245
  const MResizer = Resizer;
12796
13246
  const MScroller = Scroller;
12797
- const props$h = {
13247
+ const props$i = {
12798
13248
  tag: {
12799
13249
  type: String,
12800
13250
  default: "div"
12801
13251
  }
12802
13252
  };
12803
- const COMPONENT_NAME$k = "vc-select";
13253
+ const COMPONENT_NAME$m = "vc-select";
12804
13254
  const Select = /* @__PURE__ */ vue.defineComponent({
12805
- name: COMPONENT_NAME$k,
12806
- props: props$h,
13255
+ name: COMPONENT_NAME$m,
13256
+ props: props$i,
12807
13257
  setup(props2, {
12808
13258
  slots
12809
13259
  }) {
@@ -12815,16 +13265,16 @@ var Vc = (function (exports, vue) {
12815
13265
  }
12816
13266
  });
12817
13267
  const MSelect = Select;
12818
- const props$g = {
13268
+ const props$h = {
12819
13269
  tag: {
12820
13270
  type: String,
12821
13271
  default: "div"
12822
13272
  }
12823
13273
  };
12824
- const COMPONENT_NAME$j = "vc-slider";
13274
+ const COMPONENT_NAME$l = "vc-slider";
12825
13275
  const Slider = /* @__PURE__ */ vue.defineComponent({
12826
- name: COMPONENT_NAME$j,
12827
- props: props$g,
13276
+ name: COMPONENT_NAME$l,
13277
+ props: props$h,
12828
13278
  setup(props2, {
12829
13279
  slots
12830
13280
  }) {
@@ -12836,16 +13286,16 @@ var Vc = (function (exports, vue) {
12836
13286
  }
12837
13287
  });
12838
13288
  const MSlider = Slider;
12839
- const props$f = {
13289
+ const props$g = {
12840
13290
  tag: {
12841
13291
  type: String,
12842
13292
  default: "div"
12843
13293
  }
12844
13294
  };
12845
- const COMPONENT_NAME$i = "vc-sort-list";
13295
+ const COMPONENT_NAME$k = "vc-sort-list";
12846
13296
  const SortList = /* @__PURE__ */ vue.defineComponent({
12847
- name: COMPONENT_NAME$i,
12848
- props: props$f,
13297
+ name: COMPONENT_NAME$k,
13298
+ props: props$g,
12849
13299
  setup(props2, {
12850
13300
  slots
12851
13301
  }) {
@@ -12857,16 +13307,16 @@ var Vc = (function (exports, vue) {
12857
13307
  }
12858
13308
  });
12859
13309
  const MSortList = SortList;
12860
- const props$e = {
13310
+ const props$f = {
12861
13311
  tag: {
12862
13312
  type: String,
12863
13313
  default: "div"
12864
13314
  }
12865
13315
  };
12866
- const COMPONENT_NAME$h = "vc-steps";
13316
+ const COMPONENT_NAME$j = "vc-steps";
12867
13317
  const Steps = /* @__PURE__ */ vue.defineComponent({
12868
- name: COMPONENT_NAME$h,
12869
- props: props$e,
13318
+ name: COMPONENT_NAME$j,
13319
+ props: props$f,
12870
13320
  setup(props2, {
12871
13321
  slots
12872
13322
  }) {
@@ -12878,16 +13328,16 @@ var Vc = (function (exports, vue) {
12878
13328
  }
12879
13329
  });
12880
13330
  const MSteps = Steps;
12881
- const props$d = {
13331
+ const props$e = {
12882
13332
  tag: {
12883
13333
  type: String,
12884
13334
  default: "div"
12885
13335
  }
12886
13336
  };
12887
- const COMPONENT_NAME$g = "vc-switch";
13337
+ const COMPONENT_NAME$i = "vc-switch";
12888
13338
  const Switch = /* @__PURE__ */ vue.defineComponent({
12889
- name: COMPONENT_NAME$g,
12890
- props: props$d,
13339
+ name: COMPONENT_NAME$i,
13340
+ props: props$e,
12891
13341
  setup(props2, {
12892
13342
  slots
12893
13343
  }) {
@@ -12899,16 +13349,16 @@ var Vc = (function (exports, vue) {
12899
13349
  }
12900
13350
  });
12901
13351
  const MSwitch = Switch;
12902
- const props$c = {
13352
+ const props$d = {
12903
13353
  tag: {
12904
13354
  type: String,
12905
13355
  default: "div"
12906
13356
  }
12907
13357
  };
12908
- const COMPONENT_NAME$f = "vc-table";
13358
+ const COMPONENT_NAME$h = "vc-table";
12909
13359
  const Table = /* @__PURE__ */ vue.defineComponent({
12910
- name: COMPONENT_NAME$f,
12911
- props: props$c,
13360
+ name: COMPONENT_NAME$h,
13361
+ props: props$d,
12912
13362
  setup(props2, {
12913
13363
  slots
12914
13364
  }) {
@@ -12920,7 +13370,7 @@ var Vc = (function (exports, vue) {
12920
13370
  }
12921
13371
  });
12922
13372
  const MTable = Table;
12923
- const props$b = {
13373
+ const props$c = {
12924
13374
  type: {
12925
13375
  type: String,
12926
13376
  validator: (v) => /^(line|card)$/.test(v),
@@ -13027,7 +13477,7 @@ var Vc = (function (exports, vue) {
13027
13477
  if (!item) return;
13028
13478
  list.value.splice(list.value.indexOf(item.props), 1);
13029
13479
  };
13030
- vue.provide("tabs", {
13480
+ vue.provide("vc-tabs", {
13031
13481
  props: props2,
13032
13482
  currentValue,
13033
13483
  refresh,
@@ -13071,10 +13521,10 @@ var Vc = (function (exports, vue) {
13071
13521
  handleChange
13072
13522
  };
13073
13523
  };
13074
- const COMPONENT_NAME$e = "vc-tabs";
13524
+ const COMPONENT_NAME$g = "vc-tabs";
13075
13525
  const Tabs = /* @__PURE__ */ vue.defineComponent({
13076
- name: COMPONENT_NAME$e,
13077
- props: props$b,
13526
+ name: COMPONENT_NAME$g,
13527
+ props: props$c,
13078
13528
  emits: ["update:modelValue", "change", "click"],
13079
13529
  setup(props2, {
13080
13530
  slots
@@ -13219,7 +13669,7 @@ var Vc = (function (exports, vue) {
13219
13669
  };
13220
13670
  }
13221
13671
  });
13222
- const props$a = {
13672
+ const props$b = {
13223
13673
  value: {
13224
13674
  type: [String, Number]
13225
13675
  },
@@ -13245,7 +13695,7 @@ var Vc = (function (exports, vue) {
13245
13695
  const { props: props2 } = instance;
13246
13696
  const currentValue = vue.ref(void 0);
13247
13697
  const isLoaded = vue.ref(false);
13248
- const tabs = vue.inject("tabs", {});
13698
+ const tabs = vue.inject("vc-tabs", {});
13249
13699
  const isActive = vue.computed(() => {
13250
13700
  const state = tabs.currentValue.value === (props2.value || currentValue.value);
13251
13701
  if (!isLoaded.value && state) {
@@ -13297,10 +13747,10 @@ var Vc = (function (exports, vue) {
13297
13747
  currentValue
13298
13748
  };
13299
13749
  };
13300
- const COMPONENT_NAME$d = "vc-tabs-pane";
13750
+ const COMPONENT_NAME$f = "vc-tabs-pane";
13301
13751
  const TabsPane = /* @__PURE__ */ vue.defineComponent({
13302
- name: COMPONENT_NAME$d,
13303
- props: props$a,
13752
+ name: COMPONENT_NAME$f,
13753
+ props: props$b,
13304
13754
  setup(_, {
13305
13755
  slots
13306
13756
  }) {
@@ -13314,8 +13764,289 @@ var Vc = (function (exports, vue) {
13314
13764
  };
13315
13765
  }
13316
13766
  });
13317
- const MTabs = Tabs;
13318
- 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
+ });
13319
14050
  const props$9 = {
13320
14051
  tag: {
13321
14052
  type: String,
@@ -13737,8 +14468,8 @@ var Vc = (function (exports, vue) {
13737
14468
  MDebounce: Debounce,
13738
14469
  Divider,
13739
14470
  MDivider,
13740
- Drawer,
13741
- MDrawer,
14471
+ DrawerView,
14472
+ MDrawerView,
13742
14473
  Dropdown,
13743
14474
  MDropdown,
13744
14475
  // DropdownItem,
@@ -13781,8 +14512,8 @@ var Vc = (function (exports, vue) {
13781
14512
  MListItem,
13782
14513
  Marquee,
13783
14514
  MMarquee,
13784
- Modal: modal$1,
13785
- MModal: modal,
14515
+ ModalView,
14516
+ MModalView,
13786
14517
  Notice: Notice$1,
13787
14518
  MNotice,
13788
14519
  Option,
@@ -94016,6 +94747,7 @@ var Vc = (function (exports, vue) {
94016
94747
  exports.Checkbox = Checkbox;
94017
94748
  exports.Clipboard = Clipboard;
94018
94749
  exports.Collapse = Collapse;
94750
+ exports.CollapseItem = CollapseItem;
94019
94751
  exports.ColorPicker = ColorPicker;
94020
94752
  exports.Components = Components;
94021
94753
  exports.Countdown = Countdown;
@@ -94023,7 +94755,8 @@ var Vc = (function (exports, vue) {
94023
94755
  exports.DatePicker = DatePicker;
94024
94756
  exports.Debounce = Debounce;
94025
94757
  exports.Divider = Divider;
94026
- exports.Drawer = Drawer;
94758
+ exports.Drawer = drawer;
94759
+ exports.DrawerView = DrawerView;
94027
94760
  exports.Dropdown = Dropdown;
94028
94761
  exports.Editor = Editor;
94029
94762
  exports.Expand = Expand;
@@ -94055,13 +94788,14 @@ var Vc = (function (exports, vue) {
94055
94788
  exports.MCheckbox = MCheckbox;
94056
94789
  exports.MClipboard = MClipboard;
94057
94790
  exports.MCollapse = MCollapse;
94791
+ exports.MCollapseItem = MCollapseItem;
94058
94792
  exports.MColorPicker = MColorPicker;
94059
94793
  exports.MCountdown = MCountdown;
94060
94794
  exports.MCustomer = MCustomer;
94061
94795
  exports.MDatePicker = MDatePicker;
94062
94796
  exports.MDebounce = Debounce;
94063
94797
  exports.MDivider = MDivider;
94064
- exports.MDrawer = MDrawer;
94798
+ exports.MDrawerView = MDrawerView;
94065
94799
  exports.MDropdown = MDropdown;
94066
94800
  exports.MEditor = MEditor;
94067
94801
  exports.MExpand = MExpand;