@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.
package/dist/index.cjs CHANGED
@@ -44,7 +44,6 @@ class VcError {
44
44
  if (!message || !target) return;
45
45
  message = `[@deot/vc - ${target}]: ${message}`;
46
46
  this.message = message;
47
- /* istanbul ignore next -- @preserve */
48
47
  process.env.NODE_ENV === "development" && console.error(message);
49
48
  }
50
49
  }
@@ -429,7 +428,6 @@ class Manager {
429
428
  const key = `${prefix}${url}`;
430
429
  const cache = window.localStorage.getItem(key);
431
430
  let icons = JSON.parse(cache || '""');
432
- /* istanbul ignore next -- @preserve */
433
431
  if (!icons) {
434
432
  const data = await new Promise((resolve$) => {
435
433
  const request = new XMLHttpRequest();
@@ -464,7 +462,6 @@ class Manager {
464
462
  });
465
463
  resolve();
466
464
  } catch (e) {
467
- /* istanbul ignore next -- @preserve */
468
465
  reject(new VcError("icon", e));
469
466
  }
470
467
  })();
@@ -476,7 +473,6 @@ class Manager {
476
473
  const icons = {};
477
474
  setTimeout(() => {
478
475
  try {
479
- /* istanbul ignore next -- @preserve */
480
476
  IS_DEV && console.time(url);
481
477
  svgStr.replace(svgReg, "$1")?.match(symbolReg)?.forEach(
482
478
  (i) => i.replace(basicReg, (_, ...args) => {
@@ -491,23 +487,19 @@ class Manager {
491
487
  return "";
492
488
  })
493
489
  );
494
- /* istanbul ignore next -- @preserve */
495
490
  IS_DEV && console.timeEnd(url);
496
491
  resolve(icons);
497
492
  } catch (e) {
498
- /* istanbul ignore next -- @preserve */
499
493
  reject(new VcError("icon", e));
500
494
  }
501
495
  }, 0);
502
496
  });
503
497
  }
504
498
  on(type, fn) {
505
- /* istanbul ignore next -- @preserve */
506
499
  if (typeof type !== "string" || typeof fn !== "function") return this;
507
500
  this.events[type] = this.events[type] || [];
508
501
  if (this.events[type].length >= 100) {
509
502
  delete this.events[type];
510
- /* istanbul ignore else -- @preserve */
511
503
  if (!IS_SERVER) {
512
504
  throw new VcError("icon", `${type} nonexistent`);
513
505
  }
@@ -516,7 +508,6 @@ class Manager {
516
508
  return this;
517
509
  }
518
510
  off(type, fn) {
519
- /* istanbul ignore next -- @preserve */
520
511
  if (typeof type !== "string" || typeof fn !== "function") return this;
521
512
  this.events[type] = this.events[type]?.filter((i) => i != fn);
522
513
  return this;
@@ -780,7 +771,6 @@ const TransitionCollapse = vue.defineComponent({
780
771
  const handleBeforeEnter = (el) => {
781
772
  const duration = props.duration.enter || props.duration;
782
773
  el.style.transition = getTransitionStyle(duration);
783
- /* istanbul ignore next -- @preserve */
784
774
  if (!el.dataset) {
785
775
  el.dataset = {};
786
776
  }
@@ -797,7 +787,6 @@ const TransitionCollapse = vue.defineComponent({
797
787
  const next = createNext(done, duration);
798
788
  try {
799
789
  el.dataset.oldOverflow = el.style.overflow;
800
- /* istanbul ignore next -- @preserve */
801
790
  if (el.scrollHeight !== 0) {
802
791
  el.style.height = el.scrollHeight + "px";
803
792
  el.style.paddingTop = el.dataset.oldPaddingTop + "px";
@@ -820,7 +809,6 @@ const TransitionCollapse = vue.defineComponent({
820
809
  attrs.onAfterEnter?.(el);
821
810
  };
822
811
  const handleBeforeLeave = (el) => {
823
- /* istanbul ignore next -- @preserve */
824
812
  if (!el.dataset) {
825
813
  el.dataset = {};
826
814
  }
@@ -837,7 +825,6 @@ const TransitionCollapse = vue.defineComponent({
837
825
  const next = createNext(done, duration);
838
826
  try {
839
827
  const leaveDuration = props.duration.leave || props.duration;
840
- /* istanbul ignore next -- @preserve */
841
828
  if (el.scrollHeight !== 0) {
842
829
  el.style.transition = getTransitionStyle(leaveDuration);
843
830
  el.style.height = "0px";
@@ -1463,7 +1450,6 @@ const Debounce = vue.defineComponent({
1463
1450
  () => {
1464
1451
  const { wait, exclude, include } = props;
1465
1452
  const ons = Object.entries(attrs).reduce((pre, [key, callback]) => {
1466
- /* istanbul ignore else -- @preserve */
1467
1453
  if ((!exclude || !exclude.test(key)) && (!include || include.test(key)) && typeof callback === "function") {
1468
1454
  pre[key] = lodashEs.debounce(callback, wait, {
1469
1455
  leading: true,
@@ -2923,7 +2909,6 @@ class Portal {
2923
2909
  }
2924
2910
  }
2925
2911
  } catch (e) {
2926
- /* istanbul ignore next -- @preserve */
2927
2912
  throw new VcError("instance", e);
2928
2913
  }
2929
2914
  }
@@ -2934,7 +2919,6 @@ class Portal {
2934
2919
  try {
2935
2920
  Portal.leafs.forEach((leaf) => leaf.destroy());
2936
2921
  } catch (e) {
2937
- /* istanbul ignore next -- @preserve */
2938
2922
  throw new VcError("instance", e);
2939
2923
  }
2940
2924
  }
@@ -3007,7 +2991,6 @@ class Portal {
3007
2991
  return (...args) => {
3008
2992
  const done = () => {
3009
2993
  const leaf = getLeaf();
3010
- /* istanbul ignore next -- @preserve */
3011
2994
  if (!leaf) {
3012
2995
  throw new VcError("portal", "实例不存在或已卸载");
3013
2996
  }
@@ -3058,7 +3041,6 @@ class Portal {
3058
3041
  if (isDestroyed()) return;
3059
3042
  onDestroyed?.(...args);
3060
3043
  leaf.app?.unmount();
3061
- /* istanbul ignore else -- @preserve */
3062
3044
  if (useAllNodes) {
3063
3045
  root?.contains(container) && root.removeChild(container);
3064
3046
  } else if (container && container._children) {
@@ -3086,16 +3068,13 @@ class Portal {
3086
3068
  const handleExtra = (e) => {
3087
3069
  try {
3088
3070
  const path = e.path || $__namespace.composedPath(e);
3089
- /* istanbul ignore else -- @preserve */
3090
3071
  if (container && e.target && !container.contains(e.target) && !path?.some((item) => vcShared.Utils.eleInRegExp(item, aliveRegExp))) {
3091
- /* istanbul ignore else -- @preserve */
3092
3072
  if (leaf.wrapper && leaf.wrapper?.[aliveVisibleKey]) {
3093
3073
  typeof leaf.wrapper[aliveVisibleKey] === "function" ? leaf.wrapper[aliveVisibleKey](false) : leaf.wrapper[aliveVisibleKey] = false;
3094
3074
  }
3095
3075
  leaveDelay ? setTimeout($onDestroyed, leaveDelay) : $onDestroyed();
3096
3076
  }
3097
3077
  } catch (error) {
3098
- /* istanbul ignore next -- @preserve */
3099
3078
  throw new VcError("portal", error);
3100
3079
  }
3101
3080
  };
@@ -4197,7 +4176,8 @@ const Chart = /* @__PURE__ */ vue.defineComponent({
4197
4176
  emits: [...EVENTS, 'ready'],
4198
4177
  setup(props, {
4199
4178
  emit,
4200
- slots
4179
+ slots,
4180
+ expose
4201
4181
  }) {
4202
4182
  const instance = vue.getCurrentInstance();
4203
4183
  const chart = vue.shallowRef(null);
@@ -4296,6 +4276,10 @@ const Chart = /* @__PURE__ */ vue.defineComponent({
4296
4276
  }
4297
4277
  });
4298
4278
  });
4279
+ expose({
4280
+ chart,
4281
+ refresh
4282
+ });
4299
4283
  vue.onUnmounted(destroy);
4300
4284
  return () => {
4301
4285
  return vue.createVNode("div", {
@@ -10056,7 +10040,7 @@ const DropdownItem = /* @__PURE__ */ vue.defineComponent({
10056
10040
  }) {
10057
10041
  const owner = vcHooks.getInstance('dropdown', 'dropdownId');
10058
10042
  const currentValue = vue.computed(() => {
10059
- const v = typeof props.value === 'undefined' || props.value === '' ? props.label : props.value;
10043
+ const v = typeof props.value === 'undefined' ? props.label : props.value;
10060
10044
  return v;
10061
10045
  });
10062
10046
  const classes = vue.computed(() => {
@@ -13017,7 +13001,7 @@ const props$A = {
13017
13001
  default: "div"
13018
13002
  },
13019
13003
  fill: {
13020
- type: Boolean,
13004
+ type: [Boolean, Array],
13021
13005
  default: true
13022
13006
  }
13023
13007
  };
@@ -13031,6 +13015,13 @@ const Resizer = vue.defineComponent({
13031
13015
  const width = vue.ref(0);
13032
13016
  const height = vue.ref(0);
13033
13017
  const current = vue.ref();
13018
+ const classes = vue.computed(() => {
13019
+ const v = Array.isArray(props.fill) ? props.fill : [props.fill, props.fill];
13020
+ return {
13021
+ "is-fill-width": v[0],
13022
+ "is-fill-height": v[1]
13023
+ };
13024
+ });
13034
13025
  const currentExposed = vue.computed(() => {
13035
13026
  return {
13036
13027
  height: height.value,
@@ -13081,7 +13072,7 @@ const Resizer = vue.defineComponent({
13081
13072
  props.tag,
13082
13073
  {
13083
13074
  ref: current,
13084
- class: ["vc-resizer", { "is-fill": props.fill }]
13075
+ class: ["vc-resizer", classes.value]
13085
13076
  },
13086
13077
  slots.default?.(currentExposed.value)
13087
13078
  );
@@ -16398,26 +16389,22 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
16398
16389
  const index$ = rebuildDataIndexMap.value[index];
16399
16390
  typeof index$ === 'undefined' ? rebuildData.value.unshift(node) : rebuildData.value[index$] = node;
16400
16391
  };
16401
- // 更新item.size
16402
16392
  const refreshItemSize = index => {
16403
16393
  const current = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[index]] : rebuildData.value[index];
16404
- if (!current) return; // 受到`removeUnusedPlaceholders`影响,无效的会被回收
16405
16394
 
16406
- const oldSize = current.size;
16395
+ // 受到`removeUnusedPlaceholders`影响,无效的会被回收
16396
+ if (!current) return;
16397
+ const original = Object.assign({}, current);
16407
16398
  const dom = preloads.value[index] || curloads.value[props.inverted ? index : index - firstItemIndex.value];
16408
16399
  if (dom) {
16409
16400
  current.size = dom[K.offsetSize] || placeholderSize.value;
16410
16401
  } else if (current) {
16411
16402
  current.size = placeholderSize.value;
16412
16403
  }
16413
-
16414
- // 这样的考虑欠佳,待优化
16415
- if (oldSize !== current.size) {
16416
- emit('row-resize', {
16417
- index: current.id,
16418
- size: current.size
16419
- });
16420
- }
16404
+ return {
16405
+ original,
16406
+ changed: current
16407
+ };
16421
16408
  };
16422
16409
  const refreshItemPosition = () => {
16423
16410
  const sizes = Array.from({
@@ -16487,18 +16474,24 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
16487
16474
  const refreshLayout = async (start, end) => {
16488
16475
  isRefreshLayout = 1;
16489
16476
  const promiseTasks = [];
16477
+ const resizeChanges = [];
16490
16478
  let item;
16491
16479
  for (let i = start; i < end; i++) {
16492
16480
  item = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[i]] : rebuildData.value[i];
16493
- if (item && item.loaded) {
16494
- continue;
16495
- }
16481
+ if (item && item.loaded) continue;
16496
16482
  setItemData(i, originalData[i]);
16497
- promiseTasks.push(vue.nextTick(() => refreshItemSize(i)));
16483
+ promiseTasks.push(vue.nextTick(() => {
16484
+ const e = refreshItemSize(i);
16485
+ e && resizeChanges.push(e.changed);
16486
+ }));
16498
16487
  }
16499
16488
  await Promise.all(promiseTasks);
16500
16489
  refreshItemPosition();
16501
16490
  setFirstItemIndex();
16491
+ resizeChanges.length > 0 && emit('row-resize', resizeChanges.map(i => ({
16492
+ size: i.size,
16493
+ index: i.id
16494
+ })));
16502
16495
  interrupter.next();
16503
16496
  isRefreshLayout = 0;
16504
16497
  };
@@ -18213,11 +18206,19 @@ const NormalList = /* @__PURE__ */ vue.defineComponent({
18213
18206
  emit,
18214
18207
  slots
18215
18208
  }) {
18209
+ let resizeChanges = [];
18210
+ const emitChanges = () => {
18211
+ if (resizeChanges.length > 0) {
18212
+ emit('row-resize', resizeChanges);
18213
+ resizeChanges = [];
18214
+ }
18215
+ };
18216
18216
  const handleResize = (e, index) => {
18217
- emit('row-resize', {
18217
+ resizeChanges.push({
18218
18218
  index,
18219
18219
  size: e.height
18220
18220
  });
18221
+ vue.nextTick(emitChanges);
18221
18222
  };
18222
18223
  return () => {
18223
18224
  return props.data.map((mergeData, index) => {
@@ -18576,22 +18577,25 @@ const TableBody = /* @__PURE__ */ vue.defineComponent({
18576
18577
  return renderRow(row, row.index);
18577
18578
  })]);
18578
18579
  };
18579
- const handleMergeRowResize = v => {
18580
+ const handleMergeRowResize = changes => {
18580
18581
  if (table.props.rowHeight) return;
18581
- states.list[v.index].rows.forEach(row => {
18582
- const old = row.heightMap[props.fixed || 'main'];
18583
- if (old === v.size) return;
18584
- row.heightMap[props.fixed || 'main'] = v.size;
18585
- const heights = [row.heightMap.main];
18586
- if (states.leftFixedCount) {
18587
- heights.push(row.heightMap.left);
18588
- }
18589
- if (states.rightFixedCount) {
18590
- heights.push(row.heightMap.right);
18591
- }
18592
- if (heights.every(i => !!i)) {
18593
- row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
18594
- }
18582
+ // 批量处理所有尺寸变化
18583
+ changes.forEach(v => {
18584
+ states.list[v.index].rows.forEach(row => {
18585
+ const old = row.heightMap[props.fixed || 'main'];
18586
+ if (old === v.size) return;
18587
+ row.heightMap[props.fixed || 'main'] = v.size;
18588
+ const heights = [row.heightMap.main];
18589
+ if (states.leftFixedCount) {
18590
+ heights.push(row.heightMap.left);
18591
+ }
18592
+ if (states.rightFixedCount) {
18593
+ heights.push(row.heightMap.right);
18594
+ }
18595
+ if (heights.every(i => !!i)) {
18596
+ row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
18597
+ }
18598
+ });
18595
18599
  });
18596
18600
  };
18597
18601
  expose({
@@ -21537,7 +21541,6 @@ const Theme = vue.defineComponent({
21537
21541
  setup(props, { slots }) {
21538
21542
  const themeId = Utils__namespace.getUid("vc-theme");
21539
21543
  const setVar = (name) => {
21540
- /* istanbul ignore next -- @preserve */
21541
21544
  if (!name) return "";
21542
21545
  const globals = VcInstance.options.Theme?.variables;
21543
21546
  return props.variables?.[name] || globals?.[name] || `var(--${name})`;
@@ -21573,7 +21576,6 @@ const Theme = vue.defineComponent({
21573
21576
  }
21574
21577
  });
21575
21578
  const setCss = (attrs) => {
21576
- /* istanbul ignore next -- @preserve */
21577
21579
  if (!attrs || typeof attrs === "string") return attrs;
21578
21580
  let content = "";
21579
21581
  Object.entries(attrs).forEach(([key, val]) => {
@@ -21582,7 +21584,6 @@ const Theme = vue.defineComponent({
21582
21584
  return content;
21583
21585
  };
21584
21586
  const resetPseudo = () => {
21585
- /* istanbul ignore next -- @preserve */
21586
21587
  if (typeof document === "undefined") return;
21587
21588
  const { pseudo } = props;
21588
21589
  if (!pseudo) return Load__namespace.removeStyle(themeId);
package/dist/index.d.ts CHANGED
@@ -8057,7 +8057,7 @@ type: StringConstructor;
8057
8057
  default: string;
8058
8058
  };
8059
8059
  fill: {
8060
- type: BooleanConstructor;
8060
+ type: (BooleanConstructor | ArrayConstructor)[];
8061
8061
  default: boolean;
8062
8062
  };
8063
8063
  }>, () => VNode<RendererNode, RendererElement, {
@@ -8068,14 +8068,14 @@ type: StringConstructor;
8068
8068
  default: string;
8069
8069
  };
8070
8070
  fill: {
8071
- type: BooleanConstructor;
8071
+ type: (BooleanConstructor | ArrayConstructor)[];
8072
8072
  default: boolean;
8073
8073
  };
8074
8074
  }>> & Readonly<{
8075
8075
  onResize?: ((...args: any[]) => any) | undefined;
8076
8076
  }>, {
8077
8077
  tag: string;
8078
- fill: boolean;
8078
+ fill: boolean | unknown[];
8079
8079
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
8080
8080
 
8081
8081
  export declare const MScroller: DefineComponent<ExtractPropTypes< {
@@ -12796,7 +12796,7 @@ type: StringConstructor;
12796
12796
  default: string;
12797
12797
  };
12798
12798
  fill: {
12799
- type: BooleanConstructor;
12799
+ type: (BooleanConstructor | ArrayConstructor)[];
12800
12800
  default: boolean;
12801
12801
  };
12802
12802
  }>, () => VNode<RendererNode, RendererElement, {
@@ -12807,14 +12807,14 @@ type: StringConstructor;
12807
12807
  default: string;
12808
12808
  };
12809
12809
  fill: {
12810
- type: BooleanConstructor;
12810
+ type: (BooleanConstructor | ArrayConstructor)[];
12811
12811
  default: boolean;
12812
12812
  };
12813
12813
  }>> & Readonly<{
12814
12814
  onResize?: ((...args: any[]) => any) | undefined;
12815
12815
  }>, {
12816
12816
  tag: string;
12817
- fill: boolean;
12817
+ fill: boolean | unknown[];
12818
12818
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
12819
12819
 
12820
12820
  export declare const Scroller: DefineComponent<ExtractPropTypes< {