@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.cjs
CHANGED
|
@@ -794,7 +794,7 @@ const COMPONENT_NAME$1T = 'vc-alert';
|
|
|
794
794
|
|
|
795
795
|
// [color, borderColor, backgroundColor], -> CSS
|
|
796
796
|
const THEME_MAP = {
|
|
797
|
-
info: ['#
|
|
797
|
+
info: ['#2B72FD', '#91d5ff', '#e6f7ff'],
|
|
798
798
|
success: ['#52c41a', '#b7eb8f', '#f6ffed'],
|
|
799
799
|
error: ['#ed4014', '#ffb08f', '#fbe9e9'],
|
|
800
800
|
warning: ['#ffbf00', '#ffe58f', '#fffbe6']
|
|
@@ -12144,7 +12144,7 @@ const props$m = {
|
|
|
12144
12144
|
color: {
|
|
12145
12145
|
type: [Object, String],
|
|
12146
12146
|
default: () => ({
|
|
12147
|
-
normal: "#
|
|
12147
|
+
normal: "#2B72FD",
|
|
12148
12148
|
success: "#52c41a",
|
|
12149
12149
|
error: "#f5222d"
|
|
12150
12150
|
})
|
|
@@ -13384,6 +13384,8 @@ const RecycleList = /* @__PURE__ */ vue.defineComponent({
|
|
|
13384
13384
|
});
|
|
13385
13385
|
if (!originalData.length) {
|
|
13386
13386
|
rebuildData.value = [];
|
|
13387
|
+
} else {
|
|
13388
|
+
rebuildData.value = originalData.slice();
|
|
13387
13389
|
}
|
|
13388
13390
|
offsetPageSize.value = 0;
|
|
13389
13391
|
await refreshLayout(0, originalData.length);
|
|
@@ -14526,17 +14528,24 @@ class Store extends BaseWatcher {
|
|
|
14526
14528
|
const dataInstanceChanged = this.states._data !== data;
|
|
14527
14529
|
this.states._data = data;
|
|
14528
14530
|
this.states.data = data;
|
|
14531
|
+
const caches = /* @__PURE__ */ new Map();
|
|
14532
|
+
this.states.list.forEach((item) => {
|
|
14533
|
+
item.rows.forEach((row) => {
|
|
14534
|
+
caches.set(row.data, row);
|
|
14535
|
+
});
|
|
14536
|
+
});
|
|
14529
14537
|
this.states.list = data.reduce((pre, row, index) => {
|
|
14538
|
+
const cache = caches.get(row) || { heightMap: {} };
|
|
14530
14539
|
pre.push({
|
|
14531
14540
|
rows: [
|
|
14532
14541
|
{
|
|
14533
14542
|
index,
|
|
14534
14543
|
data: row,
|
|
14535
|
-
height: "",
|
|
14544
|
+
height: cache.height || "",
|
|
14536
14545
|
heightMap: {
|
|
14537
|
-
left: "",
|
|
14538
|
-
main: "",
|
|
14539
|
-
right: ""
|
|
14546
|
+
left: cache.heightMap.left || "",
|
|
14547
|
+
main: cache.heightMap.main || "",
|
|
14548
|
+
right: cache.heightMap.right || ""
|
|
14540
14549
|
}
|
|
14541
14550
|
}
|
|
14542
14551
|
],
|
|
@@ -14544,6 +14553,7 @@ class Store extends BaseWatcher {
|
|
|
14544
14553
|
});
|
|
14545
14554
|
return pre;
|
|
14546
14555
|
}, []);
|
|
14556
|
+
caches.clear();
|
|
14547
14557
|
this.current.update();
|
|
14548
14558
|
this.expand.update();
|
|
14549
14559
|
if (!this.states.reserveSelection) {
|
|
@@ -14677,12 +14687,12 @@ class Store extends BaseWatcher {
|
|
|
14677
14687
|
*/
|
|
14678
14688
|
cleanSelection() {
|
|
14679
14689
|
const { primaryKey } = this.table.props;
|
|
14680
|
-
const { selection = [] } = this.states;
|
|
14690
|
+
const { selection = [], data } = this.states;
|
|
14681
14691
|
let deleted;
|
|
14682
14692
|
if (primaryKey) {
|
|
14683
14693
|
deleted = [];
|
|
14684
14694
|
const selectedMap = getValuesMap(selection, primaryKey);
|
|
14685
|
-
const dataMap = getValuesMap(
|
|
14695
|
+
const dataMap = getValuesMap(data, primaryKey);
|
|
14686
14696
|
for (const key in selectedMap) {
|
|
14687
14697
|
if (Utils.hasOwn(selectedMap, key) && !dataMap[key]) {
|
|
14688
14698
|
deleted.push(selectedMap[key].row);
|
|
@@ -14857,8 +14867,10 @@ const COMPONENT_NAME$h = 'vc-table-normal-list';
|
|
|
14857
14867
|
const NormalList = /* @__PURE__ */ vue.defineComponent({
|
|
14858
14868
|
name: COMPONENT_NAME$h,
|
|
14859
14869
|
props: {
|
|
14860
|
-
data:
|
|
14861
|
-
|
|
14870
|
+
data: {
|
|
14871
|
+
type: Array,
|
|
14872
|
+
default: () => []
|
|
14873
|
+
}
|
|
14862
14874
|
},
|
|
14863
14875
|
emits: ['row-resize'],
|
|
14864
14876
|
setup(props, {
|
|
@@ -14900,7 +14912,7 @@ const TableBody = /* @__PURE__ */ vue.defineComponent({
|
|
|
14900
14912
|
expose
|
|
14901
14913
|
}) {
|
|
14902
14914
|
const instance = vue.getCurrentInstance();
|
|
14903
|
-
const table =
|
|
14915
|
+
const table = vue.inject('vc-table');
|
|
14904
14916
|
const states = useStates({
|
|
14905
14917
|
data: 'data',
|
|
14906
14918
|
list: 'list',
|
|
@@ -15024,7 +15036,7 @@ const TableBody = /* @__PURE__ */ vue.defineComponent({
|
|
|
15024
15036
|
column,
|
|
15025
15037
|
row
|
|
15026
15038
|
};
|
|
15027
|
-
table.
|
|
15039
|
+
table.hoverState.value = hoverState;
|
|
15028
15040
|
table.emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, e);
|
|
15029
15041
|
}
|
|
15030
15042
|
|
|
@@ -15057,7 +15069,7 @@ const TableBody = /* @__PURE__ */ vue.defineComponent({
|
|
|
15057
15069
|
const handleCellMouseLeave = e => {
|
|
15058
15070
|
const cell = getCell(e);
|
|
15059
15071
|
if (!cell) return;
|
|
15060
|
-
const oldHoverState = table.
|
|
15072
|
+
const oldHoverState = table.hoverState.value || {};
|
|
15061
15073
|
table.emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, e);
|
|
15062
15074
|
};
|
|
15063
15075
|
const handleMouseEnter = lodashEs.debounce(index => {
|
|
@@ -15095,6 +15107,7 @@ const TableBody = /* @__PURE__ */ vue.defineComponent({
|
|
|
15095
15107
|
columns
|
|
15096
15108
|
} = states;
|
|
15097
15109
|
const key = getValueOfRow(row, rowIndex);
|
|
15110
|
+
const selected = props.store.isSelected(row);
|
|
15098
15111
|
return vue.createVNode("div", {
|
|
15099
15112
|
"key": key,
|
|
15100
15113
|
"class": [getRowClass(row, rowIndex), 'vc-table__tr'],
|
|
@@ -15115,10 +15128,12 @@ const TableBody = /* @__PURE__ */ vue.defineComponent({
|
|
|
15115
15128
|
};
|
|
15116
15129
|
if (columnsHidden.value[columnIndex]) {
|
|
15117
15130
|
return vue.createVNode("div", {
|
|
15131
|
+
"key": column.id,
|
|
15118
15132
|
"style": [sizeStyle]
|
|
15119
15133
|
}, null);
|
|
15120
15134
|
}
|
|
15121
15135
|
return vue.createVNode("div", {
|
|
15136
|
+
"key": column.id,
|
|
15122
15137
|
"style": [getCellStyle(rowIndex, columnIndex, row, column), sizeStyle],
|
|
15123
15138
|
"class": [getCellClass(rowIndex, columnIndex, row, column), 'vc-table__td'],
|
|
15124
15139
|
"onMouseenter": e => handleCellMouseEnter(e, row),
|
|
@@ -15128,7 +15143,8 @@ const TableBody = /* @__PURE__ */ vue.defineComponent({
|
|
|
15128
15143
|
column,
|
|
15129
15144
|
rowIndex,
|
|
15130
15145
|
columnIndex,
|
|
15131
|
-
store: props.store
|
|
15146
|
+
store: props.store,
|
|
15147
|
+
selected
|
|
15132
15148
|
})]);
|
|
15133
15149
|
})]);
|
|
15134
15150
|
};
|
|
@@ -15162,7 +15178,7 @@ const TableBody = /* @__PURE__ */ vue.defineComponent({
|
|
|
15162
15178
|
wrapper,
|
|
15163
15179
|
getRootElement: () => instance.vnode.el
|
|
15164
15180
|
});
|
|
15165
|
-
const layout = table.
|
|
15181
|
+
const layout = table.layout;
|
|
15166
15182
|
return () => {
|
|
15167
15183
|
return vue.createVNode("div", {
|
|
15168
15184
|
"class": "vc-table__body"
|
|
@@ -15172,7 +15188,7 @@ const TableBody = /* @__PURE__ */ vue.defineComponent({
|
|
|
15172
15188
|
"disabled": true,
|
|
15173
15189
|
"class": "vc-table__tbody",
|
|
15174
15190
|
"scrollerOptions": {
|
|
15175
|
-
barTo: `.${table.
|
|
15191
|
+
barTo: `.${table.tableId}`,
|
|
15176
15192
|
native: false,
|
|
15177
15193
|
always: false,
|
|
15178
15194
|
showBar: !props.fixed,
|
|
@@ -15224,7 +15240,7 @@ const TableHeader = /* @__PURE__ */ vue.defineComponent({
|
|
|
15224
15240
|
}
|
|
15225
15241
|
},
|
|
15226
15242
|
setup(props) {
|
|
15227
|
-
const table =
|
|
15243
|
+
const table = vue.inject('vc-table');
|
|
15228
15244
|
const instance = vue.getCurrentInstance();
|
|
15229
15245
|
const draggingColumn = vue.ref(null);
|
|
15230
15246
|
const dragging = vue.ref(false);
|
|
@@ -15331,7 +15347,7 @@ const TableHeader = /* @__PURE__ */ vue.defineComponent({
|
|
|
15331
15347
|
/* istanbul ignore if */
|
|
15332
15348
|
if (draggingColumn.value && props.border) {
|
|
15333
15349
|
dragging.value = true;
|
|
15334
|
-
table.
|
|
15350
|
+
table.resizeProxyVisible.value = true;
|
|
15335
15351
|
const tableEl = table.vnode.el;
|
|
15336
15352
|
const tableLeft = tableEl.getBoundingClientRect().left;
|
|
15337
15353
|
const columnEl = instance.vnode.el.querySelector(`.vc-table__th.${column.id}`);
|
|
@@ -15344,7 +15360,7 @@ const TableHeader = /* @__PURE__ */ vue.defineComponent({
|
|
|
15344
15360
|
startColumnLeft: columnRect.left - tableLeft,
|
|
15345
15361
|
tableLeft
|
|
15346
15362
|
};
|
|
15347
|
-
const resizeProxy = table.
|
|
15363
|
+
const resizeProxy = table.resizeProxy.value;
|
|
15348
15364
|
resizeProxy.style.left = dragState.value.startLeft + 'px';
|
|
15349
15365
|
document.onselectstart = () => false;
|
|
15350
15366
|
document.ondragstart = () => false;
|
|
@@ -15703,7 +15719,8 @@ const Table = /* @__PURE__ */ vue.defineComponent({
|
|
|
15703
15719
|
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'],
|
|
15704
15720
|
setup(props, {
|
|
15705
15721
|
slots,
|
|
15706
|
-
expose
|
|
15722
|
+
expose,
|
|
15723
|
+
emit
|
|
15707
15724
|
}) {
|
|
15708
15725
|
const instance = vue.getCurrentInstance();
|
|
15709
15726
|
const store = new Store({
|
|
@@ -16023,8 +16040,8 @@ const Table = /* @__PURE__ */ vue.defineComponent({
|
|
|
16023
16040
|
}, {
|
|
16024
16041
|
immediate: true
|
|
16025
16042
|
});
|
|
16026
|
-
vue.watch(() => props.data,
|
|
16027
|
-
store.setData(
|
|
16043
|
+
vue.watch(() => [props.data, props.data.length], () => {
|
|
16044
|
+
store.setData(props.data);
|
|
16028
16045
|
isReady.value && vue.nextTick(refreshLayout);
|
|
16029
16046
|
}, {
|
|
16030
16047
|
immediate: true
|
|
@@ -16062,7 +16079,7 @@ const Table = /* @__PURE__ */ vue.defineComponent({
|
|
|
16062
16079
|
isUnMount = true;
|
|
16063
16080
|
unbindEvents();
|
|
16064
16081
|
});
|
|
16065
|
-
|
|
16082
|
+
const exposed = {
|
|
16066
16083
|
bodyXWrapper,
|
|
16067
16084
|
bodyYWrapper,
|
|
16068
16085
|
tableId,
|
|
@@ -16084,8 +16101,12 @@ const Table = /* @__PURE__ */ vue.defineComponent({
|
|
|
16084
16101
|
isReady,
|
|
16085
16102
|
hoverState,
|
|
16086
16103
|
renderExpanded,
|
|
16087
|
-
hiddenColumns
|
|
16088
|
-
|
|
16104
|
+
hiddenColumns,
|
|
16105
|
+
props,
|
|
16106
|
+
emit
|
|
16107
|
+
};
|
|
16108
|
+
expose(exposed);
|
|
16109
|
+
vue.provide('vc-table', exposed);
|
|
16089
16110
|
return () => {
|
|
16090
16111
|
return vue.createVNode("div", {
|
|
16091
16112
|
"class": [classes.value, tableId, 'vc-table'],
|
|
@@ -16272,10 +16293,11 @@ const cellForced = {
|
|
|
16272
16293
|
column,
|
|
16273
16294
|
store,
|
|
16274
16295
|
rowIndex,
|
|
16275
|
-
level
|
|
16296
|
+
level,
|
|
16297
|
+
selected
|
|
16276
16298
|
}) {
|
|
16277
16299
|
return vue.withDirectives(vue.createVNode(Checkbox, {
|
|
16278
|
-
"modelValue":
|
|
16300
|
+
"modelValue": selected,
|
|
16279
16301
|
"disabled": column.selectable ? !column.selectable.call(null, row, rowIndex) : false,
|
|
16280
16302
|
"onChange": () => store.rowSelectedChanged(row),
|
|
16281
16303
|
"onClick": e => e.stopPropagation()
|
|
@@ -16448,15 +16470,14 @@ const TableColumn = /* @__PURE__ */ vue.defineComponent({
|
|
|
16448
16470
|
tooltip: [String, Function]
|
|
16449
16471
|
},
|
|
16450
16472
|
setup(props, {
|
|
16451
|
-
slots
|
|
16452
|
-
expose
|
|
16473
|
+
slots
|
|
16453
16474
|
}) {
|
|
16454
16475
|
const instance = vue.getCurrentInstance();
|
|
16455
|
-
const table =
|
|
16456
|
-
const parent =
|
|
16476
|
+
const table = vue.inject('vc-table');
|
|
16477
|
+
const parent = vue.inject('vc-table-column', table);
|
|
16457
16478
|
const isSubColumn = table !== parent; // 用于多久表头
|
|
16458
16479
|
|
|
16459
|
-
const columnId = vue.ref((parent.
|
|
16480
|
+
const columnId = vue.ref((parent.tableId || parent.columnId) + Utils.getUid('column'));
|
|
16460
16481
|
const realWidth = vue.computed(() => {
|
|
16461
16482
|
return parseWidth(props.width);
|
|
16462
16483
|
});
|
|
@@ -16555,7 +16576,7 @@ const TableColumn = /* @__PURE__ */ vue.defineComponent({
|
|
|
16555
16576
|
column.renderCell = data => vue.createVNode("div", {
|
|
16556
16577
|
"class": "vc-table__cell"
|
|
16557
16578
|
}, [originRenderCell(data)]);
|
|
16558
|
-
table.
|
|
16579
|
+
table.renderExpanded.value = data => {
|
|
16559
16580
|
return slots.default ? slots.default(data) : slots.default;
|
|
16560
16581
|
};
|
|
16561
16582
|
} else {
|
|
@@ -16574,7 +16595,7 @@ const TableColumn = /* @__PURE__ */ vue.defineComponent({
|
|
|
16574
16595
|
style: {}
|
|
16575
16596
|
};
|
|
16576
16597
|
// 存在树形数组,且当前行无箭头图标且处于当前展开列,表格对齐
|
|
16577
|
-
if (!lodashEs.isEmpty(table.
|
|
16598
|
+
if (!lodashEs.isEmpty(table.store.states.treeData) && !prefix && data.isExpandColumn) {
|
|
16578
16599
|
prefix = vue.createVNode("span", {
|
|
16579
16600
|
"class": "vc-table-un-expand__indent"
|
|
16580
16601
|
}, null);
|
|
@@ -16617,15 +16638,15 @@ const TableColumn = /* @__PURE__ */ vue.defineComponent({
|
|
|
16617
16638
|
|
|
16618
16639
|
// 影响布局
|
|
16619
16640
|
vue.watch(() => props.fixed, () => {
|
|
16620
|
-
table.
|
|
16641
|
+
table.store.scheduleLayout(true);
|
|
16621
16642
|
});
|
|
16622
16643
|
vue.watch(() => realWidth.value, v => {
|
|
16623
16644
|
columnConfig['width'] = v;
|
|
16624
16645
|
columnConfig['realWidth'] = v;
|
|
16625
|
-
table.
|
|
16646
|
+
table.store.scheduleLayout(false);
|
|
16626
16647
|
});
|
|
16627
16648
|
vue.watch(() => realMinWidth.value, () => {
|
|
16628
|
-
table.
|
|
16649
|
+
table.store.scheduleLayout(false);
|
|
16629
16650
|
});
|
|
16630
16651
|
};
|
|
16631
16652
|
vue.onBeforeMount(() => {
|
|
@@ -16633,17 +16654,17 @@ const TableColumn = /* @__PURE__ */ vue.defineComponent({
|
|
|
16633
16654
|
registerWatchers();
|
|
16634
16655
|
});
|
|
16635
16656
|
vue.onMounted(() => {
|
|
16636
|
-
const children = isSubColumn ? parent.vnode.el.children : parent.
|
|
16657
|
+
const children = isSubColumn ? parent.vnode.el.children : parent.hiddenColumns.value.children;
|
|
16637
16658
|
|
|
16638
16659
|
// DOM上
|
|
16639
16660
|
const columnIndex = [...children].indexOf(instance.vnode.el);
|
|
16640
|
-
table.
|
|
16661
|
+
table.store.insertColumn(columnConfig, columnIndex, isSubColumn && parent.columnConfig);
|
|
16641
16662
|
});
|
|
16642
16663
|
vue.onUnmounted(() => {
|
|
16643
16664
|
if (!instance.parent) return;
|
|
16644
|
-
table.
|
|
16665
|
+
table.store.removeColumn(columnConfig, isSubColumn && parent.columnConfig);
|
|
16645
16666
|
});
|
|
16646
|
-
|
|
16667
|
+
vue.provide('vc-table-column', {
|
|
16647
16668
|
columnId,
|
|
16648
16669
|
columnConfig
|
|
16649
16670
|
});
|
package/dist/index.iife.js
CHANGED
|
@@ -756,7 +756,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
756
756
|
|
|
757
757
|
// [color, borderColor, backgroundColor], -> CSS
|
|
758
758
|
const THEME_MAP = {
|
|
759
|
-
info: ['#
|
|
759
|
+
info: ['#2B72FD', '#91d5ff', '#e6f7ff'],
|
|
760
760
|
success: ['#52c41a', '#b7eb8f', '#f6ffed'],
|
|
761
761
|
error: ['#ed4014', '#ffb08f', '#fbe9e9'],
|
|
762
762
|
warning: ['#ffbf00', '#ffe58f', '#fffbe6']
|
|
@@ -18893,7 +18893,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
18893
18893
|
color: {
|
|
18894
18894
|
type: [Object, String],
|
|
18895
18895
|
default: () => ({
|
|
18896
|
-
normal: "#
|
|
18896
|
+
normal: "#2B72FD",
|
|
18897
18897
|
success: "#52c41a",
|
|
18898
18898
|
error: "#f5222d"
|
|
18899
18899
|
})
|
|
@@ -20247,6 +20247,8 @@ var VcComponents = (function (exports, vue) {
|
|
|
20247
20247
|
});
|
|
20248
20248
|
if (!originalData.length) {
|
|
20249
20249
|
rebuildData.value = [];
|
|
20250
|
+
} else {
|
|
20251
|
+
rebuildData.value = originalData.slice();
|
|
20250
20252
|
}
|
|
20251
20253
|
offsetPageSize.value = 0;
|
|
20252
20254
|
await refreshLayout(0, originalData.length);
|
|
@@ -38600,17 +38602,24 @@ var VcComponents = (function (exports, vue) {
|
|
|
38600
38602
|
const dataInstanceChanged = this.states._data !== data;
|
|
38601
38603
|
this.states._data = data;
|
|
38602
38604
|
this.states.data = data;
|
|
38605
|
+
const caches = /* @__PURE__ */ new Map();
|
|
38606
|
+
this.states.list.forEach((item) => {
|
|
38607
|
+
item.rows.forEach((row) => {
|
|
38608
|
+
caches.set(row.data, row);
|
|
38609
|
+
});
|
|
38610
|
+
});
|
|
38603
38611
|
this.states.list = data.reduce((pre, row, index) => {
|
|
38612
|
+
const cache = caches.get(row) || { heightMap: {} };
|
|
38604
38613
|
pre.push({
|
|
38605
38614
|
rows: [
|
|
38606
38615
|
{
|
|
38607
38616
|
index,
|
|
38608
38617
|
data: row,
|
|
38609
|
-
height: "",
|
|
38618
|
+
height: cache.height || "",
|
|
38610
38619
|
heightMap: {
|
|
38611
|
-
left: "",
|
|
38612
|
-
main: "",
|
|
38613
|
-
right: ""
|
|
38620
|
+
left: cache.heightMap.left || "",
|
|
38621
|
+
main: cache.heightMap.main || "",
|
|
38622
|
+
right: cache.heightMap.right || ""
|
|
38614
38623
|
}
|
|
38615
38624
|
}
|
|
38616
38625
|
],
|
|
@@ -38618,6 +38627,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
38618
38627
|
});
|
|
38619
38628
|
return pre;
|
|
38620
38629
|
}, []);
|
|
38630
|
+
caches.clear();
|
|
38621
38631
|
this.current.update();
|
|
38622
38632
|
this.expand.update();
|
|
38623
38633
|
if (!this.states.reserveSelection) {
|
|
@@ -38751,12 +38761,12 @@ var VcComponents = (function (exports, vue) {
|
|
|
38751
38761
|
*/
|
|
38752
38762
|
cleanSelection() {
|
|
38753
38763
|
const { primaryKey } = this.table.props;
|
|
38754
|
-
const { selection = [] } = this.states;
|
|
38764
|
+
const { selection = [], data } = this.states;
|
|
38755
38765
|
let deleted;
|
|
38756
38766
|
if (primaryKey) {
|
|
38757
38767
|
deleted = [];
|
|
38758
38768
|
const selectedMap = getValuesMap(selection, primaryKey);
|
|
38759
|
-
const dataMap = getValuesMap(
|
|
38769
|
+
const dataMap = getValuesMap(data, primaryKey);
|
|
38760
38770
|
for (const key in selectedMap) {
|
|
38761
38771
|
if (hasOwn$1(selectedMap, key) && !dataMap[key]) {
|
|
38762
38772
|
deleted.push(selectedMap[key].row);
|
|
@@ -38931,8 +38941,10 @@ var VcComponents = (function (exports, vue) {
|
|
|
38931
38941
|
const NormalList = /* @__PURE__ */ vue.defineComponent({
|
|
38932
38942
|
name: COMPONENT_NAME$h,
|
|
38933
38943
|
props: {
|
|
38934
|
-
data:
|
|
38935
|
-
|
|
38944
|
+
data: {
|
|
38945
|
+
type: Array,
|
|
38946
|
+
default: () => []
|
|
38947
|
+
}
|
|
38936
38948
|
},
|
|
38937
38949
|
emits: ['row-resize'],
|
|
38938
38950
|
setup(props, {
|
|
@@ -38974,7 +38986,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
38974
38986
|
expose
|
|
38975
38987
|
}) {
|
|
38976
38988
|
const instance = vue.getCurrentInstance();
|
|
38977
|
-
const table =
|
|
38989
|
+
const table = vue.inject('vc-table');
|
|
38978
38990
|
const states = useStates({
|
|
38979
38991
|
data: 'data',
|
|
38980
38992
|
list: 'list',
|
|
@@ -39098,7 +39110,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
39098
39110
|
column,
|
|
39099
39111
|
row
|
|
39100
39112
|
};
|
|
39101
|
-
table.
|
|
39113
|
+
table.hoverState.value = hoverState;
|
|
39102
39114
|
table.emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, e);
|
|
39103
39115
|
}
|
|
39104
39116
|
|
|
@@ -39131,7 +39143,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
39131
39143
|
const handleCellMouseLeave = e => {
|
|
39132
39144
|
const cell = getCell(e);
|
|
39133
39145
|
if (!cell) return;
|
|
39134
|
-
const oldHoverState = table.
|
|
39146
|
+
const oldHoverState = table.hoverState.value || {};
|
|
39135
39147
|
table.emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, e);
|
|
39136
39148
|
};
|
|
39137
39149
|
const handleMouseEnter = debounce$1(index => {
|
|
@@ -39169,6 +39181,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
39169
39181
|
columns
|
|
39170
39182
|
} = states;
|
|
39171
39183
|
const key = getValueOfRow(row, rowIndex);
|
|
39184
|
+
const selected = props.store.isSelected(row);
|
|
39172
39185
|
return vue.createVNode("div", {
|
|
39173
39186
|
"key": key,
|
|
39174
39187
|
"class": [getRowClass(row, rowIndex), 'vc-table__tr'],
|
|
@@ -39189,10 +39202,12 @@ var VcComponents = (function (exports, vue) {
|
|
|
39189
39202
|
};
|
|
39190
39203
|
if (columnsHidden.value[columnIndex]) {
|
|
39191
39204
|
return vue.createVNode("div", {
|
|
39205
|
+
"key": column.id,
|
|
39192
39206
|
"style": [sizeStyle]
|
|
39193
39207
|
}, null);
|
|
39194
39208
|
}
|
|
39195
39209
|
return vue.createVNode("div", {
|
|
39210
|
+
"key": column.id,
|
|
39196
39211
|
"style": [getCellStyle(rowIndex, columnIndex, row, column), sizeStyle],
|
|
39197
39212
|
"class": [getCellClass(rowIndex, columnIndex, row, column), 'vc-table__td'],
|
|
39198
39213
|
"onMouseenter": e => handleCellMouseEnter(e, row),
|
|
@@ -39202,7 +39217,8 @@ var VcComponents = (function (exports, vue) {
|
|
|
39202
39217
|
column,
|
|
39203
39218
|
rowIndex,
|
|
39204
39219
|
columnIndex,
|
|
39205
|
-
store: props.store
|
|
39220
|
+
store: props.store,
|
|
39221
|
+
selected
|
|
39206
39222
|
})]);
|
|
39207
39223
|
})]);
|
|
39208
39224
|
};
|
|
@@ -39236,7 +39252,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
39236
39252
|
wrapper,
|
|
39237
39253
|
getRootElement: () => instance.vnode.el
|
|
39238
39254
|
});
|
|
39239
|
-
const layout = table.
|
|
39255
|
+
const layout = table.layout;
|
|
39240
39256
|
return () => {
|
|
39241
39257
|
return vue.createVNode("div", {
|
|
39242
39258
|
"class": "vc-table__body"
|
|
@@ -39246,7 +39262,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
39246
39262
|
"disabled": true,
|
|
39247
39263
|
"class": "vc-table__tbody",
|
|
39248
39264
|
"scrollerOptions": {
|
|
39249
|
-
barTo: `.${table.
|
|
39265
|
+
barTo: `.${table.tableId}`,
|
|
39250
39266
|
native: false,
|
|
39251
39267
|
always: false,
|
|
39252
39268
|
showBar: !props.fixed,
|
|
@@ -39298,7 +39314,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
39298
39314
|
}
|
|
39299
39315
|
},
|
|
39300
39316
|
setup(props) {
|
|
39301
|
-
const table =
|
|
39317
|
+
const table = vue.inject('vc-table');
|
|
39302
39318
|
const instance = vue.getCurrentInstance();
|
|
39303
39319
|
const draggingColumn = vue.ref(null);
|
|
39304
39320
|
const dragging = vue.ref(false);
|
|
@@ -39405,7 +39421,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
39405
39421
|
/* istanbul ignore if */
|
|
39406
39422
|
if (draggingColumn.value && props.border) {
|
|
39407
39423
|
dragging.value = true;
|
|
39408
|
-
table.
|
|
39424
|
+
table.resizeProxyVisible.value = true;
|
|
39409
39425
|
const tableEl = table.vnode.el;
|
|
39410
39426
|
const tableLeft = tableEl.getBoundingClientRect().left;
|
|
39411
39427
|
const columnEl = instance.vnode.el.querySelector(`.vc-table__th.${column.id}`);
|
|
@@ -39418,7 +39434,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
39418
39434
|
startColumnLeft: columnRect.left - tableLeft,
|
|
39419
39435
|
tableLeft
|
|
39420
39436
|
};
|
|
39421
|
-
const resizeProxy = table.
|
|
39437
|
+
const resizeProxy = table.resizeProxy.value;
|
|
39422
39438
|
resizeProxy.style.left = dragState.value.startLeft + 'px';
|
|
39423
39439
|
document.onselectstart = () => false;
|
|
39424
39440
|
document.ondragstart = () => false;
|
|
@@ -39777,7 +39793,8 @@ var VcComponents = (function (exports, vue) {
|
|
|
39777
39793
|
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'],
|
|
39778
39794
|
setup(props, {
|
|
39779
39795
|
slots,
|
|
39780
|
-
expose
|
|
39796
|
+
expose,
|
|
39797
|
+
emit
|
|
39781
39798
|
}) {
|
|
39782
39799
|
const instance = vue.getCurrentInstance();
|
|
39783
39800
|
const store = new Store({
|
|
@@ -40097,8 +40114,8 @@ var VcComponents = (function (exports, vue) {
|
|
|
40097
40114
|
}, {
|
|
40098
40115
|
immediate: true
|
|
40099
40116
|
});
|
|
40100
|
-
vue.watch(() => props.data,
|
|
40101
|
-
store.setData(
|
|
40117
|
+
vue.watch(() => [props.data, props.data.length], () => {
|
|
40118
|
+
store.setData(props.data);
|
|
40102
40119
|
isReady.value && vue.nextTick(refreshLayout);
|
|
40103
40120
|
}, {
|
|
40104
40121
|
immediate: true
|
|
@@ -40136,7 +40153,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
40136
40153
|
isUnMount = true;
|
|
40137
40154
|
unbindEvents();
|
|
40138
40155
|
});
|
|
40139
|
-
|
|
40156
|
+
const exposed = {
|
|
40140
40157
|
bodyXWrapper,
|
|
40141
40158
|
bodyYWrapper,
|
|
40142
40159
|
tableId,
|
|
@@ -40158,8 +40175,12 @@ var VcComponents = (function (exports, vue) {
|
|
|
40158
40175
|
isReady,
|
|
40159
40176
|
hoverState,
|
|
40160
40177
|
renderExpanded,
|
|
40161
|
-
hiddenColumns
|
|
40162
|
-
|
|
40178
|
+
hiddenColumns,
|
|
40179
|
+
props,
|
|
40180
|
+
emit
|
|
40181
|
+
};
|
|
40182
|
+
expose(exposed);
|
|
40183
|
+
vue.provide('vc-table', exposed);
|
|
40163
40184
|
return () => {
|
|
40164
40185
|
return vue.createVNode("div", {
|
|
40165
40186
|
"class": [classes.value, tableId, 'vc-table'],
|
|
@@ -40346,10 +40367,11 @@ var VcComponents = (function (exports, vue) {
|
|
|
40346
40367
|
column,
|
|
40347
40368
|
store,
|
|
40348
40369
|
rowIndex,
|
|
40349
|
-
level
|
|
40370
|
+
level,
|
|
40371
|
+
selected
|
|
40350
40372
|
}) {
|
|
40351
40373
|
return vue.withDirectives(vue.createVNode(Checkbox, {
|
|
40352
|
-
"modelValue":
|
|
40374
|
+
"modelValue": selected,
|
|
40353
40375
|
"disabled": column.selectable ? !column.selectable.call(null, row, rowIndex) : false,
|
|
40354
40376
|
"onChange": () => store.rowSelectedChanged(row),
|
|
40355
40377
|
"onClick": e => e.stopPropagation()
|
|
@@ -40522,15 +40544,14 @@ var VcComponents = (function (exports, vue) {
|
|
|
40522
40544
|
tooltip: [String, Function]
|
|
40523
40545
|
},
|
|
40524
40546
|
setup(props, {
|
|
40525
|
-
slots
|
|
40526
|
-
expose
|
|
40547
|
+
slots
|
|
40527
40548
|
}) {
|
|
40528
40549
|
const instance = vue.getCurrentInstance();
|
|
40529
|
-
const table =
|
|
40530
|
-
const parent =
|
|
40550
|
+
const table = vue.inject('vc-table');
|
|
40551
|
+
const parent = vue.inject('vc-table-column', table);
|
|
40531
40552
|
const isSubColumn = table !== parent; // 用于多久表头
|
|
40532
40553
|
|
|
40533
|
-
const columnId = vue.ref((parent.
|
|
40554
|
+
const columnId = vue.ref((parent.tableId || parent.columnId) + getUid('column'));
|
|
40534
40555
|
const realWidth = vue.computed(() => {
|
|
40535
40556
|
return parseWidth(props.width);
|
|
40536
40557
|
});
|
|
@@ -40629,7 +40650,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
40629
40650
|
column.renderCell = data => vue.createVNode("div", {
|
|
40630
40651
|
"class": "vc-table__cell"
|
|
40631
40652
|
}, [originRenderCell(data)]);
|
|
40632
|
-
table.
|
|
40653
|
+
table.renderExpanded.value = data => {
|
|
40633
40654
|
return slots.default ? slots.default(data) : slots.default;
|
|
40634
40655
|
};
|
|
40635
40656
|
} else {
|
|
@@ -40648,7 +40669,7 @@ var VcComponents = (function (exports, vue) {
|
|
|
40648
40669
|
style: {}
|
|
40649
40670
|
};
|
|
40650
40671
|
// 存在树形数组,且当前行无箭头图标且处于当前展开列,表格对齐
|
|
40651
|
-
if (!isEmpty$1(table.
|
|
40672
|
+
if (!isEmpty$1(table.store.states.treeData) && !prefix && data.isExpandColumn) {
|
|
40652
40673
|
prefix = vue.createVNode("span", {
|
|
40653
40674
|
"class": "vc-table-un-expand__indent"
|
|
40654
40675
|
}, null);
|
|
@@ -40691,15 +40712,15 @@ var VcComponents = (function (exports, vue) {
|
|
|
40691
40712
|
|
|
40692
40713
|
// 影响布局
|
|
40693
40714
|
vue.watch(() => props.fixed, () => {
|
|
40694
|
-
table.
|
|
40715
|
+
table.store.scheduleLayout(true);
|
|
40695
40716
|
});
|
|
40696
40717
|
vue.watch(() => realWidth.value, v => {
|
|
40697
40718
|
columnConfig['width'] = v;
|
|
40698
40719
|
columnConfig['realWidth'] = v;
|
|
40699
|
-
table.
|
|
40720
|
+
table.store.scheduleLayout(false);
|
|
40700
40721
|
});
|
|
40701
40722
|
vue.watch(() => realMinWidth.value, () => {
|
|
40702
|
-
table.
|
|
40723
|
+
table.store.scheduleLayout(false);
|
|
40703
40724
|
});
|
|
40704
40725
|
};
|
|
40705
40726
|
vue.onBeforeMount(() => {
|
|
@@ -40707,17 +40728,17 @@ var VcComponents = (function (exports, vue) {
|
|
|
40707
40728
|
registerWatchers();
|
|
40708
40729
|
});
|
|
40709
40730
|
vue.onMounted(() => {
|
|
40710
|
-
const children = isSubColumn ? parent.vnode.el.children : parent.
|
|
40731
|
+
const children = isSubColumn ? parent.vnode.el.children : parent.hiddenColumns.value.children;
|
|
40711
40732
|
|
|
40712
40733
|
// DOM上
|
|
40713
40734
|
const columnIndex = [...children].indexOf(instance.vnode.el);
|
|
40714
|
-
table.
|
|
40735
|
+
table.store.insertColumn(columnConfig, columnIndex, isSubColumn && parent.columnConfig);
|
|
40715
40736
|
});
|
|
40716
40737
|
vue.onUnmounted(() => {
|
|
40717
40738
|
if (!instance.parent) return;
|
|
40718
|
-
table.
|
|
40739
|
+
table.store.removeColumn(columnConfig, isSubColumn && parent.columnConfig);
|
|
40719
40740
|
});
|
|
40720
|
-
|
|
40741
|
+
vue.provide('vc-table-column', {
|
|
40721
40742
|
columnId,
|
|
40722
40743
|
columnConfig
|
|
40723
40744
|
});
|