@deot/vc-components 1.0.12 → 1.0.14
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 +77 -48
- package/dist/index.d.ts +34 -6
- package/dist/index.iife.js +77 -48
- package/dist/index.js +77 -48
- package/dist/index.style.css +1 -1
- package/dist/index.umd.cjs +77 -48
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -759,7 +759,7 @@
|
|
|
759
759
|
|
|
760
760
|
// [color, borderColor, backgroundColor], -> CSS
|
|
761
761
|
const THEME_MAP = {
|
|
762
|
-
info: ['#
|
|
762
|
+
info: ['#2B72FD', '#91d5ff', '#e6f7ff'],
|
|
763
763
|
success: ['#52c41a', '#b7eb8f', '#f6ffed'],
|
|
764
764
|
error: ['#ed4014', '#ffb08f', '#fbe9e9'],
|
|
765
765
|
warning: ['#ffbf00', '#ffe58f', '#fffbe6']
|
|
@@ -17037,7 +17037,7 @@
|
|
|
17037
17037
|
validator: (v) => /(small|medium|large)/.test(v),
|
|
17038
17038
|
default: "small"
|
|
17039
17039
|
},
|
|
17040
|
-
|
|
17040
|
+
contentClass: [Object, String],
|
|
17041
17041
|
width: {
|
|
17042
17042
|
type: Number
|
|
17043
17043
|
},
|
|
@@ -17086,6 +17086,10 @@
|
|
|
17086
17086
|
type: Boolean,
|
|
17087
17087
|
default: true
|
|
17088
17088
|
},
|
|
17089
|
+
border: {
|
|
17090
|
+
type: Boolean,
|
|
17091
|
+
default: false
|
|
17092
|
+
},
|
|
17089
17093
|
/**
|
|
17090
17094
|
* 兼容portal设计, 实现Promise方式
|
|
17091
17095
|
*/
|
|
@@ -17383,7 +17387,8 @@
|
|
|
17383
17387
|
"class": [{
|
|
17384
17388
|
'is-drag': props.draggable,
|
|
17385
17389
|
'is-large': props.size === 'large' || props.size === 'medium',
|
|
17386
|
-
'
|
|
17390
|
+
'has-footer': props.footer && (props.cancelText || props.okText),
|
|
17391
|
+
'has-border': props.border
|
|
17387
17392
|
}, 'vc-modal__container'],
|
|
17388
17393
|
"style": [basicStyle.value, draggableStyle.value]
|
|
17389
17394
|
}, [vue.createVNode("div", {
|
|
@@ -17415,7 +17420,7 @@
|
|
|
17415
17420
|
"height": isTransitionEnd.value ? row.height : void 0,
|
|
17416
17421
|
"contentClass": [{
|
|
17417
17422
|
'is-confirm': props.mode
|
|
17418
|
-
}, props.
|
|
17423
|
+
}, props.contentClass, 'vc-modal__content']
|
|
17419
17424
|
}, {
|
|
17420
17425
|
default: () => [typeof props.content === 'string' ? vue.createVNode("div", {
|
|
17421
17426
|
"innerHTML": props.content
|
|
@@ -18896,7 +18901,7 @@
|
|
|
18896
18901
|
color: {
|
|
18897
18902
|
type: [Object, String],
|
|
18898
18903
|
default: () => ({
|
|
18899
|
-
normal: "#
|
|
18904
|
+
normal: "#2B72FD",
|
|
18900
18905
|
success: "#52c41a",
|
|
18901
18906
|
error: "#f5222d"
|
|
18902
18907
|
})
|
|
@@ -20250,6 +20255,8 @@
|
|
|
20250
20255
|
});
|
|
20251
20256
|
if (!originalData.length) {
|
|
20252
20257
|
rebuildData.value = [];
|
|
20258
|
+
} else {
|
|
20259
|
+
rebuildData.value = originalData.slice();
|
|
20253
20260
|
}
|
|
20254
20261
|
offsetPageSize.value = 0;
|
|
20255
20262
|
await refreshLayout(0, originalData.length);
|
|
@@ -38603,17 +38610,24 @@
|
|
|
38603
38610
|
const dataInstanceChanged = this.states._data !== data;
|
|
38604
38611
|
this.states._data = data;
|
|
38605
38612
|
this.states.data = data;
|
|
38613
|
+
const caches = /* @__PURE__ */ new Map();
|
|
38614
|
+
this.states.list.forEach((item) => {
|
|
38615
|
+
item.rows.forEach((row) => {
|
|
38616
|
+
caches.set(row.data, row);
|
|
38617
|
+
});
|
|
38618
|
+
});
|
|
38606
38619
|
this.states.list = data.reduce((pre, row, index) => {
|
|
38620
|
+
const cache = caches.get(row) || { heightMap: {} };
|
|
38607
38621
|
pre.push({
|
|
38608
38622
|
rows: [
|
|
38609
38623
|
{
|
|
38610
38624
|
index,
|
|
38611
38625
|
data: row,
|
|
38612
|
-
height: "",
|
|
38626
|
+
height: cache.height || "",
|
|
38613
38627
|
heightMap: {
|
|
38614
|
-
left: "",
|
|
38615
|
-
main: "",
|
|
38616
|
-
right: ""
|
|
38628
|
+
left: cache.heightMap.left || "",
|
|
38629
|
+
main: cache.heightMap.main || "",
|
|
38630
|
+
right: cache.heightMap.right || ""
|
|
38617
38631
|
}
|
|
38618
38632
|
}
|
|
38619
38633
|
],
|
|
@@ -38621,6 +38635,7 @@
|
|
|
38621
38635
|
});
|
|
38622
38636
|
return pre;
|
|
38623
38637
|
}, []);
|
|
38638
|
+
caches.clear();
|
|
38624
38639
|
this.current.update();
|
|
38625
38640
|
this.expand.update();
|
|
38626
38641
|
if (!this.states.reserveSelection) {
|
|
@@ -38754,12 +38769,12 @@
|
|
|
38754
38769
|
*/
|
|
38755
38770
|
cleanSelection() {
|
|
38756
38771
|
const { primaryKey } = this.table.props;
|
|
38757
|
-
const { selection = [] } = this.states;
|
|
38772
|
+
const { selection = [], data } = this.states;
|
|
38758
38773
|
let deleted;
|
|
38759
38774
|
if (primaryKey) {
|
|
38760
38775
|
deleted = [];
|
|
38761
38776
|
const selectedMap = getValuesMap(selection, primaryKey);
|
|
38762
|
-
const dataMap = getValuesMap(
|
|
38777
|
+
const dataMap = getValuesMap(data, primaryKey);
|
|
38763
38778
|
for (const key in selectedMap) {
|
|
38764
38779
|
if (hasOwn$1(selectedMap, key) && !dataMap[key]) {
|
|
38765
38780
|
deleted.push(selectedMap[key].row);
|
|
@@ -38934,8 +38949,10 @@
|
|
|
38934
38949
|
const NormalList = /* @__PURE__ */ vue.defineComponent({
|
|
38935
38950
|
name: COMPONENT_NAME$h,
|
|
38936
38951
|
props: {
|
|
38937
|
-
data:
|
|
38938
|
-
|
|
38952
|
+
data: {
|
|
38953
|
+
type: Array,
|
|
38954
|
+
default: () => []
|
|
38955
|
+
}
|
|
38939
38956
|
},
|
|
38940
38957
|
emits: ['row-resize'],
|
|
38941
38958
|
setup(props, {
|
|
@@ -38977,7 +38994,7 @@
|
|
|
38977
38994
|
expose
|
|
38978
38995
|
}) {
|
|
38979
38996
|
const instance = vue.getCurrentInstance();
|
|
38980
|
-
const table =
|
|
38997
|
+
const table = vue.inject('vc-table');
|
|
38981
38998
|
const states = useStates({
|
|
38982
38999
|
data: 'data',
|
|
38983
39000
|
list: 'list',
|
|
@@ -39101,7 +39118,7 @@
|
|
|
39101
39118
|
column,
|
|
39102
39119
|
row
|
|
39103
39120
|
};
|
|
39104
|
-
table.
|
|
39121
|
+
table.hoverState.value = hoverState;
|
|
39105
39122
|
table.emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, e);
|
|
39106
39123
|
}
|
|
39107
39124
|
|
|
@@ -39134,7 +39151,7 @@
|
|
|
39134
39151
|
const handleCellMouseLeave = e => {
|
|
39135
39152
|
const cell = getCell(e);
|
|
39136
39153
|
if (!cell) return;
|
|
39137
|
-
const oldHoverState = table.
|
|
39154
|
+
const oldHoverState = table.hoverState.value || {};
|
|
39138
39155
|
table.emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, e);
|
|
39139
39156
|
};
|
|
39140
39157
|
const handleMouseEnter = debounce$1(index => {
|
|
@@ -39172,6 +39189,7 @@
|
|
|
39172
39189
|
columns
|
|
39173
39190
|
} = states;
|
|
39174
39191
|
const key = getValueOfRow(row, rowIndex);
|
|
39192
|
+
const selected = props.store.isSelected(row);
|
|
39175
39193
|
return vue.createVNode("div", {
|
|
39176
39194
|
"key": key,
|
|
39177
39195
|
"class": [getRowClass(row, rowIndex), 'vc-table__tr'],
|
|
@@ -39192,10 +39210,12 @@
|
|
|
39192
39210
|
};
|
|
39193
39211
|
if (columnsHidden.value[columnIndex]) {
|
|
39194
39212
|
return vue.createVNode("div", {
|
|
39213
|
+
"key": column.id,
|
|
39195
39214
|
"style": [sizeStyle]
|
|
39196
39215
|
}, null);
|
|
39197
39216
|
}
|
|
39198
39217
|
return vue.createVNode("div", {
|
|
39218
|
+
"key": column.id,
|
|
39199
39219
|
"style": [getCellStyle(rowIndex, columnIndex, row, column), sizeStyle],
|
|
39200
39220
|
"class": [getCellClass(rowIndex, columnIndex, row, column), 'vc-table__td'],
|
|
39201
39221
|
"onMouseenter": e => handleCellMouseEnter(e, row),
|
|
@@ -39205,7 +39225,8 @@
|
|
|
39205
39225
|
column,
|
|
39206
39226
|
rowIndex,
|
|
39207
39227
|
columnIndex,
|
|
39208
|
-
store: props.store
|
|
39228
|
+
store: props.store,
|
|
39229
|
+
selected
|
|
39209
39230
|
})]);
|
|
39210
39231
|
})]);
|
|
39211
39232
|
};
|
|
@@ -39239,7 +39260,7 @@
|
|
|
39239
39260
|
wrapper,
|
|
39240
39261
|
getRootElement: () => instance.vnode.el
|
|
39241
39262
|
});
|
|
39242
|
-
const layout = table.
|
|
39263
|
+
const layout = table.layout;
|
|
39243
39264
|
return () => {
|
|
39244
39265
|
return vue.createVNode("div", {
|
|
39245
39266
|
"class": "vc-table__body"
|
|
@@ -39249,7 +39270,7 @@
|
|
|
39249
39270
|
"disabled": true,
|
|
39250
39271
|
"class": "vc-table__tbody",
|
|
39251
39272
|
"scrollerOptions": {
|
|
39252
|
-
barTo: `.${table.
|
|
39273
|
+
barTo: `.${table.tableId}`,
|
|
39253
39274
|
native: false,
|
|
39254
39275
|
always: false,
|
|
39255
39276
|
showBar: !props.fixed,
|
|
@@ -39301,7 +39322,7 @@
|
|
|
39301
39322
|
}
|
|
39302
39323
|
},
|
|
39303
39324
|
setup(props) {
|
|
39304
|
-
const table =
|
|
39325
|
+
const table = vue.inject('vc-table');
|
|
39305
39326
|
const instance = vue.getCurrentInstance();
|
|
39306
39327
|
const draggingColumn = vue.ref(null);
|
|
39307
39328
|
const dragging = vue.ref(false);
|
|
@@ -39408,7 +39429,7 @@
|
|
|
39408
39429
|
/* istanbul ignore if */
|
|
39409
39430
|
if (draggingColumn.value && props.border) {
|
|
39410
39431
|
dragging.value = true;
|
|
39411
|
-
table.
|
|
39432
|
+
table.resizeProxyVisible.value = true;
|
|
39412
39433
|
const tableEl = table.vnode.el;
|
|
39413
39434
|
const tableLeft = tableEl.getBoundingClientRect().left;
|
|
39414
39435
|
const columnEl = instance.vnode.el.querySelector(`.vc-table__th.${column.id}`);
|
|
@@ -39421,7 +39442,7 @@
|
|
|
39421
39442
|
startColumnLeft: columnRect.left - tableLeft,
|
|
39422
39443
|
tableLeft
|
|
39423
39444
|
};
|
|
39424
|
-
const resizeProxy = table.
|
|
39445
|
+
const resizeProxy = table.resizeProxy.value;
|
|
39425
39446
|
resizeProxy.style.left = dragState.value.startLeft + 'px';
|
|
39426
39447
|
document.onselectstart = () => false;
|
|
39427
39448
|
document.ondragstart = () => false;
|
|
@@ -39780,7 +39801,8 @@
|
|
|
39780
39801
|
emits: ['select', 'select-all', 'selection-change', 'cell-mouse-enter', 'cell-mouse-leave', 'cell-click', 'cell-dblclick', 'row-click', 'row-contextmenu', 'row-dblclick', 'header-click', 'header-contextmenu', 'current-change', 'header-dragend ', 'expand-change', 'sort-change'],
|
|
39781
39802
|
setup(props, {
|
|
39782
39803
|
slots,
|
|
39783
|
-
expose
|
|
39804
|
+
expose,
|
|
39805
|
+
emit
|
|
39784
39806
|
}) {
|
|
39785
39807
|
const instance = vue.getCurrentInstance();
|
|
39786
39808
|
const store = new Store({
|
|
@@ -39896,7 +39918,8 @@
|
|
|
39896
39918
|
};
|
|
39897
39919
|
}
|
|
39898
39920
|
return {
|
|
39899
|
-
height: layout.states.viewportHeight ? layout.states.viewportHeight + 'px' : ''
|
|
39921
|
+
height: layout.states.viewportHeight ? layout.states.viewportHeight + 'px' : '',
|
|
39922
|
+
bottom: 0
|
|
39900
39923
|
};
|
|
39901
39924
|
}
|
|
39902
39925
|
});
|
|
@@ -40100,8 +40123,8 @@
|
|
|
40100
40123
|
}, {
|
|
40101
40124
|
immediate: true
|
|
40102
40125
|
});
|
|
40103
|
-
vue.watch(() => props.data,
|
|
40104
|
-
store.setData(
|
|
40126
|
+
vue.watch(() => [props.data, props.data.length], () => {
|
|
40127
|
+
store.setData(props.data);
|
|
40105
40128
|
isReady.value && vue.nextTick(refreshLayout);
|
|
40106
40129
|
}, {
|
|
40107
40130
|
immediate: true
|
|
@@ -40139,7 +40162,7 @@
|
|
|
40139
40162
|
isUnMount = true;
|
|
40140
40163
|
unbindEvents();
|
|
40141
40164
|
});
|
|
40142
|
-
|
|
40165
|
+
const exposed = {
|
|
40143
40166
|
bodyXWrapper,
|
|
40144
40167
|
bodyYWrapper,
|
|
40145
40168
|
tableId,
|
|
@@ -40161,8 +40184,12 @@
|
|
|
40161
40184
|
isReady,
|
|
40162
40185
|
hoverState,
|
|
40163
40186
|
renderExpanded,
|
|
40164
|
-
hiddenColumns
|
|
40165
|
-
|
|
40187
|
+
hiddenColumns,
|
|
40188
|
+
props,
|
|
40189
|
+
emit
|
|
40190
|
+
};
|
|
40191
|
+
expose(exposed);
|
|
40192
|
+
vue.provide('vc-table', exposed);
|
|
40166
40193
|
return () => {
|
|
40167
40194
|
return vue.createVNode("div", {
|
|
40168
40195
|
"class": [classes.value, tableId, 'vc-table'],
|
|
@@ -40198,7 +40225,9 @@
|
|
|
40198
40225
|
}, null), props.data.length === 0 && vue.createVNode("div", {
|
|
40199
40226
|
"ref": emptyBlock,
|
|
40200
40227
|
"style": bodyWidthStyle.value,
|
|
40201
|
-
"class":
|
|
40228
|
+
"class": [{
|
|
40229
|
+
'is-absolute': !!props.height
|
|
40230
|
+
}, 'vc-table__empty-wrapper']
|
|
40202
40231
|
}, [vue.createVNode("span", {
|
|
40203
40232
|
"class": "vc-table__empty-text"
|
|
40204
40233
|
}, [slots.empty ? slots.empty() : props.emptyText || '暂无数据'])]), slots.append && vue.createVNode("div", {
|
|
@@ -40349,10 +40378,11 @@
|
|
|
40349
40378
|
column,
|
|
40350
40379
|
store,
|
|
40351
40380
|
rowIndex,
|
|
40352
|
-
level
|
|
40381
|
+
level,
|
|
40382
|
+
selected
|
|
40353
40383
|
}) {
|
|
40354
40384
|
return vue.withDirectives(vue.createVNode(Checkbox, {
|
|
40355
|
-
"modelValue":
|
|
40385
|
+
"modelValue": selected,
|
|
40356
40386
|
"disabled": column.selectable ? !column.selectable.call(null, row, rowIndex) : false,
|
|
40357
40387
|
"onChange": () => store.rowSelectedChanged(row),
|
|
40358
40388
|
"onClick": e => e.stopPropagation()
|
|
@@ -40525,15 +40555,14 @@
|
|
|
40525
40555
|
tooltip: [String, Function]
|
|
40526
40556
|
},
|
|
40527
40557
|
setup(props, {
|
|
40528
|
-
slots
|
|
40529
|
-
expose
|
|
40558
|
+
slots
|
|
40530
40559
|
}) {
|
|
40531
40560
|
const instance = vue.getCurrentInstance();
|
|
40532
|
-
const table =
|
|
40533
|
-
const parent =
|
|
40561
|
+
const table = vue.inject('vc-table');
|
|
40562
|
+
const parent = vue.inject('vc-table-column', table);
|
|
40534
40563
|
const isSubColumn = table !== parent; // 用于多久表头
|
|
40535
40564
|
|
|
40536
|
-
const columnId = vue.ref((parent.
|
|
40565
|
+
const columnId = vue.ref((parent.tableId || parent.columnId) + getUid('column'));
|
|
40537
40566
|
const realWidth = vue.computed(() => {
|
|
40538
40567
|
return parseWidth(props.width);
|
|
40539
40568
|
});
|
|
@@ -40632,7 +40661,7 @@
|
|
|
40632
40661
|
column.renderCell = data => vue.createVNode("div", {
|
|
40633
40662
|
"class": "vc-table__cell"
|
|
40634
40663
|
}, [originRenderCell(data)]);
|
|
40635
|
-
table.
|
|
40664
|
+
table.renderExpanded.value = data => {
|
|
40636
40665
|
return slots.default ? slots.default(data) : slots.default;
|
|
40637
40666
|
};
|
|
40638
40667
|
} else {
|
|
@@ -40651,7 +40680,7 @@
|
|
|
40651
40680
|
style: {}
|
|
40652
40681
|
};
|
|
40653
40682
|
// 存在树形数组,且当前行无箭头图标且处于当前展开列,表格对齐
|
|
40654
|
-
if (!isEmpty$1(table.
|
|
40683
|
+
if (!isEmpty$1(table.store.states.treeData) && !prefix && data.isExpandColumn) {
|
|
40655
40684
|
prefix = vue.createVNode("span", {
|
|
40656
40685
|
"class": "vc-table-un-expand__indent"
|
|
40657
40686
|
}, null);
|
|
@@ -40694,15 +40723,15 @@
|
|
|
40694
40723
|
|
|
40695
40724
|
// 影响布局
|
|
40696
40725
|
vue.watch(() => props.fixed, () => {
|
|
40697
|
-
table.
|
|
40726
|
+
table.store.scheduleLayout(true);
|
|
40698
40727
|
});
|
|
40699
40728
|
vue.watch(() => realWidth.value, v => {
|
|
40700
40729
|
columnConfig['width'] = v;
|
|
40701
40730
|
columnConfig['realWidth'] = v;
|
|
40702
|
-
table.
|
|
40731
|
+
table.store.scheduleLayout(false);
|
|
40703
40732
|
});
|
|
40704
40733
|
vue.watch(() => realMinWidth.value, () => {
|
|
40705
|
-
table.
|
|
40734
|
+
table.store.scheduleLayout(false);
|
|
40706
40735
|
});
|
|
40707
40736
|
};
|
|
40708
40737
|
vue.onBeforeMount(() => {
|
|
@@ -40710,17 +40739,17 @@
|
|
|
40710
40739
|
registerWatchers();
|
|
40711
40740
|
});
|
|
40712
40741
|
vue.onMounted(() => {
|
|
40713
|
-
const children = isSubColumn ? parent.vnode.el.children : parent.
|
|
40742
|
+
const children = isSubColumn ? parent.vnode.el.children : parent.hiddenColumns.value.children;
|
|
40714
40743
|
|
|
40715
40744
|
// DOM上
|
|
40716
40745
|
const columnIndex = [...children].indexOf(instance.vnode.el);
|
|
40717
|
-
table.
|
|
40746
|
+
table.store.insertColumn(columnConfig, columnIndex, isSubColumn && parent.columnConfig);
|
|
40718
40747
|
});
|
|
40719
40748
|
vue.onUnmounted(() => {
|
|
40720
40749
|
if (!instance.parent) return;
|
|
40721
|
-
table.
|
|
40750
|
+
table.store.removeColumn(columnConfig, isSubColumn && parent.columnConfig);
|
|
40722
40751
|
});
|
|
40723
|
-
|
|
40752
|
+
vue.provide('vc-table-column', {
|
|
40724
40753
|
columnId,
|
|
40725
40754
|
columnConfig
|
|
40726
40755
|
});
|
|
@@ -40961,7 +40990,7 @@
|
|
|
40961
40990
|
if (!Array.from(items).length) return;
|
|
40962
40991
|
let offset = 0;
|
|
40963
40992
|
if (index > 0) {
|
|
40964
|
-
const gutter =
|
|
40993
|
+
const gutter = 12; // margin-right -> 12px
|
|
40965
40994
|
for (let i = 0; i < index; i++) {
|
|
40966
40995
|
offset += parseFloat(items[i].offsetWidth) + gutter;
|
|
40967
40996
|
}
|
|
@@ -41033,7 +41062,7 @@
|
|
|
41033
41062
|
}, [slots.extra?.()]), vue.createVNode("div", {
|
|
41034
41063
|
"ref": wrapper,
|
|
41035
41064
|
"style": {
|
|
41036
|
-
padding: tabs.scrollable.value
|
|
41065
|
+
padding: tabs.scrollable.value ? '0 24px' : 0
|
|
41037
41066
|
},
|
|
41038
41067
|
"class": "vc-tabs__bar"
|
|
41039
41068
|
}, [tabs.scrollable.value && vue.createVNode(Icon, {
|