bri-components 1.1.2 → 1.1.4

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.
Files changed (158) hide show
  1. package/lib/0.bri-components.min.js +1 -1
  2. package/lib/1.bri-components.min.js +1 -1
  3. package/lib/10.bri-components.min.js +1 -0
  4. package/lib/2.bri-components.min.js +1 -1
  5. package/lib/3.bri-components.min.js +1 -1
  6. package/lib/4.bri-components.min.js +1 -1
  7. package/lib/5.bri-components.min.js +1 -1
  8. package/lib/6.bri-components.min.js +1 -1
  9. package/lib/7.bri-components.min.js +1 -1
  10. package/lib/8.bri-components.min.js +1 -1
  11. package/lib/9.bri-components.min.js +1 -1
  12. package/lib/bri-components.min.js +6 -6
  13. package/lib/styles/bri-components.css +1 -1
  14. package/package.json +1 -1
  15. package/src/abolish/DshCascaders.less +11 -0
  16. package/src/{components/controls/base/DshCascaderMultiple.vue → abolish/DshCascaders.vue} +17 -27
  17. package/src/{components/list → abolish}/DshFlatTable.vue +1 -1
  18. package/src/abolish/DshTexts.less +13 -0
  19. package/src/{components/controls/base/textMultiple/DshTextMultiple.vue → abolish/DshTexts.vue} +17 -25
  20. package/src/components/controls/base/{textMultiple/MultipleInput.vue → BriInputs.vue} +18 -17
  21. package/src/components/controls/base/{ZUpload/YUploadImage.vue → BriUpload/BriUploadImage.vue} +56 -15
  22. package/src/components/controls/base/{ZUpload → BriUpload}/index.vue +24 -21
  23. package/src/components/controls/base/{ZUpload → BriUpload}/upload-list.vue +20 -13
  24. package/src/components/controls/base/{ZUpload → BriUpload}/uploadMixin.js +7 -3
  25. package/src/components/controls/base/{DshCascader.vue → DshCascader/DshCascader.vue} +33 -26
  26. package/src/components/controls/base/DshCheckbox.vue +17 -20
  27. package/src/components/controls/base/DshCoordinates.vue +119 -110
  28. package/src/components/controls/base/DshDate.vue +24 -37
  29. package/src/components/controls/base/DshDaterange.vue +3 -1
  30. package/src/components/controls/base/DshEditor.vue +73 -60
  31. package/src/components/controls/base/DshInput.vue +72 -60
  32. package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +1 -1
  33. package/src/components/controls/base/DshNumber/DshNumber.vue +52 -48
  34. package/src/components/controls/base/DshNumberange.vue +11 -21
  35. package/src/components/controls/base/DshSelect.vue +13 -17
  36. package/src/components/controls/controlMap.js +12 -11
  37. package/src/components/controls/controlMixin.js +40 -29
  38. package/src/components/controls/controlShow.vue +44 -0
  39. package/src/components/controls/{base → senior}/BriLabels.vue +7 -12
  40. package/src/components/controls/{base → senior}/DshPackage.vue +6 -25
  41. package/src/components/controls/senior/cascaderTable.vue +52 -51
  42. package/src/components/controls/senior/flatTable.vue +20 -17
  43. package/src/components/controls/{base → special}/DshBack.vue +4 -4
  44. package/src/components/controls/{base → special}/DshUndeveloped.vue +3 -1
  45. package/src/components/form/DshAdvSearchForm.vue +10 -1
  46. package/src/components/form/DshForm.vue +10 -3
  47. package/src/components/list/BriFlatTable.vue +5 -5
  48. package/src/components/list/BriTable.vue +6 -8
  49. package/src/components/list/DshBox/DshBox.vue +7 -24
  50. package/src/components/list/DshBox/DshCard.vue +15 -74
  51. package/src/components/list/DshBox/DshCrossTable.vue +4 -8
  52. package/src/components/list/DshBox/DshList.vue +8 -136
  53. package/src/components/list/DshBox/DshPanel.vue +0 -110
  54. package/src/components/list/DshBox/DshTable.vue +1 -4
  55. package/src/components/list/DshCascaderTable.vue +1 -1
  56. package/src/components/list/ZTree.vue +0 -58
  57. package/src/components/other/ZIframe.vue +5 -0
  58. package/src/components/small/DshControlDefine.vue +6 -2
  59. package/src/components/small/DshModal.vue +0 -134
  60. package/src/components/small/DshPage.vue +1 -0
  61. package/src/components/unit/DshFormItem.vue +7 -10
  62. package/src/components/unit/DshUnit.vue +1 -11
  63. package/src/components/unit/unitMixin.js +8 -5
  64. package/src/index.js +16 -33
  65. package/src/styles/common/control.less +63 -27
  66. package/src/styles/components/controls/{MultipleInput.less → BriInputs.less} +1 -1
  67. package/src/styles/components/controls/BriLabels.less +4 -2
  68. package/src/styles/components/controls/{ZUpload.less → BriUpload.less} +5 -6
  69. package/src/styles/components/controls/DshCheckbox.less +45 -42
  70. package/src/styles/components/controls/DshCoordinates.less +66 -59
  71. package/src/styles/components/controls/DshDate.less +1 -52
  72. package/src/styles/components/controls/DshEditor.less +51 -34
  73. package/src/styles/components/controls/DshInput.less +13 -34
  74. package/src/styles/components/controls/DshNumber.less +51 -0
  75. package/src/styles/components/controls/DshNumberange.less +8 -3
  76. package/src/styles/components/controls/DshSelect.less +78 -92
  77. package/src/styles/components/{other → controls}/InfoCascader.less +4 -4
  78. package/src/styles/components/controls/cascaderTable.less +10 -24
  79. package/src/styles/components/controls/controlShow.less +3 -1
  80. package/src/styles/components/controls/flatTable.less +10 -23
  81. package/src/styles/components/form/DshAdvSearchForm.less +0 -9
  82. package/src/styles/components/form/DshDefaultSearch.less +0 -20
  83. package/src/styles/components/index.less +24 -17
  84. package/src/styles/components/list/DshBox/DshBox.less +20 -0
  85. package/src/styles/components/list/DshBox/DshCard.less +59 -0
  86. package/src/styles/components/list/DshBox/DshList.less +142 -0
  87. package/src/styles/components/list/DshBox/DshPanel.less +107 -0
  88. package/src/styles/components/list/DshBox/DshTable.less +4 -0
  89. package/src/styles/components/list/ZTree.less +52 -0
  90. package/src/styles/components/small/DshControlDefine.less +4 -7
  91. package/src/styles/components/small/DshDropdown.less +1 -0
  92. package/src/styles/components/small/DshModal.less +207 -0
  93. package/src/styles/components/unit/DshFormItem.less +2 -0
  94. package/src/styles/reset.less +14 -0
  95. package/src/styles/variables.less +1 -0
  96. package/src/utils/table.js +5 -4
  97. package/src/components/controls/base/DshLabels.vue +0 -309
  98. package/src/components/controls/base/YSerialNumber.vue +0 -36
  99. package/src/components/controls/base/controlShow.vue +0 -52
  100. package/src/components/list/easyTable/index.js +0 -23
  101. package/src/components/list/easyTable/src/directives/clickoutside.js +0 -32
  102. package/src/components/list/easyTable/src/mixins/layerAdjustment.js +0 -62
  103. package/src/components/list/easyTable/src/settings/settings.js +0 -11
  104. package/src/components/list/easyTable/src/utils/deepClone.js +0 -256
  105. package/src/components/list/easyTable/src/utils/dom.js +0 -41
  106. package/src/components/list/easyTable/src/utils/utils.js +0 -190
  107. package/src/components/list/easyTable/v-checkbox/index.js +0 -7
  108. package/src/components/list/easyTable/v-checkbox/src/checkbox.vue +0 -127
  109. package/src/components/list/easyTable/v-checkbox-group/index.js +0 -7
  110. package/src/components/list/easyTable/v-checkbox-group/src/checkbox-group.vue +0 -68
  111. package/src/components/list/easyTable/v-dropdown/index.js +0 -7
  112. package/src/components/list/easyTable/v-dropdown/src/dropdown.vue +0 -337
  113. package/src/components/list/easyTable/v-table/index.js +0 -7
  114. package/src/components/list/easyTable/v-table/src/body-cell-merge-mixin.js +0 -141
  115. package/src/components/list/easyTable/v-table/src/cell-edit-mixin.js +0 -102
  116. package/src/components/list/easyTable/v-table/src/checkbox-selection-mixin.js +0 -189
  117. package/src/components/list/easyTable/v-table/src/classes-mixin.js +0 -56
  118. package/src/components/list/easyTable/v-table/src/drag-width-mixin.js +0 -202
  119. package/src/components/list/easyTable/v-table/src/export-csv.js +0 -74
  120. package/src/components/list/easyTable/v-table/src/frozen-columns-mixin.js +0 -134
  121. package/src/components/list/easyTable/v-table/src/loading.vue +0 -49
  122. package/src/components/list/easyTable/v-table/src/scroll-bar-control-mixin.js +0 -21
  123. package/src/components/list/easyTable/v-table/src/scroll-control-mixin.js +0 -92
  124. package/src/components/list/easyTable/v-table/src/sort-control-mixin.js +0 -108
  125. package/src/components/list/easyTable/v-table/src/table-empty-mixin.js +0 -73
  126. package/src/components/list/easyTable/v-table/src/table-empty.vue +0 -66
  127. package/src/components/list/easyTable/v-table/src/table-filters-mixin.js +0 -126
  128. package/src/components/list/easyTable/v-table/src/table-footer-mixin.js +0 -122
  129. package/src/components/list/easyTable/v-table/src/table-resize-mixin.js +0 -279
  130. package/src/components/list/easyTable/v-table/src/table-row-mouse-events-mixin.js +0 -123
  131. package/src/components/list/easyTable/v-table/src/table.vue +0 -1565
  132. package/src/components/list/easyTable/v-table/src/title-cell-merge-mixin.js +0 -115
  133. package/src/components/list/evTable/EvTable.vue +0 -321
  134. package/src/components/list/evTable/EvTableMixin.js +0 -26
  135. package/src/styles/components/controls/DshLabels.less +0 -187
  136. package/src/styles/components/list/evTable.less +0 -79
  137. package/src/styles/components/list/evtable/animation.less +0 -141
  138. package/src/styles/components/list/evtable/font/fontello.eot +0 -0
  139. package/src/styles/components/list/evtable/font/fontello.svg +0 -32
  140. package/src/styles/components/list/evtable/font/fontello.ttf +0 -0
  141. package/src/styles/components/list/evtable/font/fontello.woff +0 -0
  142. package/src/styles/components/list/evtable/font/fontello.woff2 +0 -0
  143. package/src/styles/components/list/evtable/fontello.less +0 -68
  144. package/src/styles/components/list/evtable/index.less +0 -5
  145. package/src/styles/components/list/evtable/v-checkbox.less +0 -167
  146. package/src/styles/components/list/evtable/v-dropdown.less +0 -235
  147. package/src/styles/components/list/evtable/v-table.less +0 -334
  148. package/src/styles/components/list/ivu_reset.less +0 -49
  149. /package/src/{styles/components/list → abolish}/DshFlatTable.less +0 -0
  150. /package/src/components/{pages/Error → Error}/Error403.vue +0 -0
  151. /package/src/components/{pages/Error → Error}/Error404.vue +0 -0
  152. /package/src/components/{pages/Error → Error}/Error500.vue +0 -0
  153. /package/src/components/{pages/Error → Error}/error.less +0 -0
  154. /package/src/components/{pages/Error → Error}/errorBack.vue +0 -0
  155. /package/src/components/controls/base/{ZUpload → BriUpload}/upload-listItem.vue +0 -0
  156. /package/src/components/{other → controls/base/DshCascader}/InfoCascader.vue +0 -0
  157. /package/src/styles/components/list/{DshCrossTable.less → DshBox/DshCrossTable.less} +0 -0
  158. /package/src/styles/components/list/{DshSingleData.less → DshBox/DshSingleData.less} +0 -0
@@ -1,122 +0,0 @@
1
- import deepClone from "../../src/utils/deepClone.js";
2
-
3
- export default {
4
- data () {
5
-
6
- return {
7
-
8
- footerTotalHeight: 0
9
- };
10
- },
11
- computed: {
12
-
13
- frozenFooterCols () {
14
- let result = [];
15
- if (this.initInternalFooter.length > 0) {
16
- this.initInternalFooter.forEach(columns => {
17
- result.push(columns.filter(col => col.isFrozen));
18
- });
19
- }
20
- return result;
21
- },
22
- frozenRightFooterCols () {
23
- let result = [];
24
- if (this.initInternalFooter.length > 0) {
25
- this.initInternalFooter.forEach(columns => {
26
- result.push(columns.filter(col => col.isFrozenRight));
27
- });
28
- }
29
- return result;
30
- },
31
- noFrozenFooterCols () {
32
- let result = [];
33
-
34
- if (this.initInternalFooter.length > 0) {
35
-
36
- this.initInternalFooter.forEach(columns => {
37
-
38
- result.push(columns.filter(col => !col.isFrozen || !col.isFrozenRight));
39
- });
40
- }
41
-
42
- return result;
43
- },
44
-
45
- getFooterTotalRowHeight () {
46
-
47
- if (Array.isArray(this.footer) && this.footer.length > 0) {
48
-
49
- return this.footer.length * this.footerRowHeight;
50
- }
51
- return 0;
52
- },
53
-
54
- hasTableFooter () {
55
-
56
- return Array.isArray(this.footer) && this.footer.length;
57
- },
58
-
59
- initInternalFooter () {
60
-
61
- if (!(Array.isArray(this.footer) && this.footer.length > 0)) {
62
-
63
- return [];
64
- }
65
-
66
- let result = [];
67
- let resultRow = [];
68
- let cloneInternalColumns;
69
-
70
- // 防止排序后对原数组进行干扰
71
- cloneInternalColumns = deepClone(this.internalColumns);
72
-
73
- cloneInternalColumns.sort(function (a, b) {
74
-
75
- if (a.isFrozen) {
76
-
77
- return -1;
78
- } else if (b.isFrozen) {
79
-
80
- return 1;
81
- }
82
- return 0;
83
- });
84
-
85
- this.footer.forEach((items, rows) => {
86
-
87
- resultRow = [];
88
-
89
- items.forEach((value, index) => {
90
-
91
- resultRow.push({
92
- content: value,
93
- width: cloneInternalColumns[index].width,
94
- align: cloneInternalColumns[index].columnAlign,
95
- isFrozen: !!cloneInternalColumns[index].isFrozen
96
- });
97
- });
98
-
99
- result.push(resultRow);
100
- });
101
- return result;
102
- }
103
- },
104
-
105
- methods: {
106
-
107
- // 设置 footer 单元格样式
108
- setFooterCellClassName (isLeftView, rowIndex, colIndex, value) {
109
-
110
- let _colIndex = colIndex;
111
-
112
- // 如果是右列,并且有固定列
113
- if (!isLeftView && this.hasFrozenColumn) {
114
-
115
- _colIndex += this.frozenCols.length;
116
- }
117
-
118
- return this.footerCellClassName && this.footerCellClassName(rowIndex, _colIndex, value);
119
- }
120
- }
121
-
122
- };
@@ -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
- };