@deot/vc-components 1.0.56 → 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.
@@ -10,7 +10,6 @@
10
10
  if (!message || !target) return;
11
11
  message = `[@deot/vc - ${target}]: ${message}`;
12
12
  this.message = message;
13
- /* istanbul ignore next -- @preserve */
14
13
  }
15
14
  }
16
15
 
@@ -610,7 +609,6 @@
610
609
  const key = `${prefix}${url}`;
611
610
  const cache = window.localStorage.getItem(key);
612
611
  let icons = JSON.parse(cache || '""');
613
- /* istanbul ignore next -- @preserve */
614
612
  if (!icons) {
615
613
  const data = await new Promise((resolve$) => {
616
614
  const request = new XMLHttpRequest();
@@ -645,7 +643,6 @@
645
643
  });
646
644
  resolve();
647
645
  } catch (e) {
648
- /* istanbul ignore next -- @preserve */
649
646
  reject(new VcError("icon", e));
650
647
  }
651
648
  })();
@@ -657,7 +654,6 @@
657
654
  const icons = {};
658
655
  setTimeout(() => {
659
656
  try {
660
- /* istanbul ignore next -- @preserve */
661
657
  IS_DEV && console.time(url);
662
658
  svgStr.replace(svgReg, "$1")?.match(symbolReg)?.forEach(
663
659
  (i) => i.replace(basicReg, (_, ...args) => {
@@ -672,23 +668,19 @@
672
668
  return "";
673
669
  })
674
670
  );
675
- /* istanbul ignore next -- @preserve */
676
671
  IS_DEV && console.timeEnd(url);
677
672
  resolve(icons);
678
673
  } catch (e) {
679
- /* istanbul ignore next -- @preserve */
680
674
  reject(new VcError("icon", e));
681
675
  }
682
676
  }, 0);
683
677
  });
684
678
  }
685
679
  on(type, fn) {
686
- /* istanbul ignore next -- @preserve */
687
680
  if (typeof type !== "string" || typeof fn !== "function") return this;
688
681
  this.events[type] = this.events[type] || [];
689
682
  if (this.events[type].length >= 100) {
690
683
  delete this.events[type];
691
- /* istanbul ignore else -- @preserve */
692
684
  if (!IS_SERVER$2) {
693
685
  throw new VcError("icon", `${type} nonexistent`);
694
686
  }
@@ -697,7 +689,6 @@
697
689
  return this;
698
690
  }
699
691
  off(type, fn) {
700
- /* istanbul ignore next -- @preserve */
701
692
  if (typeof type !== "string" || typeof fn !== "function") return this;
702
693
  this.events[type] = this.events[type]?.filter((i) => i != fn);
703
694
  return this;
@@ -961,7 +952,6 @@
961
952
  const handleBeforeEnter = (el) => {
962
953
  const duration = props.duration.enter || props.duration;
963
954
  el.style.transition = getTransitionStyle(duration);
964
- /* istanbul ignore next -- @preserve */
965
955
  if (!el.dataset) {
966
956
  el.dataset = {};
967
957
  }
@@ -978,7 +968,6 @@
978
968
  const next = createNext(done, duration);
979
969
  try {
980
970
  el.dataset.oldOverflow = el.style.overflow;
981
- /* istanbul ignore next -- @preserve */
982
971
  if (el.scrollHeight !== 0) {
983
972
  el.style.height = el.scrollHeight + "px";
984
973
  el.style.paddingTop = el.dataset.oldPaddingTop + "px";
@@ -1001,7 +990,6 @@
1001
990
  attrs.onAfterEnter?.(el);
1002
991
  };
1003
992
  const handleBeforeLeave = (el) => {
1004
- /* istanbul ignore next -- @preserve */
1005
993
  if (!el.dataset) {
1006
994
  el.dataset = {};
1007
995
  }
@@ -1018,7 +1006,6 @@
1018
1006
  const next = createNext(done, duration);
1019
1007
  try {
1020
1008
  const leaveDuration = props.duration.leave || props.duration;
1021
- /* istanbul ignore next -- @preserve */
1022
1009
  if (el.scrollHeight !== 0) {
1023
1010
  el.style.transition = getTransitionStyle(leaveDuration);
1024
1011
  el.style.height = "0px";
@@ -6808,7 +6795,6 @@
6808
6795
  () => {
6809
6796
  const { wait, exclude, include } = props;
6810
6797
  const ons = Object.entries(attrs).reduce((pre, [key, callback]) => {
6811
- /* istanbul ignore else -- @preserve */
6812
6798
  if ((!exclude || !exclude.test(key)) && (!include || include.test(key)) && typeof callback === "function") {
6813
6799
  pre[key] = debounce(callback, wait, {
6814
6800
  leading: true,
@@ -7140,7 +7126,6 @@
7140
7126
  const instance = vue.getCurrentInstance();
7141
7127
  const regex = new RegExp(`${componentName}$`);
7142
7128
  let parent = instance.parent;
7143
- /* istanbul ignore next -- @preserve */
7144
7129
  while (parent && !(parent?.type?.name && regex.test(parent.type.name)) && (!privateKey || !parent?.[privateKey] || !parent?.proxy?.[privateKey])) {
7145
7130
  parent = parent.parent || parent?.type?.parent;
7146
7131
  }
@@ -8454,7 +8439,6 @@
8454
8439
  }
8455
8440
  }
8456
8441
  } catch (e) {
8457
- /* istanbul ignore next -- @preserve */
8458
8442
  throw new VcError("instance", e);
8459
8443
  }
8460
8444
  }
@@ -8465,7 +8449,6 @@
8465
8449
  try {
8466
8450
  Portal.leafs.forEach((leaf) => leaf.destroy());
8467
8451
  } catch (e) {
8468
- /* istanbul ignore next -- @preserve */
8469
8452
  throw new VcError("instance", e);
8470
8453
  }
8471
8454
  }
@@ -8538,7 +8521,6 @@
8538
8521
  return (...args) => {
8539
8522
  const done = () => {
8540
8523
  const leaf = getLeaf();
8541
- /* istanbul ignore next -- @preserve */
8542
8524
  if (!leaf) {
8543
8525
  throw new VcError("portal", "实例不存在或已卸载");
8544
8526
  }
@@ -8589,7 +8571,6 @@
8589
8571
  if (isDestroyed()) return;
8590
8572
  onDestroyed?.(...args);
8591
8573
  leaf.app?.unmount();
8592
- /* istanbul ignore else -- @preserve */
8593
8574
  if (useAllNodes) {
8594
8575
  root?.contains(container) && root.removeChild(container);
8595
8576
  } else if (container && container._children) {
@@ -8617,16 +8598,13 @@
8617
8598
  const handleExtra = (e) => {
8618
8599
  try {
8619
8600
  const path = e.path || composedPath(e);
8620
- /* istanbul ignore else -- @preserve */
8621
8601
  if (container && e.target && !container.contains(e.target) && !path?.some((item) => utils.eleInRegExp(item, aliveRegExp))) {
8622
- /* istanbul ignore else -- @preserve */
8623
8602
  if (leaf.wrapper && leaf.wrapper?.[aliveVisibleKey]) {
8624
8603
  typeof leaf.wrapper[aliveVisibleKey] === "function" ? leaf.wrapper[aliveVisibleKey](false) : leaf.wrapper[aliveVisibleKey] = false;
8625
8604
  }
8626
8605
  leaveDelay ? setTimeout($onDestroyed, leaveDelay) : $onDestroyed();
8627
8606
  }
8628
8607
  } catch (error) {
8629
- /* istanbul ignore next -- @preserve */
8630
8608
  throw new VcError("portal", error);
8631
8609
  }
8632
8610
  };
@@ -9728,7 +9706,8 @@
9728
9706
  emits: [...EVENTS$1, 'ready'],
9729
9707
  setup(props, {
9730
9708
  emit,
9731
- slots
9709
+ slots,
9710
+ expose
9732
9711
  }) {
9733
9712
  const instance = vue.getCurrentInstance();
9734
9713
  const chart = vue.shallowRef(null);
@@ -9827,6 +9806,10 @@
9827
9806
  }
9828
9807
  });
9829
9808
  });
9809
+ expose({
9810
+ chart,
9811
+ refresh
9812
+ });
9830
9813
  vue.onUnmounted(destroy);
9831
9814
  return () => {
9832
9815
  return vue.createVNode("div", {
@@ -16473,7 +16456,7 @@
16473
16456
  }) {
16474
16457
  const owner = getInstance$1('dropdown', 'dropdownId');
16475
16458
  const currentValue = vue.computed(() => {
16476
- const v = typeof props.value === 'undefined' || props.value === '' ? props.label : props.value;
16459
+ const v = typeof props.value === 'undefined' ? props.label : props.value;
16477
16460
  return v;
16478
16461
  });
16479
16462
  const classes = vue.computed(() => {
@@ -16783,6 +16766,7 @@
16783
16766
  }
16784
16767
  });
16785
16768
  };
16769
+ const handlePrevent = e => e.preventDefault();
16786
16770
  vue.onMounted(() => {
16787
16771
  insertStyle(buttons.value);
16788
16772
  });
@@ -16793,7 +16777,8 @@
16793
16777
  });
16794
16778
  return () => {
16795
16779
  return vue.createVNode("div", {
16796
- "id": props.elementId
16780
+ "id": props.elementId,
16781
+ "onClick": handlePrevent
16797
16782
  }, [renderButtonGroup(buttons.value), slots?.extend?.()]);
16798
16783
  };
16799
16784
  }
@@ -21935,7 +21920,7 @@
21935
21920
  default: "div"
21936
21921
  },
21937
21922
  fill: {
21938
- type: Boolean,
21923
+ type: [Boolean, Array],
21939
21924
  default: true
21940
21925
  }
21941
21926
  };
@@ -21949,6 +21934,13 @@
21949
21934
  const width = vue.ref(0);
21950
21935
  const height = vue.ref(0);
21951
21936
  const current = vue.ref();
21937
+ const classes = vue.computed(() => {
21938
+ const v = Array.isArray(props.fill) ? props.fill : [props.fill, props.fill];
21939
+ return {
21940
+ "is-fill-width": v[0],
21941
+ "is-fill-height": v[1]
21942
+ };
21943
+ });
21952
21944
  const currentExposed = vue.computed(() => {
21953
21945
  return {
21954
21946
  height: height.value,
@@ -21999,7 +21991,7 @@
21999
21991
  props.tag,
22000
21992
  {
22001
21993
  ref: current,
22002
- class: ["vc-resizer", { "is-fill": props.fill }]
21994
+ class: ["vc-resizer", classes.value]
22003
21995
  },
22004
21996
  slots.default?.(currentExposed.value)
22005
21997
  );
@@ -25430,26 +25422,22 @@
25430
25422
  const index$ = rebuildDataIndexMap.value[index];
25431
25423
  typeof index$ === 'undefined' ? rebuildData.value.unshift(node) : rebuildData.value[index$] = node;
25432
25424
  };
25433
- // 更新item.size
25434
25425
  const refreshItemSize = index => {
25435
25426
  const current = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[index]] : rebuildData.value[index];
25436
- if (!current) return; // 受到`removeUnusedPlaceholders`影响,无效的会被回收
25437
25427
 
25438
- const oldSize = current.size;
25428
+ // 受到`removeUnusedPlaceholders`影响,无效的会被回收
25429
+ if (!current) return;
25430
+ const original = Object.assign({}, current);
25439
25431
  const dom = preloads.value[index] || curloads.value[props.inverted ? index : index - firstItemIndex.value];
25440
25432
  if (dom) {
25441
25433
  current.size = dom[K.offsetSize] || placeholderSize.value;
25442
25434
  } else if (current) {
25443
25435
  current.size = placeholderSize.value;
25444
25436
  }
25445
-
25446
- // 这样的考虑欠佳,待优化
25447
- if (oldSize !== current.size) {
25448
- emit('row-resize', {
25449
- index: current.id,
25450
- size: current.size
25451
- });
25452
- }
25437
+ return {
25438
+ original,
25439
+ changed: current
25440
+ };
25453
25441
  };
25454
25442
  const refreshItemPosition = () => {
25455
25443
  const sizes = Array.from({
@@ -25519,18 +25507,24 @@
25519
25507
  const refreshLayout = async (start, end) => {
25520
25508
  isRefreshLayout = 1;
25521
25509
  const promiseTasks = [];
25510
+ const resizeChanges = [];
25522
25511
  let item;
25523
25512
  for (let i = start; i < end; i++) {
25524
25513
  item = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[i]] : rebuildData.value[i];
25525
- if (item && item.loaded) {
25526
- continue;
25527
- }
25514
+ if (item && item.loaded) continue;
25528
25515
  setItemData(i, originalData[i]);
25529
- promiseTasks.push(vue.nextTick(() => refreshItemSize(i)));
25516
+ promiseTasks.push(vue.nextTick(() => {
25517
+ const e = refreshItemSize(i);
25518
+ e && resizeChanges.push(e.changed);
25519
+ }));
25530
25520
  }
25531
25521
  await Promise.all(promiseTasks);
25532
25522
  refreshItemPosition();
25533
25523
  setFirstItemIndex();
25524
+ resizeChanges.length > 0 && emit('row-resize', resizeChanges.map(i => ({
25525
+ size: i.size,
25526
+ index: i.id
25527
+ })));
25534
25528
  interrupter.next();
25535
25529
  isRefreshLayout = 0;
25536
25530
  };
@@ -27245,11 +27239,19 @@
27245
27239
  emit,
27246
27240
  slots
27247
27241
  }) {
27242
+ let resizeChanges = [];
27243
+ const emitChanges = () => {
27244
+ if (resizeChanges.length > 0) {
27245
+ emit('row-resize', resizeChanges);
27246
+ resizeChanges = [];
27247
+ }
27248
+ };
27248
27249
  const handleResize = (e, index) => {
27249
- emit('row-resize', {
27250
+ resizeChanges.push({
27250
27251
  index,
27251
27252
  size: e.height
27252
27253
  });
27254
+ vue.nextTick(emitChanges);
27253
27255
  };
27254
27256
  return () => {
27255
27257
  return props.data.map((mergeData, index) => {
@@ -27608,22 +27610,25 @@
27608
27610
  return renderRow(row, row.index);
27609
27611
  })]);
27610
27612
  };
27611
- const handleMergeRowResize = v => {
27613
+ const handleMergeRowResize = changes => {
27612
27614
  if (table.props.rowHeight) return;
27613
- states.list[v.index].rows.forEach(row => {
27614
- const old = row.heightMap[props.fixed || 'main'];
27615
- if (old === v.size) return;
27616
- row.heightMap[props.fixed || 'main'] = v.size;
27617
- const heights = [row.heightMap.main];
27618
- if (states.leftFixedCount) {
27619
- heights.push(row.heightMap.left);
27620
- }
27621
- if (states.rightFixedCount) {
27622
- heights.push(row.heightMap.right);
27623
- }
27624
- if (heights.every(i => !!i)) {
27625
- row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
27626
- }
27615
+ // 批量处理所有尺寸变化
27616
+ changes.forEach(v => {
27617
+ states.list[v.index].rows.forEach(row => {
27618
+ const old = row.heightMap[props.fixed || 'main'];
27619
+ if (old === v.size) return;
27620
+ row.heightMap[props.fixed || 'main'] = v.size;
27621
+ const heights = [row.heightMap.main];
27622
+ if (states.leftFixedCount) {
27623
+ heights.push(row.heightMap.left);
27624
+ }
27625
+ if (states.rightFixedCount) {
27626
+ heights.push(row.heightMap.right);
27627
+ }
27628
+ if (heights.every(i => !!i)) {
27629
+ row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
27630
+ }
27631
+ });
27627
27632
  });
27628
27633
  };
27629
27634
  expose({
@@ -30569,7 +30574,6 @@
30569
30574
  setup(props, { slots }) {
30570
30575
  const themeId = getUid("vc-theme");
30571
30576
  const setVar = (name) => {
30572
- /* istanbul ignore next -- @preserve */
30573
30577
  if (!name) return "";
30574
30578
  const globals = VcInstance.options.Theme?.variables;
30575
30579
  return props.variables?.[name] || globals?.[name] || `var(--${name})`;
@@ -30605,7 +30609,6 @@
30605
30609
  }
30606
30610
  });
30607
30611
  const setCss = (attrs) => {
30608
- /* istanbul ignore next -- @preserve */
30609
30612
  if (!attrs || typeof attrs === "string") return attrs;
30610
30613
  let content = "";
30611
30614
  Object.entries(attrs).forEach(([key, val]) => {
@@ -30614,7 +30617,6 @@
30614
30617
  return content;
30615
30618
  };
30616
30619
  const resetPseudo = () => {
30617
- /* istanbul ignore next -- @preserve */
30618
30620
  if (typeof document === "undefined") return;
30619
30621
  const { pseudo } = props;
30620
30622
  if (!pseudo) return removeStyle(themeId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deot/vc-components",
3
- "version": "1.0.56",
3
+ "version": "1.0.58",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",