@deot/vc-components 1.0.57 → 1.0.58

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.
@@ -7,7 +7,6 @@ var VcComponents = (function (exports, vue) {
7
7
  if (!message || !target) return;
8
8
  message = `[@deot/vc - ${target}]: ${message}`;
9
9
  this.message = message;
10
- /* istanbul ignore next -- @preserve */
11
10
  }
12
11
  }
13
12
 
@@ -607,7 +606,6 @@ var VcComponents = (function (exports, vue) {
607
606
  const key = `${prefix}${url}`;
608
607
  const cache = window.localStorage.getItem(key);
609
608
  let icons = JSON.parse(cache || '""');
610
- /* istanbul ignore next -- @preserve */
611
609
  if (!icons) {
612
610
  const data = await new Promise((resolve$) => {
613
611
  const request = new XMLHttpRequest();
@@ -642,7 +640,6 @@ var VcComponents = (function (exports, vue) {
642
640
  });
643
641
  resolve();
644
642
  } catch (e) {
645
- /* istanbul ignore next -- @preserve */
646
643
  reject(new VcError("icon", e));
647
644
  }
648
645
  })();
@@ -654,7 +651,6 @@ var VcComponents = (function (exports, vue) {
654
651
  const icons = {};
655
652
  setTimeout(() => {
656
653
  try {
657
- /* istanbul ignore next -- @preserve */
658
654
  IS_DEV && console.time(url);
659
655
  svgStr.replace(svgReg, "$1")?.match(symbolReg)?.forEach(
660
656
  (i) => i.replace(basicReg, (_, ...args) => {
@@ -669,23 +665,19 @@ var VcComponents = (function (exports, vue) {
669
665
  return "";
670
666
  })
671
667
  );
672
- /* istanbul ignore next -- @preserve */
673
668
  IS_DEV && console.timeEnd(url);
674
669
  resolve(icons);
675
670
  } catch (e) {
676
- /* istanbul ignore next -- @preserve */
677
671
  reject(new VcError("icon", e));
678
672
  }
679
673
  }, 0);
680
674
  });
681
675
  }
682
676
  on(type, fn) {
683
- /* istanbul ignore next -- @preserve */
684
677
  if (typeof type !== "string" || typeof fn !== "function") return this;
685
678
  this.events[type] = this.events[type] || [];
686
679
  if (this.events[type].length >= 100) {
687
680
  delete this.events[type];
688
- /* istanbul ignore else -- @preserve */
689
681
  if (!IS_SERVER$2) {
690
682
  throw new VcError("icon", `${type} nonexistent`);
691
683
  }
@@ -694,7 +686,6 @@ var VcComponents = (function (exports, vue) {
694
686
  return this;
695
687
  }
696
688
  off(type, fn) {
697
- /* istanbul ignore next -- @preserve */
698
689
  if (typeof type !== "string" || typeof fn !== "function") return this;
699
690
  this.events[type] = this.events[type]?.filter((i) => i != fn);
700
691
  return this;
@@ -958,7 +949,6 @@ var VcComponents = (function (exports, vue) {
958
949
  const handleBeforeEnter = (el) => {
959
950
  const duration = props.duration.enter || props.duration;
960
951
  el.style.transition = getTransitionStyle(duration);
961
- /* istanbul ignore next -- @preserve */
962
952
  if (!el.dataset) {
963
953
  el.dataset = {};
964
954
  }
@@ -975,7 +965,6 @@ var VcComponents = (function (exports, vue) {
975
965
  const next = createNext(done, duration);
976
966
  try {
977
967
  el.dataset.oldOverflow = el.style.overflow;
978
- /* istanbul ignore next -- @preserve */
979
968
  if (el.scrollHeight !== 0) {
980
969
  el.style.height = el.scrollHeight + "px";
981
970
  el.style.paddingTop = el.dataset.oldPaddingTop + "px";
@@ -998,7 +987,6 @@ var VcComponents = (function (exports, vue) {
998
987
  attrs.onAfterEnter?.(el);
999
988
  };
1000
989
  const handleBeforeLeave = (el) => {
1001
- /* istanbul ignore next -- @preserve */
1002
990
  if (!el.dataset) {
1003
991
  el.dataset = {};
1004
992
  }
@@ -1015,7 +1003,6 @@ var VcComponents = (function (exports, vue) {
1015
1003
  const next = createNext(done, duration);
1016
1004
  try {
1017
1005
  const leaveDuration = props.duration.leave || props.duration;
1018
- /* istanbul ignore next -- @preserve */
1019
1006
  if (el.scrollHeight !== 0) {
1020
1007
  el.style.transition = getTransitionStyle(leaveDuration);
1021
1008
  el.style.height = "0px";
@@ -6805,7 +6792,6 @@ var VcComponents = (function (exports, vue) {
6805
6792
  () => {
6806
6793
  const { wait, exclude, include } = props;
6807
6794
  const ons = Object.entries(attrs).reduce((pre, [key, callback]) => {
6808
- /* istanbul ignore else -- @preserve */
6809
6795
  if ((!exclude || !exclude.test(key)) && (!include || include.test(key)) && typeof callback === "function") {
6810
6796
  pre[key] = debounce(callback, wait, {
6811
6797
  leading: true,
@@ -7137,7 +7123,6 @@ var VcComponents = (function (exports, vue) {
7137
7123
  const instance = vue.getCurrentInstance();
7138
7124
  const regex = new RegExp(`${componentName}$`);
7139
7125
  let parent = instance.parent;
7140
- /* istanbul ignore next -- @preserve */
7141
7126
  while (parent && !(parent?.type?.name && regex.test(parent.type.name)) && (!privateKey || !parent?.[privateKey] || !parent?.proxy?.[privateKey])) {
7142
7127
  parent = parent.parent || parent?.type?.parent;
7143
7128
  }
@@ -8451,7 +8436,6 @@ var VcComponents = (function (exports, vue) {
8451
8436
  }
8452
8437
  }
8453
8438
  } catch (e) {
8454
- /* istanbul ignore next -- @preserve */
8455
8439
  throw new VcError("instance", e);
8456
8440
  }
8457
8441
  }
@@ -8462,7 +8446,6 @@ var VcComponents = (function (exports, vue) {
8462
8446
  try {
8463
8447
  Portal.leafs.forEach((leaf) => leaf.destroy());
8464
8448
  } catch (e) {
8465
- /* istanbul ignore next -- @preserve */
8466
8449
  throw new VcError("instance", e);
8467
8450
  }
8468
8451
  }
@@ -8535,7 +8518,6 @@ var VcComponents = (function (exports, vue) {
8535
8518
  return (...args) => {
8536
8519
  const done = () => {
8537
8520
  const leaf = getLeaf();
8538
- /* istanbul ignore next -- @preserve */
8539
8521
  if (!leaf) {
8540
8522
  throw new VcError("portal", "实例不存在或已卸载");
8541
8523
  }
@@ -8586,7 +8568,6 @@ var VcComponents = (function (exports, vue) {
8586
8568
  if (isDestroyed()) return;
8587
8569
  onDestroyed?.(...args);
8588
8570
  leaf.app?.unmount();
8589
- /* istanbul ignore else -- @preserve */
8590
8571
  if (useAllNodes) {
8591
8572
  root?.contains(container) && root.removeChild(container);
8592
8573
  } else if (container && container._children) {
@@ -8614,16 +8595,13 @@ var VcComponents = (function (exports, vue) {
8614
8595
  const handleExtra = (e) => {
8615
8596
  try {
8616
8597
  const path = e.path || composedPath(e);
8617
- /* istanbul ignore else -- @preserve */
8618
8598
  if (container && e.target && !container.contains(e.target) && !path?.some((item) => utils.eleInRegExp(item, aliveRegExp))) {
8619
- /* istanbul ignore else -- @preserve */
8620
8599
  if (leaf.wrapper && leaf.wrapper?.[aliveVisibleKey]) {
8621
8600
  typeof leaf.wrapper[aliveVisibleKey] === "function" ? leaf.wrapper[aliveVisibleKey](false) : leaf.wrapper[aliveVisibleKey] = false;
8622
8601
  }
8623
8602
  leaveDelay ? setTimeout($onDestroyed, leaveDelay) : $onDestroyed();
8624
8603
  }
8625
8604
  } catch (error) {
8626
- /* istanbul ignore next -- @preserve */
8627
8605
  throw new VcError("portal", error);
8628
8606
  }
8629
8607
  };
@@ -9725,7 +9703,8 @@ var VcComponents = (function (exports, vue) {
9725
9703
  emits: [...EVENTS$1, 'ready'],
9726
9704
  setup(props, {
9727
9705
  emit,
9728
- slots
9706
+ slots,
9707
+ expose
9729
9708
  }) {
9730
9709
  const instance = vue.getCurrentInstance();
9731
9710
  const chart = vue.shallowRef(null);
@@ -9824,6 +9803,10 @@ var VcComponents = (function (exports, vue) {
9824
9803
  }
9825
9804
  });
9826
9805
  });
9806
+ expose({
9807
+ chart,
9808
+ refresh
9809
+ });
9827
9810
  vue.onUnmounted(destroy);
9828
9811
  return () => {
9829
9812
  return vue.createVNode("div", {
@@ -16470,7 +16453,7 @@ var VcComponents = (function (exports, vue) {
16470
16453
  }) {
16471
16454
  const owner = getInstance$1('dropdown', 'dropdownId');
16472
16455
  const currentValue = vue.computed(() => {
16473
- const v = typeof props.value === 'undefined' || props.value === '' ? props.label : props.value;
16456
+ const v = typeof props.value === 'undefined' ? props.label : props.value;
16474
16457
  return v;
16475
16458
  });
16476
16459
  const classes = vue.computed(() => {
@@ -21934,7 +21917,7 @@ var VcComponents = (function (exports, vue) {
21934
21917
  default: "div"
21935
21918
  },
21936
21919
  fill: {
21937
- type: Boolean,
21920
+ type: [Boolean, Array],
21938
21921
  default: true
21939
21922
  }
21940
21923
  };
@@ -21948,6 +21931,13 @@ var VcComponents = (function (exports, vue) {
21948
21931
  const width = vue.ref(0);
21949
21932
  const height = vue.ref(0);
21950
21933
  const current = vue.ref();
21934
+ const classes = vue.computed(() => {
21935
+ const v = Array.isArray(props.fill) ? props.fill : [props.fill, props.fill];
21936
+ return {
21937
+ "is-fill-width": v[0],
21938
+ "is-fill-height": v[1]
21939
+ };
21940
+ });
21951
21941
  const currentExposed = vue.computed(() => {
21952
21942
  return {
21953
21943
  height: height.value,
@@ -21998,7 +21988,7 @@ var VcComponents = (function (exports, vue) {
21998
21988
  props.tag,
21999
21989
  {
22000
21990
  ref: current,
22001
- class: ["vc-resizer", { "is-fill": props.fill }]
21991
+ class: ["vc-resizer", classes.value]
22002
21992
  },
22003
21993
  slots.default?.(currentExposed.value)
22004
21994
  );
@@ -25429,26 +25419,22 @@ var VcComponents = (function (exports, vue) {
25429
25419
  const index$ = rebuildDataIndexMap.value[index];
25430
25420
  typeof index$ === 'undefined' ? rebuildData.value.unshift(node) : rebuildData.value[index$] = node;
25431
25421
  };
25432
- // 更新item.size
25433
25422
  const refreshItemSize = index => {
25434
25423
  const current = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[index]] : rebuildData.value[index];
25435
- if (!current) return; // 受到`removeUnusedPlaceholders`影响,无效的会被回收
25436
25424
 
25437
- const oldSize = current.size;
25425
+ // 受到`removeUnusedPlaceholders`影响,无效的会被回收
25426
+ if (!current) return;
25427
+ const original = Object.assign({}, current);
25438
25428
  const dom = preloads.value[index] || curloads.value[props.inverted ? index : index - firstItemIndex.value];
25439
25429
  if (dom) {
25440
25430
  current.size = dom[K.offsetSize] || placeholderSize.value;
25441
25431
  } else if (current) {
25442
25432
  current.size = placeholderSize.value;
25443
25433
  }
25444
-
25445
- // 这样的考虑欠佳,待优化
25446
- if (oldSize !== current.size) {
25447
- emit('row-resize', {
25448
- index: current.id,
25449
- size: current.size
25450
- });
25451
- }
25434
+ return {
25435
+ original,
25436
+ changed: current
25437
+ };
25452
25438
  };
25453
25439
  const refreshItemPosition = () => {
25454
25440
  const sizes = Array.from({
@@ -25518,18 +25504,24 @@ var VcComponents = (function (exports, vue) {
25518
25504
  const refreshLayout = async (start, end) => {
25519
25505
  isRefreshLayout = 1;
25520
25506
  const promiseTasks = [];
25507
+ const resizeChanges = [];
25521
25508
  let item;
25522
25509
  for (let i = start; i < end; i++) {
25523
25510
  item = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[i]] : rebuildData.value[i];
25524
- if (item && item.loaded) {
25525
- continue;
25526
- }
25511
+ if (item && item.loaded) continue;
25527
25512
  setItemData(i, originalData[i]);
25528
- promiseTasks.push(vue.nextTick(() => refreshItemSize(i)));
25513
+ promiseTasks.push(vue.nextTick(() => {
25514
+ const e = refreshItemSize(i);
25515
+ e && resizeChanges.push(e.changed);
25516
+ }));
25529
25517
  }
25530
25518
  await Promise.all(promiseTasks);
25531
25519
  refreshItemPosition();
25532
25520
  setFirstItemIndex();
25521
+ resizeChanges.length > 0 && emit('row-resize', resizeChanges.map(i => ({
25522
+ size: i.size,
25523
+ index: i.id
25524
+ })));
25533
25525
  interrupter.next();
25534
25526
  isRefreshLayout = 0;
25535
25527
  };
@@ -27244,11 +27236,19 @@ var VcComponents = (function (exports, vue) {
27244
27236
  emit,
27245
27237
  slots
27246
27238
  }) {
27239
+ let resizeChanges = [];
27240
+ const emitChanges = () => {
27241
+ if (resizeChanges.length > 0) {
27242
+ emit('row-resize', resizeChanges);
27243
+ resizeChanges = [];
27244
+ }
27245
+ };
27247
27246
  const handleResize = (e, index) => {
27248
- emit('row-resize', {
27247
+ resizeChanges.push({
27249
27248
  index,
27250
27249
  size: e.height
27251
27250
  });
27251
+ vue.nextTick(emitChanges);
27252
27252
  };
27253
27253
  return () => {
27254
27254
  return props.data.map((mergeData, index) => {
@@ -27607,22 +27607,25 @@ var VcComponents = (function (exports, vue) {
27607
27607
  return renderRow(row, row.index);
27608
27608
  })]);
27609
27609
  };
27610
- const handleMergeRowResize = v => {
27610
+ const handleMergeRowResize = changes => {
27611
27611
  if (table.props.rowHeight) return;
27612
- states.list[v.index].rows.forEach(row => {
27613
- const old = row.heightMap[props.fixed || 'main'];
27614
- if (old === v.size) return;
27615
- row.heightMap[props.fixed || 'main'] = v.size;
27616
- const heights = [row.heightMap.main];
27617
- if (states.leftFixedCount) {
27618
- heights.push(row.heightMap.left);
27619
- }
27620
- if (states.rightFixedCount) {
27621
- heights.push(row.heightMap.right);
27622
- }
27623
- if (heights.every(i => !!i)) {
27624
- row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
27625
- }
27612
+ // 批量处理所有尺寸变化
27613
+ changes.forEach(v => {
27614
+ states.list[v.index].rows.forEach(row => {
27615
+ const old = row.heightMap[props.fixed || 'main'];
27616
+ if (old === v.size) return;
27617
+ row.heightMap[props.fixed || 'main'] = v.size;
27618
+ const heights = [row.heightMap.main];
27619
+ if (states.leftFixedCount) {
27620
+ heights.push(row.heightMap.left);
27621
+ }
27622
+ if (states.rightFixedCount) {
27623
+ heights.push(row.heightMap.right);
27624
+ }
27625
+ if (heights.every(i => !!i)) {
27626
+ row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
27627
+ }
27628
+ });
27626
27629
  });
27627
27630
  };
27628
27631
  expose({
@@ -30568,7 +30571,6 @@ var VcComponents = (function (exports, vue) {
30568
30571
  setup(props, { slots }) {
30569
30572
  const themeId = getUid("vc-theme");
30570
30573
  const setVar = (name) => {
30571
- /* istanbul ignore next -- @preserve */
30572
30574
  if (!name) return "";
30573
30575
  const globals = VcInstance.options.Theme?.variables;
30574
30576
  return props.variables?.[name] || globals?.[name] || `var(--${name})`;
@@ -30604,7 +30606,6 @@ var VcComponents = (function (exports, vue) {
30604
30606
  }
30605
30607
  });
30606
30608
  const setCss = (attrs) => {
30607
- /* istanbul ignore next -- @preserve */
30608
30609
  if (!attrs || typeof attrs === "string") return attrs;
30609
30610
  let content = "";
30610
30611
  Object.entries(attrs).forEach(([key, val]) => {
@@ -30613,7 +30614,6 @@ var VcComponents = (function (exports, vue) {
30613
30614
  return content;
30614
30615
  };
30615
30616
  const resetPseudo = () => {
30616
- /* istanbul ignore next -- @preserve */
30617
30617
  if (typeof document === "undefined") return;
30618
30618
  const { pseudo } = props;
30619
30619
  if (!pseudo) return removeStyle(themeId);