vxe-table 4.16.17 → 4.16.19
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/es/colgroup/style.css +0 -0
- package/es/colgroup/style.min.css +0 -0
- package/es/column/style.css +0 -0
- package/es/column/style.min.css +0 -0
- package/es/grid/style.css +86 -0
- package/es/grid/style.min.css +1 -0
- package/es/iconfont.1758609514163.ttf +0 -0
- package/es/iconfont.1758609514163.woff +0 -0
- package/es/iconfont.1758609514163.woff2 +0 -0
- package/es/index.esm.js +3 -0
- package/es/locale/lang/ar-EG.d.ts +2 -0
- package/es/locale/lang/de-DE.d.ts +2 -0
- package/es/locale/lang/en-US.d.ts +2 -0
- package/es/locale/lang/es-ES.d.ts +2 -0
- package/es/locale/lang/fr-FR.d.ts +2 -0
- package/es/locale/lang/hu-HU.d.ts +2 -0
- package/es/locale/lang/hy-AM.d.ts +2 -0
- package/es/locale/lang/id-ID.d.ts +2 -0
- package/es/locale/lang/it-IT.d.ts +2 -0
- package/es/locale/lang/ja-JP.d.ts +2 -0
- package/es/locale/lang/ko-KR.d.ts +2 -0
- package/es/locale/lang/ms-MY.d.ts +2 -0
- package/es/locale/lang/nb-NO.d.ts +2 -0
- package/es/locale/lang/pt-BR.d.ts +2 -0
- package/es/locale/lang/ru-RU.d.ts +2 -0
- package/es/locale/lang/th-TH.d.ts +2 -0
- package/es/locale/lang/ug-CN.d.ts +2 -0
- package/es/locale/lang/uk-UA.d.ts +2 -0
- package/es/locale/lang/uz-UZ.d.ts +2 -0
- package/es/locale/lang/vi-VN.d.ts +2 -0
- package/es/locale/lang/zh-CHT.d.ts +2 -0
- package/es/locale/lang/zh-CN.d.ts +2 -0
- package/es/locale/lang/zh-HK.d.ts +2 -0
- package/es/locale/lang/zh-MO.d.ts +2 -0
- package/es/locale/lang/zh-TW.d.ts +2 -0
- package/es/style.css +1 -1
- package/es/table/module/filter/hook.js +21 -5
- package/es/table/module/filter/panel.js +4 -4
- package/es/table/module/menu/panel.js +27 -14
- package/es/table/src/cell.js +10 -7
- package/es/table/src/table.js +22 -22
- package/es/table/style.css +3657 -0
- package/es/table/style.min.css +1 -0
- package/es/toolbar/style.css +90 -0
- package/es/toolbar/style.min.css +1 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/style.css +0 -0
- package/es/ui/style.min.css +0 -0
- package/es/v-x-e-table/style.css +0 -0
- package/es/v-x-e-table/style.min.css +0 -0
- package/es/vxe-colgroup/style.css +0 -0
- package/es/vxe-colgroup/style.min.css +0 -0
- package/es/vxe-column/style.css +0 -0
- package/es/vxe-column/style.min.css +0 -0
- package/es/vxe-grid/style.css +86 -0
- package/es/vxe-grid/style.min.css +1 -0
- package/es/vxe-table/style.css +3657 -0
- package/es/vxe-table/style.min.css +1 -0
- package/es/vxe-toolbar/style.css +90 -0
- package/es/vxe-toolbar/style.min.css +1 -0
- package/es/vxe-ui/style.css +0 -0
- package/es/vxe-ui/style.min.css +0 -0
- package/es/vxe-v-x-e-table/style.css +0 -0
- package/es/vxe-v-x-e-table/style.min.css +0 -0
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/colgroup/style/index.js +1 -0
- package/lib/colgroup/style/style.css +0 -0
- package/lib/colgroup/style/style.min.css +0 -0
- package/lib/column/style/index.js +1 -0
- package/lib/column/style/style.css +0 -0
- package/lib/column/style/style.min.css +0 -0
- package/lib/grid/style/index.js +1 -0
- package/lib/grid/style/style.css +86 -0
- package/lib/grid/style/style.min.css +1 -0
- package/lib/iconfont.1758609514163.ttf +0 -0
- package/lib/iconfont.1758609514163.woff +0 -0
- package/lib/iconfont.1758609514163.woff2 +0 -0
- package/lib/index.common.js +22 -0
- package/lib/index.umd.js +73 -25
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.d.ts +2 -0
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/ar-EG.umd.js +806 -0
- package/lib/locale/lang/de-DE.d.ts +2 -0
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/de-DE.umd.js +806 -0
- package/lib/locale/lang/en-US.d.ts +2 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +806 -0
- package/lib/locale/lang/es-ES.d.ts +2 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +806 -0
- package/lib/locale/lang/fr-FR.d.ts +2 -0
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +806 -0
- package/lib/locale/lang/hu-HU.d.ts +2 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +806 -0
- package/lib/locale/lang/hy-AM.d.ts +2 -0
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/hy-AM.umd.js +806 -0
- package/lib/locale/lang/id-ID.d.ts +2 -0
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/id-ID.umd.js +806 -0
- package/lib/locale/lang/it-IT.d.ts +2 -0
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/it-IT.umd.js +806 -0
- package/lib/locale/lang/ja-JP.d.ts +2 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +806 -0
- package/lib/locale/lang/ko-KR.d.ts +2 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +806 -0
- package/lib/locale/lang/ms-MY.d.ts +2 -0
- package/lib/locale/lang/ms-MY.min.js +1 -1
- package/lib/locale/lang/ms-MY.umd.js +806 -0
- package/lib/locale/lang/nb-NO.d.ts +2 -0
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/nb-NO.umd.js +806 -0
- package/lib/locale/lang/pt-BR.d.ts +2 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +806 -0
- package/lib/locale/lang/ru-RU.d.ts +2 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +806 -0
- package/lib/locale/lang/th-TH.d.ts +2 -0
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/th-TH.umd.js +806 -0
- package/lib/locale/lang/ug-CN.d.ts +2 -0
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/ug-CN.umd.js +806 -0
- package/lib/locale/lang/uk-UA.d.ts +2 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +806 -0
- package/lib/locale/lang/uz-UZ.d.ts +2 -0
- package/lib/locale/lang/uz-UZ.min.js +1 -1
- package/lib/locale/lang/uz-UZ.umd.js +806 -0
- package/lib/locale/lang/vi-VN.d.ts +2 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/vi-VN.umd.js +806 -0
- package/lib/locale/lang/zh-CHT.d.ts +2 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +806 -0
- package/lib/locale/lang/zh-CN.d.ts +2 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +808 -0
- package/lib/locale/lang/zh-HK.d.ts +2 -0
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +23 -0
- package/lib/locale/lang/zh-MO.d.ts +2 -0
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +23 -0
- package/lib/locale/lang/zh-TW.d.ts +2 -0
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +23 -0
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +430 -0
- package/lib/table/module/custom/hook.min.js +1 -0
- package/lib/table/module/custom/panel.js +1193 -0
- package/lib/table/module/custom/panel.min.js +1 -0
- package/lib/table/module/edit/hook.js +1308 -0
- package/lib/table/module/edit/hook.min.js +1 -0
- package/lib/table/module/export/export-panel.js +467 -0
- package/lib/table/module/export/export-panel.min.js +1 -0
- package/lib/table/module/export/hook.js +1888 -0
- package/lib/table/module/export/hook.min.js +1 -0
- package/lib/table/module/export/import-panel.js +226 -0
- package/lib/table/module/export/import-panel.min.js +1 -0
- package/lib/table/module/export/util.js +20 -0
- package/lib/table/module/export/util.min.js +1 -0
- package/lib/table/module/filter/hook.js +458 -0
- package/lib/table/module/filter/hook.min.js +1 -0
- package/lib/table/module/filter/panel.js +265 -0
- package/lib/table/module/filter/panel.min.js +1 -0
- package/lib/table/module/keyboard/hook.js +579 -0
- package/lib/table/module/keyboard/hook.min.js +1 -0
- package/lib/table/module/menu/hook.js +392 -0
- package/lib/table/module/menu/hook.min.js +1 -0
- package/lib/table/module/menu/panel.js +150 -0
- package/lib/table/module/menu/panel.min.js +1 -0
- package/lib/table/module/validator/hook.js +681 -0
- package/lib/table/module/validator/hook.min.js +1 -0
- package/lib/table/src/cell.js +9 -4
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/header.min.js +1 -0
- package/lib/table/src/props.js +318 -0
- package/lib/table/src/props.min.js +1 -0
- package/lib/table/src/store.js +15 -0
- package/lib/table/src/store.min.js +1 -0
- package/lib/table/src/table.js +924 -0
- package/lib/table/src/table.min.js +1 -0
- package/lib/table/src/use/cell-view.js +57 -0
- package/lib/table/src/use/cell-view.min.js +1 -0
- package/lib/table/src/use/index.js +16 -0
- package/lib/table/src/use/index.min.js +1 -0
- package/lib/table/src/util.js +916 -0
- package/lib/table/src/util.min.js +1 -0
- package/lib/table/style/index.js +1 -0
- package/lib/table/style/style.css +3657 -0
- package/lib/table/style/style.min.css +1 -0
- package/lib/toolbar/style/index.js +1 -0
- package/lib/toolbar/style/style.css +90 -0
- package/lib/toolbar/style/style.min.css +1 -0
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/style/index.js +1 -0
- package/lib/ui/style/style.css +0 -0
- package/lib/ui/style/style.min.css +0 -0
- package/lib/v-x-e-table/style/index.js +1 -0
- package/lib/v-x-e-table/style/style.css +0 -0
- package/lib/v-x-e-table/style/style.min.css +0 -0
- package/lib/vxe-colgroup/style/index.js +1 -0
- package/lib/vxe-colgroup/style/style.css +0 -0
- package/lib/vxe-colgroup/style/style.min.css +0 -0
- package/lib/vxe-column/style/index.js +1 -0
- package/lib/vxe-column/style/style.css +0 -0
- package/lib/vxe-column/style/style.min.css +0 -0
- package/lib/vxe-grid/style/index.js +1 -0
- package/lib/vxe-grid/style/style.css +86 -0
- package/lib/vxe-grid/style/style.min.css +1 -0
- package/lib/vxe-table/style/index.js +1 -0
- package/lib/vxe-table/style/style.css +3657 -0
- package/lib/vxe-table/style/style.min.css +1 -0
- package/lib/vxe-toolbar/style/index.js +1 -0
- package/lib/vxe-toolbar/style/style.css +90 -0
- package/lib/vxe-toolbar/style/style.min.css +1 -0
- package/lib/vxe-ui/style/index.js +1 -0
- package/lib/vxe-ui/style/style.css +0 -0
- package/lib/vxe-ui/style/style.min.css +0 -0
- package/lib/vxe-v-x-e-table/style/index.js +1 -0
- package/lib/vxe-v-x-e-table/style/style.css +0 -0
- package/lib/vxe-v-x-e-table/style/style.min.css +0 -0
- package/package.json +1 -1
- package/packages/table/module/filter/hook.ts +23 -6
- package/packages/table/module/filter/panel.ts +4 -4
- package/packages/table/module/menu/panel.ts +29 -16
- package/packages/table/src/cell.ts +10 -7
- package/packages/table/src/table.ts +22 -22
|
@@ -0,0 +1,916 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.assembleColumn = assembleColumn;
|
|
7
|
+
exports.calcTreeLine = calcTreeLine;
|
|
8
|
+
exports.clearTableAllStatus = clearTableAllStatus;
|
|
9
|
+
exports.clearTableDefaultStatus = clearTableDefaultStatus;
|
|
10
|
+
exports.colToVisible = colToVisible;
|
|
11
|
+
exports.convertHeaderColumnToRows = void 0;
|
|
12
|
+
exports.convertHeaderToGridRows = convertHeaderToGridRows;
|
|
13
|
+
exports.createColumn = createColumn;
|
|
14
|
+
exports.createHandleGetRowId = createHandleGetRowId;
|
|
15
|
+
exports.createHandleUpdateRowId = createHandleUpdateRowId;
|
|
16
|
+
exports.createInternalData = createInternalData;
|
|
17
|
+
exports.destroyColumn = destroyColumn;
|
|
18
|
+
exports.encodeRowid = encodeRowid;
|
|
19
|
+
exports.getCalcHeight = getCalcHeight;
|
|
20
|
+
exports.getCellRestHeight = getCellRestHeight;
|
|
21
|
+
exports.getCellValue = getCellValue;
|
|
22
|
+
exports.getColReMaxWidth = getColReMaxWidth;
|
|
23
|
+
exports.getColReMinWidth = getColReMinWidth;
|
|
24
|
+
exports.getColumnList = getColumnList;
|
|
25
|
+
exports.getFirstChildColumn = getFirstChildColumn;
|
|
26
|
+
exports.getLastChildColumn = getLastChildColumn;
|
|
27
|
+
exports.getOffsetSize = getOffsetSize;
|
|
28
|
+
exports.getRefElem = getRefElem;
|
|
29
|
+
exports.getRootColumn = getRootColumn;
|
|
30
|
+
exports.getRowUniqueId = getRowUniqueId;
|
|
31
|
+
exports.getRowid = getRowid;
|
|
32
|
+
exports.getRowkey = getRowkey;
|
|
33
|
+
exports.handleFieldOrColumn = handleFieldOrColumn;
|
|
34
|
+
exports.handleRowidOrRow = handleRowidOrRow;
|
|
35
|
+
exports.hasDeepKey = hasDeepKey;
|
|
36
|
+
exports.isColumnInfo = isColumnInfo;
|
|
37
|
+
exports.restoreScrollLocation = restoreScrollLocation;
|
|
38
|
+
exports.rowToVisible = rowToVisible;
|
|
39
|
+
exports.setCellValue = setCellValue;
|
|
40
|
+
exports.toFilters = toFilters;
|
|
41
|
+
exports.toTreePathSeq = toTreePathSeq;
|
|
42
|
+
exports.updateDeepRowKey = updateDeepRowKey;
|
|
43
|
+
exports.updateFastRowKey = updateFastRowKey;
|
|
44
|
+
exports.watchColumn = watchColumn;
|
|
45
|
+
var _vue = require("vue");
|
|
46
|
+
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
47
|
+
var _columnInfo = require("./columnInfo");
|
|
48
|
+
var _dom = require("../../ui/src/dom");
|
|
49
|
+
var _utils = require("../../ui/src/utils");
|
|
50
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
51
|
+
function createInternalData() {
|
|
52
|
+
return {
|
|
53
|
+
tZindex: 0,
|
|
54
|
+
currKeyField: '',
|
|
55
|
+
isCurrDeepKey: false,
|
|
56
|
+
elemStore: {},
|
|
57
|
+
// 存放横向 X 虚拟滚动相关的信息
|
|
58
|
+
scrollXStore: {
|
|
59
|
+
preloadSize: 0,
|
|
60
|
+
offsetSize: 0,
|
|
61
|
+
visibleSize: 0,
|
|
62
|
+
visibleStartIndex: 0,
|
|
63
|
+
visibleEndIndex: 0,
|
|
64
|
+
startIndex: 0,
|
|
65
|
+
endIndex: 0
|
|
66
|
+
},
|
|
67
|
+
// 存放纵向 Y 虚拟滚动相关信息
|
|
68
|
+
scrollYStore: {
|
|
69
|
+
preloadSize: 0,
|
|
70
|
+
offsetSize: 0,
|
|
71
|
+
visibleSize: 0,
|
|
72
|
+
visibleStartIndex: 0,
|
|
73
|
+
visibleEndIndex: 0,
|
|
74
|
+
startIndex: 0,
|
|
75
|
+
endIndex: 0
|
|
76
|
+
},
|
|
77
|
+
// 表格宽度
|
|
78
|
+
tableWidth: 0,
|
|
79
|
+
// 表格高度
|
|
80
|
+
tableHeight: 0,
|
|
81
|
+
customHeight: 0,
|
|
82
|
+
customMinHeight: 0,
|
|
83
|
+
customMaxHeight: 0,
|
|
84
|
+
// 当前 hover 行
|
|
85
|
+
hoverRow: null,
|
|
86
|
+
// 最后滚动位置
|
|
87
|
+
lastScrollLeft: 0,
|
|
88
|
+
lastScrollTop: 0,
|
|
89
|
+
// 单选框属性,已选中保留的行
|
|
90
|
+
radioReserveRow: null,
|
|
91
|
+
// 复选框属性,已选中保留的行集合
|
|
92
|
+
checkboxReserveRowMap: {},
|
|
93
|
+
// 行数据,已展开保留的行集合
|
|
94
|
+
rowExpandedReserveRowMap: {},
|
|
95
|
+
// 树结构数据,已展开保留的行集合
|
|
96
|
+
treeExpandedReserveRowMap: {},
|
|
97
|
+
// 树结构数据,不确定状态的集合
|
|
98
|
+
treeIndeterminateRowMaps: {},
|
|
99
|
+
// 列表完整数据、条件处理后
|
|
100
|
+
tableFullData: [],
|
|
101
|
+
afterFullData: [],
|
|
102
|
+
afterTreeFullData: [],
|
|
103
|
+
afterGroupFullData: [],
|
|
104
|
+
// 列表条件处理后数据集合
|
|
105
|
+
afterFullRowMaps: {},
|
|
106
|
+
// 树结构完整数据、条件处理后
|
|
107
|
+
tableFullTreeData: [],
|
|
108
|
+
// 行分组全量数据、条件处理后
|
|
109
|
+
tableFullGroupData: [],
|
|
110
|
+
tableSynchData: [],
|
|
111
|
+
tableSourceData: [],
|
|
112
|
+
// 收集的列配置(带分组)
|
|
113
|
+
collectColumn: [],
|
|
114
|
+
// 完整所有列(不带分组)
|
|
115
|
+
tableFullColumn: [],
|
|
116
|
+
// 渲染所有列
|
|
117
|
+
visibleColumn: [],
|
|
118
|
+
// 全量数据集(包括当前和已删除)
|
|
119
|
+
fullAllDataRowIdData: {},
|
|
120
|
+
// 数据集(仅当前)
|
|
121
|
+
fullDataRowIdData: {},
|
|
122
|
+
// 数据集(仅可视)
|
|
123
|
+
visibleDataRowIdData: {},
|
|
124
|
+
// 渲染中缓存数据
|
|
125
|
+
sourceDataRowIdData: {},
|
|
126
|
+
fullColumnIdData: {},
|
|
127
|
+
fullColumnFieldData: {},
|
|
128
|
+
// 合并表头单元格的数据
|
|
129
|
+
mergeHeaderList: [],
|
|
130
|
+
mergeHeaderMaps: {},
|
|
131
|
+
// 已合并单元格数据集合
|
|
132
|
+
mergeHeaderCellMaps: {},
|
|
133
|
+
// 合并单元格的数据
|
|
134
|
+
mergeBodyList: [],
|
|
135
|
+
mergeBodyMaps: {},
|
|
136
|
+
// 已合并单元格数据集合
|
|
137
|
+
mergeBodyCellMaps: {},
|
|
138
|
+
// 合并表尾的数据
|
|
139
|
+
mergeFooterList: [],
|
|
140
|
+
mergeFooterMaps: {},
|
|
141
|
+
// 已合并表尾数据集合
|
|
142
|
+
mergeFooterCellMaps: {},
|
|
143
|
+
// 已展开的行集合
|
|
144
|
+
rowExpandedMaps: {},
|
|
145
|
+
// 懒加载中的展开行的集合
|
|
146
|
+
rowExpandLazyLoadedMaps: {},
|
|
147
|
+
// 已展开的分组行
|
|
148
|
+
rowGroupExpandedMaps: {},
|
|
149
|
+
// 已展开树节点集合
|
|
150
|
+
treeExpandedMaps: {},
|
|
151
|
+
// 懒加载中的树节点的集合
|
|
152
|
+
treeExpandLazyLoadedMaps: {},
|
|
153
|
+
// 复选框属性,已选中的行集合
|
|
154
|
+
selectCheckboxMaps: {},
|
|
155
|
+
// 已标记的对象集
|
|
156
|
+
pendingRowMaps: {},
|
|
157
|
+
// 已新增的临时行
|
|
158
|
+
insertRowMaps: {},
|
|
159
|
+
// 已删除行
|
|
160
|
+
removeRowMaps: {},
|
|
161
|
+
cvCacheMaps: {},
|
|
162
|
+
// 表头高度
|
|
163
|
+
tHeaderHeight: 0,
|
|
164
|
+
// 表体高度
|
|
165
|
+
tBodyHeight: 0,
|
|
166
|
+
// 表尾高度
|
|
167
|
+
tFooterHeight: 0,
|
|
168
|
+
teleportToWrapperElem: null,
|
|
169
|
+
popupToWrapperElem: null,
|
|
170
|
+
inited: false,
|
|
171
|
+
tooltipTimeout: null,
|
|
172
|
+
initStatus: false,
|
|
173
|
+
isActivated: false
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
const getAllConvertColumns = (columns, parentColumn) => {
|
|
177
|
+
const result = [];
|
|
178
|
+
columns.forEach(column => {
|
|
179
|
+
column.parentId = parentColumn ? parentColumn.id : null;
|
|
180
|
+
if (column.visible) {
|
|
181
|
+
if (column.children && column.children.length && column.children.some(column => column.visible)) {
|
|
182
|
+
result.push(column);
|
|
183
|
+
result.push(...getAllConvertColumns(column.children, column));
|
|
184
|
+
} else {
|
|
185
|
+
result.push(column);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
return result;
|
|
190
|
+
};
|
|
191
|
+
const convertHeaderColumnToRows = originColumns => {
|
|
192
|
+
let maxLevel = 1;
|
|
193
|
+
const traverse = (column, parent) => {
|
|
194
|
+
if (parent) {
|
|
195
|
+
column.level = parent.level + 1;
|
|
196
|
+
if (maxLevel < column.level) {
|
|
197
|
+
maxLevel = column.level;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (column.children && column.children.length && column.children.some(column => column.visible)) {
|
|
201
|
+
let colSpan = 0;
|
|
202
|
+
column.children.forEach(subColumn => {
|
|
203
|
+
if (subColumn.visible) {
|
|
204
|
+
traverse(subColumn, column);
|
|
205
|
+
colSpan += subColumn.colSpan;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
column.colSpan = colSpan;
|
|
209
|
+
} else {
|
|
210
|
+
column.colSpan = 1;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
originColumns.forEach(column => {
|
|
214
|
+
column.level = 1;
|
|
215
|
+
traverse(column);
|
|
216
|
+
});
|
|
217
|
+
const rows = [];
|
|
218
|
+
for (let i = 0; i < maxLevel; i++) {
|
|
219
|
+
rows.push([]);
|
|
220
|
+
}
|
|
221
|
+
const allColumns = getAllConvertColumns(originColumns);
|
|
222
|
+
allColumns.forEach(column => {
|
|
223
|
+
if (column.children && column.children.length && column.children.some(column => column.visible)) {
|
|
224
|
+
column.rowSpan = 1;
|
|
225
|
+
} else {
|
|
226
|
+
column.rowSpan = maxLevel - column.level + 1;
|
|
227
|
+
}
|
|
228
|
+
rows[column.level - 1].push(column);
|
|
229
|
+
});
|
|
230
|
+
return rows;
|
|
231
|
+
};
|
|
232
|
+
exports.convertHeaderColumnToRows = convertHeaderColumnToRows;
|
|
233
|
+
function convertHeaderToGridRows(spanColumns) {
|
|
234
|
+
const rSize = spanColumns.length;
|
|
235
|
+
const cSize = spanColumns[0].reduce((sum, cell) => sum + cell.colSpan, 0);
|
|
236
|
+
const occupiedRows = [];
|
|
237
|
+
const fullRows = [];
|
|
238
|
+
for (let rIndex = 0; rIndex < rSize; rIndex++) {
|
|
239
|
+
const oCols = [];
|
|
240
|
+
const dCols = [];
|
|
241
|
+
for (let cIndex = 0; cIndex < cSize; cIndex++) {
|
|
242
|
+
oCols.push(false);
|
|
243
|
+
dCols.push('');
|
|
244
|
+
}
|
|
245
|
+
occupiedRows.push(oCols);
|
|
246
|
+
fullRows.push(dCols);
|
|
247
|
+
}
|
|
248
|
+
for (let rIndex = 0; rIndex < rSize; rIndex++) {
|
|
249
|
+
let currColIndex = 0;
|
|
250
|
+
for (const column of spanColumns[rIndex]) {
|
|
251
|
+
const {
|
|
252
|
+
colSpan,
|
|
253
|
+
rowSpan
|
|
254
|
+
} = column;
|
|
255
|
+
let startColIndex = -1;
|
|
256
|
+
for (let ccIndex = currColIndex; ccIndex <= cSize - colSpan; ccIndex++) {
|
|
257
|
+
let oFlag = true;
|
|
258
|
+
for (let csIndex = 0; csIndex < colSpan; csIndex++) {
|
|
259
|
+
if (occupiedRows[rIndex][ccIndex + csIndex]) {
|
|
260
|
+
oFlag = false;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (oFlag) {
|
|
265
|
+
startColIndex = ccIndex;
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (startColIndex === -1) {
|
|
270
|
+
for (let j = 0; j <= cSize - colSpan; j++) {
|
|
271
|
+
let oFlag = true;
|
|
272
|
+
for (let k = 0; k < colSpan; k++) {
|
|
273
|
+
if (occupiedRows[rIndex][j + k]) {
|
|
274
|
+
oFlag = false;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (oFlag) {
|
|
279
|
+
startColIndex = j;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (startColIndex === -1) {
|
|
284
|
+
// error
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
for (let srIndex = rIndex; srIndex < rIndex + rowSpan; srIndex++) {
|
|
289
|
+
for (let scIndex = startColIndex; scIndex < startColIndex + colSpan; scIndex++) {
|
|
290
|
+
occupiedRows[srIndex][scIndex] = true;
|
|
291
|
+
fullRows[srIndex][scIndex] = column;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
currColIndex = startColIndex + colSpan;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return fullRows;
|
|
298
|
+
}
|
|
299
|
+
function restoreScrollLocation($xeTable, scrollLeft, scrollTop) {
|
|
300
|
+
const internalData = $xeTable.internalData;
|
|
301
|
+
if (scrollLeft || scrollTop) {
|
|
302
|
+
internalData.intoRunScroll = false;
|
|
303
|
+
internalData.inVirtualScroll = false;
|
|
304
|
+
internalData.inWheelScroll = false;
|
|
305
|
+
internalData.inHeaderScroll = false;
|
|
306
|
+
internalData.inBodyScroll = false;
|
|
307
|
+
internalData.inFooterScroll = false;
|
|
308
|
+
internalData.scrollRenderType = '';
|
|
309
|
+
// 还原滚动状态
|
|
310
|
+
return $xeTable.scrollTo(scrollLeft, scrollTop);
|
|
311
|
+
}
|
|
312
|
+
return $xeTable.clearScroll();
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* 生成行的唯一主键
|
|
316
|
+
*/
|
|
317
|
+
function getRowUniqueId() {
|
|
318
|
+
return _xeUtils.default.uniqueId('row_');
|
|
319
|
+
}
|
|
320
|
+
function hasDeepKey(rowKey) {
|
|
321
|
+
return rowKey.indexOf('.') > -1;
|
|
322
|
+
}
|
|
323
|
+
// 行主键 key
|
|
324
|
+
function getRowkey($xeTable) {
|
|
325
|
+
const {
|
|
326
|
+
currKeyField
|
|
327
|
+
} = $xeTable.internalData;
|
|
328
|
+
return currKeyField;
|
|
329
|
+
}
|
|
330
|
+
// 行主键 value
|
|
331
|
+
function getRowid($xeTable, row) {
|
|
332
|
+
const internalData = $xeTable.internalData;
|
|
333
|
+
const {
|
|
334
|
+
isCurrDeepKey,
|
|
335
|
+
currKeyField
|
|
336
|
+
} = internalData;
|
|
337
|
+
return row ? encodeRowid((isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey)(row, currKeyField)) : '';
|
|
338
|
+
}
|
|
339
|
+
function createHandleUpdateRowId($xeTable) {
|
|
340
|
+
const internalData = $xeTable.internalData;
|
|
341
|
+
const {
|
|
342
|
+
isCurrDeepKey,
|
|
343
|
+
currKeyField
|
|
344
|
+
} = internalData;
|
|
345
|
+
const updateRId = isCurrDeepKey ? updateDeepRowKey : updateFastRowKey;
|
|
346
|
+
return {
|
|
347
|
+
rowKey: currKeyField,
|
|
348
|
+
handleUpdateRowId(row) {
|
|
349
|
+
return row ? updateRId(row, currKeyField) : '';
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function createHandleGetRowId($xeTable) {
|
|
354
|
+
const internalData = $xeTable.internalData;
|
|
355
|
+
const {
|
|
356
|
+
isCurrDeepKey,
|
|
357
|
+
currKeyField
|
|
358
|
+
} = internalData;
|
|
359
|
+
const getRId = isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey;
|
|
360
|
+
return {
|
|
361
|
+
rowKey: currKeyField,
|
|
362
|
+
handleGetRowId(row) {
|
|
363
|
+
return row ? encodeRowid(getRId(row, currKeyField)) : '';
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
// 编码行主键
|
|
368
|
+
function encodeRowid(rowVal) {
|
|
369
|
+
return _xeUtils.default.eqNull(rowVal) ? '' : encodeURIComponent(rowVal);
|
|
370
|
+
}
|
|
371
|
+
function getDeepRowIdByKey(row, rowKey) {
|
|
372
|
+
return _xeUtils.default.get(row, rowKey);
|
|
373
|
+
}
|
|
374
|
+
function updateDeepRowKey(row, rowKey) {
|
|
375
|
+
let rowid = encodeRowid(getDeepRowIdByKey(row, rowKey));
|
|
376
|
+
if ((0, _utils.eqEmptyValue)(rowid)) {
|
|
377
|
+
rowid = getRowUniqueId();
|
|
378
|
+
_xeUtils.default.set(row, rowKey, rowid);
|
|
379
|
+
}
|
|
380
|
+
return rowid;
|
|
381
|
+
}
|
|
382
|
+
function getFastRowIdByKey(row, rowKey) {
|
|
383
|
+
return row[rowKey];
|
|
384
|
+
}
|
|
385
|
+
function updateFastRowKey(row, rowKey) {
|
|
386
|
+
let rowid = encodeRowid(getFastRowIdByKey(row, rowKey));
|
|
387
|
+
if ((0, _utils.eqEmptyValue)(rowid)) {
|
|
388
|
+
rowid = getRowUniqueId();
|
|
389
|
+
row[rowKey] = rowid;
|
|
390
|
+
}
|
|
391
|
+
return rowid;
|
|
392
|
+
}
|
|
393
|
+
function handleFieldOrColumn($xeTable, fieldOrColumn) {
|
|
394
|
+
if (fieldOrColumn) {
|
|
395
|
+
return _xeUtils.default.isString(fieldOrColumn) || _xeUtils.default.isNumber(fieldOrColumn) ? $xeTable.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn;
|
|
396
|
+
}
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
function handleRowidOrRow($xeTable, rowidOrRow) {
|
|
400
|
+
if (rowidOrRow) {
|
|
401
|
+
const rowid = _xeUtils.default.isString(rowidOrRow) || _xeUtils.default.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
|
|
402
|
+
return $xeTable.getRowById(rowid);
|
|
403
|
+
}
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
|
|
407
|
+
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
408
|
+
}
|
|
409
|
+
function getPaddingLeftRightSize(elem) {
|
|
410
|
+
if (elem) {
|
|
411
|
+
const computedStyle = getComputedStyle(elem);
|
|
412
|
+
const paddingLeft = _xeUtils.default.toNumber(computedStyle.paddingLeft);
|
|
413
|
+
const paddingRight = _xeUtils.default.toNumber(computedStyle.paddingRight);
|
|
414
|
+
return paddingLeft + paddingRight;
|
|
415
|
+
}
|
|
416
|
+
return 0;
|
|
417
|
+
}
|
|
418
|
+
function getElementMarginAndWidth(elem) {
|
|
419
|
+
if (elem) {
|
|
420
|
+
const computedStyle = getComputedStyle(elem);
|
|
421
|
+
const marginLeft = _xeUtils.default.toNumber(computedStyle.marginLeft);
|
|
422
|
+
const marginRight = _xeUtils.default.toNumber(computedStyle.marginRight);
|
|
423
|
+
return elem.offsetWidth + marginLeft + marginRight;
|
|
424
|
+
}
|
|
425
|
+
return 0;
|
|
426
|
+
}
|
|
427
|
+
function toFilters(filters) {
|
|
428
|
+
if (filters && _xeUtils.default.isArray(filters)) {
|
|
429
|
+
return filters.map(({
|
|
430
|
+
label,
|
|
431
|
+
value,
|
|
432
|
+
data,
|
|
433
|
+
resetValue,
|
|
434
|
+
checked
|
|
435
|
+
}) => {
|
|
436
|
+
return {
|
|
437
|
+
label,
|
|
438
|
+
value,
|
|
439
|
+
data,
|
|
440
|
+
resetValue,
|
|
441
|
+
checked: !!checked,
|
|
442
|
+
_checked: !!checked
|
|
443
|
+
};
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
return filters;
|
|
447
|
+
}
|
|
448
|
+
function toTreePathSeq(path) {
|
|
449
|
+
return path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
|
|
450
|
+
}
|
|
451
|
+
function getCellValue(row, column) {
|
|
452
|
+
return _xeUtils.default.get(row, column.field);
|
|
453
|
+
}
|
|
454
|
+
function setCellValue(row, column, value) {
|
|
455
|
+
return _xeUtils.default.set(row, column.field, value);
|
|
456
|
+
}
|
|
457
|
+
function getRefElem(refEl) {
|
|
458
|
+
if (refEl) {
|
|
459
|
+
const rest = refEl.value;
|
|
460
|
+
if (rest) {
|
|
461
|
+
return rest.$el || rest;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
function getCalcHeight(height) {
|
|
467
|
+
if (height === 'unset') {
|
|
468
|
+
return 0;
|
|
469
|
+
}
|
|
470
|
+
return height || 0;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* 列宽拖动最大宽度
|
|
474
|
+
* @param params
|
|
475
|
+
* @returns
|
|
476
|
+
*/
|
|
477
|
+
function getColReMaxWidth(params) {
|
|
478
|
+
const {
|
|
479
|
+
$table
|
|
480
|
+
} = params;
|
|
481
|
+
const {
|
|
482
|
+
computeResizableOpts
|
|
483
|
+
} = $table.getComputeMaps();
|
|
484
|
+
const resizableOpts = computeResizableOpts.value;
|
|
485
|
+
const {
|
|
486
|
+
maxWidth: reMaxWidth
|
|
487
|
+
} = resizableOpts;
|
|
488
|
+
// 如果自定义调整宽度逻辑
|
|
489
|
+
if (reMaxWidth) {
|
|
490
|
+
const customMaxWidth = _xeUtils.default.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
491
|
+
if (customMaxWidth !== 'auto') {
|
|
492
|
+
return Math.max(1, _xeUtils.default.toNumber(customMaxWidth));
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return -1;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* 列宽拖动最小宽度
|
|
499
|
+
* @param params
|
|
500
|
+
* @returns
|
|
501
|
+
*/
|
|
502
|
+
function getColReMinWidth(params) {
|
|
503
|
+
const {
|
|
504
|
+
$table,
|
|
505
|
+
column,
|
|
506
|
+
cell
|
|
507
|
+
} = params;
|
|
508
|
+
const tableProps = $table.props;
|
|
509
|
+
const internalData = $table.internalData;
|
|
510
|
+
const {
|
|
511
|
+
computeResizableOpts
|
|
512
|
+
} = $table.getComputeMaps();
|
|
513
|
+
const resizableOpts = computeResizableOpts.value;
|
|
514
|
+
const {
|
|
515
|
+
minWidth: reMinWidth
|
|
516
|
+
} = resizableOpts;
|
|
517
|
+
// 如果自定义调整宽度逻辑
|
|
518
|
+
if (reMinWidth) {
|
|
519
|
+
const customMinWidth = _xeUtils.default.isFunction(reMinWidth) ? reMinWidth(params) : reMinWidth;
|
|
520
|
+
if (customMinWidth !== 'auto') {
|
|
521
|
+
return Math.max(1, _xeUtils.default.toNumber(customMinWidth));
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
const {
|
|
525
|
+
elemStore
|
|
526
|
+
} = internalData;
|
|
527
|
+
const {
|
|
528
|
+
showHeaderOverflow: allColumnHeaderOverflow
|
|
529
|
+
} = tableProps;
|
|
530
|
+
const {
|
|
531
|
+
showHeaderOverflow,
|
|
532
|
+
minWidth: colMinWidth
|
|
533
|
+
} = column;
|
|
534
|
+
const headOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
535
|
+
const showEllipsis = headOverflow === 'ellipsis';
|
|
536
|
+
const showTitle = headOverflow === 'title';
|
|
537
|
+
const showTooltip = headOverflow === true || headOverflow === 'tooltip';
|
|
538
|
+
const hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
539
|
+
const minTitleWidth = _xeUtils.default.floor((_xeUtils.default.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
|
|
540
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize((0, _dom.queryElement)(cell, '.vxe-cell'));
|
|
541
|
+
let mWidth = minTitleWidth + paddingLeftRight;
|
|
542
|
+
// 默认最小宽处理
|
|
543
|
+
if (hasEllipsis) {
|
|
544
|
+
const dragIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--drag-handle'));
|
|
545
|
+
const checkboxIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--checkbox'));
|
|
546
|
+
const requiredIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--required-icon'));
|
|
547
|
+
const editIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--edit-icon'));
|
|
548
|
+
const prefixIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell-title-prefix-icon'));
|
|
549
|
+
const suffixIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell-title-suffix-icon'));
|
|
550
|
+
const sortIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--sort'));
|
|
551
|
+
const filterIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--filter'));
|
|
552
|
+
mWidth += dragIconWidth + checkboxIconWidth + requiredIconWidth + editIconWidth + prefixIconWidth + suffixIconWidth + filterIconWidth + sortIconWidth;
|
|
553
|
+
}
|
|
554
|
+
// 如果设置最小宽
|
|
555
|
+
if (colMinWidth) {
|
|
556
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
557
|
+
if (bodyScrollElem) {
|
|
558
|
+
if ((0, _dom.isScale)(colMinWidth)) {
|
|
559
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
560
|
+
const meanWidth = bodyWidth / 100;
|
|
561
|
+
return Math.max(mWidth, Math.floor(_xeUtils.default.toInteger(colMinWidth) * meanWidth));
|
|
562
|
+
} else if ((0, _dom.isPx)(colMinWidth)) {
|
|
563
|
+
return Math.max(mWidth, _xeUtils.default.toInteger(colMinWidth));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return mWidth;
|
|
568
|
+
}
|
|
569
|
+
function isColumnInfo(column) {
|
|
570
|
+
return column && (column.constructor === _columnInfo.ColumnInfo || column instanceof _columnInfo.ColumnInfo);
|
|
571
|
+
}
|
|
572
|
+
// 获取所有的列,排除分组
|
|
573
|
+
function getColumnList(columns) {
|
|
574
|
+
const result = [];
|
|
575
|
+
columns.forEach(column => {
|
|
576
|
+
result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
|
|
577
|
+
});
|
|
578
|
+
return result;
|
|
579
|
+
}
|
|
580
|
+
function createColumn($xeTable, options, renderOptions) {
|
|
581
|
+
return isColumnInfo(options) ? options : (0, _vue.reactive)(new _columnInfo.ColumnInfo($xeTable, options, renderOptions));
|
|
582
|
+
}
|
|
583
|
+
function watchColumn($xeTable, props, column) {
|
|
584
|
+
Object.keys(props).forEach(name => {
|
|
585
|
+
(0, _vue.watch)(() => props[name], value => {
|
|
586
|
+
column.update(name, value);
|
|
587
|
+
if ($xeTable) {
|
|
588
|
+
if (name === 'filters') {
|
|
589
|
+
$xeTable.setFilter(column, value);
|
|
590
|
+
$xeTable.handleUpdateDataQueue();
|
|
591
|
+
} else if (['visible', 'fixed', 'width', 'minWidth', 'maxWidth'].includes(name)) {
|
|
592
|
+
$xeTable.handleRefreshColumnQueue();
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function assembleColumn($xeTable, elem, column, colgroup) {
|
|
599
|
+
const {
|
|
600
|
+
reactData
|
|
601
|
+
} = $xeTable;
|
|
602
|
+
const {
|
|
603
|
+
staticColumns
|
|
604
|
+
} = reactData;
|
|
605
|
+
const parentElem = elem.parentNode;
|
|
606
|
+
const parentColumn = colgroup ? colgroup.columnConfig : null;
|
|
607
|
+
const parentCols = parentColumn ? parentColumn.children : staticColumns;
|
|
608
|
+
if (parentElem && parentCols) {
|
|
609
|
+
column.defaultParentId = parentColumn ? parentColumn.id : null;
|
|
610
|
+
parentCols.splice(_xeUtils.default.arrayIndexOf(parentElem.children, elem), 0, column);
|
|
611
|
+
reactData.staticColumns = staticColumns.slice(0);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
function destroyColumn($xeTable, column) {
|
|
615
|
+
const {
|
|
616
|
+
reactData
|
|
617
|
+
} = $xeTable;
|
|
618
|
+
const {
|
|
619
|
+
staticColumns
|
|
620
|
+
} = reactData;
|
|
621
|
+
const matchObj = _xeUtils.default.findTree(staticColumns, item => item.id === column.id, {
|
|
622
|
+
children: 'children'
|
|
623
|
+
});
|
|
624
|
+
if (matchObj) {
|
|
625
|
+
matchObj.items.splice(matchObj.index, 1);
|
|
626
|
+
}
|
|
627
|
+
reactData.staticColumns = staticColumns.slice(0);
|
|
628
|
+
}
|
|
629
|
+
function getRootColumn($xeTable, column) {
|
|
630
|
+
const {
|
|
631
|
+
internalData
|
|
632
|
+
} = $xeTable;
|
|
633
|
+
const {
|
|
634
|
+
fullColumnIdData
|
|
635
|
+
} = internalData;
|
|
636
|
+
if (!column) {
|
|
637
|
+
return null;
|
|
638
|
+
}
|
|
639
|
+
let parentColId = column.parentId;
|
|
640
|
+
while (fullColumnIdData[parentColId]) {
|
|
641
|
+
const column = fullColumnIdData[parentColId].column;
|
|
642
|
+
parentColId = column.parentId;
|
|
643
|
+
if (!parentColId) {
|
|
644
|
+
return column;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
return column;
|
|
648
|
+
}
|
|
649
|
+
function getFirstChildColumn(column) {
|
|
650
|
+
const {
|
|
651
|
+
children
|
|
652
|
+
} = column;
|
|
653
|
+
if (children && children.length) {
|
|
654
|
+
return getFirstChildColumn(_xeUtils.default.first(children));
|
|
655
|
+
}
|
|
656
|
+
return column;
|
|
657
|
+
}
|
|
658
|
+
function getLastChildColumn(column) {
|
|
659
|
+
const {
|
|
660
|
+
children
|
|
661
|
+
} = column;
|
|
662
|
+
if (children && children.length) {
|
|
663
|
+
return getFirstChildColumn(_xeUtils.default.last(children));
|
|
664
|
+
}
|
|
665
|
+
return column;
|
|
666
|
+
}
|
|
667
|
+
const lineOffsetSizes = {
|
|
668
|
+
mini: 3,
|
|
669
|
+
small: 2,
|
|
670
|
+
medium: 1,
|
|
671
|
+
large: 0
|
|
672
|
+
};
|
|
673
|
+
function countTreeExpand(prevRow, params) {
|
|
674
|
+
let count = 1;
|
|
675
|
+
if (!prevRow) {
|
|
676
|
+
return count;
|
|
677
|
+
}
|
|
678
|
+
const {
|
|
679
|
+
$table
|
|
680
|
+
} = params;
|
|
681
|
+
const reactData = $table.reactData;
|
|
682
|
+
const {
|
|
683
|
+
treeExpandedFlag
|
|
684
|
+
} = reactData;
|
|
685
|
+
const internalData = $table.internalData;
|
|
686
|
+
const {
|
|
687
|
+
treeExpandedMaps
|
|
688
|
+
} = internalData;
|
|
689
|
+
const {
|
|
690
|
+
computeTreeOpts
|
|
691
|
+
} = $table.getComputeMaps();
|
|
692
|
+
const treeOpts = computeTreeOpts.value;
|
|
693
|
+
const {
|
|
694
|
+
transform,
|
|
695
|
+
mapChildrenField
|
|
696
|
+
} = treeOpts;
|
|
697
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
698
|
+
const rowChildren = prevRow[transform ? mapChildrenField : childrenField];
|
|
699
|
+
if (rowChildren && treeExpandedFlag && treeExpandedMaps[getRowid($table, prevRow)]) {
|
|
700
|
+
for (let index = 0; index < rowChildren.length; index++) {
|
|
701
|
+
count += countTreeExpand(rowChildren[index], params);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return count;
|
|
705
|
+
}
|
|
706
|
+
function getOffsetSize($xeTable) {
|
|
707
|
+
const {
|
|
708
|
+
computeSize
|
|
709
|
+
} = $xeTable.getComputeMaps();
|
|
710
|
+
const vSize = computeSize.value;
|
|
711
|
+
if (vSize) {
|
|
712
|
+
return lineOffsetSizes[vSize] || 0;
|
|
713
|
+
}
|
|
714
|
+
return 0;
|
|
715
|
+
}
|
|
716
|
+
function calcTreeLine(params, prevRow) {
|
|
717
|
+
const {
|
|
718
|
+
$table,
|
|
719
|
+
row
|
|
720
|
+
} = params;
|
|
721
|
+
const tableProps = $table.props;
|
|
722
|
+
const tableReactData = $table.reactData;
|
|
723
|
+
const tableInternalData = $table.internalData;
|
|
724
|
+
const {
|
|
725
|
+
showOverflow
|
|
726
|
+
} = tableProps;
|
|
727
|
+
const {
|
|
728
|
+
scrollYLoad
|
|
729
|
+
} = tableReactData;
|
|
730
|
+
const {
|
|
731
|
+
fullAllDataRowIdData
|
|
732
|
+
} = tableInternalData;
|
|
733
|
+
const {
|
|
734
|
+
computeRowOpts,
|
|
735
|
+
computeCellOpts,
|
|
736
|
+
computeDefaultRowHeight
|
|
737
|
+
} = $table.getComputeMaps();
|
|
738
|
+
const rowOpts = computeRowOpts.value;
|
|
739
|
+
const cellOpts = computeCellOpts.value;
|
|
740
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
741
|
+
const rowid = getRowid($table, row);
|
|
742
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
743
|
+
const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
744
|
+
let expandSize = 1;
|
|
745
|
+
if (prevRow) {
|
|
746
|
+
expandSize = countTreeExpand(prevRow, params);
|
|
747
|
+
}
|
|
748
|
+
let cellHeight = currCellHeight;
|
|
749
|
+
const vnHeight = rowRest.height;
|
|
750
|
+
if (scrollYLoad) {
|
|
751
|
+
if (!showOverflow) {
|
|
752
|
+
cellHeight = vnHeight || currCellHeight;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
return cellHeight * expandSize - (prevRow ? 1 : 12 - getOffsetSize($table));
|
|
756
|
+
}
|
|
757
|
+
function clearTableDefaultStatus($xeTable) {
|
|
758
|
+
const {
|
|
759
|
+
props,
|
|
760
|
+
internalData
|
|
761
|
+
} = $xeTable;
|
|
762
|
+
internalData.initStatus = false;
|
|
763
|
+
$xeTable.clearSort();
|
|
764
|
+
$xeTable.clearCurrentRow();
|
|
765
|
+
$xeTable.clearCurrentColumn();
|
|
766
|
+
$xeTable.clearRadioRow();
|
|
767
|
+
$xeTable.clearRadioReserve();
|
|
768
|
+
$xeTable.clearCheckboxRow();
|
|
769
|
+
$xeTable.clearCheckboxReserve();
|
|
770
|
+
$xeTable.clearRowExpand();
|
|
771
|
+
$xeTable.clearTreeExpand();
|
|
772
|
+
$xeTable.clearTreeExpandReserve();
|
|
773
|
+
$xeTable.clearPendingRow();
|
|
774
|
+
if ($xeTable.clearFilter) {
|
|
775
|
+
$xeTable.clearFilter();
|
|
776
|
+
}
|
|
777
|
+
if ($xeTable.clearSelected && (props.keyboardConfig || props.mouseConfig)) {
|
|
778
|
+
$xeTable.clearSelected();
|
|
779
|
+
}
|
|
780
|
+
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
781
|
+
$xeTable.clearCellAreas();
|
|
782
|
+
$xeTable.clearCopyCellArea();
|
|
783
|
+
}
|
|
784
|
+
return $xeTable.clearScroll();
|
|
785
|
+
}
|
|
786
|
+
function clearTableAllStatus($xeTable) {
|
|
787
|
+
if ($xeTable.clearFilter) {
|
|
788
|
+
$xeTable.clearFilter();
|
|
789
|
+
}
|
|
790
|
+
return clearTableDefaultStatus($xeTable);
|
|
791
|
+
}
|
|
792
|
+
function rowToVisible($xeTable, row) {
|
|
793
|
+
const tableProps = $xeTable.props;
|
|
794
|
+
const reactData = $xeTable.reactData;
|
|
795
|
+
const internalData = $xeTable.internalData;
|
|
796
|
+
const {
|
|
797
|
+
computeLeftFixedWidth,
|
|
798
|
+
computeRightFixedWidth,
|
|
799
|
+
computeRowOpts,
|
|
800
|
+
computeCellOpts,
|
|
801
|
+
computeDefaultRowHeight
|
|
802
|
+
} = $xeTable.getComputeMaps();
|
|
803
|
+
const {
|
|
804
|
+
showOverflow
|
|
805
|
+
} = tableProps;
|
|
806
|
+
const {
|
|
807
|
+
scrollYLoad,
|
|
808
|
+
scrollYTop
|
|
809
|
+
} = reactData;
|
|
810
|
+
const {
|
|
811
|
+
elemStore,
|
|
812
|
+
afterFullData,
|
|
813
|
+
fullAllDataRowIdData,
|
|
814
|
+
isResizeCellHeight
|
|
815
|
+
} = internalData;
|
|
816
|
+
const rowOpts = computeRowOpts.value;
|
|
817
|
+
const cellOpts = computeCellOpts.value;
|
|
818
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
819
|
+
const leftFixedWidth = computeLeftFixedWidth.value;
|
|
820
|
+
const rightFixedWidth = computeRightFixedWidth.value;
|
|
821
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
822
|
+
const rowid = getRowid($xeTable, row);
|
|
823
|
+
if (bodyScrollElem) {
|
|
824
|
+
const bodyHeight = bodyScrollElem.clientHeight;
|
|
825
|
+
const bodyScrollTop = bodyScrollElem.scrollTop;
|
|
826
|
+
const trElem = bodyScrollElem.querySelector(`[rowid="${rowid}"]`);
|
|
827
|
+
if (trElem) {
|
|
828
|
+
const trOffsetTop = trElem.offsetTop + (scrollYLoad ? scrollYTop : 0);
|
|
829
|
+
const trHeight = trElem.clientHeight;
|
|
830
|
+
// 检测行是否在可视区中
|
|
831
|
+
if (trOffsetTop < bodyScrollTop || trOffsetTop > bodyScrollTop + bodyHeight) {
|
|
832
|
+
return $xeTable.scrollTo(null, trOffsetTop);
|
|
833
|
+
} else if (trOffsetTop + trHeight >= bodyHeight + bodyScrollTop) {
|
|
834
|
+
return $xeTable.scrollTo(null, bodyScrollTop + trHeight);
|
|
835
|
+
}
|
|
836
|
+
} else {
|
|
837
|
+
// 如果是虚拟渲染滚动
|
|
838
|
+
if (scrollYLoad) {
|
|
839
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
840
|
+
if (!isCustomCellHeight && showOverflow) {
|
|
841
|
+
return $xeTable.scrollTo(null, ($xeTable.findRowIndexOf(afterFullData, row) - 1) * defaultRowHeight);
|
|
842
|
+
}
|
|
843
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
844
|
+
const rHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
845
|
+
const scrollTop = rowRest.oTop;
|
|
846
|
+
if (scrollTop < bodyScrollTop) {
|
|
847
|
+
return $xeTable.scrollTo(null, scrollTop - leftFixedWidth - 1);
|
|
848
|
+
}
|
|
849
|
+
return $xeTable.scrollTo(null, scrollTop + rHeight - (bodyHeight - rightFixedWidth - 1));
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
return Promise.resolve();
|
|
854
|
+
}
|
|
855
|
+
function colToVisible($xeTable, column, row) {
|
|
856
|
+
const reactData = $xeTable.reactData;
|
|
857
|
+
const internalData = $xeTable.internalData;
|
|
858
|
+
const {
|
|
859
|
+
computeLeftFixedWidth,
|
|
860
|
+
computeRightFixedWidth
|
|
861
|
+
} = $xeTable.getComputeMaps();
|
|
862
|
+
const {
|
|
863
|
+
scrollXLoad,
|
|
864
|
+
scrollXLeft
|
|
865
|
+
} = reactData;
|
|
866
|
+
const {
|
|
867
|
+
elemStore,
|
|
868
|
+
visibleColumn
|
|
869
|
+
} = internalData;
|
|
870
|
+
const leftFixedWidth = computeLeftFixedWidth.value;
|
|
871
|
+
const rightFixedWidth = computeRightFixedWidth.value;
|
|
872
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
873
|
+
if (column.fixed) {
|
|
874
|
+
return Promise.resolve();
|
|
875
|
+
}
|
|
876
|
+
if (bodyScrollElem) {
|
|
877
|
+
const bodyWidth = bodyScrollElem.clientWidth;
|
|
878
|
+
const bodyScrollLeft = bodyScrollElem.scrollLeft;
|
|
879
|
+
let tdElem = null;
|
|
880
|
+
if (row) {
|
|
881
|
+
const rowid = getRowid($xeTable, row);
|
|
882
|
+
tdElem = bodyScrollElem.querySelector(`[rowid="${rowid}"] .${column.id}`);
|
|
883
|
+
}
|
|
884
|
+
if (!tdElem) {
|
|
885
|
+
tdElem = bodyScrollElem.querySelector(`.${column.id}`);
|
|
886
|
+
}
|
|
887
|
+
if (tdElem) {
|
|
888
|
+
const tdOffsetLeft = tdElem.offsetLeft + (scrollXLoad ? scrollXLeft : 0);
|
|
889
|
+
const cellWidth = tdElem.clientWidth;
|
|
890
|
+
// 检测是否在可视区中
|
|
891
|
+
if (tdOffsetLeft < bodyScrollLeft + leftFixedWidth) {
|
|
892
|
+
return $xeTable.scrollTo(tdOffsetLeft - leftFixedWidth - 1);
|
|
893
|
+
} else if (tdOffsetLeft + cellWidth - bodyScrollLeft > bodyWidth - rightFixedWidth) {
|
|
894
|
+
return $xeTable.scrollTo(tdOffsetLeft + cellWidth - (bodyWidth - rightFixedWidth - 1));
|
|
895
|
+
}
|
|
896
|
+
} else {
|
|
897
|
+
// 检测是否在虚拟渲染可视区中
|
|
898
|
+
if (scrollXLoad) {
|
|
899
|
+
let scrollLeft = 0;
|
|
900
|
+
const cellWidth = column.renderWidth;
|
|
901
|
+
for (let i = 0; i < visibleColumn.length; i++) {
|
|
902
|
+
const currCol = visibleColumn[i];
|
|
903
|
+
if (currCol === column || currCol.id === column.id) {
|
|
904
|
+
break;
|
|
905
|
+
}
|
|
906
|
+
scrollLeft += currCol.renderWidth;
|
|
907
|
+
}
|
|
908
|
+
if (scrollLeft < bodyScrollLeft) {
|
|
909
|
+
return $xeTable.scrollTo(scrollLeft - leftFixedWidth - 1);
|
|
910
|
+
}
|
|
911
|
+
return $xeTable.scrollTo(scrollLeft + cellWidth - (bodyWidth - rightFixedWidth - 1));
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
return Promise.resolve();
|
|
916
|
+
}
|