@deot/vc-components 1.0.12 → 1.0.13
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 +62 -41
- package/dist/index.iife.js +62 -41
- package/dist/index.js +62 -41
- package/dist/index.style.css +1 -1
- package/dist/index.umd.cjs +62 -41
- 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']
|
|
@@ -18896,7 +18896,7 @@
|
|
|
18896
18896
|
color: {
|
|
18897
18897
|
type: [Object, String],
|
|
18898
18898
|
default: () => ({
|
|
18899
|
-
normal: "#
|
|
18899
|
+
normal: "#2B72FD",
|
|
18900
18900
|
success: "#52c41a",
|
|
18901
18901
|
error: "#f5222d"
|
|
18902
18902
|
})
|
|
@@ -20250,6 +20250,8 @@
|
|
|
20250
20250
|
});
|
|
20251
20251
|
if (!originalData.length) {
|
|
20252
20252
|
rebuildData.value = [];
|
|
20253
|
+
} else {
|
|
20254
|
+
rebuildData.value = originalData.slice();
|
|
20253
20255
|
}
|
|
20254
20256
|
offsetPageSize.value = 0;
|
|
20255
20257
|
await refreshLayout(0, originalData.length);
|
|
@@ -38603,17 +38605,24 @@
|
|
|
38603
38605
|
const dataInstanceChanged = this.states._data !== data;
|
|
38604
38606
|
this.states._data = data;
|
|
38605
38607
|
this.states.data = data;
|
|
38608
|
+
const caches = /* @__PURE__ */ new Map();
|
|
38609
|
+
this.states.list.forEach((item) => {
|
|
38610
|
+
item.rows.forEach((row) => {
|
|
38611
|
+
caches.set(row.data, row);
|
|
38612
|
+
});
|
|
38613
|
+
});
|
|
38606
38614
|
this.states.list = data.reduce((pre, row, index) => {
|
|
38615
|
+
const cache = caches.get(row) || { heightMap: {} };
|
|
38607
38616
|
pre.push({
|
|
38608
38617
|
rows: [
|
|
38609
38618
|
{
|
|
38610
38619
|
index,
|
|
38611
38620
|
data: row,
|
|
38612
|
-
height: "",
|
|
38621
|
+
height: cache.height || "",
|
|
38613
38622
|
heightMap: {
|
|
38614
|
-
left: "",
|
|
38615
|
-
main: "",
|
|
38616
|
-
right: ""
|
|
38623
|
+
left: cache.heightMap.left || "",
|
|
38624
|
+
main: cache.heightMap.main || "",
|
|
38625
|
+
right: cache.heightMap.right || ""
|
|
38617
38626
|
}
|
|
38618
38627
|
}
|
|
38619
38628
|
],
|
|
@@ -38621,6 +38630,7 @@
|
|
|
38621
38630
|
});
|
|
38622
38631
|
return pre;
|
|
38623
38632
|
}, []);
|
|
38633
|
+
caches.clear();
|
|
38624
38634
|
this.current.update();
|
|
38625
38635
|
this.expand.update();
|
|
38626
38636
|
if (!this.states.reserveSelection) {
|
|
@@ -38754,12 +38764,12 @@
|
|
|
38754
38764
|
*/
|
|
38755
38765
|
cleanSelection() {
|
|
38756
38766
|
const { primaryKey } = this.table.props;
|
|
38757
|
-
const { selection = [] } = this.states;
|
|
38767
|
+
const { selection = [], data } = this.states;
|
|
38758
38768
|
let deleted;
|
|
38759
38769
|
if (primaryKey) {
|
|
38760
38770
|
deleted = [];
|
|
38761
38771
|
const selectedMap = getValuesMap(selection, primaryKey);
|
|
38762
|
-
const dataMap = getValuesMap(
|
|
38772
|
+
const dataMap = getValuesMap(data, primaryKey);
|
|
38763
38773
|
for (const key in selectedMap) {
|
|
38764
38774
|
if (hasOwn$1(selectedMap, key) && !dataMap[key]) {
|
|
38765
38775
|
deleted.push(selectedMap[key].row);
|
|
@@ -38934,8 +38944,10 @@
|
|
|
38934
38944
|
const NormalList = /* @__PURE__ */ vue.defineComponent({
|
|
38935
38945
|
name: COMPONENT_NAME$h,
|
|
38936
38946
|
props: {
|
|
38937
|
-
data:
|
|
38938
|
-
|
|
38947
|
+
data: {
|
|
38948
|
+
type: Array,
|
|
38949
|
+
default: () => []
|
|
38950
|
+
}
|
|
38939
38951
|
},
|
|
38940
38952
|
emits: ['row-resize'],
|
|
38941
38953
|
setup(props, {
|
|
@@ -38977,7 +38989,7 @@
|
|
|
38977
38989
|
expose
|
|
38978
38990
|
}) {
|
|
38979
38991
|
const instance = vue.getCurrentInstance();
|
|
38980
|
-
const table =
|
|
38992
|
+
const table = vue.inject('vc-table');
|
|
38981
38993
|
const states = useStates({
|
|
38982
38994
|
data: 'data',
|
|
38983
38995
|
list: 'list',
|
|
@@ -39101,7 +39113,7 @@
|
|
|
39101
39113
|
column,
|
|
39102
39114
|
row
|
|
39103
39115
|
};
|
|
39104
|
-
table.
|
|
39116
|
+
table.hoverState.value = hoverState;
|
|
39105
39117
|
table.emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, e);
|
|
39106
39118
|
}
|
|
39107
39119
|
|
|
@@ -39134,7 +39146,7 @@
|
|
|
39134
39146
|
const handleCellMouseLeave = e => {
|
|
39135
39147
|
const cell = getCell(e);
|
|
39136
39148
|
if (!cell) return;
|
|
39137
|
-
const oldHoverState = table.
|
|
39149
|
+
const oldHoverState = table.hoverState.value || {};
|
|
39138
39150
|
table.emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, e);
|
|
39139
39151
|
};
|
|
39140
39152
|
const handleMouseEnter = debounce$1(index => {
|
|
@@ -39172,6 +39184,7 @@
|
|
|
39172
39184
|
columns
|
|
39173
39185
|
} = states;
|
|
39174
39186
|
const key = getValueOfRow(row, rowIndex);
|
|
39187
|
+
const selected = props.store.isSelected(row);
|
|
39175
39188
|
return vue.createVNode("div", {
|
|
39176
39189
|
"key": key,
|
|
39177
39190
|
"class": [getRowClass(row, rowIndex), 'vc-table__tr'],
|
|
@@ -39192,10 +39205,12 @@
|
|
|
39192
39205
|
};
|
|
39193
39206
|
if (columnsHidden.value[columnIndex]) {
|
|
39194
39207
|
return vue.createVNode("div", {
|
|
39208
|
+
"key": column.id,
|
|
39195
39209
|
"style": [sizeStyle]
|
|
39196
39210
|
}, null);
|
|
39197
39211
|
}
|
|
39198
39212
|
return vue.createVNode("div", {
|
|
39213
|
+
"key": column.id,
|
|
39199
39214
|
"style": [getCellStyle(rowIndex, columnIndex, row, column), sizeStyle],
|
|
39200
39215
|
"class": [getCellClass(rowIndex, columnIndex, row, column), 'vc-table__td'],
|
|
39201
39216
|
"onMouseenter": e => handleCellMouseEnter(e, row),
|
|
@@ -39205,7 +39220,8 @@
|
|
|
39205
39220
|
column,
|
|
39206
39221
|
rowIndex,
|
|
39207
39222
|
columnIndex,
|
|
39208
|
-
store: props.store
|
|
39223
|
+
store: props.store,
|
|
39224
|
+
selected
|
|
39209
39225
|
})]);
|
|
39210
39226
|
})]);
|
|
39211
39227
|
};
|
|
@@ -39239,7 +39255,7 @@
|
|
|
39239
39255
|
wrapper,
|
|
39240
39256
|
getRootElement: () => instance.vnode.el
|
|
39241
39257
|
});
|
|
39242
|
-
const layout = table.
|
|
39258
|
+
const layout = table.layout;
|
|
39243
39259
|
return () => {
|
|
39244
39260
|
return vue.createVNode("div", {
|
|
39245
39261
|
"class": "vc-table__body"
|
|
@@ -39249,7 +39265,7 @@
|
|
|
39249
39265
|
"disabled": true,
|
|
39250
39266
|
"class": "vc-table__tbody",
|
|
39251
39267
|
"scrollerOptions": {
|
|
39252
|
-
barTo: `.${table.
|
|
39268
|
+
barTo: `.${table.tableId}`,
|
|
39253
39269
|
native: false,
|
|
39254
39270
|
always: false,
|
|
39255
39271
|
showBar: !props.fixed,
|
|
@@ -39301,7 +39317,7 @@
|
|
|
39301
39317
|
}
|
|
39302
39318
|
},
|
|
39303
39319
|
setup(props) {
|
|
39304
|
-
const table =
|
|
39320
|
+
const table = vue.inject('vc-table');
|
|
39305
39321
|
const instance = vue.getCurrentInstance();
|
|
39306
39322
|
const draggingColumn = vue.ref(null);
|
|
39307
39323
|
const dragging = vue.ref(false);
|
|
@@ -39408,7 +39424,7 @@
|
|
|
39408
39424
|
/* istanbul ignore if */
|
|
39409
39425
|
if (draggingColumn.value && props.border) {
|
|
39410
39426
|
dragging.value = true;
|
|
39411
|
-
table.
|
|
39427
|
+
table.resizeProxyVisible.value = true;
|
|
39412
39428
|
const tableEl = table.vnode.el;
|
|
39413
39429
|
const tableLeft = tableEl.getBoundingClientRect().left;
|
|
39414
39430
|
const columnEl = instance.vnode.el.querySelector(`.vc-table__th.${column.id}`);
|
|
@@ -39421,7 +39437,7 @@
|
|
|
39421
39437
|
startColumnLeft: columnRect.left - tableLeft,
|
|
39422
39438
|
tableLeft
|
|
39423
39439
|
};
|
|
39424
|
-
const resizeProxy = table.
|
|
39440
|
+
const resizeProxy = table.resizeProxy.value;
|
|
39425
39441
|
resizeProxy.style.left = dragState.value.startLeft + 'px';
|
|
39426
39442
|
document.onselectstart = () => false;
|
|
39427
39443
|
document.ondragstart = () => false;
|
|
@@ -39780,7 +39796,8 @@
|
|
|
39780
39796
|
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
39797
|
setup(props, {
|
|
39782
39798
|
slots,
|
|
39783
|
-
expose
|
|
39799
|
+
expose,
|
|
39800
|
+
emit
|
|
39784
39801
|
}) {
|
|
39785
39802
|
const instance = vue.getCurrentInstance();
|
|
39786
39803
|
const store = new Store({
|
|
@@ -40100,8 +40117,8 @@
|
|
|
40100
40117
|
}, {
|
|
40101
40118
|
immediate: true
|
|
40102
40119
|
});
|
|
40103
|
-
vue.watch(() => props.data,
|
|
40104
|
-
store.setData(
|
|
40120
|
+
vue.watch(() => [props.data, props.data.length], () => {
|
|
40121
|
+
store.setData(props.data);
|
|
40105
40122
|
isReady.value && vue.nextTick(refreshLayout);
|
|
40106
40123
|
}, {
|
|
40107
40124
|
immediate: true
|
|
@@ -40139,7 +40156,7 @@
|
|
|
40139
40156
|
isUnMount = true;
|
|
40140
40157
|
unbindEvents();
|
|
40141
40158
|
});
|
|
40142
|
-
|
|
40159
|
+
const exposed = {
|
|
40143
40160
|
bodyXWrapper,
|
|
40144
40161
|
bodyYWrapper,
|
|
40145
40162
|
tableId,
|
|
@@ -40161,8 +40178,12 @@
|
|
|
40161
40178
|
isReady,
|
|
40162
40179
|
hoverState,
|
|
40163
40180
|
renderExpanded,
|
|
40164
|
-
hiddenColumns
|
|
40165
|
-
|
|
40181
|
+
hiddenColumns,
|
|
40182
|
+
props,
|
|
40183
|
+
emit
|
|
40184
|
+
};
|
|
40185
|
+
expose(exposed);
|
|
40186
|
+
vue.provide('vc-table', exposed);
|
|
40166
40187
|
return () => {
|
|
40167
40188
|
return vue.createVNode("div", {
|
|
40168
40189
|
"class": [classes.value, tableId, 'vc-table'],
|
|
@@ -40349,10 +40370,11 @@
|
|
|
40349
40370
|
column,
|
|
40350
40371
|
store,
|
|
40351
40372
|
rowIndex,
|
|
40352
|
-
level
|
|
40373
|
+
level,
|
|
40374
|
+
selected
|
|
40353
40375
|
}) {
|
|
40354
40376
|
return vue.withDirectives(vue.createVNode(Checkbox, {
|
|
40355
|
-
"modelValue":
|
|
40377
|
+
"modelValue": selected,
|
|
40356
40378
|
"disabled": column.selectable ? !column.selectable.call(null, row, rowIndex) : false,
|
|
40357
40379
|
"onChange": () => store.rowSelectedChanged(row),
|
|
40358
40380
|
"onClick": e => e.stopPropagation()
|
|
@@ -40525,15 +40547,14 @@
|
|
|
40525
40547
|
tooltip: [String, Function]
|
|
40526
40548
|
},
|
|
40527
40549
|
setup(props, {
|
|
40528
|
-
slots
|
|
40529
|
-
expose
|
|
40550
|
+
slots
|
|
40530
40551
|
}) {
|
|
40531
40552
|
const instance = vue.getCurrentInstance();
|
|
40532
|
-
const table =
|
|
40533
|
-
const parent =
|
|
40553
|
+
const table = vue.inject('vc-table');
|
|
40554
|
+
const parent = vue.inject('vc-table-column', table);
|
|
40534
40555
|
const isSubColumn = table !== parent; // 用于多久表头
|
|
40535
40556
|
|
|
40536
|
-
const columnId = vue.ref((parent.
|
|
40557
|
+
const columnId = vue.ref((parent.tableId || parent.columnId) + getUid('column'));
|
|
40537
40558
|
const realWidth = vue.computed(() => {
|
|
40538
40559
|
return parseWidth(props.width);
|
|
40539
40560
|
});
|
|
@@ -40632,7 +40653,7 @@
|
|
|
40632
40653
|
column.renderCell = data => vue.createVNode("div", {
|
|
40633
40654
|
"class": "vc-table__cell"
|
|
40634
40655
|
}, [originRenderCell(data)]);
|
|
40635
|
-
table.
|
|
40656
|
+
table.renderExpanded.value = data => {
|
|
40636
40657
|
return slots.default ? slots.default(data) : slots.default;
|
|
40637
40658
|
};
|
|
40638
40659
|
} else {
|
|
@@ -40651,7 +40672,7 @@
|
|
|
40651
40672
|
style: {}
|
|
40652
40673
|
};
|
|
40653
40674
|
// 存在树形数组,且当前行无箭头图标且处于当前展开列,表格对齐
|
|
40654
|
-
if (!isEmpty$1(table.
|
|
40675
|
+
if (!isEmpty$1(table.store.states.treeData) && !prefix && data.isExpandColumn) {
|
|
40655
40676
|
prefix = vue.createVNode("span", {
|
|
40656
40677
|
"class": "vc-table-un-expand__indent"
|
|
40657
40678
|
}, null);
|
|
@@ -40694,15 +40715,15 @@
|
|
|
40694
40715
|
|
|
40695
40716
|
// 影响布局
|
|
40696
40717
|
vue.watch(() => props.fixed, () => {
|
|
40697
|
-
table.
|
|
40718
|
+
table.store.scheduleLayout(true);
|
|
40698
40719
|
});
|
|
40699
40720
|
vue.watch(() => realWidth.value, v => {
|
|
40700
40721
|
columnConfig['width'] = v;
|
|
40701
40722
|
columnConfig['realWidth'] = v;
|
|
40702
|
-
table.
|
|
40723
|
+
table.store.scheduleLayout(false);
|
|
40703
40724
|
});
|
|
40704
40725
|
vue.watch(() => realMinWidth.value, () => {
|
|
40705
|
-
table.
|
|
40726
|
+
table.store.scheduleLayout(false);
|
|
40706
40727
|
});
|
|
40707
40728
|
};
|
|
40708
40729
|
vue.onBeforeMount(() => {
|
|
@@ -40710,17 +40731,17 @@
|
|
|
40710
40731
|
registerWatchers();
|
|
40711
40732
|
});
|
|
40712
40733
|
vue.onMounted(() => {
|
|
40713
|
-
const children = isSubColumn ? parent.vnode.el.children : parent.
|
|
40734
|
+
const children = isSubColumn ? parent.vnode.el.children : parent.hiddenColumns.value.children;
|
|
40714
40735
|
|
|
40715
40736
|
// DOM上
|
|
40716
40737
|
const columnIndex = [...children].indexOf(instance.vnode.el);
|
|
40717
|
-
table.
|
|
40738
|
+
table.store.insertColumn(columnConfig, columnIndex, isSubColumn && parent.columnConfig);
|
|
40718
40739
|
});
|
|
40719
40740
|
vue.onUnmounted(() => {
|
|
40720
40741
|
if (!instance.parent) return;
|
|
40721
|
-
table.
|
|
40742
|
+
table.store.removeColumn(columnConfig, isSubColumn && parent.columnConfig);
|
|
40722
40743
|
});
|
|
40723
|
-
|
|
40744
|
+
vue.provide('vc-table-column', {
|
|
40724
40745
|
columnId,
|
|
40725
40746
|
columnConfig
|
|
40726
40747
|
});
|