@deot/vc-components 1.0.2 → 1.0.4

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.
package/dist/index.cjs CHANGED
@@ -4,12 +4,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const vue = require('vue');
6
6
  const lodashEs = require('lodash-es');
7
+ const helperResize = require('@deot/helper-resize');
7
8
  const Utils = require('@deot/helper-utils');
8
9
  const helperValidator = require('@deot/helper-validator');
9
10
  const vcShared = require('@deot/vc-shared');
10
11
  const $ = require('@deot/helper-dom');
11
12
  const vcHooks = require('@deot/vc-hooks');
12
- const helperResize = require('@deot/helper-resize');
13
+ const helperCache = require('@deot/helper-cache');
13
14
  const helperScheduler = require('@deot/helper-scheduler');
14
15
  const helperWheel = require('@deot/helper-wheel');
15
16
  const Load = require('@deot/helper-load');
@@ -79,7 +80,7 @@ class Instance {
79
80
  }
80
81
  const VcInstance = new Instance();
81
82
 
82
- const props$1g = {
83
+ const props$1h = {
83
84
  tag: {
84
85
  type: String,
85
86
  default: "div"
@@ -88,10 +89,10 @@ const props$1g = {
88
89
 
89
90
  /** @jsxImportSource vue */
90
91
 
91
- const COMPONENT_NAME$1w = 'vc-action-sheet';
92
+ const COMPONENT_NAME$1x = 'vc-action-sheet';
92
93
  const ActionSheet = /* @__PURE__ */ vue.defineComponent({
93
- name: COMPONENT_NAME$1w,
94
- props: props$1g,
94
+ name: COMPONENT_NAME$1x,
95
+ props: props$1h,
95
96
  setup(props, {
96
97
  slots
97
98
  }) {
@@ -105,7 +106,7 @@ const ActionSheet = /* @__PURE__ */ vue.defineComponent({
105
106
 
106
107
  const MActionSheet = ActionSheet;
107
108
 
108
- const props$1f = {
109
+ const props$1g = {
109
110
  modelValue: {
110
111
  type: Boolean,
111
112
  default: true
@@ -132,7 +133,7 @@ const props$1f = {
132
133
  }
133
134
  };
134
135
 
135
- const props$1e = {
136
+ const props$1f = {
136
137
  type: String,
137
138
  inherit: {
138
139
  type: Boolean,
@@ -277,10 +278,10 @@ const IconManager = new Manager();
277
278
 
278
279
  /** @jsxImportSource vue */
279
280
 
280
- const COMPONENT_NAME$1v = 'vc-icon';
281
+ const COMPONENT_NAME$1w = 'vc-icon';
281
282
  const Icon = /* @__PURE__ */ vue.defineComponent({
282
- name: COMPONENT_NAME$1v,
283
- props: props$1e,
283
+ name: COMPONENT_NAME$1w,
284
+ props: props$1f,
284
285
  setup(props) {
285
286
  const viewBox = vue.ref('0 0 1024 1024');
286
287
  const path = vue.ref([]);
@@ -313,7 +314,7 @@ const Icon = /* @__PURE__ */ vue.defineComponent({
313
314
  }
314
315
  });
315
316
 
316
- const props$1d = {
317
+ const props$1e = {
317
318
  /**
318
319
  * 进入/离开持续时间
319
320
  * {enter: 300, leave: 300}
@@ -478,10 +479,10 @@ const useTransition = () => {
478
479
  };
479
480
  };
480
481
 
481
- const COMPONENT_NAME$1u = "vc-transition";
482
+ const COMPONENT_NAME$1v = "vc-transition";
482
483
  const Transition = vue.defineComponent({
483
- name: COMPONENT_NAME$1u,
484
- props: props$1d,
484
+ name: COMPONENT_NAME$1v,
485
+ props: props$1e,
485
486
  // 当不声明emits的情况下,事件存在于attrs中
486
487
  inheritAttrs: false,
487
488
  setup(props, { slots, attrs }) {
@@ -501,10 +502,10 @@ const Transition = vue.defineComponent({
501
502
  }
502
503
  });
503
504
 
504
- const COMPONENT_NAME$1t = "vc-transition-collapse";
505
+ const COMPONENT_NAME$1u = "vc-transition-collapse";
505
506
  const TransitionCollapse = vue.defineComponent({
506
- name: COMPONENT_NAME$1t,
507
- props: props$1d,
507
+ name: COMPONENT_NAME$1u,
508
+ props: props$1e,
508
509
  // 当不声明emits的情况下,事件存在于attrs中
509
510
  inheritAttrs: false,
510
511
  setup(props, { slots, attrs: _attrs }) {
@@ -622,11 +623,11 @@ const TransitionCollapse = vue.defineComponent({
622
623
  }
623
624
  });
624
625
 
625
- const COMPONENT_NAME$1s = "vc-transition-fade";
626
+ const COMPONENT_NAME$1t = "vc-transition-fade";
626
627
  const TransitionFade = vue.defineComponent({
627
- name: COMPONENT_NAME$1s,
628
+ name: COMPONENT_NAME$1t,
628
629
  props: {
629
- ...props$1d,
630
+ ...props$1e,
630
631
  // inheritAttrs必须是false
631
632
  style: {
632
633
  type: Object,
@@ -659,11 +660,11 @@ const TransitionFade = vue.defineComponent({
659
660
  }
660
661
  });
661
662
 
662
- const COMPONENT_NAME$1r = "vc-transition-scale";
663
+ const COMPONENT_NAME$1s = "vc-transition-scale";
663
664
  const TransitionScale = vue.defineComponent({
664
- name: COMPONENT_NAME$1r,
665
+ name: COMPONENT_NAME$1s,
665
666
  props: {
666
- ...props$1d,
667
+ ...props$1e,
667
668
  mode: {
668
669
  type: String,
669
670
  default: "both",
@@ -701,11 +702,11 @@ const TransitionScale = vue.defineComponent({
701
702
  }
702
703
  });
703
704
 
704
- const COMPONENT_NAME$1q = "vc-transition-slide";
705
+ const COMPONENT_NAME$1r = "vc-transition-slide";
705
706
  const TransitionSlide = vue.defineComponent({
706
- name: COMPONENT_NAME$1q,
707
+ name: COMPONENT_NAME$1r,
707
708
  props: {
708
- ...props$1d,
709
+ ...props$1e,
709
710
  mode: {
710
711
  type: String,
711
712
  default: "left",
@@ -743,11 +744,11 @@ const TransitionSlide = vue.defineComponent({
743
744
  }
744
745
  });
745
746
 
746
- const COMPONENT_NAME$1p = "vc-transition-zoom";
747
+ const COMPONENT_NAME$1q = "vc-transition-zoom";
747
748
  const TransitionZoom = vue.defineComponent({
748
- name: COMPONENT_NAME$1p,
749
+ name: COMPONENT_NAME$1q,
749
750
  props: {
750
- ...props$1d,
751
+ ...props$1e,
751
752
  mode: {
752
753
  type: String,
753
754
  default: "x",
@@ -787,7 +788,7 @@ const TransitionZoom = vue.defineComponent({
787
788
 
788
789
  /** @jsxImportSource vue */
789
790
 
790
- const COMPONENT_NAME$1o = 'vc-alert';
791
+ const COMPONENT_NAME$1p = 'vc-alert';
791
792
 
792
793
  // [color, borderColor, backgroundColor], -> CSS
793
794
  const THEME_MAP = {
@@ -797,8 +798,8 @@ const THEME_MAP = {
797
798
  warning: ['#ffbf00', '#ffe58f', '#fffbe6']
798
799
  };
799
800
  const Alert = /* @__PURE__ */ vue.defineComponent({
800
- name: COMPONENT_NAME$1o,
801
- props: props$1f,
801
+ name: COMPONENT_NAME$1p,
802
+ props: props$1g,
802
803
  setup(props, {
803
804
  slots,
804
805
  emit
@@ -887,7 +888,7 @@ const Alert = /* @__PURE__ */ vue.defineComponent({
887
888
 
888
889
  const MAlert = Alert;
889
890
 
890
- const props$1c = {
891
+ const props$1d = {
891
892
  tag: {
892
893
  type: String,
893
894
  default: "div"
@@ -896,10 +897,10 @@ const props$1c = {
896
897
 
897
898
  /** @jsxImportSource vue */
898
899
 
899
- const COMPONENT_NAME$1n = 'vc-artboard';
900
+ const COMPONENT_NAME$1o = 'vc-artboard';
900
901
  const Artboard = /* @__PURE__ */ vue.defineComponent({
901
- name: COMPONENT_NAME$1n,
902
- props: props$1c,
902
+ name: COMPONENT_NAME$1o,
903
+ props: props$1d,
903
904
  setup(props, {
904
905
  slots
905
906
  }) {
@@ -913,7 +914,7 @@ const Artboard = /* @__PURE__ */ vue.defineComponent({
913
914
 
914
915
  const MArtboard = Artboard;
915
916
 
916
- const props$1b = {
917
+ const props$1c = {
917
918
  size: {
918
919
  type: Number,
919
920
  default: 28
@@ -937,10 +938,10 @@ const props$1b = {
937
938
 
938
939
  /** @jsxImportSource vue */
939
940
 
940
- const COMPONENT_NAME$1m = 'vc-spin';
941
+ const COMPONENT_NAME$1n = 'vc-spin';
941
942
  const Spin = /* @__PURE__ */ vue.defineComponent({
942
- name: COMPONENT_NAME$1m,
943
- props: props$1b,
943
+ name: COMPONENT_NAME$1n,
944
+ props: props$1c,
944
945
  setup(props, {
945
946
  slots
946
947
  }) {
@@ -974,7 +975,7 @@ const Spin = /* @__PURE__ */ vue.defineComponent({
974
975
  }
975
976
  });
976
977
 
977
- const props$1a = {
978
+ const props$1b = {
978
979
  wait: {
979
980
  type: Number,
980
981
  default: 250
@@ -990,10 +991,10 @@ const props$1a = {
990
991
  exclude: RegExp
991
992
  };
992
993
 
993
- const COMPONENT_NAME$1l = "vc-debounce";
994
+ const COMPONENT_NAME$1m = "vc-debounce";
994
995
  const Debounce = vue.defineComponent({
995
- name: COMPONENT_NAME$1l,
996
- props: props$1a,
996
+ name: COMPONENT_NAME$1m,
997
+ props: props$1b,
997
998
  /**
998
999
  * 不声明emits使得事件被透传放入attrs中, 这样可以让所有的事件透传
999
1000
  * 如事件onClick
@@ -1034,7 +1035,7 @@ const Debounce = vue.defineComponent({
1034
1035
  }
1035
1036
  });
1036
1037
 
1037
- const props$19 = {
1038
+ const props$1a = {
1038
1039
  tag: {
1039
1040
  type: String,
1040
1041
  default: "button"
@@ -1064,11 +1065,11 @@ const props$19 = {
1064
1065
 
1065
1066
  /** @jsxImportSource vue */
1066
1067
 
1067
- const COMPONENT_NAME$1k = 'vc-button';
1068
+ const COMPONENT_NAME$1l = 'vc-button';
1068
1069
  const Button = /* @__PURE__ */ vue.defineComponent({
1069
- name: COMPONENT_NAME$1k,
1070
+ name: COMPONENT_NAME$1l,
1070
1071
  emits: ['click'],
1071
- props: props$19,
1072
+ props: props$1a,
1072
1073
  setup(props, {
1073
1074
  slots
1074
1075
  }) {
@@ -1125,7 +1126,7 @@ const Button = /* @__PURE__ */ vue.defineComponent({
1125
1126
  }
1126
1127
  });
1127
1128
 
1128
- const props$18 = {
1129
+ const props$19 = {
1129
1130
  vertical: {
1130
1131
  type: Boolean,
1131
1132
  default: false
@@ -1146,10 +1147,10 @@ const props$18 = {
1146
1147
 
1147
1148
  /** @jsxImportSource vue */
1148
1149
 
1149
- const COMPONENT_NAME$1j = 'vc-button-group';
1150
+ const COMPONENT_NAME$1k = 'vc-button-group';
1150
1151
  const ButtonGroup = /* @__PURE__ */ vue.defineComponent({
1151
- name: COMPONENT_NAME$1j,
1152
- props: props$18,
1152
+ name: COMPONENT_NAME$1k,
1153
+ props: props$19,
1153
1154
  setup(props, {
1154
1155
  slots
1155
1156
  }) {
@@ -1173,7 +1174,7 @@ const ButtonGroup = /* @__PURE__ */ vue.defineComponent({
1173
1174
  const MButton = Button;
1174
1175
  const MButtonGroup = ButtonGroup;
1175
1176
 
1176
- const props$17 = {
1177
+ const props$18 = {
1177
1178
  tag: {
1178
1179
  type: String,
1179
1180
  default: "div"
@@ -1182,10 +1183,10 @@ const props$17 = {
1182
1183
 
1183
1184
  /** @jsxImportSource vue */
1184
1185
 
1185
- const COMPONENT_NAME$1i = 'vc-calendar';
1186
+ const COMPONENT_NAME$1j = 'vc-calendar';
1186
1187
  const Calendar = /* @__PURE__ */ vue.defineComponent({
1187
- name: COMPONENT_NAME$1i,
1188
- props: props$17,
1188
+ name: COMPONENT_NAME$1j,
1189
+ props: props$18,
1189
1190
  setup(props, {
1190
1191
  slots
1191
1192
  }) {
@@ -1199,7 +1200,7 @@ const Calendar = /* @__PURE__ */ vue.defineComponent({
1199
1200
 
1200
1201
  const MCalendar = Calendar;
1201
1202
 
1202
- const props$16 = {
1203
+ const props$17 = {
1203
1204
  border: {
1204
1205
  type: Boolean,
1205
1206
  default: true
@@ -1222,10 +1223,10 @@ const props$16 = {
1222
1223
 
1223
1224
  /** @jsxImportSource vue */
1224
1225
 
1225
- const COMPONENT_NAME$1h = 'vc-card';
1226
+ const COMPONENT_NAME$1i = 'vc-card';
1226
1227
  const Card = /* @__PURE__ */ vue.defineComponent({
1227
- name: COMPONENT_NAME$1h,
1228
- props: props$16,
1228
+ name: COMPONENT_NAME$1i,
1229
+ props: props$17,
1229
1230
  setup(props, {
1230
1231
  slots
1231
1232
  }) {
@@ -1251,7 +1252,7 @@ const Card = /* @__PURE__ */ vue.defineComponent({
1251
1252
 
1252
1253
  const MCard = Card;
1253
1254
 
1254
- const props$15 = {
1255
+ const props$16 = {
1255
1256
  tag: {
1256
1257
  type: String,
1257
1258
  default: "div"
@@ -1260,10 +1261,10 @@ const props$15 = {
1260
1261
 
1261
1262
  /** @jsxImportSource vue */
1262
1263
 
1263
- const COMPONENT_NAME$1g = 'vc-carousel';
1264
+ const COMPONENT_NAME$1h = 'vc-carousel';
1264
1265
  const Carousel = /* @__PURE__ */ vue.defineComponent({
1265
- name: COMPONENT_NAME$1g,
1266
- props: props$15,
1266
+ name: COMPONENT_NAME$1h,
1267
+ props: props$16,
1267
1268
  setup(props, {
1268
1269
  slots
1269
1270
  }) {
@@ -1277,7 +1278,7 @@ const Carousel = /* @__PURE__ */ vue.defineComponent({
1277
1278
 
1278
1279
  const MCarousel = Carousel;
1279
1280
 
1280
- const props$14 = {
1281
+ const props$15 = {
1281
1282
  tag: {
1282
1283
  type: String,
1283
1284
  default: "div"
@@ -1286,10 +1287,10 @@ const props$14 = {
1286
1287
 
1287
1288
  /** @jsxImportSource vue */
1288
1289
 
1289
- const COMPONENT_NAME$1f = 'vc-cascader';
1290
+ const COMPONENT_NAME$1g = 'vc-cascader';
1290
1291
  const Cascader = /* @__PURE__ */ vue.defineComponent({
1291
- name: COMPONENT_NAME$1f,
1292
- props: props$14,
1292
+ name: COMPONENT_NAME$1g,
1293
+ props: props$15,
1293
1294
  setup(props, {
1294
1295
  slots
1295
1296
  }) {
@@ -1303,25 +1304,167 @@ const Cascader = /* @__PURE__ */ vue.defineComponent({
1303
1304
 
1304
1305
  const MCascader = Cascader;
1305
1306
 
1306
- const props$13 = {
1307
- tag: {
1308
- type: String,
1309
- default: "div"
1310
- }
1307
+ const EVENTS = [
1308
+ "legendselectchanged",
1309
+ "legendselected",
1310
+ "legendunselected",
1311
+ "legendunscroll",
1312
+ "datazoom",
1313
+ "datarangeselected",
1314
+ "timelinechanged",
1315
+ "timelineplaychanged",
1316
+ "restore",
1317
+ "dataviewchanged",
1318
+ "magictypechanged",
1319
+ "geoselectchanged",
1320
+ "geoselected",
1321
+ "geounselected",
1322
+ "pieselectchanged",
1323
+ "pieselected",
1324
+ "pieunselected",
1325
+ "mapselectchanged",
1326
+ "mapselected",
1327
+ "mapunselected",
1328
+ "axisareaselected",
1329
+ "focusnodeadjacency",
1330
+ "unfocusnodeadjacency",
1331
+ "brush",
1332
+ "brushselected",
1333
+ "rendered",
1334
+ "finished",
1335
+ "click",
1336
+ "dblclick",
1337
+ "mouseover",
1338
+ "mouseout",
1339
+ "mousemove",
1340
+ "mousedown",
1341
+ "mouseup",
1342
+ "globalout",
1343
+ "contextmenu"
1344
+ ];
1345
+
1346
+ const props$14 = {
1347
+ options: Object,
1348
+ pluginOptions: Object,
1349
+ theme: [String, Object],
1350
+ group: String,
1351
+ autoResize: Boolean,
1352
+ watchShallow: Boolean,
1353
+ manualUpdate: Boolean
1311
1354
  };
1312
1355
 
1313
1356
  /** @jsxImportSource vue */
1314
1357
 
1315
- const COMPONENT_NAME$1e = 'vc-chart';
1358
+ const COMPONENT_NAME$1f = 'vc-chart';
1316
1359
  const Chart = /* @__PURE__ */ vue.defineComponent({
1317
- name: COMPONENT_NAME$1e,
1318
- props: props$13,
1360
+ name: COMPONENT_NAME$1f,
1361
+ props: props$14,
1362
+ emits: [...EVENTS, 'ready'],
1319
1363
  setup(props, {
1364
+ emit,
1320
1365
  slots
1321
1366
  }) {
1367
+ const instance = vue.getCurrentInstance();
1368
+ const chart = vue.shallowRef(null);
1369
+ const echartsInstance = vue.shallowRef(null);
1370
+ const manualOptions = vue.shallowRef(null);
1371
+ let resizeHandler;
1372
+ let lastArea = 0;
1373
+ const getArea = () => {
1374
+ const el = instance.vnode.el;
1375
+ return el.offsetWidth * el.offsetHeight;
1376
+ };
1377
+ const mergeOptions = (options, notMerge, lazyUpdate) => {
1378
+ if (props.manualUpdate) {
1379
+ manualOptions.value = options;
1380
+ }
1381
+ if (!chart.value) return;
1382
+ chart.value.setOption(options, notMerge, lazyUpdate);
1383
+ };
1384
+ const init = () => {
1385
+ if (chart.value || !echartsInstance.value) {
1386
+ return;
1387
+ }
1388
+ chart.value = echartsInstance.value.init(instance.vnode.el, props.theme, props.pluginOptions);
1389
+ if (props.group) {
1390
+ chart.value.group = props.group;
1391
+ }
1392
+ chart.value.setOption(manualOptions.value || props.options || {}, true);
1393
+
1394
+ // expose ECharts events as custom events
1395
+ EVENTS.forEach(event => {
1396
+ chart.value.on(event, params => {
1397
+ emit(event, params);
1398
+ });
1399
+ });
1400
+ if (props.autoResize) {
1401
+ lastArea = getArea();
1402
+ resizeHandler && helperResize.Resize.off(instance.vnode.el, resizeHandler);
1403
+ resizeHandler = lodashEs.debounce(() => {
1404
+ if (lastArea === 0) {
1405
+ // emulate initial render for initially hidden charts
1406
+ mergeOptions({}, true);
1407
+ chart.value.resize();
1408
+ mergeOptions(props.options || manualOptions.value || {}, true);
1409
+ } else {
1410
+ chart.value.resize();
1411
+ }
1412
+ lastArea = getArea();
1413
+ }, 100, {
1414
+ leading: true
1415
+ });
1416
+ helperResize.Resize.on(instance.vnode.el, resizeHandler);
1417
+ }
1418
+ };
1419
+ const destroy = () => {
1420
+ if (!chart.value) return;
1421
+ if (props.autoResize) {
1422
+ resizeHandler && helperResize.Resize.off(instance.vnode.el, resizeHandler);
1423
+ resizeHandler = null;
1424
+ }
1425
+ chart.value.dispose();
1426
+ chart.value = null;
1427
+ };
1428
+ const refresh = () => {
1429
+ if (!chart.value) return;
1430
+ destroy();
1431
+ init();
1432
+ };
1433
+ vue.watch(() => props.group, v => {
1434
+ chart.value && (chart.value.group = v);
1435
+ });
1436
+ if (!props.manualUpdate) {
1437
+ vue.watch(() => props.options, (val, oldVal) => {
1438
+ if (!chart.value && val) {
1439
+ init();
1440
+ } else {
1441
+ chart.value.setOption(val, val !== oldVal);
1442
+ }
1443
+ }, {
1444
+ deep: !props.watchShallow
1445
+ });
1446
+ }
1447
+ const watched = ['theme', 'pluginOptions', 'autoResize', 'manualUpdate', 'watchShallow'];
1448
+ watched.forEach(prop => vue.watch(() => props[prop], refresh, {
1449
+ deep: true
1450
+ }));
1451
+ vue.onMounted(async () => {
1452
+ const echarts = window.echarts || (await import('echarts'));
1453
+ // 兼容webpack 3.0/4.0 写法
1454
+ echartsInstance.value = echarts.default ? echarts.default : echarts;
1455
+ props.options && init();
1456
+ emit('ready', {
1457
+ instance: chart.value,
1458
+ dependencies: {
1459
+ echarts: echartsInstance.value
1460
+ }
1461
+ });
1462
+ });
1463
+ vue.onUnmounted(destroy);
1322
1464
  return () => {
1323
1465
  return vue.createVNode("div", {
1324
- "class": "vc-chart"
1466
+ "class": "vc-chart",
1467
+ "style": "width: 100%; height: 100%"
1325
1468
  }, [slots?.default?.()]);
1326
1469
  };
1327
1470
  }
@@ -1329,7 +1472,7 @@ const Chart = /* @__PURE__ */ vue.defineComponent({
1329
1472
 
1330
1473
  const MChart = Chart;
1331
1474
 
1332
- const props$12 = {
1475
+ const props$13 = {
1333
1476
  tag: {
1334
1477
  type: String,
1335
1478
  default: "div"
@@ -1338,10 +1481,10 @@ const props$12 = {
1338
1481
 
1339
1482
  /** @jsxImportSource vue */
1340
1483
 
1341
- const COMPONENT_NAME$1d = 'vc-checkbox';
1484
+ const COMPONENT_NAME$1e = 'vc-checkbox';
1342
1485
  const Checkbox = /* @__PURE__ */ vue.defineComponent({
1343
- name: COMPONENT_NAME$1d,
1344
- props: props$12,
1486
+ name: COMPONENT_NAME$1e,
1487
+ props: props$13,
1345
1488
  setup(props, {
1346
1489
  slots
1347
1490
  }) {
@@ -1355,7 +1498,7 @@ const Checkbox = /* @__PURE__ */ vue.defineComponent({
1355
1498
 
1356
1499
  const MCheckbox = Checkbox;
1357
1500
 
1358
- const props$11 = {
1501
+ const props$12 = {
1359
1502
  tag: {
1360
1503
  type: String,
1361
1504
  default: "div"
@@ -1364,10 +1507,10 @@ const props$11 = {
1364
1507
 
1365
1508
  /** @jsxImportSource vue */
1366
1509
 
1367
- const COMPONENT_NAME$1c = 'vc-clipboard';
1510
+ const COMPONENT_NAME$1d = 'vc-clipboard';
1368
1511
  const Clipboard = /* @__PURE__ */ vue.defineComponent({
1369
- name: COMPONENT_NAME$1c,
1370
- props: props$11,
1512
+ name: COMPONENT_NAME$1d,
1513
+ props: props$12,
1371
1514
  setup(props, {
1372
1515
  slots
1373
1516
  }) {
@@ -1381,7 +1524,7 @@ const Clipboard = /* @__PURE__ */ vue.defineComponent({
1381
1524
 
1382
1525
  const MClipboard = Clipboard;
1383
1526
 
1384
- const props$10 = {
1527
+ const props$11 = {
1385
1528
  tag: {
1386
1529
  type: String,
1387
1530
  default: "div"
@@ -1390,10 +1533,10 @@ const props$10 = {
1390
1533
 
1391
1534
  /** @jsxImportSource vue */
1392
1535
 
1393
- const COMPONENT_NAME$1b = 'vc-collapse';
1536
+ const COMPONENT_NAME$1c = 'vc-collapse';
1394
1537
  const Collapse = /* @__PURE__ */ vue.defineComponent({
1395
- name: COMPONENT_NAME$1b,
1396
- props: props$10,
1538
+ name: COMPONENT_NAME$1c,
1539
+ props: props$11,
1397
1540
  setup(props, {
1398
1541
  slots
1399
1542
  }) {
@@ -1407,7 +1550,7 @@ const Collapse = /* @__PURE__ */ vue.defineComponent({
1407
1550
 
1408
1551
  const MCollapse = Collapse;
1409
1552
 
1410
- const props$$ = {
1553
+ const props$10 = {
1411
1554
  tag: {
1412
1555
  type: String,
1413
1556
  default: "div"
@@ -1416,10 +1559,10 @@ const props$$ = {
1416
1559
 
1417
1560
  /** @jsxImportSource vue */
1418
1561
 
1419
- const COMPONENT_NAME$1a = 'vc-color-picker';
1562
+ const COMPONENT_NAME$1b = 'vc-color-picker';
1420
1563
  const ColorPicker = /* @__PURE__ */ vue.defineComponent({
1421
- name: COMPONENT_NAME$1a,
1422
- props: props$$,
1564
+ name: COMPONENT_NAME$1b,
1565
+ props: props$10,
1423
1566
  setup(props, {
1424
1567
  slots
1425
1568
  }) {
@@ -1433,7 +1576,7 @@ const ColorPicker = /* @__PURE__ */ vue.defineComponent({
1433
1576
 
1434
1577
  const MColorPicker = ColorPicker;
1435
1578
 
1436
- const props$_ = {
1579
+ const props$$ = {
1437
1580
  tag: {
1438
1581
  type: String,
1439
1582
  default: "div"
@@ -1442,10 +1585,10 @@ const props$_ = {
1442
1585
 
1443
1586
  /** @jsxImportSource vue */
1444
1587
 
1445
- const COMPONENT_NAME$19 = 'vc-countdown';
1588
+ const COMPONENT_NAME$1a = 'vc-countdown';
1446
1589
  const Countdown = /* @__PURE__ */ vue.defineComponent({
1447
- name: COMPONENT_NAME$19,
1448
- props: props$_,
1590
+ name: COMPONENT_NAME$1a,
1591
+ props: props$$,
1449
1592
  setup(props, {
1450
1593
  slots
1451
1594
  }) {
@@ -1459,17 +1602,17 @@ const Countdown = /* @__PURE__ */ vue.defineComponent({
1459
1602
 
1460
1603
  const MCountdown = Countdown;
1461
1604
 
1462
- const props$Z = {
1605
+ const props$_ = {
1463
1606
  render: {
1464
1607
  type: Function,
1465
1608
  default: () => null
1466
1609
  }
1467
1610
  };
1468
1611
 
1469
- const COMPONENT_NAME$18 = "vc-customer";
1612
+ const COMPONENT_NAME$19 = "vc-customer";
1470
1613
  const Customer = vue.defineComponent({
1471
- name: COMPONENT_NAME$18,
1472
- props: props$Z,
1614
+ name: COMPONENT_NAME$19,
1615
+ props: props$_,
1473
1616
  setup(props, context) {
1474
1617
  return () => vue.h(() => {
1475
1618
  return props.render(context.attrs, context);
@@ -1479,7 +1622,7 @@ const Customer = vue.defineComponent({
1479
1622
 
1480
1623
  const MCustomer = Customer;
1481
1624
 
1482
- const props$Y = {
1625
+ const props$Z = {
1483
1626
  tag: {
1484
1627
  type: String,
1485
1628
  default: "div"
@@ -1488,10 +1631,10 @@ const props$Y = {
1488
1631
 
1489
1632
  /** @jsxImportSource vue */
1490
1633
 
1491
- const COMPONENT_NAME$17 = 'vc-date-picker';
1634
+ const COMPONENT_NAME$18 = 'vc-date-picker';
1492
1635
  const DatePicker = /* @__PURE__ */ vue.defineComponent({
1493
- name: COMPONENT_NAME$17,
1494
- props: props$Y,
1636
+ name: COMPONENT_NAME$18,
1637
+ props: props$Z,
1495
1638
  setup(props, {
1496
1639
  slots
1497
1640
  }) {
@@ -1505,7 +1648,7 @@ const DatePicker = /* @__PURE__ */ vue.defineComponent({
1505
1648
 
1506
1649
  const MDatePicker = DatePicker;
1507
1650
 
1508
- const props$X = {
1651
+ const props$Y = {
1509
1652
  tag: {
1510
1653
  type: String,
1511
1654
  default: "div"
@@ -1514,10 +1657,10 @@ const props$X = {
1514
1657
 
1515
1658
  /** @jsxImportSource vue */
1516
1659
 
1517
- const COMPONENT_NAME$16 = 'vc-divider';
1660
+ const COMPONENT_NAME$17 = 'vc-divider';
1518
1661
  const Divider = /* @__PURE__ */ vue.defineComponent({
1519
- name: COMPONENT_NAME$16,
1520
- props: props$X,
1662
+ name: COMPONENT_NAME$17,
1663
+ props: props$Y,
1521
1664
  setup(props, {
1522
1665
  slots
1523
1666
  }) {
@@ -1531,7 +1674,7 @@ const Divider = /* @__PURE__ */ vue.defineComponent({
1531
1674
 
1532
1675
  const MDivider = Divider;
1533
1676
 
1534
- const props$W = {
1677
+ const props$X = {
1535
1678
  tag: {
1536
1679
  type: String,
1537
1680
  default: "div"
@@ -1540,10 +1683,10 @@ const props$W = {
1540
1683
 
1541
1684
  /** @jsxImportSource vue */
1542
1685
 
1543
- const COMPONENT_NAME$15 = 'vc-drawer';
1686
+ const COMPONENT_NAME$16 = 'vc-drawer';
1544
1687
  const Drawer = /* @__PURE__ */ vue.defineComponent({
1545
- name: COMPONENT_NAME$15,
1546
- props: props$W,
1688
+ name: COMPONENT_NAME$16,
1689
+ props: props$X,
1547
1690
  setup(props, {
1548
1691
  slots
1549
1692
  }) {
@@ -1557,7 +1700,7 @@ const Drawer = /* @__PURE__ */ vue.defineComponent({
1557
1700
 
1558
1701
  const MDrawer = Drawer;
1559
1702
 
1560
- const props$V = {
1703
+ const props$W = {
1561
1704
  tag: {
1562
1705
  type: String,
1563
1706
  default: "div"
@@ -1566,10 +1709,10 @@ const props$V = {
1566
1709
 
1567
1710
  /** @jsxImportSource vue */
1568
1711
 
1569
- const COMPONENT_NAME$14 = 'vc-dropdown';
1712
+ const COMPONENT_NAME$15 = 'vc-dropdown';
1570
1713
  const Dropdown = /* @__PURE__ */ vue.defineComponent({
1571
- name: COMPONENT_NAME$14,
1572
- props: props$V,
1714
+ name: COMPONENT_NAME$15,
1715
+ props: props$W,
1573
1716
  setup(props, {
1574
1717
  slots
1575
1718
  }) {
@@ -1583,7 +1726,7 @@ const Dropdown = /* @__PURE__ */ vue.defineComponent({
1583
1726
 
1584
1727
  const MDropdown = Dropdown;
1585
1728
 
1586
- const props$U = {
1729
+ const props$V = {
1587
1730
  tag: {
1588
1731
  type: String,
1589
1732
  default: "div"
@@ -1592,10 +1735,10 @@ const props$U = {
1592
1735
 
1593
1736
  /** @jsxImportSource vue */
1594
1737
 
1595
- const COMPONENT_NAME$13 = 'vc-editor';
1738
+ const COMPONENT_NAME$14 = 'vc-editor';
1596
1739
  const Editor = /* @__PURE__ */ vue.defineComponent({
1597
- name: COMPONENT_NAME$13,
1598
- props: props$U,
1740
+ name: COMPONENT_NAME$14,
1741
+ props: props$V,
1599
1742
  setup(props, {
1600
1743
  slots
1601
1744
  }) {
@@ -1609,7 +1752,7 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
1609
1752
 
1610
1753
  const MEditor = Editor;
1611
1754
 
1612
- const props$T = {
1755
+ const props$U = {
1613
1756
  tag: {
1614
1757
  type: String,
1615
1758
  default: "div"
@@ -1618,10 +1761,10 @@ const props$T = {
1618
1761
 
1619
1762
  /** @jsxImportSource vue */
1620
1763
 
1621
- const COMPONENT_NAME$12 = 'vc-expand';
1764
+ const COMPONENT_NAME$13 = 'vc-expand';
1622
1765
  const Expand = /* @__PURE__ */ vue.defineComponent({
1623
- name: COMPONENT_NAME$12,
1624
- props: props$T,
1766
+ name: COMPONENT_NAME$13,
1767
+ props: props$U,
1625
1768
  setup(props, {
1626
1769
  slots
1627
1770
  }) {
@@ -1635,7 +1778,7 @@ const Expand = /* @__PURE__ */ vue.defineComponent({
1635
1778
 
1636
1779
  const MExpand = Expand;
1637
1780
 
1638
- const props$S = {
1781
+ const props$T = {
1639
1782
  tag: {
1640
1783
  type: String,
1641
1784
  default: "form"
@@ -1762,10 +1905,10 @@ const useForm = (expose, options = {}) => {
1762
1905
  });
1763
1906
  };
1764
1907
 
1765
- const COMPONENT_NAME$11 = "vc-form";
1908
+ const COMPONENT_NAME$12 = "vc-form";
1766
1909
  const Form = vue.defineComponent({
1767
- name: COMPONENT_NAME$11,
1768
- props: props$S,
1910
+ name: COMPONENT_NAME$12,
1911
+ props: props$T,
1769
1912
  setup(props, { slots, expose }) {
1770
1913
  useForm(expose);
1771
1914
  return () => {
@@ -1781,7 +1924,7 @@ const Form = vue.defineComponent({
1781
1924
  }
1782
1925
  });
1783
1926
 
1784
- const props$R = {
1927
+ const props$S = {
1785
1928
  label: {
1786
1929
  type: String,
1787
1930
  default: ""
@@ -2079,10 +2222,10 @@ const useFormItem = (expose) => {
2079
2222
 
2080
2223
  /** @jsxImportSource vue */
2081
2224
 
2082
- const COMPONENT_NAME$10 = 'vc-form-item';
2225
+ const COMPONENT_NAME$11 = 'vc-form-item';
2083
2226
  const FormItem = /* @__PURE__ */ vue.defineComponent({
2084
- name: COMPONENT_NAME$10,
2085
- props: props$R,
2227
+ name: COMPONENT_NAME$11,
2228
+ props: props$S,
2086
2229
  setup(props, {
2087
2230
  slots,
2088
2231
  expose
@@ -2134,8 +2277,8 @@ const FormItem = /* @__PURE__ */ vue.defineComponent({
2134
2277
  }
2135
2278
  });
2136
2279
 
2137
- const props$Q = {
2138
- ...props$S,
2280
+ const props$R = {
2281
+ ...props$T,
2139
2282
  showToast: {
2140
2283
  type: Boolean,
2141
2284
  default: false
@@ -2146,7 +2289,7 @@ const props$Q = {
2146
2289
  }
2147
2290
  };
2148
2291
 
2149
- const props$P = {
2292
+ const props$Q = {
2150
2293
  content: [String, Function],
2151
2294
  maskClosable: {
2152
2295
  type: Boolean,
@@ -2174,11 +2317,11 @@ const MTransitionZoom = TransitionZoom;
2174
2317
 
2175
2318
  /** @jsxImportSource vue */
2176
2319
 
2177
- const COMPONENT_NAME$$ = 'vcm-toast';
2320
+ const COMPONENT_NAME$10 = 'vcm-toast';
2178
2321
  const MToastView = /* @__PURE__ */ vue.defineComponent({
2179
- name: COMPONENT_NAME$$,
2322
+ name: COMPONENT_NAME$10,
2180
2323
  emits: ['close', 'portal-fulfilled'],
2181
- props: props$P,
2324
+ props: props$Q,
2182
2325
  setup(props, {
2183
2326
  emit,
2184
2327
  expose
@@ -2293,7 +2436,7 @@ class PortalLeaf {
2293
2436
  }
2294
2437
  }
2295
2438
 
2296
- const COMPONENT_NAME$_ = "vc-portal";
2439
+ const COMPONENT_NAME$$ = "vc-portal";
2297
2440
  class Portal {
2298
2441
  /**
2299
2442
  * 清理Portals类型组件
@@ -2345,7 +2488,7 @@ class Portal {
2345
2488
  this.wrapper = wrapper;
2346
2489
  this.globalOptions = {
2347
2490
  ...options,
2348
- name: options?.name || wrapper.name || Utils__namespace.getUid(COMPONENT_NAME$_)
2491
+ name: options?.name || wrapper.name || Utils__namespace.getUid(COMPONENT_NAME$$)
2349
2492
  };
2350
2493
  }
2351
2494
  popup(propsData, options) {
@@ -2444,7 +2587,7 @@ class Portal {
2444
2587
  ...rest
2445
2588
  } = options;
2446
2589
  let useAllNodes = fragment;
2447
- const name = multiple ? `${name$}__${Utils__namespace.getUid(COMPONENT_NAME$_)}` : name$;
2590
+ const name = multiple ? `${name$}__${Utils__namespace.getUid(COMPONENT_NAME$$)}` : name$;
2448
2591
  const container = document.createElement(tag);
2449
2592
  const root = typeof el === "object" ? el : document.querySelector(el || "body");
2450
2593
  !alive && Portal.leafs.get(name)?.destroy();
@@ -2478,7 +2621,7 @@ class Portal {
2478
2621
  } else {
2479
2622
  const wrapper = this.wrapper;
2480
2623
  const app = vue.createApp({
2481
- name: COMPONENT_NAME$_,
2624
+ name: COMPONENT_NAME$$,
2482
2625
  parent,
2483
2626
  setup() {
2484
2627
  if (alive) {
@@ -2583,21 +2726,21 @@ class Portal {
2583
2726
  }
2584
2727
  }
2585
2728
 
2586
- const props$O = {
2729
+ const props$P = {
2587
2730
  tag: {
2588
2731
  type: String,
2589
2732
  default: "div"
2590
2733
  }
2591
2734
  };
2592
2735
 
2593
- const COMPONENT_NAME$Z = 'vc-portal-view';
2736
+ const COMPONENT_NAME$_ = 'vc-portal-view';
2594
2737
 
2595
2738
  /**
2596
2739
  * 写法不同,但与vue@2.x 保持一致
2597
2740
  */
2598
2741
  const PortalView = /* @__PURE__ */ vue.defineComponent({
2599
- name: COMPONENT_NAME$Z,
2600
- props: props$O,
2742
+ name: COMPONENT_NAME$_,
2743
+ props: props$P,
2601
2744
  setup(props, {
2602
2745
  slots
2603
2746
  }) {
@@ -2649,10 +2792,10 @@ const MToast$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2649
2792
  warning: warning$3
2650
2793
  }, Symbol.toStringTag, { value: 'Module' }));
2651
2794
 
2652
- const COMPONENT_NAME$Y = "vcm-form";
2795
+ const COMPONENT_NAME$Z = "vcm-form";
2653
2796
  const MForm = vue.defineComponent({
2654
- name: COMPONENT_NAME$Y,
2655
- props: props$Q,
2797
+ name: COMPONENT_NAME$Z,
2798
+ props: props$R,
2656
2799
  setup(props, { slots, expose }) {
2657
2800
  useForm(expose, {
2658
2801
  throwToast(message) {
@@ -2672,8 +2815,8 @@ const MForm = vue.defineComponent({
2672
2815
  }
2673
2816
  });
2674
2817
 
2675
- const props$N = {
2676
- ...props$R,
2818
+ const props$O = {
2819
+ ...props$S,
2677
2820
  indent: {
2678
2821
  type: Number,
2679
2822
  default: 12
@@ -2682,10 +2825,10 @@ const props$N = {
2682
2825
 
2683
2826
  /** @jsxImportSource vue */
2684
2827
 
2685
- const COMPONENT_NAME$X = 'vcm-form-item';
2828
+ const COMPONENT_NAME$Y = 'vcm-form-item';
2686
2829
  const MFormItem = /* @__PURE__ */ vue.defineComponent({
2687
- name: COMPONENT_NAME$X,
2688
- props: props$N,
2830
+ name: COMPONENT_NAME$Y,
2831
+ props: props$O,
2689
2832
  setup(props, {
2690
2833
  slots,
2691
2834
  expose
@@ -2738,9 +2881,9 @@ const MFormItem = /* @__PURE__ */ vue.defineComponent({
2738
2881
  }
2739
2882
  });
2740
2883
 
2741
- const COMPONENT_NAME$W = "vc-fragment";
2884
+ const COMPONENT_NAME$X = "vc-fragment";
2742
2885
  const Fragment = vue.defineComponent({
2743
- name: COMPONENT_NAME$W,
2886
+ name: COMPONENT_NAME$X,
2744
2887
  setup(_, { slots }) {
2745
2888
  return () => vue.h(vue.Fragment, slots.default?.());
2746
2889
  }
@@ -2748,7 +2891,7 @@ const Fragment = vue.defineComponent({
2748
2891
 
2749
2892
  const MFragment = Fragment;
2750
2893
 
2751
- const props$M = {
2894
+ const props$N = {
2752
2895
  tag: {
2753
2896
  type: String,
2754
2897
  default: "div"
@@ -2757,10 +2900,10 @@ const props$M = {
2757
2900
 
2758
2901
  /** @jsxImportSource vue */
2759
2902
 
2760
- const COMPONENT_NAME$V = 'vc-html-to-image';
2903
+ const COMPONENT_NAME$W = 'vc-html-to-image';
2761
2904
  const HTMLToImage = /* @__PURE__ */ vue.defineComponent({
2762
- name: COMPONENT_NAME$V,
2763
- props: props$M,
2905
+ name: COMPONENT_NAME$W,
2906
+ props: props$N,
2764
2907
  setup(props, {
2765
2908
  slots
2766
2909
  }) {
@@ -2776,33 +2919,275 @@ const MHTMLToImage = HTMLToImage;
2776
2919
 
2777
2920
  const MIcon = Icon;
2778
2921
 
2779
- const props$L = {
2780
- tag: {
2781
- type: String,
2782
- default: "div"
2783
- }
2922
+ const props$M = {
2923
+ src: String,
2924
+ fit: String,
2925
+ lazy: Boolean,
2926
+ wrapper: [Object, String]
2784
2927
  };
2785
2928
 
2786
- /** @jsxImportSource vue */
2787
-
2788
- const COMPONENT_NAME$U = 'vc-image';
2789
- const Image = /* @__PURE__ */ vue.defineComponent({
2790
- name: COMPONENT_NAME$U,
2791
- props: props$L,
2929
+ class IMGStore {
2930
+ map;
2931
+ constructor() {
2932
+ this.map = helperCache.Storage.get("@wya/vc-img:", { session: true }) || {};
2933
+ }
2934
+ add(src, opts = {}) {
2935
+ const { originW, originH } = opts;
2936
+ if (this.map[src] && originW && originH) return;
2937
+ this.map[src] = {
2938
+ originW,
2939
+ originH
2940
+ };
2941
+ helperCache.Storage.set("@wya/vc-img:", this.map, { session: true });
2942
+ }
2943
+ getSize(src, opts = {}) {
2944
+ const { clientW, clientH, style, wrapperW } = opts;
2945
+ if (!this.map[src]) return {};
2946
+ const { originW, originH } = this.map[src];
2947
+ if (style.width && clientW > 1) {
2948
+ return {
2949
+ w: clientW,
2950
+ h: clientW / originW * originH
2951
+ };
2952
+ } else if (style.height && clientH > 1) {
2953
+ return {
2954
+ w: clientH / originH * originW,
2955
+ h: clientH
2956
+ };
2957
+ } else if (wrapperW && !style.height && !style.width) {
2958
+ if (originW <= wrapperW) {
2959
+ return {
2960
+ w: originW,
2961
+ h: originH
2962
+ };
2963
+ } else {
2964
+ return {
2965
+ w: wrapperW / originW * originW,
2966
+ h: wrapperW / originW * originH
2967
+ };
2968
+ }
2969
+ } else {
2970
+ return {
2971
+ w: originW,
2972
+ h: originH
2973
+ };
2974
+ }
2975
+ }
2976
+ }
2977
+ const IMGStore$1 = new IMGStore();
2978
+
2979
+ /** @jsxImportSource vue */
2980
+
2981
+ const COMPONENT_NAME$V = 'vc-image';
2982
+ let isSupportObjectFit = false;
2983
+ window.addEventListener('DOMContentLoaded', () => {
2984
+ isSupportObjectFit = !vcShared.IS_SERVER && document.documentElement.style.objectFit !== undefined;
2985
+ });
2986
+ const ObjectFit = {
2987
+ NONE: 'none',
2988
+ CONTAIN: 'contain',
2989
+ COVER: 'cover',
2990
+ FILL: 'fill',
2991
+ SCALE_DOWN: 'scale-down'
2992
+ };
2993
+ const Image = /* @__PURE__ */ vue.defineComponent({
2994
+ name: COMPONENT_NAME$V,
2995
+ inheritAttrs: false,
2996
+ props: props$M,
2792
2997
  setup(props, {
2793
- slots
2998
+ slots,
2999
+ emit
2794
3000
  }) {
3001
+ const instance = vue.getCurrentInstance();
3002
+ const its = vcHooks.useAttrs({
3003
+ merge: false,
3004
+ exclude: ['onLoad', 'onError']
3005
+ });
3006
+ const isLoading = vue.ref(true);
3007
+ const isError = vue.ref(false);
3008
+ const isActive = vue.ref(!props.lazy);
3009
+ const isAuto = vue.ref(false);
3010
+ const originW = vue.ref(0);
3011
+ const originH = vue.ref(0);
3012
+ const pStyle = vue.ref({});
3013
+ const scroller = vue.ref(null);
3014
+ const setScroller = () => {
3015
+ const {
3016
+ wrapper
3017
+ } = props;
3018
+ if (typeof wrapper === 'object') {
3019
+ scroller.value = wrapper;
3020
+ } else if (typeof wrapper === 'string') {
3021
+ scroller.value = document.querySelector(wrapper);
3022
+ } else {
3023
+ scroller.value = $__namespace.getScroller(instance.vnode.el);
3024
+ }
3025
+ };
3026
+ const initPlaceholder = () => {
3027
+ isAuto.value = instance.vnode.el.clientHeight === 1 || instance.vnode.el.clientWidth === 1;
3028
+
3029
+ // el上是否有width和height
3030
+ const {
3031
+ width,
3032
+ height
3033
+ } = instance.vnode.el.style;
3034
+ if (width && height) return;
3035
+ const {
3036
+ w,
3037
+ h
3038
+ } = IMGStore$1.getSize(props.src, {
3039
+ clientW: instance.vnode.el.clientWidth,
3040
+ clientH: instance.vnode.el.clientHeight,
3041
+ style: {
3042
+ width,
3043
+ height
3044
+ },
3045
+ wrapperW: scroller.value && scroller.value.clientWidth,
3046
+ // TODO
3047
+ wrapperH: scroller.value && scroller.value.clientHeight
3048
+ });
3049
+ if (w && h) {
3050
+ pStyle.value = {
3051
+ width: `${w}px`,
3052
+ height: `${h}px`
3053
+ };
3054
+ }
3055
+ };
3056
+ let handleLazyLoad;
3057
+ const removeLazyLoadListener = () => {
3058
+ if (!scroller.value || !handleLazyLoad) return;
3059
+ scroller.value.removeEventListener('scroll', handleLazyLoad);
3060
+ scroller.value = null;
3061
+ handleLazyLoad = null;
3062
+ };
3063
+ const addLazyLoadListener = () => {
3064
+ if (scroller.value) {
3065
+ handleLazyLoad = lodashEs.throttle(() => {
3066
+ if ($__namespace.contains(scroller.value, instance.vnode.el)) {
3067
+ isActive.value = true;
3068
+ removeLazyLoadListener();
3069
+ }
3070
+ }, 200);
3071
+ scroller.value.addEventListener('scroll', handleLazyLoad);
3072
+ handleLazyLoad();
3073
+ }
3074
+ };
3075
+ const handleLoad = (e, img) => {
3076
+ originW.value = img.naturalWidth || img.width;
3077
+ originH.value = img.naturalHeight || img.height;
3078
+ isLoading.value = false;
3079
+ emit('load', e, img, instance);
3080
+ IMGStore$1.add(props.src, {
3081
+ originW: originW.value,
3082
+ originH: originH.value
3083
+ });
3084
+ };
3085
+ const handleError = (e, img) => {
3086
+ isLoading.value = false;
3087
+ isError.value = true;
3088
+ emit('error', e, img, instance);
3089
+ };
3090
+ const loadImage = () => {
3091
+ if (!props.src) return;
3092
+ // reset status
3093
+ isLoading.value = true;
3094
+ isError.value = false;
3095
+ const img = new window.Image();
3096
+ img.onload = e => handleLoad(e, img);
3097
+ img.onerror = e => handleError(e, img);
3098
+
3099
+ // bind html attrs
3100
+ Object.keys(its.value.attrs || {}).forEach(key => img.setAttribute(key, its.value.attrs[key]));
3101
+ img.src = props.src;
3102
+ };
3103
+ const hackFit = fit => {
3104
+ const {
3105
+ clientWidth: elW,
3106
+ clientHeight: elH
3107
+ } = instance.vnode.el;
3108
+ if (!originW.value || !originH.value || !elW || !elH) return {};
3109
+ const vertical = originW.value / originH.value < 1;
3110
+ if (fit === ObjectFit.SCALE_DOWN) {
3111
+ const isSmaller = originW.value < elW && originH.value < elH;
3112
+ fit = isSmaller ? ObjectFit.NONE : ObjectFit.CONTAIN;
3113
+ }
3114
+ switch (fit) {
3115
+ case ObjectFit.NONE:
3116
+ return {
3117
+ width: 'auto',
3118
+ height: 'auto'
3119
+ };
3120
+ case ObjectFit.CONTAIN:
3121
+ return vertical ? {
3122
+ width: 'auto'
3123
+ } : {
3124
+ height: 'auto'
3125
+ };
3126
+ case ObjectFit.COVER:
3127
+ return vertical ? {
3128
+ height: 'auto'
3129
+ } : {
3130
+ width: 'auto'
3131
+ };
3132
+ default:
3133
+ return {};
3134
+ }
3135
+ };
3136
+ const style = vue.computed(() => {
3137
+ if (!props.fit) return;
3138
+ return isSupportObjectFit ? {
3139
+ 'object-fit': props.fit
3140
+ } : hackFit(props.fit);
3141
+ });
3142
+ const alignCenter = vue.computed(() => {
3143
+ return !isSupportObjectFit && props.fit !== ObjectFit.FILL;
3144
+ });
3145
+ vue.watch(() => props.src, v => {
3146
+ if (!v && !isLoading.value) {
3147
+ isLoading.value = true;
3148
+ }
3149
+ isActive.value && loadImage();
3150
+ });
3151
+ vue.watch(() => isActive.value, v => {
3152
+ v && loadImage();
3153
+ });
3154
+ vue.onMounted(() => {
3155
+ setScroller();
3156
+ initPlaceholder();
3157
+ props.lazy ? addLazyLoadListener() : loadImage();
3158
+ });
3159
+ vue.onBeforeUnmount(() => {
3160
+ props.lazy && removeLazyLoadListener();
3161
+ });
2795
3162
  return () => {
2796
3163
  return vue.createVNode("div", {
2797
- "class": "vc-image"
2798
- }, [slots?.default?.()]);
3164
+ "style": its.value.style,
3165
+ "class": [its.value.class, 'vc-image']
3166
+ }, [isLoading.value && (slots.placeholder ? slots.placeholder() : vue.createVNode("div", {
3167
+ "class": [{
3168
+ 'is-auto': isAuto.value
3169
+ }, 'vc-image__placeholder'],
3170
+ "style": pStyle.value
3171
+ }, null)), !isLoading.value && isError.value && (slots.error ? slots.error() : vue.createVNode("div", {
3172
+ "class": "vc-image__error"
3173
+ }, [vue.createTextVNode(" \u52A0\u8F7D\u5931\u8D25")])), !isLoading.value && !isError.value && vue.createVNode("img", vue.mergeProps({
3174
+ "src": props.src,
3175
+ "style": style.value,
3176
+ "class": [{
3177
+ 'is-center': alignCenter
3178
+ }, 'vc-image__inner']
3179
+ }, {
3180
+ // 包含所有on*都会被绑定, 且listeners中覆盖将由listener内触发(inheritAttrs: false)
3181
+ ...its.value.attrs,
3182
+ ...its.value.listeners
3183
+ }), null)]);
2799
3184
  };
2800
3185
  }
2801
3186
  });
2802
3187
 
2803
3188
  const MImage = Image;
2804
3189
 
2805
- const props$K = {
3190
+ const props$L = {
2806
3191
  tag: {
2807
3192
  type: String,
2808
3193
  default: "div"
@@ -2811,10 +3196,10 @@ const props$K = {
2811
3196
 
2812
3197
  /** @jsxImportSource vue */
2813
3198
 
2814
- const COMPONENT_NAME$T = 'vc-image-crop';
3199
+ const COMPONENT_NAME$U = 'vc-image-crop';
2815
3200
  const ImageCrop = /* @__PURE__ */ vue.defineComponent({
2816
- name: COMPONENT_NAME$T,
2817
- props: props$K,
3201
+ name: COMPONENT_NAME$U,
3202
+ props: props$L,
2818
3203
  setup(props, {
2819
3204
  slots
2820
3205
  }) {
@@ -2828,7 +3213,7 @@ const ImageCrop = /* @__PURE__ */ vue.defineComponent({
2828
3213
 
2829
3214
  const MImageCrop = ImageCrop;
2830
3215
 
2831
- const props$J = {
3216
+ const props$K = {
2832
3217
  tag: {
2833
3218
  type: String,
2834
3219
  default: "div"
@@ -2837,10 +3222,10 @@ const props$J = {
2837
3222
 
2838
3223
  /** @jsxImportSource vue */
2839
3224
 
2840
- const COMPONENT_NAME$S = 'vc-image-preview';
3225
+ const COMPONENT_NAME$T = 'vc-image-preview';
2841
3226
  const ImagePreview = /* @__PURE__ */ vue.defineComponent({
2842
- name: COMPONENT_NAME$S,
2843
- props: props$J,
3227
+ name: COMPONENT_NAME$T,
3228
+ props: props$K,
2844
3229
  setup(props, {
2845
3230
  slots
2846
3231
  }) {
@@ -2854,7 +3239,7 @@ const ImagePreview = /* @__PURE__ */ vue.defineComponent({
2854
3239
 
2855
3240
  const MImagePreview = ImagePreview;
2856
3241
 
2857
- const props$I = {
3242
+ const props$J = {
2858
3243
  tag: {
2859
3244
  type: String,
2860
3245
  default: "div"
@@ -2863,10 +3248,10 @@ const props$I = {
2863
3248
 
2864
3249
  /** @jsxImportSource vue */
2865
3250
 
2866
- const COMPONENT_NAME$R = 'vc-image-processing';
3251
+ const COMPONENT_NAME$S = 'vc-image-processing';
2867
3252
  const ImageProcessing = /* @__PURE__ */ vue.defineComponent({
2868
- name: COMPONENT_NAME$R,
2869
- props: props$I,
3253
+ name: COMPONENT_NAME$S,
3254
+ props: props$J,
2870
3255
  setup(props, {
2871
3256
  slots
2872
3257
  }) {
@@ -2880,7 +3265,7 @@ const ImageProcessing = /* @__PURE__ */ vue.defineComponent({
2880
3265
 
2881
3266
  const MImageProcessing = ImageProcessing;
2882
3267
 
2883
- const props$H = {
3268
+ const props$I = {
2884
3269
  // Array, 作为select等数组存放临时值
2885
3270
  modelValue: {
2886
3271
  type: [String, Number, Array],
@@ -3134,12 +3519,12 @@ const useNativeEmitter = (input, expose) => {
3134
3519
 
3135
3520
  /** @jsxImportSource vue */
3136
3521
 
3137
- const COMPONENT_NAME$Q = 'vc-input';
3522
+ const COMPONENT_NAME$R = 'vc-input';
3138
3523
  const Input = /* @__PURE__ */ vue.defineComponent({
3139
- name: COMPONENT_NAME$Q,
3524
+ name: COMPONENT_NAME$R,
3140
3525
  inheritAttrs: false,
3141
3526
  props: {
3142
- ...props$H,
3527
+ ...props$I,
3143
3528
  indicator: {
3144
3529
  type: [Boolean, Object],
3145
3530
  default: false
@@ -3240,8 +3625,8 @@ const Input = /* @__PURE__ */ vue.defineComponent({
3240
3625
  }
3241
3626
  });
3242
3627
 
3243
- const props$G = {
3244
- ...props$H,
3628
+ const props$H = {
3629
+ ...props$I,
3245
3630
  min: {
3246
3631
  type: Number,
3247
3632
  default: 0
@@ -3456,10 +3841,10 @@ const useInputNumber = () => {
3456
3841
 
3457
3842
  /** @jsxImportSource vue */
3458
3843
 
3459
- const COMPONENT_NAME$P = 'vc-input-number';
3844
+ const COMPONENT_NAME$Q = 'vc-input-number';
3460
3845
  const InputNumber = /* @__PURE__ */ vue.defineComponent({
3461
- name: COMPONENT_NAME$P,
3462
- props: props$G,
3846
+ name: COMPONENT_NAME$Q,
3847
+ props: props$H,
3463
3848
  inheritAttrs: false,
3464
3849
  setup(props, {
3465
3850
  slots,
@@ -3510,8 +3895,8 @@ const InputNumber = /* @__PURE__ */ vue.defineComponent({
3510
3895
  }
3511
3896
  });
3512
3897
 
3513
- const props$F = {
3514
- ...props$H,
3898
+ const props$G = {
3899
+ ...props$I,
3515
3900
  enterText: {
3516
3901
  type: [Boolean, String],
3517
3902
  default: true
@@ -3520,10 +3905,10 @@ const props$F = {
3520
3905
 
3521
3906
  /** @jsxImportSource vue */
3522
3907
 
3523
- const COMPONENT_NAME$O = 'vc-input-search';
3908
+ const COMPONENT_NAME$P = 'vc-input-search';
3524
3909
  const InputSearch = /* @__PURE__ */ vue.defineComponent({
3525
- name: COMPONENT_NAME$O,
3526
- props: props$F,
3910
+ name: COMPONENT_NAME$P,
3911
+ props: props$G,
3527
3912
  inheritAttrs: false,
3528
3913
  setup(props, {
3529
3914
  emit,
@@ -3557,12 +3942,12 @@ const InputSearch = /* @__PURE__ */ vue.defineComponent({
3557
3942
 
3558
3943
  /** @jsxImportSource vue */
3559
3944
 
3560
- const COMPONENT_NAME$N = 'vcm-input';
3945
+ const COMPONENT_NAME$O = 'vcm-input';
3561
3946
  const MInput = /* @__PURE__ */ vue.defineComponent({
3562
- name: COMPONENT_NAME$N,
3947
+ name: COMPONENT_NAME$O,
3563
3948
  inheritAttrs: false,
3564
3949
  props: {
3565
- ...props$H,
3950
+ ...props$I,
3566
3951
  right: {
3567
3952
  type: Boolean,
3568
3953
  default: false
@@ -3648,10 +4033,10 @@ const MInput = /* @__PURE__ */ vue.defineComponent({
3648
4033
 
3649
4034
  /** @jsxImportSource vue */
3650
4035
 
3651
- const COMPONENT_NAME$M = 'vcm-input-number';
4036
+ const COMPONENT_NAME$N = 'vcm-input-number';
3652
4037
  const MInputNumber = /* @__PURE__ */ vue.defineComponent({
3653
- name: COMPONENT_NAME$M,
3654
- props: props$G,
4038
+ name: COMPONENT_NAME$N,
4039
+ props: props$H,
3655
4040
  inheritAttrs: false,
3656
4041
  setup(props, {
3657
4042
  slots,
@@ -3699,11 +4084,11 @@ const MInputNumber = /* @__PURE__ */ vue.defineComponent({
3699
4084
 
3700
4085
  /** @jsxImportSource vue */
3701
4086
 
3702
- const COMPONENT_NAME$L = 'vcm-input-search';
4087
+ const COMPONENT_NAME$M = 'vcm-input-search';
3703
4088
  const MInputSearch = /* @__PURE__ */ vue.defineComponent({
3704
- name: COMPONENT_NAME$L,
4089
+ name: COMPONENT_NAME$M,
3705
4090
  props: {
3706
- ...props$F,
4091
+ ...props$G,
3707
4092
  cancelText: {
3708
4093
  type: String,
3709
4094
  default: '取消'
@@ -3763,7 +4148,7 @@ const MInputSearch = /* @__PURE__ */ vue.defineComponent({
3763
4148
  }
3764
4149
  });
3765
4150
 
3766
- const props$E = {
4151
+ const props$F = {
3767
4152
  tag: {
3768
4153
  type: String,
3769
4154
  default: "div"
@@ -3778,10 +4163,10 @@ const props$E = {
3778
4163
  }
3779
4164
  };
3780
4165
 
3781
- const COMPONENT_NAME$K = "vcm-list";
4166
+ const COMPONENT_NAME$L = "vcm-list";
3782
4167
  const MList = vue.defineComponent({
3783
- name: COMPONENT_NAME$K,
3784
- props: props$E,
4168
+ name: COMPONENT_NAME$L,
4169
+ props: props$F,
3785
4170
  setup(props, { slots }) {
3786
4171
  vue.provide("list", { props });
3787
4172
  return () => {
@@ -3801,7 +4186,7 @@ const MList = vue.defineComponent({
3801
4186
  }
3802
4187
  });
3803
4188
 
3804
- const props$D = {
4189
+ const props$E = {
3805
4190
  tag: {
3806
4191
  type: String,
3807
4192
  default: "div"
@@ -3835,11 +4220,11 @@ const props$D = {
3835
4220
 
3836
4221
  /** @jsxImportSource vue */
3837
4222
 
3838
- const COMPONENT_NAME$J = 'vcm-list-item';
4223
+ const COMPONENT_NAME$K = 'vcm-list-item';
3839
4224
  const HTTP_REGEX = /[a-zA-z]+:\/\/[^\s]*/;
3840
4225
  const MListItem = /* @__PURE__ */ vue.defineComponent({
3841
- name: COMPONENT_NAME$J,
3842
- props: props$D,
4226
+ name: COMPONENT_NAME$K,
4227
+ props: props$E,
3843
4228
  emits: ['click'],
3844
4229
  setup(props, {
3845
4230
  slots,
@@ -3913,7 +4298,7 @@ const MListItem = /* @__PURE__ */ vue.defineComponent({
3913
4298
  }
3914
4299
  });
3915
4300
 
3916
- const props$C = {
4301
+ const props$D = {
3917
4302
  tag: {
3918
4303
  type: String,
3919
4304
  default: "div"
@@ -3922,10 +4307,10 @@ const props$C = {
3922
4307
 
3923
4308
  /** @jsxImportSource vue */
3924
4309
 
3925
- const COMPONENT_NAME$I = 'vc-marquee';
4310
+ const COMPONENT_NAME$J = 'vc-marquee';
3926
4311
  const Marquee = /* @__PURE__ */ vue.defineComponent({
3927
- name: COMPONENT_NAME$I,
3928
- props: props$C,
4312
+ name: COMPONENT_NAME$J,
4313
+ props: props$D,
3929
4314
  setup(props, {
3930
4315
  slots
3931
4316
  }) {
@@ -3939,7 +4324,7 @@ const Marquee = /* @__PURE__ */ vue.defineComponent({
3939
4324
 
3940
4325
  const MMarquee = Marquee;
3941
4326
 
3942
- const props$B = {
4327
+ const props$C = {
3943
4328
  content: [String, Function],
3944
4329
  mask: {
3945
4330
  type: Boolean,
@@ -3976,11 +4361,11 @@ const props$B = {
3976
4361
 
3977
4362
  /** @jsxImportSource vue */
3978
4363
 
3979
- const COMPONENT_NAME$H = 'vc-message';
4364
+ const COMPONENT_NAME$I = 'vc-message';
3980
4365
  const MessageView = /* @__PURE__ */ vue.defineComponent({
3981
- name: COMPONENT_NAME$H,
4366
+ name: COMPONENT_NAME$I,
3982
4367
  emits: ['before-close', 'close', 'portal-fulfilled'],
3983
- props: props$B,
4368
+ props: props$C,
3984
4369
  setup(props, {
3985
4370
  emit,
3986
4371
  expose
@@ -4111,7 +4496,7 @@ const Message$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty(
4111
4496
 
4112
4497
  const MMessage = Message$1;
4113
4498
 
4114
- const props$A = {
4499
+ const props$B = {
4115
4500
  modelValue: {
4116
4501
  type: Boolean,
4117
4502
  default: false
@@ -4191,12 +4576,12 @@ const props$A = {
4191
4576
 
4192
4577
  /** @jsxImportSource vue */
4193
4578
 
4194
- const COMPONENT_NAME$G = 'vc-modal';
4579
+ const COMPONENT_NAME$H = 'vc-modal';
4195
4580
  let zIndexNumber = 1002;
4196
4581
  const ModalView = /* @__PURE__ */ vue.defineComponent({
4197
- name: COMPONENT_NAME$G,
4582
+ name: COMPONENT_NAME$H,
4198
4583
  emits: ['update:modelValue', 'close', 'portal-fulfilled', 'visible-change', 'ok', 'cancel'],
4199
- props: props$A,
4584
+ props: props$B,
4200
4585
  setup(props, {
4201
4586
  slots,
4202
4587
  emit,
@@ -4531,7 +4916,7 @@ const modal$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
4531
4916
  warning: warning$1
4532
4917
  }, Symbol.toStringTag, { value: 'Module' }));
4533
4918
 
4534
- const props$z = {
4919
+ const props$A = {
4535
4920
  mode: {
4536
4921
  type: String,
4537
4922
  validator: (v) => /(alert|operation)/.test(v),
@@ -4593,11 +4978,11 @@ const props$z = {
4593
4978
 
4594
4979
  /** @jsxImportSource vue */
4595
4980
 
4596
- const COMPONENT_NAME$F = 'vc-modal';
4981
+ const COMPONENT_NAME$G = 'vc-modal';
4597
4982
  const MModalView = /* @__PURE__ */ vue.defineComponent({
4598
- name: COMPONENT_NAME$F,
4983
+ name: COMPONENT_NAME$G,
4599
4984
  emits: ['update:modelValue', 'portal-fulfilled', 'close', 'ok', 'cancel'],
4600
- props: props$z,
4985
+ props: props$A,
4601
4986
  setup(props, {
4602
4987
  slots,
4603
4988
  emit,
@@ -4770,7 +5155,7 @@ const modal = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
4770
5155
  operation
4771
5156
  }, Symbol.toStringTag, { value: 'Module' }));
4772
5157
 
4773
- const props$y = {
5158
+ const props$z = {
4774
5159
  title: [String, Function],
4775
5160
  content: [String, Function],
4776
5161
  duration: {
@@ -4799,10 +5184,10 @@ const props$y = {
4799
5184
 
4800
5185
  /** @jsxImportSource vue */
4801
5186
 
4802
- const COMPONENT_NAME$E = 'vc-notice';
5187
+ const COMPONENT_NAME$F = 'vc-notice';
4803
5188
  const NoticeView = /* @__PURE__ */ vue.defineComponent({
4804
- name: COMPONENT_NAME$E,
4805
- props: props$y,
5189
+ name: COMPONENT_NAME$F,
5190
+ props: props$z,
4806
5191
  emits: ['portal-fulfilled', 'close', 'before-close'],
4807
5192
  setup(props, {
4808
5193
  emit
@@ -4951,7 +5336,7 @@ const Notice$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
4951
5336
 
4952
5337
  const MNotice = Notice$1;
4953
5338
 
4954
- const props$x = {
5339
+ const props$y = {
4955
5340
  tag: {
4956
5341
  type: String,
4957
5342
  default: "div"
@@ -4960,10 +5345,10 @@ const props$x = {
4960
5345
 
4961
5346
  /** @jsxImportSource vue */
4962
5347
 
4963
- const COMPONENT_NAME$D = 'vc-option';
5348
+ const COMPONENT_NAME$E = 'vc-option';
4964
5349
  const Option = /* @__PURE__ */ vue.defineComponent({
4965
- name: COMPONENT_NAME$D,
4966
- props: props$x,
5350
+ name: COMPONENT_NAME$E,
5351
+ props: props$y,
4967
5352
  setup(props, {
4968
5353
  slots
4969
5354
  }) {
@@ -4977,7 +5362,7 @@ const Option = /* @__PURE__ */ vue.defineComponent({
4977
5362
 
4978
5363
  const MOption = Option;
4979
5364
 
4980
- const props$w = {
5365
+ const props$x = {
4981
5366
  tag: {
4982
5367
  type: String,
4983
5368
  default: "div"
@@ -4986,10 +5371,10 @@ const props$w = {
4986
5371
 
4987
5372
  /** @jsxImportSource vue */
4988
5373
 
4989
- const COMPONENT_NAME$C = 'vc-page';
5374
+ const COMPONENT_NAME$D = 'vc-page';
4990
5375
  const Page = /* @__PURE__ */ vue.defineComponent({
4991
- name: COMPONENT_NAME$C,
4992
- props: props$w,
5376
+ name: COMPONENT_NAME$D,
5377
+ props: props$x,
4993
5378
  setup(props, {
4994
5379
  slots
4995
5380
  }) {
@@ -5003,7 +5388,7 @@ const Page = /* @__PURE__ */ vue.defineComponent({
5003
5388
 
5004
5389
  const MPage = Page;
5005
5390
 
5006
- const props$v = {
5391
+ const props$w = {
5007
5392
  tag: {
5008
5393
  type: String,
5009
5394
  default: "div"
@@ -5012,10 +5397,10 @@ const props$v = {
5012
5397
 
5013
5398
  /** @jsxImportSource vue */
5014
5399
 
5015
- const COMPONENT_NAME$B = 'vc-picker';
5400
+ const COMPONENT_NAME$C = 'vc-picker';
5016
5401
  const Picker = /* @__PURE__ */ vue.defineComponent({
5017
- name: COMPONENT_NAME$B,
5018
- props: props$v,
5402
+ name: COMPONENT_NAME$C,
5403
+ props: props$w,
5019
5404
  setup(props, {
5020
5405
  slots
5021
5406
  }) {
@@ -5029,7 +5414,7 @@ const Picker = /* @__PURE__ */ vue.defineComponent({
5029
5414
 
5030
5415
  const MPicker = Picker;
5031
5416
 
5032
- const props$u = {
5417
+ const props$v = {
5033
5418
  tag: {
5034
5419
  type: String,
5035
5420
  default: "div"
@@ -5038,10 +5423,10 @@ const props$u = {
5038
5423
 
5039
5424
  /** @jsxImportSource vue */
5040
5425
 
5041
- const COMPONENT_NAME$A = 'vc-popconfirm';
5426
+ const COMPONENT_NAME$B = 'vc-popconfirm';
5042
5427
  const Popconfirm = /* @__PURE__ */ vue.defineComponent({
5043
- name: COMPONENT_NAME$A,
5044
- props: props$u,
5428
+ name: COMPONENT_NAME$B,
5429
+ props: props$v,
5045
5430
  setup(props, {
5046
5431
  slots
5047
5432
  }) {
@@ -5055,7 +5440,7 @@ const Popconfirm = /* @__PURE__ */ vue.defineComponent({
5055
5440
 
5056
5441
  const MPopconfirm = Popconfirm;
5057
5442
 
5058
- const props$t = {
5443
+ const props$u = {
5059
5444
  modelValue: Boolean,
5060
5445
  animation: String,
5061
5446
  placement: {
@@ -5134,7 +5519,7 @@ const wrapperKeys = [
5134
5519
  "autoWidth",
5135
5520
  "always"
5136
5521
  ];
5137
- const props$s = {
5522
+ const props$t = {
5138
5523
  trigger: {
5139
5524
  type: String,
5140
5525
  default: "hover",
@@ -5152,7 +5537,7 @@ const props$s = {
5152
5537
  type: Boolean,
5153
5538
  default: true
5154
5539
  },
5155
- ...lodashEs.pick(props$t, wrapperKeys)
5540
+ ...lodashEs.pick(props$u, wrapperKeys)
5156
5541
  };
5157
5542
 
5158
5543
  const EXTRA_DISTANCE = 4;
@@ -5413,10 +5798,10 @@ const usePos = () => {
5413
5798
  function _isSlot(s) {
5414
5799
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
5415
5800
  }
5416
- const COMPONENT_NAME$z = 'vc-popover-wrapper';
5801
+ const COMPONENT_NAME$A = 'vc-popover-wrapper';
5417
5802
  const PopoverWrapper = /* @__PURE__ */ vue.defineComponent({
5418
- name: COMPONENT_NAME$z,
5419
- props: props$t,
5803
+ name: COMPONENT_NAME$A,
5804
+ props: props$u,
5420
5805
  emits: ['portal-fulfilled', 'close'],
5421
5806
  setup(props, {
5422
5807
  emit,
@@ -5666,10 +6051,10 @@ const PopoverPortal = new Portal(PopoverWrapper);
5666
6051
 
5667
6052
  /** @jsxImportSource vue */
5668
6053
 
5669
- const COMPONENT_NAME$y = 'vc-popover';
6054
+ const COMPONENT_NAME$z = 'vc-popover';
5670
6055
  const Popover = /* @__PURE__ */ vue.defineComponent({
5671
- name: COMPONENT_NAME$y,
5672
- props: props$s,
6056
+ name: COMPONENT_NAME$z,
6057
+ props: props$t,
5673
6058
  emits: ['update:modelValue', 'visible-change', 'ready', 'close'],
5674
6059
  open: PopoverPortal.popup.bind(PopoverPortal),
5675
6060
  setup(props, {
@@ -5806,7 +6191,7 @@ const Popover = /* @__PURE__ */ vue.defineComponent({
5806
6191
 
5807
6192
  const MPopover = Popover;
5808
6193
 
5809
- const props$r = {
6194
+ const props$s = {
5810
6195
  tag: {
5811
6196
  type: String,
5812
6197
  default: "div"
@@ -5815,10 +6200,10 @@ const props$r = {
5815
6200
 
5816
6201
  /** @jsxImportSource vue */
5817
6202
 
5818
- const COMPONENT_NAME$x = 'vc-popup';
6203
+ const COMPONENT_NAME$y = 'vc-popup';
5819
6204
  const Popup = /* @__PURE__ */ vue.defineComponent({
5820
- name: COMPONENT_NAME$x,
5821
- props: props$r,
6205
+ name: COMPONENT_NAME$y,
6206
+ props: props$s,
5822
6207
  setup(props, {
5823
6208
  slots
5824
6209
  }) {
@@ -5834,7 +6219,7 @@ const MPopup = Popup;
5834
6219
 
5835
6220
  const MPortal = Portal;
5836
6221
 
5837
- const props$q = {
6222
+ const props$r = {
5838
6223
  tag: {
5839
6224
  type: String,
5840
6225
  default: "div"
@@ -5843,10 +6228,10 @@ const props$q = {
5843
6228
 
5844
6229
  /** @jsxImportSource vue */
5845
6230
 
5846
- const COMPONENT_NAME$w = 'vc-print';
6231
+ const COMPONENT_NAME$x = 'vc-print';
5847
6232
  const Print = /* @__PURE__ */ vue.defineComponent({
5848
- name: COMPONENT_NAME$w,
5849
- props: props$q,
6233
+ name: COMPONENT_NAME$x,
6234
+ props: props$r,
5850
6235
  setup(props, {
5851
6236
  slots
5852
6237
  }) {
@@ -5860,7 +6245,7 @@ const Print = /* @__PURE__ */ vue.defineComponent({
5860
6245
 
5861
6246
  const MPrint = Print;
5862
6247
 
5863
- const props$p = {
6248
+ const props$q = {
5864
6249
  tag: {
5865
6250
  type: String,
5866
6251
  default: "div"
@@ -5869,10 +6254,10 @@ const props$p = {
5869
6254
 
5870
6255
  /** @jsxImportSource vue */
5871
6256
 
5872
- const COMPONENT_NAME$v = 'vc-progress';
6257
+ const COMPONENT_NAME$w = 'vc-progress';
5873
6258
  const Progress = /* @__PURE__ */ vue.defineComponent({
5874
- name: COMPONENT_NAME$v,
5875
- props: props$p,
6259
+ name: COMPONENT_NAME$w,
6260
+ props: props$q,
5876
6261
  setup(props, {
5877
6262
  slots
5878
6263
  }) {
@@ -5886,7 +6271,7 @@ const Progress = /* @__PURE__ */ vue.defineComponent({
5886
6271
 
5887
6272
  const MProgress = Progress;
5888
6273
 
5889
- const props$o = {
6274
+ const props$p = {
5890
6275
  tag: {
5891
6276
  type: String,
5892
6277
  default: "div"
@@ -5895,10 +6280,10 @@ const props$o = {
5895
6280
 
5896
6281
  /** @jsxImportSource vue */
5897
6282
 
5898
- const COMPONENT_NAME$u = 'vc-radio';
6283
+ const COMPONENT_NAME$v = 'vc-radio';
5899
6284
  const Radio = /* @__PURE__ */ vue.defineComponent({
5900
- name: COMPONENT_NAME$u,
5901
- props: props$o,
6285
+ name: COMPONENT_NAME$v,
6286
+ props: props$p,
5902
6287
  setup(props, {
5903
6288
  slots
5904
6289
  }) {
@@ -5912,7 +6297,7 @@ const Radio = /* @__PURE__ */ vue.defineComponent({
5912
6297
 
5913
6298
  const MRadio = Radio;
5914
6299
 
5915
- const props$n = {
6300
+ const props$o = {
5916
6301
  tag: {
5917
6302
  type: String,
5918
6303
  default: "div"
@@ -5921,10 +6306,10 @@ const props$n = {
5921
6306
 
5922
6307
  /** @jsxImportSource vue */
5923
6308
 
5924
- const COMPONENT_NAME$t = 'vc-rate';
6309
+ const COMPONENT_NAME$u = 'vc-rate';
5925
6310
  const Rate = /* @__PURE__ */ vue.defineComponent({
5926
- name: COMPONENT_NAME$t,
5927
- props: props$n,
6311
+ name: COMPONENT_NAME$u,
6312
+ props: props$o,
5928
6313
  setup(props, {
5929
6314
  slots
5930
6315
  }) {
@@ -5938,7 +6323,7 @@ const Rate = /* @__PURE__ */ vue.defineComponent({
5938
6323
 
5939
6324
  const MRate = Rate;
5940
6325
 
5941
- const props$m = {
6326
+ const props$n = {
5942
6327
  data: {
5943
6328
  type: Array,
5944
6329
  default: () => []
@@ -5989,7 +6374,7 @@ const props$m = {
5989
6374
  renderRefresh: Function
5990
6375
  };
5991
6376
 
5992
- const props$l = {
6377
+ const props$m = {
5993
6378
  vertical: Boolean,
5994
6379
  wrapperSize: {
5995
6380
  type: Number,
@@ -6044,7 +6429,7 @@ const barKeys$1 = [
6044
6429
  "thumbStyle",
6045
6430
  "thumbClass"
6046
6431
  ];
6047
- const props$k = {
6432
+ const props$l = {
6048
6433
  // 如果存在滚动条宽度为false, 不存在则为true
6049
6434
  // 为false的情况下才能使用track-offset
6050
6435
  native: {
@@ -6075,7 +6460,7 @@ const props$k = {
6075
6460
  scrollX: Number,
6076
6461
  scrollY: Number,
6077
6462
  fit: Boolean,
6078
- ...lodashEs.pick(props$l, barKeys$1)
6463
+ ...lodashEs.pick(props$m, barKeys$1)
6079
6464
  };
6080
6465
 
6081
6466
  const barKeys = [
@@ -6090,7 +6475,7 @@ const barKeys = [
6090
6475
  "autoResize",
6091
6476
  "native"
6092
6477
  ];
6093
- const props$j = {
6478
+ const props$k = {
6094
6479
  tag: {
6095
6480
  type: String,
6096
6481
  default: "div"
@@ -6123,13 +6508,13 @@ const props$j = {
6123
6508
  type: Boolean,
6124
6509
  default: true
6125
6510
  },
6126
- barTo: props$k.to,
6127
- ...lodashEs.pick(props$k, barKeys)
6511
+ barTo: props$l.to,
6512
+ ...lodashEs.pick(props$l, barKeys)
6128
6513
  };
6129
6514
 
6130
6515
  /** @jsxImportSource vue */
6131
6516
 
6132
- const COMPONENT_NAME$s = 'vc-scroller-track';
6517
+ const COMPONENT_NAME$t = 'vc-scroller-track';
6133
6518
  const BAR_MAP = {
6134
6519
  vertical: {
6135
6520
  scroll: 'scrollTop',
@@ -6149,8 +6534,8 @@ const BAR_MAP = {
6149
6534
  }
6150
6535
  };
6151
6536
  const Track = /* @__PURE__ */ vue.defineComponent({
6152
- name: COMPONENT_NAME$s,
6153
- props: props$l,
6537
+ name: COMPONENT_NAME$t,
6538
+ props: props$m,
6154
6539
  emits: ['change'],
6155
6540
  setup(props, {
6156
6541
  emit,
@@ -6335,10 +6720,10 @@ const Track = /* @__PURE__ */ vue.defineComponent({
6335
6720
 
6336
6721
  /** @jsxImportSource vue */
6337
6722
 
6338
- const COMPONENT_NAME$r = 'vc-scroller-bar';
6723
+ const COMPONENT_NAME$s = 'vc-scroller-bar';
6339
6724
  const Bar = /* @__PURE__ */ vue.defineComponent({
6340
- name: COMPONENT_NAME$r,
6341
- props: props$k,
6725
+ name: COMPONENT_NAME$s,
6726
+ props: props$l,
6342
6727
  emits: ['change'],
6343
6728
  setup(props, {
6344
6729
  emit,
@@ -6551,7 +6936,7 @@ const useScroller = (expose) => {
6551
6936
 
6552
6937
  /** @jsxImportSource vue */
6553
6938
 
6554
- const COMPONENT_NAME$q = 'vc-scroller';
6939
+ const COMPONENT_NAME$r = 'vc-scroller';
6555
6940
 
6556
6941
  /**
6557
6942
  * 作为备选方案,目前推荐使用ScrollerWheel
@@ -6562,8 +6947,8 @@ const COMPONENT_NAME$q = 'vc-scroller';
6562
6947
  * 2. 增加了一层嵌套
6563
6948
  */
6564
6949
  const Scroller = /* @__PURE__ */ vue.defineComponent({
6565
- name: COMPONENT_NAME$q,
6566
- props: props$j,
6950
+ name: COMPONENT_NAME$r,
6951
+ props: props$k,
6567
6952
  emits: ['scroll'],
6568
6953
  setup(props, {
6569
6954
  slots,
@@ -6623,7 +7008,7 @@ const Scroller = /* @__PURE__ */ vue.defineComponent({
6623
7008
 
6624
7009
  /** @jsxImportSource vue */
6625
7010
 
6626
- const COMPONENT_NAME$p = 'vc-scroller-wheel';
7011
+ const COMPONENT_NAME$q = 'vc-scroller-wheel';
6627
7012
 
6628
7013
  /**
6629
7014
  * 为减少一层嵌套,为去除滚动bar的抖动,使用wheel模拟
@@ -6645,8 +7030,8 @@ const COMPONENT_NAME$p = 'vc-scroller-wheel';
6645
7030
  * 设置scrollTop不会reflow和repaint,不需要考虑transfrom来改变content(transform也只在draw完成)
6646
7031
  */
6647
7032
  const ScrollerWheel = /* @__PURE__ */ vue.defineComponent({
6648
- name: COMPONENT_NAME$p,
6649
- props: props$j,
7033
+ name: COMPONENT_NAME$q,
7034
+ props: props$k,
6650
7035
  emits: ['scroll'],
6651
7036
  setup(props, {
6652
7037
  slots,
@@ -6750,9 +7135,9 @@ const ScrollerWheel = /* @__PURE__ */ vue.defineComponent({
6750
7135
 
6751
7136
  /** @jsxImportSource vue */
6752
7137
 
6753
- const COMPONENT_NAME$o = 'vc-recycle-list-scroll-state';
7138
+ const COMPONENT_NAME$p = 'vc-recycle-list-scroll-state';
6754
7139
  const ScrollState = /* @__PURE__ */ vue.defineComponent({
6755
- name: COMPONENT_NAME$o,
7140
+ name: COMPONENT_NAME$p,
6756
7141
  setup(_, {
6757
7142
  slots
6758
7143
  }) {
@@ -6823,7 +7208,7 @@ const STATUS_MAP = {
6823
7208
  }
6824
7209
  };
6825
7210
 
6826
- const props$i = {
7211
+ const props$j = {
6827
7212
  inverted: {
6828
7213
  type: Boolean,
6829
7214
  default: false
@@ -6882,13 +7267,13 @@ const useDirectionKeys = () => {
6882
7267
 
6883
7268
  /** @jsxImportSource vue */
6884
7269
 
6885
- const COMPONENT_NAME$n = 'vc-recycle-list-container';
7270
+ const COMPONENT_NAME$o = 'vc-recycle-list-container';
6886
7271
 
6887
7272
  // TODO: 抽离
6888
7273
  const transformKey = $__namespace.prefixStyle('transform').camel;
6889
7274
  const Container = /* @__PURE__ */ vue.defineComponent({
6890
- name: COMPONENT_NAME$n,
6891
- props: props$i,
7275
+ name: COMPONENT_NAME$o,
7276
+ props: props$j,
6892
7277
  emits: ['refresh'],
6893
7278
  setup(props, {
6894
7279
  slots
@@ -6985,9 +7370,9 @@ const Container = /* @__PURE__ */ vue.defineComponent({
6985
7370
 
6986
7371
  /** @jsxImportSource vue */
6987
7372
 
6988
- const COMPONENT_NAME$m = 'vc-recycle-list-item';
7373
+ const COMPONENT_NAME$n = 'vc-recycle-list-item';
6989
7374
  const Item = /* @__PURE__ */ vue.defineComponent({
6990
- name: COMPONENT_NAME$m,
7375
+ name: COMPONENT_NAME$n,
6991
7376
  props: {
6992
7377
  vertical: {
6993
7378
  type: Boolean,
@@ -7029,10 +7414,10 @@ const Item = /* @__PURE__ */ vue.defineComponent({
7029
7414
 
7030
7415
  /** @jsxImportSource vue */
7031
7416
 
7032
- const COMPONENT_NAME$l = 'vc-recycle-list';
7417
+ const COMPONENT_NAME$m = 'vc-recycle-list';
7033
7418
  const RecycleList = /* @__PURE__ */ vue.defineComponent({
7034
- name: COMPONENT_NAME$l,
7035
- props: props$m,
7419
+ name: COMPONENT_NAME$m,
7420
+ props: props$n,
7036
7421
  emits: ['scroll'],
7037
7422
  setup(props, {
7038
7423
  slots,
@@ -7576,17 +7961,17 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
7576
7961
 
7577
7962
  const MRecycleList = RecycleList;
7578
7963
 
7579
- const props$h = {
7964
+ const props$i = {
7580
7965
  tag: {
7581
7966
  type: String,
7582
7967
  default: "div"
7583
7968
  }
7584
7969
  };
7585
7970
 
7586
- const COMPONENT_NAME$k = "vc-resizer";
7971
+ const COMPONENT_NAME$l = "vc-resizer";
7587
7972
  const Resizer = vue.defineComponent({
7588
- name: COMPONENT_NAME$k,
7589
- props: props$h,
7973
+ name: COMPONENT_NAME$l,
7974
+ props: props$i,
7590
7975
  emit: ["resize"],
7591
7976
  setup(props, { emit, slots }) {
7592
7977
  const width = vue.ref(0);
@@ -7641,7 +8026,7 @@ const MResizer = Resizer;
7641
8026
 
7642
8027
  const MScroller = Scroller;
7643
8028
 
7644
- const props$g = {
8029
+ const props$h = {
7645
8030
  tag: {
7646
8031
  type: String,
7647
8032
  default: "div"
@@ -7650,10 +8035,10 @@ const props$g = {
7650
8035
 
7651
8036
  /** @jsxImportSource vue */
7652
8037
 
7653
- const COMPONENT_NAME$j = 'vc-select';
8038
+ const COMPONENT_NAME$k = 'vc-select';
7654
8039
  const Select = /* @__PURE__ */ vue.defineComponent({
7655
- name: COMPONENT_NAME$j,
7656
- props: props$g,
8040
+ name: COMPONENT_NAME$k,
8041
+ props: props$h,
7657
8042
  setup(props, {
7658
8043
  slots
7659
8044
  }) {
@@ -7667,7 +8052,7 @@ const Select = /* @__PURE__ */ vue.defineComponent({
7667
8052
 
7668
8053
  const MSelect = Select;
7669
8054
 
7670
- const props$f = {
8055
+ const props$g = {
7671
8056
  tag: {
7672
8057
  type: String,
7673
8058
  default: "div"
@@ -7676,10 +8061,10 @@ const props$f = {
7676
8061
 
7677
8062
  /** @jsxImportSource vue */
7678
8063
 
7679
- const COMPONENT_NAME$i = 'vc-slider';
8064
+ const COMPONENT_NAME$j = 'vc-slider';
7680
8065
  const Slider = /* @__PURE__ */ vue.defineComponent({
7681
- name: COMPONENT_NAME$i,
7682
- props: props$f,
8066
+ name: COMPONENT_NAME$j,
8067
+ props: props$g,
7683
8068
  setup(props, {
7684
8069
  slots
7685
8070
  }) {
@@ -7693,7 +8078,7 @@ const Slider = /* @__PURE__ */ vue.defineComponent({
7693
8078
 
7694
8079
  const MSlider = Slider;
7695
8080
 
7696
- const props$e = {
8081
+ const props$f = {
7697
8082
  tag: {
7698
8083
  type: String,
7699
8084
  default: "div"
@@ -7702,10 +8087,10 @@ const props$e = {
7702
8087
 
7703
8088
  /** @jsxImportSource vue */
7704
8089
 
7705
- const COMPONENT_NAME$h = 'vc-sort-list';
8090
+ const COMPONENT_NAME$i = 'vc-sort-list';
7706
8091
  const SortList = /* @__PURE__ */ vue.defineComponent({
7707
- name: COMPONENT_NAME$h,
7708
- props: props$e,
8092
+ name: COMPONENT_NAME$i,
8093
+ props: props$f,
7709
8094
  setup(props, {
7710
8095
  slots
7711
8096
  }) {
@@ -7719,7 +8104,7 @@ const SortList = /* @__PURE__ */ vue.defineComponent({
7719
8104
 
7720
8105
  const MSortList = SortList;
7721
8106
 
7722
- const props$d = {
8107
+ const props$e = {
7723
8108
  tag: {
7724
8109
  type: String,
7725
8110
  default: "div"
@@ -7728,10 +8113,10 @@ const props$d = {
7728
8113
 
7729
8114
  /** @jsxImportSource vue */
7730
8115
 
7731
- const COMPONENT_NAME$g = 'vc-steps';
8116
+ const COMPONENT_NAME$h = 'vc-steps';
7732
8117
  const Steps = /* @__PURE__ */ vue.defineComponent({
7733
- name: COMPONENT_NAME$g,
7734
- props: props$d,
8118
+ name: COMPONENT_NAME$h,
8119
+ props: props$e,
7735
8120
  setup(props, {
7736
8121
  slots
7737
8122
  }) {
@@ -7745,7 +8130,7 @@ const Steps = /* @__PURE__ */ vue.defineComponent({
7745
8130
 
7746
8131
  const MSteps = Steps;
7747
8132
 
7748
- const props$c = {
8133
+ const props$d = {
7749
8134
  tag: {
7750
8135
  type: String,
7751
8136
  default: "div"
@@ -7754,10 +8139,10 @@ const props$c = {
7754
8139
 
7755
8140
  /** @jsxImportSource vue */
7756
8141
 
7757
- const COMPONENT_NAME$f = 'vc-switch';
8142
+ const COMPONENT_NAME$g = 'vc-switch';
7758
8143
  const Switch = /* @__PURE__ */ vue.defineComponent({
7759
- name: COMPONENT_NAME$f,
7760
- props: props$c,
8144
+ name: COMPONENT_NAME$g,
8145
+ props: props$d,
7761
8146
  setup(props, {
7762
8147
  slots
7763
8148
  }) {
@@ -7771,7 +8156,7 @@ const Switch = /* @__PURE__ */ vue.defineComponent({
7771
8156
 
7772
8157
  const MSwitch = Switch;
7773
8158
 
7774
- const props$b = {
8159
+ const props$c = {
7775
8160
  tag: {
7776
8161
  type: String,
7777
8162
  default: "div"
@@ -7780,10 +8165,10 @@ const props$b = {
7780
8165
 
7781
8166
  /** @jsxImportSource vue */
7782
8167
 
7783
- const COMPONENT_NAME$e = 'vc-table';
8168
+ const COMPONENT_NAME$f = 'vc-table';
7784
8169
  const Table = /* @__PURE__ */ vue.defineComponent({
7785
- name: COMPONENT_NAME$e,
7786
- props: props$b,
8170
+ name: COMPONENT_NAME$f,
8171
+ props: props$c,
7787
8172
  setup(props, {
7788
8173
  slots
7789
8174
  }) {
@@ -7797,31 +8182,430 @@ const Table = /* @__PURE__ */ vue.defineComponent({
7797
8182
 
7798
8183
  const MTable = Table;
7799
8184
 
7800
- const props$a = {
7801
- tag: {
8185
+ const props$b = {
8186
+ type: {
7802
8187
  type: String,
7803
- default: "div"
8188
+ validator: (v) => /^(line|card)$/.test(v),
8189
+ default: "line"
8190
+ },
8191
+ modelValue: {
8192
+ type: [String, Number]
8193
+ },
8194
+ animated: {
8195
+ type: Boolean,
8196
+ default: false
8197
+ },
8198
+ afloat: {
8199
+ type: Boolean,
8200
+ default: true
8201
+ },
8202
+ closable: {
8203
+ type: Boolean,
8204
+ default: false
7804
8205
  }
7805
8206
  };
7806
8207
 
8208
+ const useTabs = (options = {}) => {
8209
+ const instance = vue.getCurrentInstance();
8210
+ const { props, emit } = instance;
8211
+ const tabsId = vue.ref(Utils.getUid("tabs"));
8212
+ const list = vue.ref([]);
8213
+ const afloatWidth = vue.ref(0);
8214
+ const afloatOffset = vue.ref(0);
8215
+ const currentValue = vue.ref(void 0);
8216
+ const scrollOffset = vue.ref(0);
8217
+ const scrollable = vue.ref(false);
8218
+ const timer = vue.ref(null);
8219
+ const getTabIndex = (v) => {
8220
+ return list.value.findIndex((nav, index) => (nav.value || index) === v);
8221
+ };
8222
+ const afloatStyle = vue.computed(() => {
8223
+ const style = {
8224
+ width: `${afloatWidth.value}px`,
8225
+ transform: `translate3d(${afloatOffset.value}px, 0px, 0px)`
8226
+ };
8227
+ return style;
8228
+ });
8229
+ const contentStyle = vue.computed(() => {
8230
+ const index = getTabIndex(currentValue.value);
8231
+ const precent = index === 0 ? "0%" : `-${index}00%`;
8232
+ const style = {
8233
+ transform: ""
8234
+ };
8235
+ if (index > -1) {
8236
+ style.transform = `translate3d(${precent}, 0px, 0px)`;
8237
+ }
8238
+ return style;
8239
+ });
8240
+ const classes = vue.computed(() => {
8241
+ return {
8242
+ "is-animated": props.animated,
8243
+ [`is-${props.type}`]: !!props.type,
8244
+ [`is-${props.theme}`]: !!props.theme
8245
+ };
8246
+ });
8247
+ const refresh = () => {
8248
+ options?.refreshAfloat?.();
8249
+ };
8250
+ const handleChange = (index) => {
8251
+ if (timer.value) return;
8252
+ timer.value = setTimeout(() => timer.value = null, 300);
8253
+ const nav = list.value[index];
8254
+ if (nav.disabled) return;
8255
+ currentValue.value = nav.value || index;
8256
+ emit("update:modelValue", currentValue.value);
8257
+ emit("change", currentValue.value);
8258
+ emit("click", currentValue.value);
8259
+ };
8260
+ const handleResize = () => {
8261
+ if (instance.isUnmounted) return;
8262
+ options?.refreshScroll?.();
8263
+ options?.refreshAfloat?.();
8264
+ };
8265
+ vue.onMounted(() => {
8266
+ helperResize.Resize.on(options.wrapper.value, handleResize);
8267
+ options.scrollToActive && vue.nextTick(options.scrollToActive);
8268
+ });
8269
+ vue.onUnmounted(() => {
8270
+ helperResize.Resize.off(options.wrapper.value, handleResize);
8271
+ timer.value && clearTimeout(timer.value);
8272
+ });
8273
+ const add = (item, setValue) => {
8274
+ if (!item) return;
8275
+ vue.nextTick(() => {
8276
+ typeof currentValue.value === "undefined" && (currentValue.value = item.proxy.currentValue || 0);
8277
+ if (options.content.value) {
8278
+ const index = Array.from(options.content.value.children).filter((i) => /vcm?-tabs-pane/.test(i.className)).indexOf(item.vnode.el);
8279
+ if (index != -1) {
8280
+ list.value.splice(index, 0, item.props);
8281
+ typeof item.props.value === "undefined" && setValue(index);
8282
+ return;
8283
+ }
8284
+ }
8285
+ list.value.push(item.props);
8286
+ typeof item.props.value === "undefined" && setValue(list.value.length - 1);
8287
+ });
8288
+ };
8289
+ const remove = (item) => {
8290
+ if (!item) return;
8291
+ list.value.splice(list.value.indexOf(item.props), 1);
8292
+ };
8293
+ vue.provide("tabs", {
8294
+ props,
8295
+ currentValue,
8296
+ refresh,
8297
+ add,
8298
+ remove
8299
+ });
8300
+ vue.watch(
8301
+ () => props.modelValue,
8302
+ (v) => {
8303
+ currentValue.value = v;
8304
+ },
8305
+ { immediate: true }
8306
+ );
8307
+ vue.watch(
8308
+ () => currentValue.value,
8309
+ () => {
8310
+ options.refreshAfloat?.();
8311
+ options.scrollToActive?.();
8312
+ }
8313
+ );
8314
+ vue.watch(
8315
+ () => list.value.length,
8316
+ () => {
8317
+ options.refreshAfloat?.();
8318
+ options.scrollToActive?.();
8319
+ }
8320
+ );
8321
+ return {
8322
+ tabsId,
8323
+ list,
8324
+ timer,
8325
+ afloatWidth,
8326
+ afloatOffset,
8327
+ currentValue,
8328
+ scrollOffset,
8329
+ scrollable,
8330
+ afloatStyle,
8331
+ contentStyle,
8332
+ classes,
8333
+ getTabIndex,
8334
+ handleChange
8335
+ };
8336
+ };
8337
+
7807
8338
  /** @jsxImportSource vue */
7808
8339
 
7809
- const COMPONENT_NAME$d = 'vc-tabs';
8340
+ const COMPONENT_NAME$e = 'vc-tabs';
7810
8341
  const Tabs = /* @__PURE__ */ vue.defineComponent({
8342
+ name: COMPONENT_NAME$e,
8343
+ props: props$b,
8344
+ emits: ['update:modelValue', 'change', 'click'],
8345
+ setup(props, {
8346
+ slots
8347
+ }) {
8348
+ const instance = vue.getCurrentInstance();
8349
+ const wrapper = vue.ref(null);
8350
+ const content = vue.ref(null);
8351
+ const scroll = vue.ref(null);
8352
+ const nav = vue.ref(null);
8353
+ // eslint-disable-next-line prefer-const
8354
+ let tabs;
8355
+
8356
+ /**
8357
+ * 刷新是否需要滚动条
8358
+ */
8359
+ const refreshScroll = () => {
8360
+ // 容器
8361
+ const boxWidth = scroll.value.offsetWidth;
8362
+ // 总长度
8363
+ const totalWidth = nav.value.offsetWidth;
8364
+ if (boxWidth < totalWidth) {
8365
+ tabs.scrollable.value = true;
8366
+ totalWidth - tabs.scrollOffset.value < boxWidth && (tabs.scrollOffset.value = totalWidth - boxWidth);
8367
+ } else {
8368
+ tabs.scrollable.value = false;
8369
+ tabs.scrollOffset.value > 0 && (tabs.scrollOffset.value = 0);
8370
+ }
8371
+ };
8372
+
8373
+ /**
8374
+ * 刷新当前标签底下的滑块位置
8375
+ */
8376
+ const refreshAfloat = () => {
8377
+ vue.nextTick(() => {
8378
+ const index = tabs.getTabIndex(tabs.currentValue.value);
8379
+ if (instance.isUnmounted) return;
8380
+ const items = nav.value.querySelectorAll(`.vc-tabs__item`);
8381
+ const $ = items[index];
8382
+ tabs.afloatWidth.value = $ ? parseFloat($.offsetWidth) : 0;
8383
+ if (!Array.from(items).length) return;
8384
+ let offset = 0;
8385
+ if (index > 0) {
8386
+ const gutter = 16; // margin-right -> 16px
8387
+ for (let i = 0; i < index; i++) {
8388
+ offset += parseFloat(items[i].offsetWidth) + gutter;
8389
+ }
8390
+ }
8391
+ tabs.afloatOffset.value = offset;
8392
+ refreshScroll();
8393
+ });
8394
+ };
8395
+ const scrollToActive = () => {
8396
+ if (!tabs.scrollable.value) return;
8397
+ // 这里不直接选择is-active,存在延迟
8398
+ const $ = instance.vnode.el.querySelector(`.vc-tabs__item[name="${tabs.currentValue.value}"]`);
8399
+ if (!$) return;
8400
+ const itemBounding = $.getBoundingClientRect();
8401
+ const scrollBounding = scroll.value.getBoundingClientRect();
8402
+ const navBounding = nav.value.getBoundingClientRect();
8403
+ let offset;
8404
+ if (navBounding.right < scrollBounding.right) {
8405
+ offset = nav.value.offsetWidth - scrollBounding.width;
8406
+ }
8407
+ if (itemBounding.left < scrollBounding.left) {
8408
+ offset = tabs.scrollOffset.value - (scrollBounding.left - itemBounding.left);
8409
+ } else if (itemBounding.right > scrollBounding.right) {
8410
+ offset = tabs.scrollOffset.value + itemBounding.right - scrollBounding.right;
8411
+ }
8412
+ if (tabs.scrollOffset.value !== offset) {
8413
+ tabs.scrollOffset.value = offset;
8414
+ }
8415
+ };
8416
+ tabs = useTabs({
8417
+ content,
8418
+ wrapper,
8419
+ refreshAfloat,
8420
+ refreshScroll,
8421
+ scrollToActive
8422
+ });
8423
+ /**
8424
+ * 上一个
8425
+ */
8426
+ const handlePrev = () => {
8427
+ const boxWidth = scroll.value.offsetWidth;
8428
+ if (!tabs.scrollOffset.value) return;
8429
+ tabs.scrollOffset.value = tabs.scrollOffset.value > boxWidth ? tabs.scrollOffset.value - boxWidth : 0;
8430
+ };
8431
+
8432
+ /**
8433
+ * 下一个
8434
+ */
8435
+ const handleNext = () => {
8436
+ const boxWidth = scroll.value.offsetWidth;
8437
+ const totalWidth = nav.value.offsetWidth;
8438
+ if (totalWidth - tabs.scrollOffset.value <= boxWidth) return;
8439
+ tabs.scrollOffset.value = totalWidth - tabs.scrollOffset.value > boxWidth * 2 ? tabs.scrollOffset.value + boxWidth : totalWidth - boxWidth;
8440
+ };
8441
+ const scrollStyle = vue.computed(() => {
8442
+ const style = {
8443
+ transform: `translate3d(${-tabs.scrollOffset.value}px, 0px, 0px)`
8444
+ };
8445
+ return style;
8446
+ });
8447
+ const isCard = vue.computed(() => {
8448
+ return props.type === 'card';
8449
+ });
8450
+ return () => {
8451
+ return vue.createVNode("div", {
8452
+ "class": [tabs.classes.value, 'vc-tabs']
8453
+ }, [vue.createVNode("div", {
8454
+ "class": "vc-tabs__extra"
8455
+ }, [slots.extra?.()]), vue.createVNode("div", {
8456
+ "ref": wrapper,
8457
+ "style": {
8458
+ padding: tabs.scrollable.value && '0 24px'
8459
+ },
8460
+ "class": "vc-tabs__bar"
8461
+ }, [tabs.scrollable.value && vue.createVNode(Icon, {
8462
+ "class": "vc-tabs__icon is-left",
8463
+ "type": "left",
8464
+ "onClick": handlePrev
8465
+ }, null), tabs.scrollable.value && vue.createVNode(Icon, {
8466
+ "class": "vc-tabs__icon is-right",
8467
+ "type": "right",
8468
+ "onClick": handleNext
8469
+ }, null), vue.createVNode("div", {
8470
+ "ref": scroll,
8471
+ "class": "vc-tabs__scroll"
8472
+ }, [vue.createVNode("div", {
8473
+ "ref": nav,
8474
+ "style": scrollStyle.value,
8475
+ "class": "vc-tabs__nav"
8476
+ }, [!isCard.value && vue.createVNode("div", {
8477
+ "style": tabs.afloatStyle.value,
8478
+ "class": "vc-tabs__afloat"
8479
+ }, null), tabs.list.value.map((item, index) => {
8480
+ return vue.createVNode("div", {
8481
+ "key": index,
8482
+ "class": [{
8483
+ 'is-active': (item.value || index) == tabs.currentValue.value
8484
+ }, 'vc-tabs__item'],
8485
+ "onClick": () => tabs.handleChange(index)
8486
+ }, [slots.label ? slots.label({
8487
+ it: item,
8488
+ index
8489
+ }) : typeof item.label === 'string' ? vue.createVNode("span", {
8490
+ "innerHTML": item.label
8491
+ }, null) : typeof item.label === 'function' && vue.createVNode(Customer, {
8492
+ "render": item.label,
8493
+ "it": item,
8494
+ "index": index
8495
+ }, null), props.closable && item.closable && vue.createVNode(Icon, {
8496
+ "type": "close"
8497
+ }, null)]);
8498
+ })])])]), vue.createVNode("div", {
8499
+ "ref": content,
8500
+ "style": tabs.contentStyle.value,
8501
+ "class": "vc-tabs__content"
8502
+ }, [slots.default?.()])]);
8503
+ };
8504
+ }
8505
+ });
8506
+
8507
+ const props$a = {
8508
+ value: {
8509
+ type: [String, Number]
8510
+ },
8511
+ label: {
8512
+ type: [String, Function],
8513
+ default: ""
8514
+ },
8515
+ /**
8516
+ * 服务端渲染时,lazy设置为false,可以把内容渲染出来;
8517
+ * 不能设置为!IS_SERVER, 会影响客服端激活,不一样会存在问题
8518
+ */
8519
+ lazy: {
8520
+ type: Boolean,
8521
+ default: true
8522
+ },
8523
+ closable: {
8524
+ type: Boolean,
8525
+ default: false
8526
+ }
8527
+ };
8528
+
8529
+ const useTabsPane = () => {
8530
+ const instance = vue.getCurrentInstance();
8531
+ const { props } = instance;
8532
+ const currentValue = vue.ref(void 0);
8533
+ const isLoaded = vue.ref(false);
8534
+ const tabs = vue.inject("tabs", {});
8535
+ const isActive = vue.computed(() => {
8536
+ const state = tabs.currentValue.value === (props.value || currentValue.value);
8537
+ if (!isLoaded.value && state) {
8538
+ isLoaded.value = true;
8539
+ }
8540
+ return state;
8541
+ });
8542
+ const isReady = vue.computed(() => {
8543
+ return !props.lazy || isLoaded.value || isActive.value;
8544
+ });
8545
+ const style = vue.computed(() => {
8546
+ return isActive.value ? {} : {
8547
+ opacity: 0,
8548
+ height: 0,
8549
+ // 避免重用高度
8550
+ overflow: "hidden"
8551
+ // 避免内层的高度影响
8552
+ };
8553
+ });
8554
+ const refresh = () => {
8555
+ !instance.isUnmounted && tabs.refresh?.();
8556
+ };
8557
+ vue.watch(
8558
+ () => props.value,
8559
+ (v) => {
8560
+ currentValue.value = v;
8561
+ },
8562
+ {
8563
+ immediate: true
8564
+ }
8565
+ );
8566
+ vue.watch(
8567
+ () => [props.value, props.label],
8568
+ refresh
8569
+ );
8570
+ vue.onMounted(refresh);
8571
+ vue.onUnmounted(refresh);
8572
+ vue.onBeforeMount(() => {
8573
+ tabs.add?.(instance, (v) => currentValue.value = v);
8574
+ });
8575
+ vue.onBeforeUnmount(() => {
8576
+ tabs.remove?.(instance);
8577
+ });
8578
+ return {
8579
+ isLoaded,
8580
+ isActive,
8581
+ isReady,
8582
+ style,
8583
+ currentValue
8584
+ };
8585
+ };
8586
+
8587
+ /** @jsxImportSource vue */
8588
+
8589
+ const COMPONENT_NAME$d = 'vc-tabs-pane';
8590
+ const TabsPane = /* @__PURE__ */ vue.defineComponent({
7811
8591
  name: COMPONENT_NAME$d,
7812
8592
  props: props$a,
7813
- setup(props, {
8593
+ setup(_, {
7814
8594
  slots
7815
8595
  }) {
8596
+ const tabsPane = useTabsPane();
7816
8597
  return () => {
7817
8598
  return vue.createVNode("div", {
7818
- "class": "vc-tabs"
7819
- }, [slots?.default?.()]);
8599
+ "class": "vc-tabs-pane",
8600
+ "style": tabsPane.style.value,
8601
+ "name": tabsPane.currentValue.value
8602
+ }, [tabsPane.isReady && slots.default?.()]);
7820
8603
  };
7821
8604
  }
7822
8605
  });
7823
8606
 
7824
8607
  const MTabs = Tabs;
8608
+ const MTabsPane = TabsPane;
7825
8609
 
7826
8610
  const props$9 = {
7827
8611
  tag: {
@@ -8347,6 +9131,7 @@ exports.MSteps = MSteps;
8347
9131
  exports.MSwitch = MSwitch;
8348
9132
  exports.MTable = MTable;
8349
9133
  exports.MTabs = MTabs;
9134
+ exports.MTabsPane = MTabsPane;
8350
9135
  exports.MTag = MTag;
8351
9136
  exports.MText = MText;
8352
9137
  exports.MTextarea = MTextarea;
@@ -8395,6 +9180,7 @@ exports.Steps = Steps;
8395
9180
  exports.Switch = Switch;
8396
9181
  exports.Table = Table;
8397
9182
  exports.Tabs = Tabs;
9183
+ exports.TabsPane = TabsPane;
8398
9184
  exports.Tag = Tag;
8399
9185
  exports.Text = Text;
8400
9186
  exports.Textarea = Textarea;