@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.
@@ -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(() => {
@@ -21937,7 +21920,7 @@
21937
21920
  default: "div"
21938
21921
  },
21939
21922
  fill: {
21940
- type: Boolean,
21923
+ type: [Boolean, Array],
21941
21924
  default: true
21942
21925
  }
21943
21926
  };
@@ -21951,6 +21934,13 @@
21951
21934
  const width = vue.ref(0);
21952
21935
  const height = vue.ref(0);
21953
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
+ });
21954
21944
  const currentExposed = vue.computed(() => {
21955
21945
  return {
21956
21946
  height: height.value,
@@ -22001,7 +21991,7 @@
22001
21991
  props.tag,
22002
21992
  {
22003
21993
  ref: current,
22004
- class: ["vc-resizer", { "is-fill": props.fill }]
21994
+ class: ["vc-resizer", classes.value]
22005
21995
  },
22006
21996
  slots.default?.(currentExposed.value)
22007
21997
  );
@@ -25432,26 +25422,22 @@
25432
25422
  const index$ = rebuildDataIndexMap.value[index];
25433
25423
  typeof index$ === 'undefined' ? rebuildData.value.unshift(node) : rebuildData.value[index$] = node;
25434
25424
  };
25435
- // 更新item.size
25436
25425
  const refreshItemSize = index => {
25437
25426
  const current = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[index]] : rebuildData.value[index];
25438
- if (!current) return; // 受到`removeUnusedPlaceholders`影响,无效的会被回收
25439
25427
 
25440
- const oldSize = current.size;
25428
+ // 受到`removeUnusedPlaceholders`影响,无效的会被回收
25429
+ if (!current) return;
25430
+ const original = Object.assign({}, current);
25441
25431
  const dom = preloads.value[index] || curloads.value[props.inverted ? index : index - firstItemIndex.value];
25442
25432
  if (dom) {
25443
25433
  current.size = dom[K.offsetSize] || placeholderSize.value;
25444
25434
  } else if (current) {
25445
25435
  current.size = placeholderSize.value;
25446
25436
  }
25447
-
25448
- // 这样的考虑欠佳,待优化
25449
- if (oldSize !== current.size) {
25450
- emit('row-resize', {
25451
- index: current.id,
25452
- size: current.size
25453
- });
25454
- }
25437
+ return {
25438
+ original,
25439
+ changed: current
25440
+ };
25455
25441
  };
25456
25442
  const refreshItemPosition = () => {
25457
25443
  const sizes = Array.from({
@@ -25521,18 +25507,24 @@
25521
25507
  const refreshLayout = async (start, end) => {
25522
25508
  isRefreshLayout = 1;
25523
25509
  const promiseTasks = [];
25510
+ const resizeChanges = [];
25524
25511
  let item;
25525
25512
  for (let i = start; i < end; i++) {
25526
25513
  item = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[i]] : rebuildData.value[i];
25527
- if (item && item.loaded) {
25528
- continue;
25529
- }
25514
+ if (item && item.loaded) continue;
25530
25515
  setItemData(i, originalData[i]);
25531
- promiseTasks.push(vue.nextTick(() => refreshItemSize(i)));
25516
+ promiseTasks.push(vue.nextTick(() => {
25517
+ const e = refreshItemSize(i);
25518
+ e && resizeChanges.push(e.changed);
25519
+ }));
25532
25520
  }
25533
25521
  await Promise.all(promiseTasks);
25534
25522
  refreshItemPosition();
25535
25523
  setFirstItemIndex();
25524
+ resizeChanges.length > 0 && emit('row-resize', resizeChanges.map(i => ({
25525
+ size: i.size,
25526
+ index: i.id
25527
+ })));
25536
25528
  interrupter.next();
25537
25529
  isRefreshLayout = 0;
25538
25530
  };
@@ -27247,11 +27239,19 @@
27247
27239
  emit,
27248
27240
  slots
27249
27241
  }) {
27242
+ let resizeChanges = [];
27243
+ const emitChanges = () => {
27244
+ if (resizeChanges.length > 0) {
27245
+ emit('row-resize', resizeChanges);
27246
+ resizeChanges = [];
27247
+ }
27248
+ };
27250
27249
  const handleResize = (e, index) => {
27251
- emit('row-resize', {
27250
+ resizeChanges.push({
27252
27251
  index,
27253
27252
  size: e.height
27254
27253
  });
27254
+ vue.nextTick(emitChanges);
27255
27255
  };
27256
27256
  return () => {
27257
27257
  return props.data.map((mergeData, index) => {
@@ -27610,22 +27610,25 @@
27610
27610
  return renderRow(row, row.index);
27611
27611
  })]);
27612
27612
  };
27613
- const handleMergeRowResize = v => {
27613
+ const handleMergeRowResize = changes => {
27614
27614
  if (table.props.rowHeight) return;
27615
- states.list[v.index].rows.forEach(row => {
27616
- const old = row.heightMap[props.fixed || 'main'];
27617
- if (old === v.size) return;
27618
- row.heightMap[props.fixed || 'main'] = v.size;
27619
- const heights = [row.heightMap.main];
27620
- if (states.leftFixedCount) {
27621
- heights.push(row.heightMap.left);
27622
- }
27623
- if (states.rightFixedCount) {
27624
- heights.push(row.heightMap.right);
27625
- }
27626
- if (heights.every(i => !!i)) {
27627
- row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
27628
- }
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
+ });
27629
27632
  });
27630
27633
  };
27631
27634
  expose({
@@ -30571,7 +30574,6 @@
30571
30574
  setup(props, { slots }) {
30572
30575
  const themeId = getUid("vc-theme");
30573
30576
  const setVar = (name) => {
30574
- /* istanbul ignore next -- @preserve */
30575
30577
  if (!name) return "";
30576
30578
  const globals = VcInstance.options.Theme?.variables;
30577
30579
  return props.variables?.[name] || globals?.[name] || `var(--${name})`;
@@ -30607,7 +30609,6 @@
30607
30609
  }
30608
30610
  });
30609
30611
  const setCss = (attrs) => {
30610
- /* istanbul ignore next -- @preserve */
30611
30612
  if (!attrs || typeof attrs === "string") return attrs;
30612
30613
  let content = "";
30613
30614
  Object.entries(attrs).forEach(([key, val]) => {
@@ -30616,7 +30617,6 @@
30616
30617
  return content;
30617
30618
  };
30618
30619
  const resetPseudo = () => {
30619
- /* istanbul ignore next -- @preserve */
30620
30620
  if (typeof document === "undefined") return;
30621
30621
  const { pseudo } = props;
30622
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.57",
3
+ "version": "1.0.58",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",