ocpview-plus 1.3.15 → 1.3.16
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/README.md +55 -43
- package/dist/ocpviewplus.min.esm.js +574 -482
- package/dist/ocpviewplus.min.js +9 -9
- package/dist/style.css +1 -1
- package/dist/styles/efviewplus.css +1 -1
- package/package.json +146 -146
- package/src/components/base/ContractPrintMixins.js +30 -30
- package/src/components/base/controlbase.vue +190 -190
- package/src/components/base/controlbox.vue +102 -102
- package/src/components/base/index.js +2 -2
- package/src/components/base/load.js +19 -19
- package/src/components/base/probase.js +220 -220
- package/src/components/base/size.js +78 -78
- package/src/components/billbox/billbox.vue +67 -67
- package/src/components/billbox/index.js +1 -1
- package/src/components/cascaderbox/cascaderbox.vue +184 -184
- package/src/components/cascaderbox/index.js +2 -2
- package/src/components/checkbox/checkbox.vue +75 -75
- package/src/components/checkbox/checkgroupbox.vue +103 -103
- package/src/components/checkbox/index.js +2 -2
- package/src/components/colorbox/colorbox.vue +43 -43
- package/src/components/colorbox/index.js +1 -1
- package/src/components/combobox/combobox.vue +219 -219
- package/src/components/combobox/index.js +1 -1
- package/src/components/conditionbox/conditionbase.vue +194 -194
- package/src/components/conditionbox/conditionbox.vue +62 -62
- package/src/components/conditionbox/conditionfilterbox.vue +479 -479
- package/src/components/conditionbox/conditionselectorbox.vue +237 -237
- package/src/components/conditionbox/index.js +4 -4
- package/src/components/conditionbox/queryconditionbox.vue +25 -25
- package/src/components/conditionbox/queryconditionboxbase.vue +123 -123
- package/src/components/conditionbox/searchconditionbox.vue +113 -113
- package/src/components/conditionbox/searchgrid.vue +391 -391
- package/src/components/datebox/DateBoxV1.vue +22 -22
- package/src/components/datebox/datebox.vue +129 -129
- package/src/components/datebox/daterangebox.vue +154 -154
- package/src/components/datebox/index.js +5 -5
- package/src/components/form/baseform.vue +676 -676
- package/src/components/form/detailsbox.vue +487 -487
- package/src/components/form/formbox.vue +28 -28
- package/src/components/form/formcardbox.vue +267 -267
- package/src/components/form/formcardbox2.vue +228 -228
- package/src/components/form/formcardgroupbox.vue +251 -251
- package/src/components/form/formcompro.js +18 -18
- package/src/components/form/formdetail.vue +128 -128
- package/src/components/form/formdetailtwo.vue +302 -302
- package/src/components/form/index.js +9 -9
- package/src/components/form/toolanchor.js +45 -45
- package/src/components/form/workform.vue +167 -167
- package/src/components/grid/basegrid.vue +1062 -1062
- package/src/components/grid/editgrid.vue +51 -51
- package/src/components/grid/editgridbase.vue +1062 -1062
- package/src/components/grid/editgridcard.vue +193 -193
- package/src/components/grid/expandrow.vue +137 -137
- package/src/components/grid/index.js +5 -5
- package/src/components/grid/viewgrid.vue +121 -121
- package/src/components/grid/viewgridbase.vue +1286 -1286
- package/src/components/icon/common-icon.vue +53 -53
- package/src/components/icon/eicon.vue +28 -28
- package/src/components/icon/icons.vue +42 -42
- package/src/components/icon/index.js +1 -1
- package/src/components/label/index.js +2 -2
- package/src/components/label/showtext.vue +94 -94
- package/src/components/load/loadcartoon.vue +227 -227
- package/src/components/map/index.js +1 -1
- package/src/components/map/mapbox.vue +348 -348
- package/src/components/masterplate/RewriteBillListDetails/BillInfoPanel.vue +184 -184
- package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTable.vue +838 -838
- package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTableControlbox.vue +126 -126
- package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTableControlboxNumberbox.vue +27 -27
- package/src/components/masterplate/RewriteBillListDetails/BillListPanel.vue +126 -126
- package/src/components/masterplate/RewriteBillListDetails/BillListPanelQueryBar.vue +280 -280
- package/src/components/masterplate/RewriteBillListDetails/BillListPanelTable.vue +346 -346
- package/src/components/masterplate/RewriteBillListDetails/index.vue +325 -325
- package/src/components/masterplate/RewriteBillListDetails/mixins/useVxeGridEditTypeKeydownEventHook.js +251 -251
- package/src/components/masterplate/RewriteListdetails/BillListPanelV2.vue +115 -115
- package/src/components/masterplate/RewriteListdetails/BillListPanelV2QueryBar.vue +24 -24
- package/src/components/masterplate/RewriteListdetails/BillListPanelV3.vue +121 -121
- package/src/components/masterplate/RewriteListdetails/BillListPanelV3QueryBar.vue +275 -275
- package/src/components/masterplate/RewriteListdetails/indexV2.vue +320 -320
- package/src/components/masterplate/RewriteListdetails/indexV3.vue +331 -331
- package/src/components/masterplate/appendix.vue +586 -586
- package/src/components/masterplate/approval.vue +863 -863
- package/src/components/masterplate/base.vue +1028 -1028
- package/src/components/masterplate/billasyncimport.vue +614 -614
- package/src/components/masterplate/billconditionbox.vue +223 -223
- package/src/components/masterplate/billconditionsbox.vue +427 -427
- package/src/components/masterplate/billdetailform.vue +1028 -1028
- package/src/components/masterplate/billimport.vue +301 -301
- package/src/components/masterplate/billquerygrid.vue +391 -391
- package/src/components/masterplate/billsinglegrid.vue +234 -234
- package/src/components/masterplate/birtreport.vue +185 -185
- package/src/components/masterplate/contractappendix.vue +688 -688
- package/src/components/masterplate/detailbtntoolbar.vue +311 -311
- package/src/components/masterplate/detailsbox.vue +386 -386
- package/src/components/masterplate/editgridcard.vue +292 -292
- package/src/components/masterplate/editgridcard2.vue +127 -127
- package/src/components/masterplate/formcard.vue +105 -105
- package/src/components/masterplate/formcardgroupbox.vue +167 -167
- package/src/components/masterplate/formdetailtwo.vue +366 -366
- package/src/components/masterplate/gridcolset.vue +226 -226
- package/src/components/masterplate/index.js +54 -54
- package/src/components/masterplate/layouttemplate.vue +51 -51
- package/src/components/masterplate/leftlistrightdetails.vue +581 -581
- package/src/components/masterplate/leftlistrightlist.vue +464 -464
- package/src/components/masterplate/lefttreerightdetails.vue +636 -636
- package/src/components/masterplate/levelreport.vue +510 -510
- package/src/components/masterplate/listbtntoolbar.vue +276 -276
- package/src/components/masterplate/listdetails.vue +768 -768
- package/src/components/masterplate/operlog.vue +272 -272
- package/src/components/masterplate/options.vue +110 -110
- package/src/components/masterplate/page.vue +102 -102
- package/src/components/masterplate/promptmessage.vue +73 -73
- package/src/components/masterplate/querybar.vue +490 -490
- package/src/components/masterplate/report.vue +357 -357
- package/src/components/masterplate/rowbtntoolbar.vue +126 -126
- package/src/components/masterplate/simpletree.vue +137 -137
- package/src/components/masterplate/simpleviewgrid.vue +144 -144
- package/src/components/mychart/bar/bar.vue +201 -201
- package/src/components/mychart/basechart.vue +190 -190
- package/src/components/mychart/complexmychart/barline.vue +153 -153
- package/src/components/mychart/gauge/gauge.vue +82 -82
- package/src/components/mychart/index.js +8 -8
- package/src/components/mychart/line/line.vue +201 -201
- package/src/components/mychart/liquidfill/liquidfill.vue +108 -108
- package/src/components/mychart/pie/pie.vue +95 -95
- package/src/components/mychart/radar/radar.vue +121 -121
- package/src/components/mychart/scatter/scatter.vue +75 -75
- package/src/components/numberbox/NumberBoxV1.vue +39 -39
- package/src/components/numberbox/append.js +11 -11
- package/src/components/numberbox/index.js +4 -4
- package/src/components/numberbox/numberbox.vue +302 -302
- package/src/components/numberbox/numberrangebox.vue +422 -422
- package/src/components/picturebox/filebox.vue +369 -369
- package/src/components/picturebox/index.js +2 -2
- package/src/components/picturebox/picturebox.vue +541 -541
- package/src/components/picturebox/uploadbox.vue +164 -164
- package/src/components/poptagbox/index.js +1 -1
- package/src/components/poptagbox/poptagbox.vue +388 -388
- package/src/components/poptextbox/index.js +1 -1
- package/src/components/poptextbox/poptextbox.vue +624 -624
- package/src/components/radiobox/index.js +1 -1
- package/src/components/radiobox/radiogroupbox.vue +75 -75
- package/src/components/richtextbox/editor.vue +150 -150
- package/src/components/richtextbox/index.js +1 -1
- package/src/components/richtextbox/richtextbox.vue +448 -448
- package/src/components/textbox/index.js +1 -1
- package/src/components/textbox/textbox.vue +97 -97
- package/src/components/timebox/index.js +1 -1
- package/src/components/timebox/timebox.vue +75 -75
- package/src/components/toolbar/ebutton.vue +169 -169
- package/src/components/toolbar/index.js +3 -3
- package/src/components/toolbar/toolbar.vue +445 -445
- package/src/components/tree/CompatTree.vue +297 -297
- package/src/components/tree/basetree.vue +1098 -1098
- package/src/components/tree/index.js +2 -2
- package/src/components/tree/treedata.vue +53 -53
- package/src/components/tree/treedatabase.vue +189 -189
- package/src/components/upload/billimport.vue +233 -233
- package/src/components/upload/index.js +1 -1
- package/src/components/videobox/index.js +1 -1
- package/src/components/videobox/uploadbox.vue +148 -148
- package/src/components/videobox/videobox.vue +503 -503
- package/src/components/wrichtextbox/editor.vue +219 -219
- package/src/components/wrichtextbox/index.js +1 -1
- package/src/components/wrichtextbox/wrichtextbox.vue +62 -62
- package/src/index.js +231 -231
- package/src/locale/format.js +51 -51
- package/src/locale/index.js +63 -63
- package/src/locale/lang/zh-CN.js +123 -123
- package/src/locale/lang/zh-TW.js +114 -114
- package/src/locale/lang/zh-UG.js +115 -115
- package/src/locale/lang.js +15 -15
- package/src/method/case/case.js +1274 -1274
- package/src/method/config/queryconfig.js +24 -24
- package/src/method/const/const.js +815 -815
- package/src/method/index.js +7 -7
- package/src/plugins/theme/theme-variable.css +114 -114
- package/src/plugins/vxeTable/index.js +241 -241
- package/src/plugins/vxeTable/renderer/components/TableFilterInput.vue +51 -51
- package/src/plugins/vxeTable/renderer/filter.js +32 -32
- package/src/static/excel/exportexcel.js +626 -626
- package/src/static/iview/coustom.js +462 -462
- package/src/store/index.js +18 -18
- package/src/store/modules/app.js +53 -53
- package/src/styles/README.md +3 -3
- package/src/styles/common.less +80 -80
- package/src/styles/components/anchor.less +74 -74
- package/src/styles/components/approval.less +135 -135
- package/src/styles/components/button.less +208 -208
- package/src/styles/components/card.less +51 -51
- package/src/styles/components/content.less +38 -38
- package/src/styles/components/font.less +313 -313
- package/src/styles/components/form.less +71 -71
- package/src/styles/components/iconfont/fonts/iconfont.less +1384 -1384
- package/src/styles/components/iconfont/fonts/iconfont.svg +703 -703
- package/src/styles/components/index.less +16 -16
- package/src/styles/components/input.less +290 -290
- package/src/styles/components/modal.less +203 -203
- package/src/styles/components/page.less +340 -340
- package/src/styles/components/select.less +361 -361
- package/src/styles/components/steps.less +367 -367
- package/src/styles/components/table.less +544 -544
- package/src/styles/components/tabs.less +249 -249
- package/src/styles/components/upload.less +82 -82
- package/src/styles/custom.less +67 -67
- package/src/styles/index.less +6 -6
- package/src/styles/pack.less +6 -6
- package/src/utils/EfuMessenger.js +155 -155
- package/src/utils/assist.js +353 -353
- package/src/utils/index.js +1 -1
- package/src/utils/random_str.js +10 -10
- package/src/components/masterplate/detailgridbox.vue +0 -386
|
@@ -1,463 +1,463 @@
|
|
|
1
|
-
import { scrollTop } from '../../utils/assist';
|
|
2
|
-
import {deepCopy} from '../../utils/assist';
|
|
3
|
-
let common = {};
|
|
4
|
-
function Table_getSelection () {
|
|
5
|
-
// 分别拿根数据和子数据的已选项
|
|
6
|
-
let selectionIndexes = [];
|
|
7
|
-
let selectionRowKeys = [];
|
|
8
|
-
for (let i in this.objData) {
|
|
9
|
-
const objData = this.objData[i];
|
|
10
|
-
if (objData._isChecked) selectionIndexes.push(parseInt(i));
|
|
11
|
-
if (objData.children && objData.children.length) {
|
|
12
|
-
selectionRowKeys = selectionRowKeys.concat(this.getSelectionChildrenRowKeys(objData, selectionRowKeys));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// 去重的 RowKeys
|
|
17
|
-
selectionRowKeys = [...new Set(selectionRowKeys)];
|
|
18
|
-
|
|
19
|
-
let selection = [];
|
|
20
|
-
|
|
21
|
-
this.data.forEach((item, index) => {
|
|
22
|
-
if (selectionIndexes.indexOf(index) > -1) {
|
|
23
|
-
// 自定义:加行号索引 便于批量删除
|
|
24
|
-
item._customIndex = index;
|
|
25
|
-
|
|
26
|
-
selection = selection.concat(item);
|
|
27
|
-
}
|
|
28
|
-
if (item.children && item.children.length && selectionRowKeys.length) {
|
|
29
|
-
selection = selection.concat(this.getSelectionChildren(item, selection, selectionRowKeys));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
selection = [...new Set(selection)];
|
|
34
|
-
return JSON.parse(JSON.stringify(selection));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function Table_handleResize () {
|
|
38
|
-
//let tableWidth = parseInt(getStyle(this.$el, 'width')) - 1;
|
|
39
|
-
// 原代码当列宽不设置的时 会出现缩进的现象
|
|
40
|
-
//let tableWidth = this.$el.offsetWidth - 1;
|
|
41
|
-
//自定义
|
|
42
|
-
let tableWidth = this.$el.parentNode.offsetWidth;
|
|
43
|
-
let columnsWidth = {};
|
|
44
|
-
let sumMinWidth = 0;
|
|
45
|
-
let hasWidthColumns = [];
|
|
46
|
-
let noWidthColumns = [];
|
|
47
|
-
let maxWidthColumns = [];
|
|
48
|
-
let noMaxWidthColumns = [];
|
|
49
|
-
this.cloneColumns.forEach((col) => {
|
|
50
|
-
if (col.width) {
|
|
51
|
-
hasWidthColumns.push(col);
|
|
52
|
-
}
|
|
53
|
-
else{
|
|
54
|
-
noWidthColumns.push(col);
|
|
55
|
-
if (col.minWidth) {
|
|
56
|
-
sumMinWidth += col.minWidth;
|
|
57
|
-
}
|
|
58
|
-
if (col.maxWidth) {
|
|
59
|
-
maxWidthColumns.push(col);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
noMaxWidthColumns.push(col);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
col._width = null;
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
let unUsableWidth = hasWidthColumns.map(cell => cell.width).reduce((a, b) => a + b, 0);
|
|
69
|
-
let usableWidth = tableWidth - unUsableWidth - sumMinWidth - (this.showVerticalScrollBar?this.scrollBarWidth:0) - 1;
|
|
70
|
-
let usableLength = noWidthColumns.length;
|
|
71
|
-
let columnWidth = 0;
|
|
72
|
-
if(usableWidth > 0 && usableLength > 0){
|
|
73
|
-
columnWidth = parseInt(usableWidth / usableLength);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
for (let i = 0; i < this.cloneColumns.length; i++) {
|
|
77
|
-
const column = this.cloneColumns[i];
|
|
78
|
-
let width = columnWidth + (column.minWidth?column.minWidth:0);
|
|
79
|
-
if(column.width){
|
|
80
|
-
width = column.width;
|
|
81
|
-
}
|
|
82
|
-
else{
|
|
83
|
-
if (column._width) {
|
|
84
|
-
width = column._width;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
if (column.minWidth > width){
|
|
88
|
-
width = column.minWidth;
|
|
89
|
-
}
|
|
90
|
-
else if (column.maxWidth < width){
|
|
91
|
-
width = column.maxWidth;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (usableWidth>0) {
|
|
95
|
-
usableWidth -= width - (column.minWidth?column.minWidth:0);
|
|
96
|
-
usableLength--;
|
|
97
|
-
if (usableLength > 0) {
|
|
98
|
-
columnWidth = parseInt(usableWidth / usableLength);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
columnWidth = 0;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else{
|
|
105
|
-
columnWidth = 0;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
column._width = width;
|
|
111
|
-
|
|
112
|
-
columnsWidth[column._index] = {
|
|
113
|
-
width: width
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
if(usableWidth>0) {
|
|
118
|
-
usableLength = noMaxWidthColumns.length;
|
|
119
|
-
columnWidth = parseInt(usableWidth / usableLength);
|
|
120
|
-
for (let i = 0; i < noMaxWidthColumns.length; i++) {
|
|
121
|
-
const column = noMaxWidthColumns[i];
|
|
122
|
-
let width = column._width + columnWidth;
|
|
123
|
-
if (usableLength > 1) {
|
|
124
|
-
usableLength--;
|
|
125
|
-
usableWidth -= columnWidth;
|
|
126
|
-
columnWidth = parseInt(usableWidth / usableLength);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
columnWidth = 0;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
column._width = width;
|
|
133
|
-
|
|
134
|
-
columnsWidth[column._index] = {
|
|
135
|
-
width: width
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
this.tableWidth = this.cloneColumns.map(cell => cell._width).reduce((a, b) => a + b, 0) + (this.showVerticalScrollBar?this.scrollBarWidth:0) + 1;
|
|
142
|
-
this.columnsWidth = columnsWidth;
|
|
143
|
-
this.fixedHeader();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function Table_highlightCurrentRow (_index, rowKey) {
|
|
147
|
-
const objData = rowKey ? this.getDataByRowKey(rowKey) : this.objData[_index];
|
|
148
|
-
if (!objData) return;
|
|
149
|
-
if (!this.highlightRow || objData._isHighlight) return;
|
|
150
|
-
this.handleCurrentRow('highlight', _index, rowKey);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function getRandomStr (len = 32) {
|
|
154
|
-
const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
|
155
|
-
const maxPos = $chars.length;
|
|
156
|
-
let str = '';
|
|
157
|
-
for (let i = 0; i < len; i++) {
|
|
158
|
-
str += $chars.charAt(Math.floor(Math.random() * maxPos));
|
|
159
|
-
}
|
|
160
|
-
return str;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
function Table_makeColumnsId (columns) {
|
|
164
|
-
const cloneColumns = deepCopy(columns);
|
|
165
|
-
return cloneColumns.map(item => {
|
|
166
|
-
if ('children' in item) item.children = this.makeColumnsId(item.children);
|
|
167
|
-
item.__id = getRandomStr(6);
|
|
168
|
-
return item;
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
function TableHead_scrollBarCellClass(){
|
|
173
|
-
let hasRightFixed = false;
|
|
174
|
-
for(let i in this.headRows){
|
|
175
|
-
for(let j in this.headRows[i]){
|
|
176
|
-
if(this.headRows[i][j].fixed === 'right') {
|
|
177
|
-
hasRightFixed=true;
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
if(hasRightFixed) break;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return [
|
|
184
|
-
{
|
|
185
|
-
[`${this.prefixCls}-hidden`]: hasRightFixed,
|
|
186
|
-
'efuture-table-scroll-th':true
|
|
187
|
-
}
|
|
188
|
-
];
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function handleCheckClick (event, new_window = false) {
|
|
192
|
-
if (this.to) {
|
|
193
|
-
if (this.target === '_blank') {
|
|
194
|
-
return false;
|
|
195
|
-
} else {
|
|
196
|
-
event.preventDefault();
|
|
197
|
-
if (this.to === 'click') {
|
|
198
|
-
this.$emit('click', event);
|
|
199
|
-
} else {
|
|
200
|
-
this.handleClick(new_window);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
function Upload_handleClick () {
|
|
206
|
-
if (this.itemDisabled) return;
|
|
207
|
-
// 自定义:弹框之前check
|
|
208
|
-
if (this.$parent && this.$parent.onClick) {
|
|
209
|
-
this.$parent.onClick()
|
|
210
|
-
} else {
|
|
211
|
-
if (this.$refs.input) {
|
|
212
|
-
this.$refs.input.click();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function DatePicker_reset() {
|
|
218
|
-
if (this.$refs.pickerPanel && this.$refs.pickerPanel.reset) {
|
|
219
|
-
this.$refs.pickerPanel.reset();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function DatePicker_handleKeydown (e) {
|
|
224
|
-
const pickerPrefixCls = 'ivu-picker';
|
|
225
|
-
const keyCode = e.keyCode;
|
|
226
|
-
|
|
227
|
-
// handle "tab" key
|
|
228
|
-
if (keyCode === 9) {
|
|
229
|
-
if (this.visible) {
|
|
230
|
-
e.stopPropagation();
|
|
231
|
-
e.preventDefault();
|
|
232
|
-
|
|
233
|
-
if (this.isConfirm) {
|
|
234
|
-
const selector = `.${pickerPrefixCls}-confirm > *`;
|
|
235
|
-
const tabbable = this.$refs.drop.$el.querySelectorAll(selector);
|
|
236
|
-
this.internalFocus = true;
|
|
237
|
-
const element = [...tabbable][e.shiftKey ? 'pop' : 'shift']();
|
|
238
|
-
element.focus();
|
|
239
|
-
} else {
|
|
240
|
-
this.handleClose();
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
this.focused = false;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// open the panel
|
|
248
|
-
const arrows = [37, 38, 39, 40];
|
|
249
|
-
if (!this.visible && arrows.includes(keyCode)) {
|
|
250
|
-
this.visible = true;
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// close on "esc" key
|
|
255
|
-
if (keyCode === 27) {
|
|
256
|
-
if (this.visible) {
|
|
257
|
-
e.stopPropagation();
|
|
258
|
-
this.handleClose();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// select date, "Enter" key
|
|
263
|
-
if (keyCode === 13) {
|
|
264
|
-
const timePickers = this.timeSpinnerList.map(item => item.timeSpinner);
|
|
265
|
-
if (timePickers.length > 0) {
|
|
266
|
-
const columnsPerPicker = timePickers[0].showSeconds ? 3 : 2;
|
|
267
|
-
const pickerIndex = Math.floor(this.focusedTime.column / columnsPerPicker);
|
|
268
|
-
const value = this.focusedTime.time[pickerIndex];
|
|
269
|
-
|
|
270
|
-
timePickers[pickerIndex].chooseValue(value);
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
if (this.type.match(/range/)) {
|
|
275
|
-
this.$refs.pickerPanel.handleRangePick(this.focusedDate, 'date');
|
|
276
|
-
} else {
|
|
277
|
-
const panels = this.panelTableList.map(item => item.panelTable);
|
|
278
|
-
const compareDate = (d) => {
|
|
279
|
-
const sliceIndex = ['year', 'month', 'date'].indexOf((this.type)) + 1;
|
|
280
|
-
return [d.getFullYear(), d.getMonth(), d.getDate()].slice(0, sliceIndex).join('-');
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
const dateIsValid = panels.find(({ cells }) => {
|
|
284
|
-
return cells.find(({ date, disabled }) => compareDate(date) === compareDate(this.focusedDate) && !disabled);
|
|
285
|
-
});
|
|
286
|
-
if (dateIsValid) {
|
|
287
|
-
if (this.modelValue === null) {
|
|
288
|
-
this.onPick(null, false, 'date');
|
|
289
|
-
} else {
|
|
290
|
-
this.onPick(this.focusedDate, false, 'date');
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (!arrows.includes(keyCode)) return; // ignore rest of keys
|
|
297
|
-
|
|
298
|
-
// navigate times and dates
|
|
299
|
-
if (this.focusedTime.active) e.preventDefault(); // to prevent cursor from moving
|
|
300
|
-
this.navigateDatePanel(keyValueMapper[keyCode], e.shiftKey);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function DatePicker_handleBlur(e) {
|
|
304
|
-
if (this.internalFocus) {
|
|
305
|
-
this.internalFocus = false;
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
if (this.visible) {
|
|
309
|
-
e.preventDefault();
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
this.isFocused = false;
|
|
314
|
-
this.onSelectionModeChange(this.type);
|
|
315
|
-
this.internalValue = this.internalValue.slice(); // trigger panel watchers to reset views
|
|
316
|
-
this.reset();
|
|
317
|
-
if (this.$refs.pickerPanel) {
|
|
318
|
-
this.$refs.pickerPanel.onToggleVisibility(false);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
export const isClient = typeof window !== 'undefined';
|
|
322
|
-
|
|
323
|
-
function getScroll(target, top) {
|
|
324
|
-
const prop = top ? 'pageYOffset' : 'pageXOffset';
|
|
325
|
-
const method = top ? 'scrollTop' : 'scrollLeft';
|
|
326
|
-
|
|
327
|
-
let ret = target[prop];
|
|
328
|
-
|
|
329
|
-
if (isClient && typeof ret !== 'number') {
|
|
330
|
-
ret = window.document.documentElement[method];
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
return ret;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
function getOffset(element) {
|
|
337
|
-
if (!isClient) return;
|
|
338
|
-
const rect = element.getBoundingClientRect();
|
|
339
|
-
|
|
340
|
-
const scrollTop = getScroll(window, true);
|
|
341
|
-
const scrollLeft = getScroll(window);
|
|
342
|
-
|
|
343
|
-
const docEl = window.document.body;
|
|
344
|
-
const clientTop = docEl.clientTop || 0;
|
|
345
|
-
const clientLeft = docEl.clientLeft || 0;
|
|
346
|
-
|
|
347
|
-
return {
|
|
348
|
-
top: rect.top + scrollTop - clientTop,
|
|
349
|
-
left: rect.left + scrollLeft - clientLeft
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
function Anchor_handleScroll (e) {
|
|
354
|
-
this.upperFirstTitle = !!this.titlesOffsetArr[0] && e.target.scrollTop < this.titlesOffsetArr[0].offset;
|
|
355
|
-
if (this.animating) return;
|
|
356
|
-
// this.updateTitleOffset();
|
|
357
|
-
const scrollTop = this.scrollContainer.scrollTop;
|
|
358
|
-
this.getCurrentScrollAtTitleId(scrollTop);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
function Affix_handleScroll () {
|
|
362
|
-
if (!isClient) return;
|
|
363
|
-
const affix = this.affix;
|
|
364
|
-
const scrollTop = getScroll(window, true);
|
|
365
|
-
const elOffset = getOffset(this.$el);
|
|
366
|
-
const windowHeight = window.innerHeight;
|
|
367
|
-
const elHeight = this.$el.getElementsByTagName('div')[0].offsetHeight;
|
|
368
|
-
|
|
369
|
-
// Fixed Top
|
|
370
|
-
if ((elOffset.top - this.offsetTop) < scrollTop && this.offsetType == 'top' && !affix) {
|
|
371
|
-
this.affix = true;
|
|
372
|
-
this.slotStyle = {
|
|
373
|
-
width: this.$refs.point.clientWidth + 'px',
|
|
374
|
-
height: this.$refs.point.clientHeight + 'px'
|
|
375
|
-
};
|
|
376
|
-
this.slot = true;
|
|
377
|
-
this.styles = {
|
|
378
|
-
top: `${this.offsetTop}px`,
|
|
379
|
-
};
|
|
380
|
-
if (elOffset.left) {
|
|
381
|
-
this.styles.left = `${elOffset.left}px`;
|
|
382
|
-
}
|
|
383
|
-
if (this.$el.offsetWidth) {
|
|
384
|
-
this.styles.width = `${this.$el.offsetWidth}px`;
|
|
385
|
-
}
|
|
386
|
-
this.$emit('on-change', true);
|
|
387
|
-
} else if ((elOffset.top - this.offsetTop) > scrollTop && this.offsetType == 'top' && affix) {
|
|
388
|
-
this.slot = false;
|
|
389
|
-
this.slotStyle = {};
|
|
390
|
-
this.affix = false;
|
|
391
|
-
this.styles = null;
|
|
392
|
-
|
|
393
|
-
this.$emit('on-change', false);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// Fixed Bottom
|
|
397
|
-
if ((elOffset.top + this.offsetBottom + elHeight) > (scrollTop + windowHeight) && this.offsetType == 'bottom' && !affix) {
|
|
398
|
-
this.affix = true;
|
|
399
|
-
this.styles = {
|
|
400
|
-
bottom: `${this.offsetBottom}px`,
|
|
401
|
-
left: `${elOffset.left}px`,
|
|
402
|
-
width: `${this.$el.offsetWidth}px`
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
this.$emit('on-change', true);
|
|
406
|
-
} else if ((elOffset.top + this.offsetBottom + elHeight) < (scrollTop + windowHeight) && this.offsetType == 'bottom' && affix) {
|
|
407
|
-
this.affix = false;
|
|
408
|
-
this.styles = null;
|
|
409
|
-
|
|
410
|
-
this.$emit('on-change', false);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
common.initTable = function (obj) {
|
|
414
|
-
obj.methods.getSelection = Table_getSelection;
|
|
415
|
-
obj.methods.handleResize = Table_handleResize;
|
|
416
|
-
obj.methods.highlightCurrentRow = Table_highlightCurrentRow;
|
|
417
|
-
obj.methods.makeColumnsId = Table_makeColumnsId;
|
|
418
|
-
obj.components.tableHead.methods.scrollBarCellClass = TableHead_scrollBarCellClass;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
common.initBreadcrumbItem = function (obj) {
|
|
422
|
-
obj.mixins[0].methods.handleCheckClick = handleCheckClick;
|
|
423
|
-
}
|
|
424
|
-
common.initButton = function (obj) {
|
|
425
|
-
obj.mixins[0].methods.handleCheckClick = handleCheckClick;
|
|
426
|
-
}
|
|
427
|
-
common.initCard = function (obj) {
|
|
428
|
-
obj.mixins[0].methods.handleCheckClick = handleCheckClick;
|
|
429
|
-
}
|
|
430
|
-
common.initCell = function (obj) {
|
|
431
|
-
obj.mixins[0].methods.handleCheckClick = handleCheckClick;
|
|
432
|
-
}
|
|
433
|
-
common.initMenuItem = function (obj) {
|
|
434
|
-
obj.mixins[1].methods.handleCheckClick = handleCheckClick;
|
|
435
|
-
}
|
|
436
|
-
common.initUpload = function (obj) {
|
|
437
|
-
obj.methods.handleClick = Upload_handleClick;
|
|
438
|
-
}
|
|
439
|
-
common.initDatePicker = function (obj) {
|
|
440
|
-
obj.mixins[0].methods.reset = DatePicker_reset;
|
|
441
|
-
obj.mixins[0].methods.handleBlur = DatePicker_handleBlur;
|
|
442
|
-
obj.mixins[0].methods.handleKeydown = DatePicker_handleKeydown;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
common.initAffix = function (obj) {
|
|
446
|
-
obj.methods.handleScroll = Affix_handleScroll;
|
|
447
|
-
}
|
|
448
|
-
common.initAnchor = function (obj) {
|
|
449
|
-
obj.methods.handleScroll = Anchor_handleScroll;
|
|
450
|
-
}
|
|
451
|
-
common.initEview = function (ViewUI) {
|
|
452
|
-
common.initTable(ViewUI.Table);
|
|
453
|
-
common.initBreadcrumbItem(ViewUI.BreadcrumbItem);
|
|
454
|
-
common.initButton(ViewUI.Button);
|
|
455
|
-
common.initCard(ViewUI.Card);
|
|
456
|
-
common.initCell(ViewUI.Cell);
|
|
457
|
-
common.initMenuItem(ViewUI.MenuItem);
|
|
458
|
-
common.initUpload(ViewUI.Upload);
|
|
459
|
-
common.initDatePicker(ViewUI.DatePicker);
|
|
460
|
-
common.initAffix(ViewUI.Affix);
|
|
461
|
-
common.initAnchor(ViewUI.Anchor);
|
|
462
|
-
}
|
|
1
|
+
import { scrollTop } from '../../utils/assist';
|
|
2
|
+
import {deepCopy} from '../../utils/assist';
|
|
3
|
+
let common = {};
|
|
4
|
+
function Table_getSelection () {
|
|
5
|
+
// 分别拿根数据和子数据的已选项
|
|
6
|
+
let selectionIndexes = [];
|
|
7
|
+
let selectionRowKeys = [];
|
|
8
|
+
for (let i in this.objData) {
|
|
9
|
+
const objData = this.objData[i];
|
|
10
|
+
if (objData._isChecked) selectionIndexes.push(parseInt(i));
|
|
11
|
+
if (objData.children && objData.children.length) {
|
|
12
|
+
selectionRowKeys = selectionRowKeys.concat(this.getSelectionChildrenRowKeys(objData, selectionRowKeys));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 去重的 RowKeys
|
|
17
|
+
selectionRowKeys = [...new Set(selectionRowKeys)];
|
|
18
|
+
|
|
19
|
+
let selection = [];
|
|
20
|
+
|
|
21
|
+
this.data.forEach((item, index) => {
|
|
22
|
+
if (selectionIndexes.indexOf(index) > -1) {
|
|
23
|
+
// 自定义:加行号索引 便于批量删除
|
|
24
|
+
item._customIndex = index;
|
|
25
|
+
|
|
26
|
+
selection = selection.concat(item);
|
|
27
|
+
}
|
|
28
|
+
if (item.children && item.children.length && selectionRowKeys.length) {
|
|
29
|
+
selection = selection.concat(this.getSelectionChildren(item, selection, selectionRowKeys));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
selection = [...new Set(selection)];
|
|
34
|
+
return JSON.parse(JSON.stringify(selection));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function Table_handleResize () {
|
|
38
|
+
//let tableWidth = parseInt(getStyle(this.$el, 'width')) - 1;
|
|
39
|
+
// 原代码当列宽不设置的时 会出现缩进的现象
|
|
40
|
+
//let tableWidth = this.$el.offsetWidth - 1;
|
|
41
|
+
//自定义
|
|
42
|
+
let tableWidth = this.$el.parentNode.offsetWidth;
|
|
43
|
+
let columnsWidth = {};
|
|
44
|
+
let sumMinWidth = 0;
|
|
45
|
+
let hasWidthColumns = [];
|
|
46
|
+
let noWidthColumns = [];
|
|
47
|
+
let maxWidthColumns = [];
|
|
48
|
+
let noMaxWidthColumns = [];
|
|
49
|
+
this.cloneColumns.forEach((col) => {
|
|
50
|
+
if (col.width) {
|
|
51
|
+
hasWidthColumns.push(col);
|
|
52
|
+
}
|
|
53
|
+
else{
|
|
54
|
+
noWidthColumns.push(col);
|
|
55
|
+
if (col.minWidth) {
|
|
56
|
+
sumMinWidth += col.minWidth;
|
|
57
|
+
}
|
|
58
|
+
if (col.maxWidth) {
|
|
59
|
+
maxWidthColumns.push(col);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
noMaxWidthColumns.push(col);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
col._width = null;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
let unUsableWidth = hasWidthColumns.map(cell => cell.width).reduce((a, b) => a + b, 0);
|
|
69
|
+
let usableWidth = tableWidth - unUsableWidth - sumMinWidth - (this.showVerticalScrollBar?this.scrollBarWidth:0) - 1;
|
|
70
|
+
let usableLength = noWidthColumns.length;
|
|
71
|
+
let columnWidth = 0;
|
|
72
|
+
if(usableWidth > 0 && usableLength > 0){
|
|
73
|
+
columnWidth = parseInt(usableWidth / usableLength);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
for (let i = 0; i < this.cloneColumns.length; i++) {
|
|
77
|
+
const column = this.cloneColumns[i];
|
|
78
|
+
let width = columnWidth + (column.minWidth?column.minWidth:0);
|
|
79
|
+
if(column.width){
|
|
80
|
+
width = column.width;
|
|
81
|
+
}
|
|
82
|
+
else{
|
|
83
|
+
if (column._width) {
|
|
84
|
+
width = column._width;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (column.minWidth > width){
|
|
88
|
+
width = column.minWidth;
|
|
89
|
+
}
|
|
90
|
+
else if (column.maxWidth < width){
|
|
91
|
+
width = column.maxWidth;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (usableWidth>0) {
|
|
95
|
+
usableWidth -= width - (column.minWidth?column.minWidth:0);
|
|
96
|
+
usableLength--;
|
|
97
|
+
if (usableLength > 0) {
|
|
98
|
+
columnWidth = parseInt(usableWidth / usableLength);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
columnWidth = 0;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else{
|
|
105
|
+
columnWidth = 0;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
column._width = width;
|
|
111
|
+
|
|
112
|
+
columnsWidth[column._index] = {
|
|
113
|
+
width: width
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
if(usableWidth>0) {
|
|
118
|
+
usableLength = noMaxWidthColumns.length;
|
|
119
|
+
columnWidth = parseInt(usableWidth / usableLength);
|
|
120
|
+
for (let i = 0; i < noMaxWidthColumns.length; i++) {
|
|
121
|
+
const column = noMaxWidthColumns[i];
|
|
122
|
+
let width = column._width + columnWidth;
|
|
123
|
+
if (usableLength > 1) {
|
|
124
|
+
usableLength--;
|
|
125
|
+
usableWidth -= columnWidth;
|
|
126
|
+
columnWidth = parseInt(usableWidth / usableLength);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
columnWidth = 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
column._width = width;
|
|
133
|
+
|
|
134
|
+
columnsWidth[column._index] = {
|
|
135
|
+
width: width
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
this.tableWidth = this.cloneColumns.map(cell => cell._width).reduce((a, b) => a + b, 0) + (this.showVerticalScrollBar?this.scrollBarWidth:0) + 1;
|
|
142
|
+
this.columnsWidth = columnsWidth;
|
|
143
|
+
this.fixedHeader();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function Table_highlightCurrentRow (_index, rowKey) {
|
|
147
|
+
const objData = rowKey ? this.getDataByRowKey(rowKey) : this.objData[_index];
|
|
148
|
+
if (!objData) return;
|
|
149
|
+
if (!this.highlightRow || objData._isHighlight) return;
|
|
150
|
+
this.handleCurrentRow('highlight', _index, rowKey);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function getRandomStr (len = 32) {
|
|
154
|
+
const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
|
155
|
+
const maxPos = $chars.length;
|
|
156
|
+
let str = '';
|
|
157
|
+
for (let i = 0; i < len; i++) {
|
|
158
|
+
str += $chars.charAt(Math.floor(Math.random() * maxPos));
|
|
159
|
+
}
|
|
160
|
+
return str;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
function Table_makeColumnsId (columns) {
|
|
164
|
+
const cloneColumns = deepCopy(columns);
|
|
165
|
+
return cloneColumns.map(item => {
|
|
166
|
+
if ('children' in item) item.children = this.makeColumnsId(item.children);
|
|
167
|
+
item.__id = getRandomStr(6);
|
|
168
|
+
return item;
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
function TableHead_scrollBarCellClass(){
|
|
173
|
+
let hasRightFixed = false;
|
|
174
|
+
for(let i in this.headRows){
|
|
175
|
+
for(let j in this.headRows[i]){
|
|
176
|
+
if(this.headRows[i][j].fixed === 'right') {
|
|
177
|
+
hasRightFixed=true;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
if(hasRightFixed) break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return [
|
|
184
|
+
{
|
|
185
|
+
[`${this.prefixCls}-hidden`]: hasRightFixed,
|
|
186
|
+
'efuture-table-scroll-th':true
|
|
187
|
+
}
|
|
188
|
+
];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function handleCheckClick (event, new_window = false) {
|
|
192
|
+
if (this.to) {
|
|
193
|
+
if (this.target === '_blank') {
|
|
194
|
+
return false;
|
|
195
|
+
} else {
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
if (this.to === 'click') {
|
|
198
|
+
this.$emit('click', event);
|
|
199
|
+
} else {
|
|
200
|
+
this.handleClick(new_window);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function Upload_handleClick () {
|
|
206
|
+
if (this.itemDisabled) return;
|
|
207
|
+
// 自定义:弹框之前check
|
|
208
|
+
if (this.$parent && this.$parent.onClick) {
|
|
209
|
+
this.$parent.onClick()
|
|
210
|
+
} else {
|
|
211
|
+
if (this.$refs.input) {
|
|
212
|
+
this.$refs.input.click();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function DatePicker_reset() {
|
|
218
|
+
if (this.$refs.pickerPanel && this.$refs.pickerPanel.reset) {
|
|
219
|
+
this.$refs.pickerPanel.reset();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function DatePicker_handleKeydown (e) {
|
|
224
|
+
const pickerPrefixCls = 'ivu-picker';
|
|
225
|
+
const keyCode = e.keyCode;
|
|
226
|
+
|
|
227
|
+
// handle "tab" key
|
|
228
|
+
if (keyCode === 9) {
|
|
229
|
+
if (this.visible) {
|
|
230
|
+
e.stopPropagation();
|
|
231
|
+
e.preventDefault();
|
|
232
|
+
|
|
233
|
+
if (this.isConfirm) {
|
|
234
|
+
const selector = `.${pickerPrefixCls}-confirm > *`;
|
|
235
|
+
const tabbable = this.$refs.drop.$el.querySelectorAll(selector);
|
|
236
|
+
this.internalFocus = true;
|
|
237
|
+
const element = [...tabbable][e.shiftKey ? 'pop' : 'shift']();
|
|
238
|
+
element.focus();
|
|
239
|
+
} else {
|
|
240
|
+
this.handleClose();
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
this.focused = false;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// open the panel
|
|
248
|
+
const arrows = [37, 38, 39, 40];
|
|
249
|
+
if (!this.visible && arrows.includes(keyCode)) {
|
|
250
|
+
this.visible = true;
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// close on "esc" key
|
|
255
|
+
if (keyCode === 27) {
|
|
256
|
+
if (this.visible) {
|
|
257
|
+
e.stopPropagation();
|
|
258
|
+
this.handleClose();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// select date, "Enter" key
|
|
263
|
+
if (keyCode === 13) {
|
|
264
|
+
const timePickers = this.timeSpinnerList.map(item => item.timeSpinner);
|
|
265
|
+
if (timePickers.length > 0) {
|
|
266
|
+
const columnsPerPicker = timePickers[0].showSeconds ? 3 : 2;
|
|
267
|
+
const pickerIndex = Math.floor(this.focusedTime.column / columnsPerPicker);
|
|
268
|
+
const value = this.focusedTime.time[pickerIndex];
|
|
269
|
+
|
|
270
|
+
timePickers[pickerIndex].chooseValue(value);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (this.type.match(/range/)) {
|
|
275
|
+
this.$refs.pickerPanel.handleRangePick(this.focusedDate, 'date');
|
|
276
|
+
} else {
|
|
277
|
+
const panels = this.panelTableList.map(item => item.panelTable);
|
|
278
|
+
const compareDate = (d) => {
|
|
279
|
+
const sliceIndex = ['year', 'month', 'date'].indexOf((this.type)) + 1;
|
|
280
|
+
return [d.getFullYear(), d.getMonth(), d.getDate()].slice(0, sliceIndex).join('-');
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const dateIsValid = panels.find(({ cells }) => {
|
|
284
|
+
return cells.find(({ date, disabled }) => compareDate(date) === compareDate(this.focusedDate) && !disabled);
|
|
285
|
+
});
|
|
286
|
+
if (dateIsValid) {
|
|
287
|
+
if (this.modelValue === null) {
|
|
288
|
+
this.onPick(null, false, 'date');
|
|
289
|
+
} else {
|
|
290
|
+
this.onPick(this.focusedDate, false, 'date');
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (!arrows.includes(keyCode)) return; // ignore rest of keys
|
|
297
|
+
|
|
298
|
+
// navigate times and dates
|
|
299
|
+
if (this.focusedTime.active) e.preventDefault(); // to prevent cursor from moving
|
|
300
|
+
this.navigateDatePanel(keyValueMapper[keyCode], e.shiftKey);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function DatePicker_handleBlur(e) {
|
|
304
|
+
if (this.internalFocus) {
|
|
305
|
+
this.internalFocus = false;
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
if (this.visible) {
|
|
309
|
+
e.preventDefault();
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
this.isFocused = false;
|
|
314
|
+
this.onSelectionModeChange(this.type);
|
|
315
|
+
this.internalValue = this.internalValue.slice(); // trigger panel watchers to reset views
|
|
316
|
+
this.reset();
|
|
317
|
+
if (this.$refs.pickerPanel) {
|
|
318
|
+
this.$refs.pickerPanel.onToggleVisibility(false);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
export const isClient = typeof window !== 'undefined';
|
|
322
|
+
|
|
323
|
+
function getScroll(target, top) {
|
|
324
|
+
const prop = top ? 'pageYOffset' : 'pageXOffset';
|
|
325
|
+
const method = top ? 'scrollTop' : 'scrollLeft';
|
|
326
|
+
|
|
327
|
+
let ret = target[prop];
|
|
328
|
+
|
|
329
|
+
if (isClient && typeof ret !== 'number') {
|
|
330
|
+
ret = window.document.documentElement[method];
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return ret;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function getOffset(element) {
|
|
337
|
+
if (!isClient) return;
|
|
338
|
+
const rect = element.getBoundingClientRect();
|
|
339
|
+
|
|
340
|
+
const scrollTop = getScroll(window, true);
|
|
341
|
+
const scrollLeft = getScroll(window);
|
|
342
|
+
|
|
343
|
+
const docEl = window.document.body;
|
|
344
|
+
const clientTop = docEl.clientTop || 0;
|
|
345
|
+
const clientLeft = docEl.clientLeft || 0;
|
|
346
|
+
|
|
347
|
+
return {
|
|
348
|
+
top: rect.top + scrollTop - clientTop,
|
|
349
|
+
left: rect.left + scrollLeft - clientLeft
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function Anchor_handleScroll (e) {
|
|
354
|
+
this.upperFirstTitle = !!this.titlesOffsetArr[0] && e.target.scrollTop < this.titlesOffsetArr[0].offset;
|
|
355
|
+
if (this.animating) return;
|
|
356
|
+
// this.updateTitleOffset();
|
|
357
|
+
const scrollTop = this.scrollContainer.scrollTop;
|
|
358
|
+
this.getCurrentScrollAtTitleId(scrollTop);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function Affix_handleScroll () {
|
|
362
|
+
if (!isClient) return;
|
|
363
|
+
const affix = this.affix;
|
|
364
|
+
const scrollTop = getScroll(window, true);
|
|
365
|
+
const elOffset = getOffset(this.$el);
|
|
366
|
+
const windowHeight = window.innerHeight;
|
|
367
|
+
const elHeight = this.$el.getElementsByTagName('div')[0].offsetHeight;
|
|
368
|
+
|
|
369
|
+
// Fixed Top
|
|
370
|
+
if ((elOffset.top - this.offsetTop) < scrollTop && this.offsetType == 'top' && !affix) {
|
|
371
|
+
this.affix = true;
|
|
372
|
+
this.slotStyle = {
|
|
373
|
+
width: this.$refs.point.clientWidth + 'px',
|
|
374
|
+
height: this.$refs.point.clientHeight + 'px'
|
|
375
|
+
};
|
|
376
|
+
this.slot = true;
|
|
377
|
+
this.styles = {
|
|
378
|
+
top: `${this.offsetTop}px`,
|
|
379
|
+
};
|
|
380
|
+
if (elOffset.left) {
|
|
381
|
+
this.styles.left = `${elOffset.left}px`;
|
|
382
|
+
}
|
|
383
|
+
if (this.$el.offsetWidth) {
|
|
384
|
+
this.styles.width = `${this.$el.offsetWidth}px`;
|
|
385
|
+
}
|
|
386
|
+
this.$emit('on-change', true);
|
|
387
|
+
} else if ((elOffset.top - this.offsetTop) > scrollTop && this.offsetType == 'top' && affix) {
|
|
388
|
+
this.slot = false;
|
|
389
|
+
this.slotStyle = {};
|
|
390
|
+
this.affix = false;
|
|
391
|
+
this.styles = null;
|
|
392
|
+
|
|
393
|
+
this.$emit('on-change', false);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Fixed Bottom
|
|
397
|
+
if ((elOffset.top + this.offsetBottom + elHeight) > (scrollTop + windowHeight) && this.offsetType == 'bottom' && !affix) {
|
|
398
|
+
this.affix = true;
|
|
399
|
+
this.styles = {
|
|
400
|
+
bottom: `${this.offsetBottom}px`,
|
|
401
|
+
left: `${elOffset.left}px`,
|
|
402
|
+
width: `${this.$el.offsetWidth}px`
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
this.$emit('on-change', true);
|
|
406
|
+
} else if ((elOffset.top + this.offsetBottom + elHeight) < (scrollTop + windowHeight) && this.offsetType == 'bottom' && affix) {
|
|
407
|
+
this.affix = false;
|
|
408
|
+
this.styles = null;
|
|
409
|
+
|
|
410
|
+
this.$emit('on-change', false);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
common.initTable = function (obj) {
|
|
414
|
+
obj.methods.getSelection = Table_getSelection;
|
|
415
|
+
obj.methods.handleResize = Table_handleResize;
|
|
416
|
+
obj.methods.highlightCurrentRow = Table_highlightCurrentRow;
|
|
417
|
+
obj.methods.makeColumnsId = Table_makeColumnsId;
|
|
418
|
+
obj.components.tableHead.methods.scrollBarCellClass = TableHead_scrollBarCellClass;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
common.initBreadcrumbItem = function (obj) {
|
|
422
|
+
obj.mixins[0].methods.handleCheckClick = handleCheckClick;
|
|
423
|
+
}
|
|
424
|
+
common.initButton = function (obj) {
|
|
425
|
+
obj.mixins[0].methods.handleCheckClick = handleCheckClick;
|
|
426
|
+
}
|
|
427
|
+
common.initCard = function (obj) {
|
|
428
|
+
obj.mixins[0].methods.handleCheckClick = handleCheckClick;
|
|
429
|
+
}
|
|
430
|
+
common.initCell = function (obj) {
|
|
431
|
+
obj.mixins[0].methods.handleCheckClick = handleCheckClick;
|
|
432
|
+
}
|
|
433
|
+
common.initMenuItem = function (obj) {
|
|
434
|
+
obj.mixins[1].methods.handleCheckClick = handleCheckClick;
|
|
435
|
+
}
|
|
436
|
+
common.initUpload = function (obj) {
|
|
437
|
+
obj.methods.handleClick = Upload_handleClick;
|
|
438
|
+
}
|
|
439
|
+
common.initDatePicker = function (obj) {
|
|
440
|
+
obj.mixins[0].methods.reset = DatePicker_reset;
|
|
441
|
+
obj.mixins[0].methods.handleBlur = DatePicker_handleBlur;
|
|
442
|
+
obj.mixins[0].methods.handleKeydown = DatePicker_handleKeydown;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
common.initAffix = function (obj) {
|
|
446
|
+
obj.methods.handleScroll = Affix_handleScroll;
|
|
447
|
+
}
|
|
448
|
+
common.initAnchor = function (obj) {
|
|
449
|
+
obj.methods.handleScroll = Anchor_handleScroll;
|
|
450
|
+
}
|
|
451
|
+
common.initEview = function (ViewUI) {
|
|
452
|
+
common.initTable(ViewUI.Table);
|
|
453
|
+
common.initBreadcrumbItem(ViewUI.BreadcrumbItem);
|
|
454
|
+
common.initButton(ViewUI.Button);
|
|
455
|
+
common.initCard(ViewUI.Card);
|
|
456
|
+
common.initCell(ViewUI.Cell);
|
|
457
|
+
common.initMenuItem(ViewUI.MenuItem);
|
|
458
|
+
common.initUpload(ViewUI.Upload);
|
|
459
|
+
common.initDatePicker(ViewUI.DatePicker);
|
|
460
|
+
common.initAffix(ViewUI.Affix);
|
|
461
|
+
common.initAnchor(ViewUI.Anchor);
|
|
462
|
+
}
|
|
463
463
|
export default common;
|