bri-components 1.1.3 → 1.1.5
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/lib/0.bri-components.min.js +1 -1
- package/lib/1.bri-components.min.js +1 -1
- package/lib/2.bri-components.min.js +1 -1
- package/lib/3.bri-components.min.js +1 -1
- package/lib/4.bri-components.min.js +1 -1
- package/lib/5.bri-components.min.js +1 -1
- package/lib/6.bri-components.min.js +1 -1
- package/lib/7.bri-components.min.js +1 -1
- package/lib/bri-components.min.js +6 -6
- package/lib/styles/bri-components.css +1 -1
- package/package.json +1 -1
- package/src/abolish/DshCascaders.less +11 -0
- package/src/{components/controls/base/DshCascaderMultiple.vue → abolish/DshCascaders.vue} +4 -23
- package/src/{components/list → abolish}/DshFlatTable.vue +1 -1
- package/src/abolish/DshTexts.less +13 -0
- package/src/{components/controls/base/textMultiple/DshTextMultiple.vue → abolish/DshTexts.vue} +4 -20
- package/src/components/controls/base/{textMultiple/MultipleInput.vue → BriInputs.vue} +13 -12
- package/src/components/controls/base/{ZUpload/YUploadImage.vue → BriUpload/BriUploadImage.vue} +56 -15
- package/src/components/controls/base/{ZUpload → BriUpload}/index.vue +11 -12
- package/src/components/controls/base/{ZUpload → BriUpload}/uploadMixin.js +2 -2
- package/src/components/controls/base/DshCascader/DshCascader.vue +393 -0
- package/src/components/{other → controls/base/DshCascader}/InfoCascader.vue +11 -9
- package/src/components/controls/base/DshCheckbox.vue +1 -1
- package/src/components/controls/base/DshCoordinates.vue +146 -135
- package/src/components/controls/base/DshEditor.vue +1 -1
- package/src/components/controls/base/DshInput.vue +9 -4
- package/src/components/controls/base/DshNumber/DshNumber.vue +2 -0
- package/src/components/controls/base/DshSelect.vue +1 -1
- package/src/components/controls/controlMap.js +6 -7
- package/src/components/controls/controlMixin.js +31 -10
- package/src/components/list/BriTable.vue +0 -1
- package/src/components/list/DshBox/DshBox.vue +7 -24
- package/src/components/list/DshBox/DshCard.vue +13 -72
- package/src/components/list/DshBox/DshList.vue +8 -136
- package/src/components/list/DshBox/DshPanel.vue +0 -110
- package/src/components/list/DshBox/DshTable.vue +1 -4
- package/src/components/list/ZTree.vue +0 -58
- package/src/components/other/BriSvg.vue +28 -0
- package/src/components/other/DshEditPanel.vue +33 -11
- package/src/components/other/ZIframe.vue +5 -0
- package/src/components/other/ZLoading.vue +24 -12
- package/src/components/small/DshPage.vue +1 -0
- package/src/index.js +17 -28
- package/src/styles/common/control.less +16 -17
- package/src/styles/components/controls/{MultipleInput.less → BriInputs.less} +1 -1
- package/src/styles/components/controls/{ZUpload.less → BriUpload.less} +4 -4
- package/src/styles/components/controls/DshCascader.less +66 -50
- package/src/styles/components/controls/DshCoordinates.less +53 -43
- package/src/styles/components/controls/DshNumber.less +18 -0
- package/src/styles/components/index.less +22 -17
- package/src/styles/components/list/DshBox/DshBox.less +20 -0
- package/src/styles/components/list/DshBox/DshCard.less +59 -0
- package/src/styles/components/list/DshBox/DshList.less +142 -0
- package/src/styles/components/list/DshBox/DshPanel.less +107 -0
- package/src/styles/components/list/DshBox/DshTable.less +4 -0
- package/src/styles/components/list/ZTree.less +52 -0
- package/src/styles/components/other/ZLoading.less +5 -7
- package/src/styles/components/small/DshDropdown.less +1 -7
- package/src/styles/components/small/DshModal.less +1 -1
- package/src/styles/variables.less +1 -0
- package/src/utils/table.js +3 -2
- package/src/components/controls/base/DshCascader.vue +0 -350
- package/src/components/controls/base/YSerialNumber.vue +0 -43
- package/src/components/list/easyTable/index.js +0 -23
- package/src/components/list/easyTable/src/directives/clickoutside.js +0 -32
- package/src/components/list/easyTable/src/mixins/layerAdjustment.js +0 -62
- package/src/components/list/easyTable/src/settings/settings.js +0 -11
- package/src/components/list/easyTable/src/utils/deepClone.js +0 -256
- package/src/components/list/easyTable/src/utils/dom.js +0 -41
- package/src/components/list/easyTable/src/utils/utils.js +0 -190
- package/src/components/list/easyTable/v-checkbox/index.js +0 -7
- package/src/components/list/easyTable/v-checkbox/src/checkbox.vue +0 -127
- package/src/components/list/easyTable/v-checkbox-group/index.js +0 -7
- package/src/components/list/easyTable/v-checkbox-group/src/checkbox-group.vue +0 -68
- package/src/components/list/easyTable/v-dropdown/index.js +0 -7
- package/src/components/list/easyTable/v-dropdown/src/dropdown.vue +0 -337
- package/src/components/list/easyTable/v-table/index.js +0 -7
- package/src/components/list/easyTable/v-table/src/body-cell-merge-mixin.js +0 -141
- package/src/components/list/easyTable/v-table/src/cell-edit-mixin.js +0 -102
- package/src/components/list/easyTable/v-table/src/checkbox-selection-mixin.js +0 -189
- package/src/components/list/easyTable/v-table/src/classes-mixin.js +0 -56
- package/src/components/list/easyTable/v-table/src/drag-width-mixin.js +0 -202
- package/src/components/list/easyTable/v-table/src/export-csv.js +0 -74
- package/src/components/list/easyTable/v-table/src/frozen-columns-mixin.js +0 -134
- package/src/components/list/easyTable/v-table/src/loading.vue +0 -49
- package/src/components/list/easyTable/v-table/src/scroll-bar-control-mixin.js +0 -21
- package/src/components/list/easyTable/v-table/src/scroll-control-mixin.js +0 -92
- package/src/components/list/easyTable/v-table/src/sort-control-mixin.js +0 -108
- package/src/components/list/easyTable/v-table/src/table-empty-mixin.js +0 -73
- package/src/components/list/easyTable/v-table/src/table-empty.vue +0 -66
- package/src/components/list/easyTable/v-table/src/table-filters-mixin.js +0 -126
- package/src/components/list/easyTable/v-table/src/table-footer-mixin.js +0 -122
- package/src/components/list/easyTable/v-table/src/table-resize-mixin.js +0 -279
- package/src/components/list/easyTable/v-table/src/table-row-mouse-events-mixin.js +0 -123
- package/src/components/list/easyTable/v-table/src/table.vue +0 -1565
- package/src/components/list/easyTable/v-table/src/title-cell-merge-mixin.js +0 -115
- package/src/components/list/evTable/EvTable.vue +0 -321
- package/src/components/list/evTable/EvTableMixin.js +0 -26
- package/src/components/small/DshControlDefine.vue +0 -111
- package/src/styles/components/list/evTable.less +0 -79
- package/src/styles/components/list/evtable/animation.less +0 -141
- package/src/styles/components/list/evtable/font/fontello.eot +0 -0
- package/src/styles/components/list/evtable/font/fontello.svg +0 -32
- package/src/styles/components/list/evtable/font/fontello.ttf +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff2 +0 -0
- package/src/styles/components/list/evtable/fontello.less +0 -68
- package/src/styles/components/list/evtable/index.less +0 -5
- package/src/styles/components/list/evtable/v-checkbox.less +0 -167
- package/src/styles/components/list/evtable/v-dropdown.less +0 -235
- package/src/styles/components/list/evtable/v-table.less +0 -334
- package/src/styles/components/list/ivu_reset.less +0 -49
- package/src/styles/components/small/DshControlDefine.less +0 -40
- /package/src/{styles/components/list → abolish}/DshFlatTable.less +0 -0
- /package/src/components/{pages/Error → Error}/Error403.vue +0 -0
- /package/src/components/{pages/Error → Error}/Error404.vue +0 -0
- /package/src/components/{pages/Error → Error}/Error500.vue +0 -0
- /package/src/components/{pages/Error → Error}/error.less +0 -0
- /package/src/components/{pages/Error → Error}/errorBack.vue +0 -0
- /package/src/components/controls/base/{ZUpload → BriUpload}/upload-list.vue +0 -0
- /package/src/components/controls/base/{ZUpload → BriUpload}/upload-listItem.vue +0 -0
- /package/src/styles/components/{other → controls}/InfoCascader.less +0 -0
- /package/src/styles/components/list/{DshCrossTable.less → DshBox/DshCrossTable.less} +0 -0
- /package/src/styles/components/list/{DshSingleData.less → DshBox/DshSingleData.less} +0 -0
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* 列自适应
|
|
3
|
-
* */
|
|
4
|
-
import utils from "../../src/utils/utils.js";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
|
|
8
|
-
data () {
|
|
9
|
-
return {
|
|
10
|
-
resizeColumns: [], // 所有需要自适应的列集合
|
|
11
|
-
initTotalColumnsWidth: 0, // 所有列初始化时的总宽度
|
|
12
|
-
hasContainerWidth: false, // 容器是否有宽度(display:none 时没有)
|
|
13
|
-
containerWidthCheckTimer: null
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
methods: {
|
|
18
|
-
// 获取所有自适应列的集合
|
|
19
|
-
getResizeColumns () {
|
|
20
|
-
|
|
21
|
-
let result = [];
|
|
22
|
-
|
|
23
|
-
this.internalColumns.forEach(item => {
|
|
24
|
-
|
|
25
|
-
if (item.isResize) {
|
|
26
|
-
result.push({width: item.width, field: item.field});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
this.resizeColumns = result;
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
// 初始化
|
|
35
|
-
initResizeColumns () {
|
|
36
|
-
|
|
37
|
-
this.initTotalColumnsWidth = this.totalColumnsWidth;
|
|
38
|
-
this.getResizeColumns();
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
// 如果初始化时document上包含滚动条,渲染完document滚动条消失会造成表格宽度计算有误的问题
|
|
42
|
-
containerWidthCheck () {
|
|
43
|
-
|
|
44
|
-
this.containerWidthCheckTimer = setTimeout(x => {
|
|
45
|
-
|
|
46
|
-
let tableContainerWidth = this.$el.clientWidth;
|
|
47
|
-
|
|
48
|
-
// 3为容错值
|
|
49
|
-
if (tableContainerWidth - this.internalWidth > 3) {
|
|
50
|
-
|
|
51
|
-
this.tableResize();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
// 目前适用于有横向自适应功能的表格
|
|
57
|
-
adjustHeight (hasScrollBar) {
|
|
58
|
-
|
|
59
|
-
if (!this.$el || this.isVerticalResize) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let totalColumnsHeight = this.getTotalColumnsHeight();
|
|
64
|
-
let scrollbarWidth = this.scrollbarWidth;
|
|
65
|
-
|
|
66
|
-
// 有footer 功能
|
|
67
|
-
if (this.hasTableFooter) {
|
|
68
|
-
|
|
69
|
-
if (hasScrollBar) {
|
|
70
|
-
|
|
71
|
-
if (this.footerTotalHeight === this.getFooterTotalRowHeight) {
|
|
72
|
-
|
|
73
|
-
this.footerTotalHeight += scrollbarWidth;
|
|
74
|
-
|
|
75
|
-
if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {
|
|
76
|
-
this.internalHeight += scrollbarWidth;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
} else if (!hasScrollBar) {
|
|
80
|
-
|
|
81
|
-
if (this.footerTotalHeight > this.getFooterTotalRowHeight) {
|
|
82
|
-
|
|
83
|
-
this.footerTotalHeight -= scrollbarWidth;
|
|
84
|
-
|
|
85
|
-
if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {
|
|
86
|
-
|
|
87
|
-
this.internalHeight -= scrollbarWidth;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// 当没有设置高度时计算总高度 || 设置的高度大于所有列高度之和时
|
|
93
|
-
else if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {
|
|
94
|
-
|
|
95
|
-
if (hasScrollBar && this.internalHeight + 2 < totalColumnsHeight + scrollbarWidth) {
|
|
96
|
-
|
|
97
|
-
this.internalHeight += scrollbarWidth;
|
|
98
|
-
|
|
99
|
-
} else if (!hasScrollBar) {
|
|
100
|
-
|
|
101
|
-
this.internalHeight = this.getTotalColumnsHeight();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
// 随着窗口改变表格自适应
|
|
107
|
-
tableResize () {
|
|
108
|
-
if (!this.isHorizontalResize && !this.isVerticalResize) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
let totalColumnsHeight = this.getTotalColumnsHeight();
|
|
113
|
-
let maxWidth = this.maxWidth;
|
|
114
|
-
let maxHeight = (this.height && this.height > 0) ? this.height : totalColumnsHeight;
|
|
115
|
-
let minWidth = this.minWidth;
|
|
116
|
-
let minHeight = this.minHeight > totalColumnsHeight ? totalColumnsHeight : this.minHeight;
|
|
117
|
-
let view = this.$el;
|
|
118
|
-
let viewOffset = utils.getViewportOffset(view);
|
|
119
|
-
let currentWidth = view.getBoundingClientRect !== "undefined" ? view.getBoundingClientRect().width : view.clientWidth;
|
|
120
|
-
let currentHeight = view.getBoundingClientRect !== "undefined" ? view.getBoundingClientRect().height : view.clientHeight;
|
|
121
|
-
// let right = window.document.documentElement.clientWidth - currentWidth - viewOffset.left;
|
|
122
|
-
let bottom = window.document.documentElement.clientHeight - currentHeight - viewOffset.top - 2;
|
|
123
|
-
let bottom2 = viewOffset.bottom2;
|
|
124
|
-
let scrollbarWidth = this.scrollbarWidth;
|
|
125
|
-
|
|
126
|
-
if (this.isHorizontalResize && this.internalWidth && this.internalWidth > 0 && currentWidth > 0) {
|
|
127
|
-
|
|
128
|
-
currentWidth = currentWidth > maxWidth ? maxWidth : currentWidth;
|
|
129
|
-
currentWidth = currentWidth < minWidth ? minWidth : currentWidth;
|
|
130
|
-
|
|
131
|
-
this.internalWidth = currentWidth;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (this.isVerticalResize && currentHeight > 0) {
|
|
135
|
-
|
|
136
|
-
bottom -= this.verticalResizeOffset;
|
|
137
|
-
|
|
138
|
-
currentHeight = currentHeight + bottom;// - this.VerticalResizeOffset;
|
|
139
|
-
currentHeight = currentHeight > maxHeight ? maxHeight : currentHeight;
|
|
140
|
-
currentHeight = currentHeight < minHeight ? minHeight : currentHeight;
|
|
141
|
-
|
|
142
|
-
// 有横向滚动条
|
|
143
|
-
if (currentWidth <= this.initTotalColumnsWidth && !this.isTableEmpty) {
|
|
144
|
-
|
|
145
|
-
bottom2 -= this.verticalResizeOffset;
|
|
146
|
-
|
|
147
|
-
let differ = bottom2 - totalColumnsHeight;
|
|
148
|
-
|
|
149
|
-
// 高度足够(table 顶部到文档底部的高度 > 表格高度+滚动条高度)
|
|
150
|
-
if (bottom2 > totalColumnsHeight + scrollbarWidth) {
|
|
151
|
-
|
|
152
|
-
currentHeight += scrollbarWidth;
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
else if (differ > 0 && differ < scrollbarWidth) {
|
|
156
|
-
|
|
157
|
-
currentHeight += differ;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
this.internalHeight = currentHeight;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
this.changeColumnsWidth(currentWidth);
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
// 改变所有需要自适应列的宽度
|
|
168
|
-
changeColumnsWidth (currentWidth) {
|
|
169
|
-
|
|
170
|
-
let differ = currentWidth - this.totalColumnsWidth;
|
|
171
|
-
let initResizeWidths = this.initTotalColumnsWidth;
|
|
172
|
-
let rightViewBody = this.$el.querySelector(".v-table-body");
|
|
173
|
-
let rightViewFooter = this.$el.querySelector(".v-table-rightview .v-table-footer");
|
|
174
|
-
|
|
175
|
-
if (currentWidth <= initResizeWidths && !this.isTableEmpty) { // 排除表格无数据的影响
|
|
176
|
-
|
|
177
|
-
if (this.hasTableFooter) {
|
|
178
|
-
|
|
179
|
-
rightViewFooter.style.overflowX = "scroll";
|
|
180
|
-
|
|
181
|
-
} else {
|
|
182
|
-
|
|
183
|
-
rightViewBody.style.overflowX = "scroll";
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
this.adjustHeight(true);
|
|
187
|
-
|
|
188
|
-
} else {
|
|
189
|
-
// 防止最后一列右距中时内容显示不全
|
|
190
|
-
if (this.getTotalColumnsHeight() > this.internalHeight) {
|
|
191
|
-
|
|
192
|
-
differ -= this.scrollbarWidth;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (this.hasTableFooter) {
|
|
196
|
-
|
|
197
|
-
rightViewFooter.style.overflowX = "hidden";
|
|
198
|
-
} else {
|
|
199
|
-
|
|
200
|
-
rightViewBody && rightViewBody.style && (rightViewBody.style.overflowX = "hidden");
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
this.adjustHeight(false);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (this.hasFrozenColumn) {
|
|
207
|
-
|
|
208
|
-
differ -= 1;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (currentWidth >= initResizeWidths || differ > 0) {
|
|
212
|
-
|
|
213
|
-
this.setColumnsWidth(differ);
|
|
214
|
-
|
|
215
|
-
} else { // 最小化有滚动条时
|
|
216
|
-
|
|
217
|
-
this.columns.forEach((col, index) => {
|
|
218
|
-
|
|
219
|
-
if (col.isResize) {
|
|
220
|
-
|
|
221
|
-
this.internalColumns[index].width = col.width;
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
this.containerWidthCheck();
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
/*
|
|
230
|
-
* 自适应时给列设置宽度
|
|
231
|
-
* 备注:浏览器 px 必须精确多整数
|
|
232
|
-
* */
|
|
233
|
-
setColumnsWidth (differ) {
|
|
234
|
-
|
|
235
|
-
let resizeColumnsLen = this.resizeColumns.length;
|
|
236
|
-
let average = Math.floor(differ / resizeColumnsLen);
|
|
237
|
-
let totalAverage = average * resizeColumnsLen;
|
|
238
|
-
let leftAverage = differ - totalAverage;
|
|
239
|
-
let leftAverageFloor = Math.floor(leftAverage);
|
|
240
|
-
let averageColumnsWidthArr = (new Array(resizeColumnsLen)).fill(average);
|
|
241
|
-
let index = 0;
|
|
242
|
-
|
|
243
|
-
// 剩余的宽度以整数的形式平均到每个列
|
|
244
|
-
for (let i = 0; i < leftAverageFloor; i++) {
|
|
245
|
-
|
|
246
|
-
averageColumnsWidthArr[i] += 1;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// 剩余的小数给最后一列
|
|
250
|
-
averageColumnsWidthArr[resizeColumnsLen - 1] += (leftAverage - leftAverageFloor);
|
|
251
|
-
|
|
252
|
-
this.internalColumns.map(item => {
|
|
253
|
-
|
|
254
|
-
if (item.isResize) {
|
|
255
|
-
|
|
256
|
-
item.width += averageColumnsWidthArr[index++];
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return item;
|
|
260
|
-
});
|
|
261
|
-
},
|
|
262
|
-
timerFn () {
|
|
263
|
-
setTimeout(() => {
|
|
264
|
-
this.tableResize();
|
|
265
|
-
}, 500);
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
mounted () {
|
|
270
|
-
|
|
271
|
-
utils.bind(window, "resize", this.timerFn);
|
|
272
|
-
},
|
|
273
|
-
beforeDestroy () {
|
|
274
|
-
|
|
275
|
-
utils.unbind(window, "resize", this.tableResize);
|
|
276
|
-
clearTimeout(this.containerWidthCheckTimer);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
};
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
data () {
|
|
3
|
-
return {
|
|
4
|
-
hoverRowIndex: -1,
|
|
5
|
-
clickRowIndex: -1
|
|
6
|
-
};
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
methods: {
|
|
10
|
-
|
|
11
|
-
handleMouseEnter (rowIndex) {
|
|
12
|
-
if (this.rowHoverColor && this.rowHoverColor.length > 0) {
|
|
13
|
-
this.hoverRowIndex = rowIndex;
|
|
14
|
-
}
|
|
15
|
-
this.rowMouseEnter && this.rowMouseEnter(rowIndex);
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
handleMouseOut (rowIndex) {
|
|
19
|
-
if (this.rowHoverColor && this.rowHoverColor.length > 0) {
|
|
20
|
-
this.hoverRowIndex = -1;
|
|
21
|
-
}
|
|
22
|
-
this.rowMouseLeave && this.rowMouseLeave(rowIndex);
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
* 表头单元格单击事件
|
|
27
|
-
* 注意:如果为复杂表头,field 为数组
|
|
28
|
-
* */
|
|
29
|
-
titleCellClick (field, title) {
|
|
30
|
-
this.titleClick && this.titleClick(title, field);
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* 表头单元格双击事件
|
|
35
|
-
* 注意:如果为复杂表头,field 为数组
|
|
36
|
-
* */
|
|
37
|
-
titleCellDblClick (field, title) {
|
|
38
|
-
this.titleDblclick && this.titleDblclick(title, field);
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
// 行单击事件
|
|
42
|
-
rowCellClick (rowIndex, rowData, column) {
|
|
43
|
-
if (this.rowClickColor && this.rowClickColor.length > 0) {
|
|
44
|
-
this.clickRowIndex = rowIndex;
|
|
45
|
-
}
|
|
46
|
-
this.rowClick && this.rowClick(rowIndex, rowData, column);
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
// 行双击事件
|
|
50
|
-
rowCellDbClick (rowIndex, rowData, column) {
|
|
51
|
-
this.rowDblclick && this.rowDblclick(rowIndex, rowData, column);
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
/*
|
|
55
|
-
* @method getHighPriorityBgColor 获取高优先级的行背景色 优先级 click color > hover color > 奇偶color > table bg color
|
|
56
|
-
* */
|
|
57
|
-
getHighPriorityBgColor (rowIndex) {
|
|
58
|
-
let result = "";
|
|
59
|
-
if (this.clickRowIndex === rowIndex) {
|
|
60
|
-
result = this.rowClickColor;
|
|
61
|
-
} else if (this.hoverRowIndex === rowIndex) {
|
|
62
|
-
result = this.rowHoverColor;
|
|
63
|
-
}
|
|
64
|
-
if (result.length <= 0) {
|
|
65
|
-
if ((this.evenBgColor && this.evenBgColor.length > 0) || (this.oddBgColor && this.oddBgColor.length > 0)) {
|
|
66
|
-
result = (rowIndex + 1) % 2 === 0 ? this.evenBgColor : this.oddBgColor;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (result.length <= 0) {
|
|
70
|
-
result = this.tableBgColor;
|
|
71
|
-
}
|
|
72
|
-
return result;
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
setRowBgColor (newVal, oldVal, color) {
|
|
76
|
-
let el = this.$el;
|
|
77
|
-
if (!el) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
let rowsCollection = [];
|
|
82
|
-
let oldRow;
|
|
83
|
-
let newRow;
|
|
84
|
-
|
|
85
|
-
if (this.hasFrozenColumn) {
|
|
86
|
-
rowsCollection.push(el.querySelectorAll(".v-table-leftview .v-table-row"));
|
|
87
|
-
}
|
|
88
|
-
if (this.hasFrozenRightColumn) {
|
|
89
|
-
rowsCollection.push(el.querySelectorAll(".v-table-rightview .v-table-row"));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
rowsCollection.push(el.querySelectorAll(".v-table-centerview .v-table-row"));
|
|
93
|
-
|
|
94
|
-
rowsCollection.forEach(rows => {
|
|
95
|
-
oldRow = rows[oldVal];
|
|
96
|
-
newRow = rows[newVal];
|
|
97
|
-
|
|
98
|
-
if (oldRow) {
|
|
99
|
-
oldRow.style.backgroundColor = this.getHighPriorityBgColor(oldVal);
|
|
100
|
-
}
|
|
101
|
-
if (newRow) {
|
|
102
|
-
newRow.style.backgroundColor = color;
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
|
-
// 取消当前选中的行
|
|
107
|
-
clearCurrentRow () {
|
|
108
|
-
this.clickRowIndex = -1;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
watch: {
|
|
114
|
-
|
|
115
|
-
"hoverRowIndex": function (newVal, oldVal) {
|
|
116
|
-
this.setRowBgColor(newVal, oldVal, this.rowHoverColor);
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
"clickRowIndex": function (newVal, oldVal) {
|
|
120
|
-
this.setRowBgColor(newVal, oldVal, this.rowClickColor);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
};
|