@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 +60 -59
- package/dist/index.d.ts +6 -6
- package/dist/index.iife.js +60 -60
- package/dist/index.js +60 -59
- package/dist/index.style.css +2 -2
- package/dist/index.umd.cjs +60 -60
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,7 +22,6 @@ class VcError {
|
|
|
22
22
|
if (!message || !target) return;
|
|
23
23
|
message = `[@deot/vc - ${target}]: ${message}`;
|
|
24
24
|
this.message = message;
|
|
25
|
-
/* istanbul ignore next -- @preserve */
|
|
26
25
|
process.env.NODE_ENV === "development" && console.error(message);
|
|
27
26
|
}
|
|
28
27
|
}
|
|
@@ -407,7 +406,6 @@ class Manager {
|
|
|
407
406
|
const key = `${prefix}${url}`;
|
|
408
407
|
const cache = window.localStorage.getItem(key);
|
|
409
408
|
let icons = JSON.parse(cache || '""');
|
|
410
|
-
/* istanbul ignore next -- @preserve */
|
|
411
409
|
if (!icons) {
|
|
412
410
|
const data = await new Promise((resolve$) => {
|
|
413
411
|
const request = new XMLHttpRequest();
|
|
@@ -442,7 +440,6 @@ class Manager {
|
|
|
442
440
|
});
|
|
443
441
|
resolve();
|
|
444
442
|
} catch (e) {
|
|
445
|
-
/* istanbul ignore next -- @preserve */
|
|
446
443
|
reject(new VcError("icon", e));
|
|
447
444
|
}
|
|
448
445
|
})();
|
|
@@ -454,7 +451,6 @@ class Manager {
|
|
|
454
451
|
const icons = {};
|
|
455
452
|
setTimeout(() => {
|
|
456
453
|
try {
|
|
457
|
-
/* istanbul ignore next -- @preserve */
|
|
458
454
|
IS_DEV && console.time(url);
|
|
459
455
|
svgStr.replace(svgReg, "$1")?.match(symbolReg)?.forEach(
|
|
460
456
|
(i) => i.replace(basicReg, (_, ...args) => {
|
|
@@ -469,23 +465,19 @@ class Manager {
|
|
|
469
465
|
return "";
|
|
470
466
|
})
|
|
471
467
|
);
|
|
472
|
-
/* istanbul ignore next -- @preserve */
|
|
473
468
|
IS_DEV && console.timeEnd(url);
|
|
474
469
|
resolve(icons);
|
|
475
470
|
} catch (e) {
|
|
476
|
-
/* istanbul ignore next -- @preserve */
|
|
477
471
|
reject(new VcError("icon", e));
|
|
478
472
|
}
|
|
479
473
|
}, 0);
|
|
480
474
|
});
|
|
481
475
|
}
|
|
482
476
|
on(type, fn) {
|
|
483
|
-
/* istanbul ignore next -- @preserve */
|
|
484
477
|
if (typeof type !== "string" || typeof fn !== "function") return this;
|
|
485
478
|
this.events[type] = this.events[type] || [];
|
|
486
479
|
if (this.events[type].length >= 100) {
|
|
487
480
|
delete this.events[type];
|
|
488
|
-
/* istanbul ignore else -- @preserve */
|
|
489
481
|
if (!IS_SERVER) {
|
|
490
482
|
throw new VcError("icon", `${type} nonexistent`);
|
|
491
483
|
}
|
|
@@ -494,7 +486,6 @@ class Manager {
|
|
|
494
486
|
return this;
|
|
495
487
|
}
|
|
496
488
|
off(type, fn) {
|
|
497
|
-
/* istanbul ignore next -- @preserve */
|
|
498
489
|
if (typeof type !== "string" || typeof fn !== "function") return this;
|
|
499
490
|
this.events[type] = this.events[type]?.filter((i) => i != fn);
|
|
500
491
|
return this;
|
|
@@ -758,7 +749,6 @@ const TransitionCollapse = defineComponent({
|
|
|
758
749
|
const handleBeforeEnter = (el) => {
|
|
759
750
|
const duration = props.duration.enter || props.duration;
|
|
760
751
|
el.style.transition = getTransitionStyle(duration);
|
|
761
|
-
/* istanbul ignore next -- @preserve */
|
|
762
752
|
if (!el.dataset) {
|
|
763
753
|
el.dataset = {};
|
|
764
754
|
}
|
|
@@ -775,7 +765,6 @@ const TransitionCollapse = defineComponent({
|
|
|
775
765
|
const next = createNext(done, duration);
|
|
776
766
|
try {
|
|
777
767
|
el.dataset.oldOverflow = el.style.overflow;
|
|
778
|
-
/* istanbul ignore next -- @preserve */
|
|
779
768
|
if (el.scrollHeight !== 0) {
|
|
780
769
|
el.style.height = el.scrollHeight + "px";
|
|
781
770
|
el.style.paddingTop = el.dataset.oldPaddingTop + "px";
|
|
@@ -798,7 +787,6 @@ const TransitionCollapse = defineComponent({
|
|
|
798
787
|
attrs.onAfterEnter?.(el);
|
|
799
788
|
};
|
|
800
789
|
const handleBeforeLeave = (el) => {
|
|
801
|
-
/* istanbul ignore next -- @preserve */
|
|
802
790
|
if (!el.dataset) {
|
|
803
791
|
el.dataset = {};
|
|
804
792
|
}
|
|
@@ -815,7 +803,6 @@ const TransitionCollapse = defineComponent({
|
|
|
815
803
|
const next = createNext(done, duration);
|
|
816
804
|
try {
|
|
817
805
|
const leaveDuration = props.duration.leave || props.duration;
|
|
818
|
-
/* istanbul ignore next -- @preserve */
|
|
819
806
|
if (el.scrollHeight !== 0) {
|
|
820
807
|
el.style.transition = getTransitionStyle(leaveDuration);
|
|
821
808
|
el.style.height = "0px";
|
|
@@ -1441,7 +1428,6 @@ const Debounce = defineComponent({
|
|
|
1441
1428
|
() => {
|
|
1442
1429
|
const { wait, exclude, include } = props;
|
|
1443
1430
|
const ons = Object.entries(attrs).reduce((pre, [key, callback]) => {
|
|
1444
|
-
/* istanbul ignore else -- @preserve */
|
|
1445
1431
|
if ((!exclude || !exclude.test(key)) && (!include || include.test(key)) && typeof callback === "function") {
|
|
1446
1432
|
pre[key] = debounce(callback, wait, {
|
|
1447
1433
|
leading: true,
|
|
@@ -2901,7 +2887,6 @@ class Portal {
|
|
|
2901
2887
|
}
|
|
2902
2888
|
}
|
|
2903
2889
|
} catch (e) {
|
|
2904
|
-
/* istanbul ignore next -- @preserve */
|
|
2905
2890
|
throw new VcError("instance", e);
|
|
2906
2891
|
}
|
|
2907
2892
|
}
|
|
@@ -2912,7 +2897,6 @@ class Portal {
|
|
|
2912
2897
|
try {
|
|
2913
2898
|
Portal.leafs.forEach((leaf) => leaf.destroy());
|
|
2914
2899
|
} catch (e) {
|
|
2915
|
-
/* istanbul ignore next -- @preserve */
|
|
2916
2900
|
throw new VcError("instance", e);
|
|
2917
2901
|
}
|
|
2918
2902
|
}
|
|
@@ -2985,7 +2969,6 @@ class Portal {
|
|
|
2985
2969
|
return (...args) => {
|
|
2986
2970
|
const done = () => {
|
|
2987
2971
|
const leaf = getLeaf();
|
|
2988
|
-
/* istanbul ignore next -- @preserve */
|
|
2989
2972
|
if (!leaf) {
|
|
2990
2973
|
throw new VcError("portal", "实例不存在或已卸载");
|
|
2991
2974
|
}
|
|
@@ -3036,7 +3019,6 @@ class Portal {
|
|
|
3036
3019
|
if (isDestroyed()) return;
|
|
3037
3020
|
onDestroyed?.(...args);
|
|
3038
3021
|
leaf.app?.unmount();
|
|
3039
|
-
/* istanbul ignore else -- @preserve */
|
|
3040
3022
|
if (useAllNodes) {
|
|
3041
3023
|
root?.contains(container) && root.removeChild(container);
|
|
3042
3024
|
} else if (container && container._children) {
|
|
@@ -3064,16 +3046,13 @@ class Portal {
|
|
|
3064
3046
|
const handleExtra = (e) => {
|
|
3065
3047
|
try {
|
|
3066
3048
|
const path = e.path || $.composedPath(e);
|
|
3067
|
-
/* istanbul ignore else -- @preserve */
|
|
3068
3049
|
if (container && e.target && !container.contains(e.target) && !path?.some((item) => Utils$1.eleInRegExp(item, aliveRegExp))) {
|
|
3069
|
-
/* istanbul ignore else -- @preserve */
|
|
3070
3050
|
if (leaf.wrapper && leaf.wrapper?.[aliveVisibleKey]) {
|
|
3071
3051
|
typeof leaf.wrapper[aliveVisibleKey] === "function" ? leaf.wrapper[aliveVisibleKey](false) : leaf.wrapper[aliveVisibleKey] = false;
|
|
3072
3052
|
}
|
|
3073
3053
|
leaveDelay ? setTimeout($onDestroyed, leaveDelay) : $onDestroyed();
|
|
3074
3054
|
}
|
|
3075
3055
|
} catch (error) {
|
|
3076
|
-
/* istanbul ignore next -- @preserve */
|
|
3077
3056
|
throw new VcError("portal", error);
|
|
3078
3057
|
}
|
|
3079
3058
|
};
|
|
@@ -4175,7 +4154,8 @@ const Chart = /* @__PURE__ */ defineComponent({
|
|
|
4175
4154
|
emits: [...EVENTS, 'ready'],
|
|
4176
4155
|
setup(props, {
|
|
4177
4156
|
emit,
|
|
4178
|
-
slots
|
|
4157
|
+
slots,
|
|
4158
|
+
expose
|
|
4179
4159
|
}) {
|
|
4180
4160
|
const instance = getCurrentInstance();
|
|
4181
4161
|
const chart = shallowRef(null);
|
|
@@ -4274,6 +4254,10 @@ const Chart = /* @__PURE__ */ defineComponent({
|
|
|
4274
4254
|
}
|
|
4275
4255
|
});
|
|
4276
4256
|
});
|
|
4257
|
+
expose({
|
|
4258
|
+
chart,
|
|
4259
|
+
refresh
|
|
4260
|
+
});
|
|
4277
4261
|
onUnmounted(destroy);
|
|
4278
4262
|
return () => {
|
|
4279
4263
|
return createVNode("div", {
|
|
@@ -10034,7 +10018,7 @@ const DropdownItem = /* @__PURE__ */ defineComponent({
|
|
|
10034
10018
|
}) {
|
|
10035
10019
|
const owner = getInstance('dropdown', 'dropdownId');
|
|
10036
10020
|
const currentValue = computed(() => {
|
|
10037
|
-
const v = typeof props.value === 'undefined'
|
|
10021
|
+
const v = typeof props.value === 'undefined' ? props.label : props.value;
|
|
10038
10022
|
return v;
|
|
10039
10023
|
});
|
|
10040
10024
|
const classes = computed(() => {
|
|
@@ -12995,7 +12979,7 @@ const props$A = {
|
|
|
12995
12979
|
default: "div"
|
|
12996
12980
|
},
|
|
12997
12981
|
fill: {
|
|
12998
|
-
type: Boolean,
|
|
12982
|
+
type: [Boolean, Array],
|
|
12999
12983
|
default: true
|
|
13000
12984
|
}
|
|
13001
12985
|
};
|
|
@@ -13009,6 +12993,13 @@ const Resizer = defineComponent({
|
|
|
13009
12993
|
const width = ref(0);
|
|
13010
12994
|
const height = ref(0);
|
|
13011
12995
|
const current = ref();
|
|
12996
|
+
const classes = computed(() => {
|
|
12997
|
+
const v = Array.isArray(props.fill) ? props.fill : [props.fill, props.fill];
|
|
12998
|
+
return {
|
|
12999
|
+
"is-fill-width": v[0],
|
|
13000
|
+
"is-fill-height": v[1]
|
|
13001
|
+
};
|
|
13002
|
+
});
|
|
13012
13003
|
const currentExposed = computed(() => {
|
|
13013
13004
|
return {
|
|
13014
13005
|
height: height.value,
|
|
@@ -13059,7 +13050,7 @@ const Resizer = defineComponent({
|
|
|
13059
13050
|
props.tag,
|
|
13060
13051
|
{
|
|
13061
13052
|
ref: current,
|
|
13062
|
-
class: ["vc-resizer",
|
|
13053
|
+
class: ["vc-resizer", classes.value]
|
|
13063
13054
|
},
|
|
13064
13055
|
slots.default?.(currentExposed.value)
|
|
13065
13056
|
);
|
|
@@ -16376,26 +16367,22 @@ const RecycleList = /* @__PURE__ */ defineComponent({
|
|
|
16376
16367
|
const index$ = rebuildDataIndexMap.value[index];
|
|
16377
16368
|
typeof index$ === 'undefined' ? rebuildData.value.unshift(node) : rebuildData.value[index$] = node;
|
|
16378
16369
|
};
|
|
16379
|
-
// 更新item.size
|
|
16380
16370
|
const refreshItemSize = index => {
|
|
16381
16371
|
const current = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[index]] : rebuildData.value[index];
|
|
16382
|
-
if (!current) return; // 受到`removeUnusedPlaceholders`影响,无效的会被回收
|
|
16383
16372
|
|
|
16384
|
-
|
|
16373
|
+
// 受到`removeUnusedPlaceholders`影响,无效的会被回收
|
|
16374
|
+
if (!current) return;
|
|
16375
|
+
const original = Object.assign({}, current);
|
|
16385
16376
|
const dom = preloads.value[index] || curloads.value[props.inverted ? index : index - firstItemIndex.value];
|
|
16386
16377
|
if (dom) {
|
|
16387
16378
|
current.size = dom[K.offsetSize] || placeholderSize.value;
|
|
16388
16379
|
} else if (current) {
|
|
16389
16380
|
current.size = placeholderSize.value;
|
|
16390
16381
|
}
|
|
16391
|
-
|
|
16392
|
-
|
|
16393
|
-
|
|
16394
|
-
|
|
16395
|
-
index: current.id,
|
|
16396
|
-
size: current.size
|
|
16397
|
-
});
|
|
16398
|
-
}
|
|
16382
|
+
return {
|
|
16383
|
+
original,
|
|
16384
|
+
changed: current
|
|
16385
|
+
};
|
|
16399
16386
|
};
|
|
16400
16387
|
const refreshItemPosition = () => {
|
|
16401
16388
|
const sizes = Array.from({
|
|
@@ -16465,18 +16452,24 @@ const RecycleList = /* @__PURE__ */ defineComponent({
|
|
|
16465
16452
|
const refreshLayout = async (start, end) => {
|
|
16466
16453
|
isRefreshLayout = 1;
|
|
16467
16454
|
const promiseTasks = [];
|
|
16455
|
+
const resizeChanges = [];
|
|
16468
16456
|
let item;
|
|
16469
16457
|
for (let i = start; i < end; i++) {
|
|
16470
16458
|
item = props.inverted ? rebuildData.value[rebuildDataIndexMap.value[i]] : rebuildData.value[i];
|
|
16471
|
-
if (item && item.loaded)
|
|
16472
|
-
continue;
|
|
16473
|
-
}
|
|
16459
|
+
if (item && item.loaded) continue;
|
|
16474
16460
|
setItemData(i, originalData[i]);
|
|
16475
|
-
promiseTasks.push(nextTick(() =>
|
|
16461
|
+
promiseTasks.push(nextTick(() => {
|
|
16462
|
+
const e = refreshItemSize(i);
|
|
16463
|
+
e && resizeChanges.push(e.changed);
|
|
16464
|
+
}));
|
|
16476
16465
|
}
|
|
16477
16466
|
await Promise.all(promiseTasks);
|
|
16478
16467
|
refreshItemPosition();
|
|
16479
16468
|
setFirstItemIndex();
|
|
16469
|
+
resizeChanges.length > 0 && emit('row-resize', resizeChanges.map(i => ({
|
|
16470
|
+
size: i.size,
|
|
16471
|
+
index: i.id
|
|
16472
|
+
})));
|
|
16480
16473
|
interrupter.next();
|
|
16481
16474
|
isRefreshLayout = 0;
|
|
16482
16475
|
};
|
|
@@ -18191,11 +18184,19 @@ const NormalList = /* @__PURE__ */ defineComponent({
|
|
|
18191
18184
|
emit,
|
|
18192
18185
|
slots
|
|
18193
18186
|
}) {
|
|
18187
|
+
let resizeChanges = [];
|
|
18188
|
+
const emitChanges = () => {
|
|
18189
|
+
if (resizeChanges.length > 0) {
|
|
18190
|
+
emit('row-resize', resizeChanges);
|
|
18191
|
+
resizeChanges = [];
|
|
18192
|
+
}
|
|
18193
|
+
};
|
|
18194
18194
|
const handleResize = (e, index) => {
|
|
18195
|
-
|
|
18195
|
+
resizeChanges.push({
|
|
18196
18196
|
index,
|
|
18197
18197
|
size: e.height
|
|
18198
18198
|
});
|
|
18199
|
+
nextTick(emitChanges);
|
|
18199
18200
|
};
|
|
18200
18201
|
return () => {
|
|
18201
18202
|
return props.data.map((mergeData, index) => {
|
|
@@ -18554,22 +18555,25 @@ const TableBody = /* @__PURE__ */ defineComponent({
|
|
|
18554
18555
|
return renderRow(row, row.index);
|
|
18555
18556
|
})]);
|
|
18556
18557
|
};
|
|
18557
|
-
const handleMergeRowResize =
|
|
18558
|
+
const handleMergeRowResize = changes => {
|
|
18558
18559
|
if (table.props.rowHeight) return;
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
|
|
18565
|
-
heights
|
|
18566
|
-
|
|
18567
|
-
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18560
|
+
// 批量处理所有尺寸变化
|
|
18561
|
+
changes.forEach(v => {
|
|
18562
|
+
states.list[v.index].rows.forEach(row => {
|
|
18563
|
+
const old = row.heightMap[props.fixed || 'main'];
|
|
18564
|
+
if (old === v.size) return;
|
|
18565
|
+
row.heightMap[props.fixed || 'main'] = v.size;
|
|
18566
|
+
const heights = [row.heightMap.main];
|
|
18567
|
+
if (states.leftFixedCount) {
|
|
18568
|
+
heights.push(row.heightMap.left);
|
|
18569
|
+
}
|
|
18570
|
+
if (states.rightFixedCount) {
|
|
18571
|
+
heights.push(row.heightMap.right);
|
|
18572
|
+
}
|
|
18573
|
+
if (heights.every(i => !!i)) {
|
|
18574
|
+
row.height = Math.max(row.heightMap.left, row.heightMap.main, row.heightMap.right) || '';
|
|
18575
|
+
}
|
|
18576
|
+
});
|
|
18573
18577
|
});
|
|
18574
18578
|
};
|
|
18575
18579
|
expose({
|
|
@@ -21515,7 +21519,6 @@ const Theme = defineComponent({
|
|
|
21515
21519
|
setup(props, { slots }) {
|
|
21516
21520
|
const themeId = Utils.getUid("vc-theme");
|
|
21517
21521
|
const setVar = (name) => {
|
|
21518
|
-
/* istanbul ignore next -- @preserve */
|
|
21519
21522
|
if (!name) return "";
|
|
21520
21523
|
const globals = VcInstance.options.Theme?.variables;
|
|
21521
21524
|
return props.variables?.[name] || globals?.[name] || `var(--${name})`;
|
|
@@ -21551,7 +21554,6 @@ const Theme = defineComponent({
|
|
|
21551
21554
|
}
|
|
21552
21555
|
});
|
|
21553
21556
|
const setCss = (attrs) => {
|
|
21554
|
-
/* istanbul ignore next -- @preserve */
|
|
21555
21557
|
if (!attrs || typeof attrs === "string") return attrs;
|
|
21556
21558
|
let content = "";
|
|
21557
21559
|
Object.entries(attrs).forEach(([key, val]) => {
|
|
@@ -21560,7 +21562,6 @@ const Theme = defineComponent({
|
|
|
21560
21562
|
return content;
|
|
21561
21563
|
};
|
|
21562
21564
|
const resetPseudo = () => {
|
|
21563
|
-
/* istanbul ignore next -- @preserve */
|
|
21564
21565
|
if (typeof document === "undefined") return;
|
|
21565
21566
|
const { pseudo } = props;
|
|
21566
21567
|
if (!pseudo) return Load.removeStyle(themeId);
|