vxe-table 4.16.17 → 4.16.18
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.1758510533325.ttf +0 -0
- package/es/iconfont.1758510533325.woff +0 -0
- package/es/iconfont.1758510533325.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/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/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.1758510533325.ttf +0 -0
- package/lib/iconfont.1758510533325.woff +0 -0
- package/lib/iconfont.1758510533325.woff2 +0 -0
- package/lib/index.common.js +22 -0
- package/lib/index.umd.js +2 -2
- 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 +442 -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 +145 -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/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 +902 -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
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vue = require("vue");
|
|
4
|
+
var _ui = require("../../../ui");
|
|
5
|
+
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
6
|
+
var _util = require("../../src/util");
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
const tableCustomMethodKeys = ['openCustom', 'closeCustom', 'toggleCustom', 'saveCustom', 'cancelCustom', 'resetCustom', 'toggleCustomAllCheckbox', 'setCustomAllCheckbox'];
|
|
9
|
+
_ui.VxeUI.hooks.add('tableCustomModule', {
|
|
10
|
+
setupTable($xeTable) {
|
|
11
|
+
const {
|
|
12
|
+
reactData,
|
|
13
|
+
internalData
|
|
14
|
+
} = $xeTable;
|
|
15
|
+
const {
|
|
16
|
+
computeCustomOpts,
|
|
17
|
+
computeRowGroupFields
|
|
18
|
+
} = $xeTable.getComputeMaps();
|
|
19
|
+
const {
|
|
20
|
+
refElem
|
|
21
|
+
} = $xeTable.getRefMaps();
|
|
22
|
+
const $xeGrid = $xeTable.xeGrid;
|
|
23
|
+
const $xeGantt = $xeTable.xeGantt;
|
|
24
|
+
const calcMaxHeight = () => {
|
|
25
|
+
const {
|
|
26
|
+
customStore
|
|
27
|
+
} = reactData;
|
|
28
|
+
let wrapperEl = refElem.value;
|
|
29
|
+
// 判断面板不能大于表格高度
|
|
30
|
+
let tableHeight = 0;
|
|
31
|
+
if ($xeGantt) {
|
|
32
|
+
const {
|
|
33
|
+
refGanttContainerElem
|
|
34
|
+
} = $xeGantt.getRefMaps();
|
|
35
|
+
const ganttContainerElem = refGanttContainerElem.value;
|
|
36
|
+
if (ganttContainerElem) {
|
|
37
|
+
wrapperEl = ganttContainerElem;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (wrapperEl) {
|
|
41
|
+
tableHeight = wrapperEl.clientHeight - 28;
|
|
42
|
+
}
|
|
43
|
+
customStore.maxHeight = Math.max(88, tableHeight);
|
|
44
|
+
};
|
|
45
|
+
const openCustom = () => {
|
|
46
|
+
const {
|
|
47
|
+
initStore,
|
|
48
|
+
customStore
|
|
49
|
+
} = reactData;
|
|
50
|
+
customStore.visible = true;
|
|
51
|
+
initStore.custom = true;
|
|
52
|
+
handleUpdateCustomColumn();
|
|
53
|
+
checkCustomStatus();
|
|
54
|
+
calcMaxHeight();
|
|
55
|
+
return (0, _vue.nextTick)().then(() => calcMaxHeight());
|
|
56
|
+
};
|
|
57
|
+
const handleUpdateCustomColumn = () => {
|
|
58
|
+
const {
|
|
59
|
+
customStore
|
|
60
|
+
} = reactData;
|
|
61
|
+
const {
|
|
62
|
+
collectColumn
|
|
63
|
+
} = internalData;
|
|
64
|
+
if (customStore.visible) {
|
|
65
|
+
const sortMaps = {};
|
|
66
|
+
const fixedMaps = {};
|
|
67
|
+
const visibleMaps = {};
|
|
68
|
+
_xeUtils.default.eachTree(collectColumn, column => {
|
|
69
|
+
const colid = column.getKey();
|
|
70
|
+
column.renderFixed = column.fixed;
|
|
71
|
+
column.renderVisible = column.visible;
|
|
72
|
+
column.renderResizeWidth = column.renderWidth;
|
|
73
|
+
sortMaps[colid] = column.renderSortNumber;
|
|
74
|
+
fixedMaps[colid] = column.fixed;
|
|
75
|
+
visibleMaps[colid] = column.visible;
|
|
76
|
+
});
|
|
77
|
+
customStore.oldSortMaps = sortMaps;
|
|
78
|
+
customStore.oldFixedMaps = fixedMaps;
|
|
79
|
+
customStore.oldVisibleMaps = visibleMaps;
|
|
80
|
+
reactData.customColumnList = collectColumn.slice(0);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const closeCustom = () => {
|
|
84
|
+
const {
|
|
85
|
+
customStore
|
|
86
|
+
} = reactData;
|
|
87
|
+
const customOpts = computeCustomOpts.value;
|
|
88
|
+
if (customStore.visible) {
|
|
89
|
+
customStore.visible = false;
|
|
90
|
+
if (!customOpts.immediate) {
|
|
91
|
+
$xeTable.handleCustom();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return (0, _vue.nextTick)();
|
|
95
|
+
};
|
|
96
|
+
const toggleCustom = () => {
|
|
97
|
+
const {
|
|
98
|
+
customStore
|
|
99
|
+
} = reactData;
|
|
100
|
+
if (customStore.visible) {
|
|
101
|
+
return closeCustom();
|
|
102
|
+
}
|
|
103
|
+
return openCustom();
|
|
104
|
+
};
|
|
105
|
+
const saveCustom = () => {
|
|
106
|
+
const {
|
|
107
|
+
customColumnList,
|
|
108
|
+
aggHandleFields,
|
|
109
|
+
rowGroupList
|
|
110
|
+
} = reactData;
|
|
111
|
+
const customOpts = computeCustomOpts.value;
|
|
112
|
+
const {
|
|
113
|
+
allowVisible,
|
|
114
|
+
allowSort,
|
|
115
|
+
allowFixed,
|
|
116
|
+
allowResizable,
|
|
117
|
+
allowGroup,
|
|
118
|
+
allowValues
|
|
119
|
+
} = customOpts;
|
|
120
|
+
_xeUtils.default.eachTree(customColumnList, (column, index, items, path, parentColumn) => {
|
|
121
|
+
if (parentColumn) {
|
|
122
|
+
// 更新子列信息
|
|
123
|
+
column.fixed = parentColumn.fixed;
|
|
124
|
+
} else {
|
|
125
|
+
if (allowSort) {
|
|
126
|
+
const sortIndex = index + 1;
|
|
127
|
+
column.renderSortNumber = sortIndex;
|
|
128
|
+
}
|
|
129
|
+
if (allowFixed) {
|
|
130
|
+
column.fixed = column.renderFixed;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (allowResizable) {
|
|
134
|
+
if (column.renderVisible && (!column.children || column.children.length)) {
|
|
135
|
+
if (column.renderResizeWidth !== column.renderWidth) {
|
|
136
|
+
column.resizeWidth = column.renderResizeWidth;
|
|
137
|
+
column.renderWidth = column.renderResizeWidth;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (allowVisible) {
|
|
142
|
+
column.visible = column.renderVisible;
|
|
143
|
+
}
|
|
144
|
+
if (allowGroup && allowValues) {
|
|
145
|
+
column.aggFunc = column.renderAggFn;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
reactData.isCustomStatus = true;
|
|
149
|
+
if (allowGroup && !!$xeTable.handlePivotTableAggregateData) {
|
|
150
|
+
if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
|
|
151
|
+
// 更新数据分组
|
|
152
|
+
if (aggHandleFields.length) {
|
|
153
|
+
$xeTable.setRowGroups(aggHandleFields);
|
|
154
|
+
} else {
|
|
155
|
+
$xeTable.clearRowGroups();
|
|
156
|
+
}
|
|
157
|
+
} else if (allowValues) {
|
|
158
|
+
// 更新聚合函数
|
|
159
|
+
$xeTable.handleUpdateAggData();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (allowSort) {
|
|
163
|
+
internalData.collectColumn = customColumnList;
|
|
164
|
+
}
|
|
165
|
+
return $xeTable.saveCustomStore('confirm');
|
|
166
|
+
};
|
|
167
|
+
const cancelCustom = () => {
|
|
168
|
+
const {
|
|
169
|
+
customColumnList,
|
|
170
|
+
customStore
|
|
171
|
+
} = reactData;
|
|
172
|
+
const {
|
|
173
|
+
oldSortMaps,
|
|
174
|
+
oldFixedMaps,
|
|
175
|
+
oldVisibleMaps
|
|
176
|
+
} = customStore;
|
|
177
|
+
const customOpts = computeCustomOpts.value;
|
|
178
|
+
const {
|
|
179
|
+
allowVisible,
|
|
180
|
+
allowSort,
|
|
181
|
+
allowFixed,
|
|
182
|
+
allowResizable
|
|
183
|
+
} = customOpts;
|
|
184
|
+
_xeUtils.default.eachTree(customColumnList, column => {
|
|
185
|
+
const colid = column.getKey();
|
|
186
|
+
const visible = !!oldVisibleMaps[colid];
|
|
187
|
+
const fixed = oldFixedMaps[colid] || '';
|
|
188
|
+
if (allowVisible) {
|
|
189
|
+
column.renderVisible = visible;
|
|
190
|
+
column.visible = visible;
|
|
191
|
+
}
|
|
192
|
+
if (allowFixed) {
|
|
193
|
+
column.renderFixed = fixed;
|
|
194
|
+
column.fixed = fixed;
|
|
195
|
+
}
|
|
196
|
+
if (allowSort) {
|
|
197
|
+
column.renderSortNumber = oldSortMaps[colid] || 0;
|
|
198
|
+
}
|
|
199
|
+
if (allowResizable) {
|
|
200
|
+
column.renderResizeWidth = column.renderWidth;
|
|
201
|
+
}
|
|
202
|
+
}, {
|
|
203
|
+
children: 'children'
|
|
204
|
+
});
|
|
205
|
+
return (0, _vue.nextTick)();
|
|
206
|
+
};
|
|
207
|
+
const setCustomAllCheckbox = checked => {
|
|
208
|
+
const {
|
|
209
|
+
customStore
|
|
210
|
+
} = reactData;
|
|
211
|
+
const {
|
|
212
|
+
customColumnList
|
|
213
|
+
} = reactData;
|
|
214
|
+
const customOpts = computeCustomOpts.value;
|
|
215
|
+
const {
|
|
216
|
+
checkMethod,
|
|
217
|
+
visibleMethod
|
|
218
|
+
} = customOpts;
|
|
219
|
+
const isAll = !!checked;
|
|
220
|
+
if (customOpts.immediate) {
|
|
221
|
+
_xeUtils.default.eachTree(customColumnList, column => {
|
|
222
|
+
if (visibleMethod && !visibleMethod({
|
|
223
|
+
$table: $xeTable,
|
|
224
|
+
column
|
|
225
|
+
})) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (checkMethod && !checkMethod({
|
|
229
|
+
$table: $xeTable,
|
|
230
|
+
column
|
|
231
|
+
})) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
column.visible = isAll;
|
|
235
|
+
column.renderVisible = isAll;
|
|
236
|
+
column.halfVisible = false;
|
|
237
|
+
});
|
|
238
|
+
customStore.isAll = isAll;
|
|
239
|
+
reactData.isCustomStatus = true;
|
|
240
|
+
$xeTable.handleCustom();
|
|
241
|
+
$xeTable.saveCustomStore('update:visible');
|
|
242
|
+
} else {
|
|
243
|
+
_xeUtils.default.eachTree(customColumnList, column => {
|
|
244
|
+
if (visibleMethod && !visibleMethod({
|
|
245
|
+
$table: $xeTable,
|
|
246
|
+
column
|
|
247
|
+
})) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (checkMethod && !checkMethod({
|
|
251
|
+
$table: $xeTable,
|
|
252
|
+
column
|
|
253
|
+
})) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
column.renderVisible = isAll;
|
|
257
|
+
column.halfVisible = false;
|
|
258
|
+
});
|
|
259
|
+
customStore.isAll = isAll;
|
|
260
|
+
}
|
|
261
|
+
$xeTable.checkCustomStatus();
|
|
262
|
+
return (0, _vue.nextTick)();
|
|
263
|
+
};
|
|
264
|
+
const customMethods = {
|
|
265
|
+
getCustomVisible() {
|
|
266
|
+
const {
|
|
267
|
+
customStore
|
|
268
|
+
} = reactData;
|
|
269
|
+
return customStore.visible;
|
|
270
|
+
},
|
|
271
|
+
openCustom,
|
|
272
|
+
closeCustom,
|
|
273
|
+
toggleCustom,
|
|
274
|
+
saveCustom,
|
|
275
|
+
cancelCustom,
|
|
276
|
+
resetCustom(options) {
|
|
277
|
+
const {
|
|
278
|
+
rowGroupList
|
|
279
|
+
} = reactData;
|
|
280
|
+
const {
|
|
281
|
+
collectColumn
|
|
282
|
+
} = internalData;
|
|
283
|
+
const customOpts = computeCustomOpts.value;
|
|
284
|
+
const {
|
|
285
|
+
checkMethod
|
|
286
|
+
} = customOpts;
|
|
287
|
+
const opts = Object.assign({
|
|
288
|
+
visible: true,
|
|
289
|
+
resizable: options === true,
|
|
290
|
+
fixed: options === true,
|
|
291
|
+
sort: options === true,
|
|
292
|
+
aggFunc: options === true
|
|
293
|
+
}, options);
|
|
294
|
+
const allCols = [];
|
|
295
|
+
_xeUtils.default.eachTree(collectColumn, column => {
|
|
296
|
+
if (opts.resizable) {
|
|
297
|
+
column.resizeWidth = 0;
|
|
298
|
+
}
|
|
299
|
+
if (opts.fixed) {
|
|
300
|
+
column.fixed = column.defaultFixed;
|
|
301
|
+
}
|
|
302
|
+
if (opts.sort) {
|
|
303
|
+
column.renderSortNumber = column.sortNumber;
|
|
304
|
+
column.parentId = column.defaultParentId;
|
|
305
|
+
}
|
|
306
|
+
if (!checkMethod || checkMethod({
|
|
307
|
+
$table: $xeTable,
|
|
308
|
+
column
|
|
309
|
+
})) {
|
|
310
|
+
column.visible = column.defaultVisible;
|
|
311
|
+
}
|
|
312
|
+
if (opts.aggFunc) {
|
|
313
|
+
column.aggFunc = column.defaultAggFunc;
|
|
314
|
+
column.renderAggFn = column.defaultAggFunc;
|
|
315
|
+
}
|
|
316
|
+
column.renderResizeWidth = column.renderWidth;
|
|
317
|
+
allCols.push(column);
|
|
318
|
+
});
|
|
319
|
+
if (opts.sort) {
|
|
320
|
+
const newCollectCols = _xeUtils.default.toArrayTree(_xeUtils.default.orderBy(allCols, 'renderSortNumber'), {
|
|
321
|
+
key: 'id',
|
|
322
|
+
parentKey: 'parentId',
|
|
323
|
+
children: 'children'
|
|
324
|
+
});
|
|
325
|
+
internalData.collectColumn = newCollectCols;
|
|
326
|
+
internalData.tableFullColumn = (0, _util.getColumnList)(newCollectCols);
|
|
327
|
+
}
|
|
328
|
+
reactData.isCustomStatus = false;
|
|
329
|
+
return $xeTable.handleCustom().then(() => {
|
|
330
|
+
if (opts.aggFunc && $xeTable.handlePivotTableAggregateData) {
|
|
331
|
+
const rowGroupFields = computeRowGroupFields.value;
|
|
332
|
+
if (rowGroupFields ? rowGroupFields.length : rowGroupList.length) {
|
|
333
|
+
if (rowGroupFields && rowGroupFields.length) {
|
|
334
|
+
$xeTable.setRowGroups(rowGroupFields);
|
|
335
|
+
} else {
|
|
336
|
+
$xeTable.clearRowGroups();
|
|
337
|
+
}
|
|
338
|
+
} else {
|
|
339
|
+
$xeTable.handleUpdateAggData();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
$xeTable.saveCustomStore('reset');
|
|
343
|
+
});
|
|
344
|
+
},
|
|
345
|
+
toggleCustomAllCheckbox() {
|
|
346
|
+
const {
|
|
347
|
+
customStore
|
|
348
|
+
} = reactData;
|
|
349
|
+
const isAll = !customStore.isAll;
|
|
350
|
+
return setCustomAllCheckbox(isAll);
|
|
351
|
+
},
|
|
352
|
+
setCustomAllCheckbox
|
|
353
|
+
};
|
|
354
|
+
const checkCustomStatus = () => {
|
|
355
|
+
const {
|
|
356
|
+
customStore
|
|
357
|
+
} = reactData;
|
|
358
|
+
const {
|
|
359
|
+
collectColumn
|
|
360
|
+
} = internalData;
|
|
361
|
+
const customOpts = computeCustomOpts.value;
|
|
362
|
+
const {
|
|
363
|
+
checkMethod
|
|
364
|
+
} = customOpts;
|
|
365
|
+
customStore.isAll = collectColumn.every(column => (checkMethod ? !checkMethod({
|
|
366
|
+
$table: $xeTable,
|
|
367
|
+
column
|
|
368
|
+
}) : false) || column.renderVisible);
|
|
369
|
+
customStore.isIndeterminate = !customStore.isAll && collectColumn.some(column => (!checkMethod || checkMethod({
|
|
370
|
+
$table: $xeTable,
|
|
371
|
+
column
|
|
372
|
+
})) && (column.renderVisible || column.halfVisible));
|
|
373
|
+
};
|
|
374
|
+
const emitCustomEvent = (type, evnt) => {
|
|
375
|
+
const comp = $xeGrid || $xeGantt || $xeTable;
|
|
376
|
+
comp.dispatchEvent('custom', {
|
|
377
|
+
type
|
|
378
|
+
}, evnt);
|
|
379
|
+
};
|
|
380
|
+
const customPrivateMethods = {
|
|
381
|
+
checkCustomStatus,
|
|
382
|
+
emitCustomEvent,
|
|
383
|
+
triggerCustomEvent(evnt) {
|
|
384
|
+
const reactData = $xeTable.reactData;
|
|
385
|
+
const {
|
|
386
|
+
customStore
|
|
387
|
+
} = reactData;
|
|
388
|
+
if (customStore.visible) {
|
|
389
|
+
closeCustom();
|
|
390
|
+
emitCustomEvent('close', evnt);
|
|
391
|
+
} else {
|
|
392
|
+
customStore.btnEl = evnt.target;
|
|
393
|
+
openCustom();
|
|
394
|
+
emitCustomEvent('open', evnt);
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
customOpenEvent(evnt) {
|
|
398
|
+
const reactData = $xeTable.reactData;
|
|
399
|
+
const {
|
|
400
|
+
customStore
|
|
401
|
+
} = reactData;
|
|
402
|
+
if (!customStore.visible) {
|
|
403
|
+
customStore.activeBtn = true;
|
|
404
|
+
customStore.btnEl = evnt.target;
|
|
405
|
+
$xeTable.openCustom();
|
|
406
|
+
$xeTable.emitCustomEvent('open', evnt);
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
customCloseEvent(evnt) {
|
|
410
|
+
const reactData = $xeTable.reactData;
|
|
411
|
+
const {
|
|
412
|
+
customStore
|
|
413
|
+
} = reactData;
|
|
414
|
+
if (customStore.visible) {
|
|
415
|
+
customStore.activeBtn = false;
|
|
416
|
+
$xeTable.closeCustom();
|
|
417
|
+
$xeTable.emitCustomEvent('close', evnt);
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
handleUpdateCustomColumn
|
|
421
|
+
};
|
|
422
|
+
return Object.assign(Object.assign({}, customMethods), customPrivateMethods);
|
|
423
|
+
},
|
|
424
|
+
setupGrid($xeGrid) {
|
|
425
|
+
return $xeGrid.extendTableMethods(tableCustomMethodKeys);
|
|
426
|
+
},
|
|
427
|
+
setupGantt($xeGantt) {
|
|
428
|
+
return $xeGantt.extendTableMethods(tableCustomMethodKeys);
|
|
429
|
+
}
|
|
430
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _vue=require("vue"),_ui=require("../../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("../../src/util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let tableCustomMethodKeys=["openCustom","closeCustom","toggleCustom","saveCustom","cancelCustom","resetCustom","toggleCustomAllCheckbox","setCustomAllCheckbox"];_ui.VxeUI.hooks.add("tableCustomModule",{setupTable(m){let{reactData:c,internalData:b}=m,{computeCustomOpts:v,computeRowGroupFields:o}=m.getComputeMaps(),s=m.getRefMaps().refElem,l=m.xeGrid,i=m.xeGantt,r=()=>{var e,t=c.customStore;let l=s.value,r=0;(l=i&&(e=i.getRefMaps().refGanttContainerElem,e=e.value)?e:l)&&(r=l.clientHeight-28),t.maxHeight=Math.max(88,r)},a=()=>{var{initStore:e,customStore:t}=c;return t.visible=!0,e.custom=!0,u(),d(),r(),(0,_vue.nextTick)().then(()=>r())},u=()=>{var e=c.customStore,t=b.collectColumn;if(e.visible){let l={},r={},s={};_xeUtils.default.eachTree(t,e=>{var t=e.getKey();e.renderFixed=e.fixed,e.renderVisible=e.visible,e.renderResizeWidth=e.renderWidth,l[t]=e.renderSortNumber,r[t]=e.fixed,s[t]=e.visible}),e.oldSortMaps=l,e.oldFixedMaps=r,e.oldVisibleMaps=s,c.customColumnList=t.slice(0)}},n=()=>{var e=c.customStore,t=v.value;return e.visible&&(e.visible=!1,t.immediate||m.handleCustom()),(0,_vue.nextTick)()};let t=e=>{var t=c.customStore,l=c.customColumnList,r=v.value;let{checkMethod:s,visibleMethod:i}=r,o=!!e;return r.immediate?(_xeUtils.default.eachTree(l,e=>{i&&!i({$table:m,column:e})||s&&!s({$table:m,column:e})||(e.visible=o,e.renderVisible=o,e.halfVisible=!1)}),t.isAll=o,c.isCustomStatus=!0,m.handleCustom(),m.saveCustomStore("update:visible")):(_xeUtils.default.eachTree(l,e=>{i&&!i({$table:m,column:e})||s&&!s({$table:m,column:e})||(e.renderVisible=o,e.halfVisible=!1)}),t.isAll=o),m.checkCustomStatus(),(0,_vue.nextTick)()};var e={getCustomVisible(){var e=c.customStore;return e.visible},openCustom:a,closeCustom:n,toggleCustom:()=>{var e=c.customStore;return(e.visible?n:a)()},saveCustom:()=>{let{customColumnList:e,aggHandleFields:l,rowGroupList:t}=c;let{allowVisible:i,allowSort:o,allowFixed:a,allowResizable:u,allowGroup:n,allowValues:d}=v.value;return _xeUtils.default.eachTree(e,(e,t,l,r,s)=>{s?e.fixed=s.fixed:(o&&(e.renderSortNumber=t+1),a&&(e.fixed=e.renderFixed)),u&&e.renderVisible&&(!e.children||e.children.length)&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),i&&(e.visible=e.renderVisible),n&&d&&(e.aggFunc=e.renderAggFn)}),c.isCustomStatus=!0,n&&m.handlePivotTableAggregateData&&(t.length!==l.length||t.some((e,t)=>e.field!==l[t])?l.length?m.setRowGroups(l):m.clearRowGroups():d&&m.handleUpdateAggData()),o&&(b.collectColumn=e),m.saveCustomStore("confirm")},cancelCustom:()=>{var{customColumnList:e,customStore:t}=c;let{oldSortMaps:s,oldFixedMaps:i,oldVisibleMaps:o}=t,{allowVisible:a,allowSort:u,allowFixed:n,allowResizable:d}=v.value;return _xeUtils.default.eachTree(e,e=>{var t=e.getKey(),l=!!o[t],r=i[t]||"";a&&(e.renderVisible=l,e.visible=l),n&&(e.renderFixed=r,e.fixed=r),u&&(e.renderSortNumber=s[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),(0,_vue.nextTick)()},resetCustom(e){let t=c.rowGroupList;var l=b.collectColumn;let r=v.value.checkMethod,s=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e,aggFunc:!0===e},e),i=[];return _xeUtils.default.eachTree(l,e=>{s.resizable&&(e.resizeWidth=0),s.fixed&&(e.fixed=e.defaultFixed),s.sort&&(e.renderSortNumber=e.sortNumber,e.parentId=e.defaultParentId),r&&!r({$table:m,column:e})||(e.visible=e.defaultVisible),s.aggFunc&&(e.aggFunc=e.defaultAggFunc,e.renderAggFn=e.defaultAggFunc),e.renderResizeWidth=e.renderWidth,i.push(e)}),s.sort&&(e=_xeUtils.default.toArrayTree(_xeUtils.default.orderBy(i,"renderSortNumber"),{key:"id",parentKey:"parentId",children:"children"}),b.collectColumn=e,b.tableFullColumn=(0,_util.getColumnList)(e)),c.isCustomStatus=!1,m.handleCustom().then(()=>{var e;s.aggFunc&&m.handlePivotTableAggregateData&&(((e=o.value)||t).length?e&&e.length?m.setRowGroups(e):m.clearRowGroups():m.handleUpdateAggData()),m.saveCustomStore("reset")})},toggleCustomAllCheckbox(){var e=c.customStore,e=!e.isAll;return t(e)},setCustomAllCheckbox:t};let d=()=>{var e=c.customStore,t=b.collectColumn;let l=v.value.checkMethod;e.isAll=t.every(e=>!!l&&!l({$table:m,column:e})||e.renderVisible),e.isIndeterminate=!e.isAll&&t.some(e=>(!l||l({$table:m,column:e}))&&(e.renderVisible||e.halfVisible))},h=(e,t)=>{(l||i||m).dispatchEvent("custom",{type:e},t)};var g={checkCustomStatus:d,emitCustomEvent:h,triggerCustomEvent(e){var t=m.reactData.customStore;t.visible?(n(),h("close",e)):(t.btnEl=e.target,a(),h("open",e))},customOpenEvent(e){var t=m.reactData.customStore;t.visible||(t.activeBtn=!0,t.btnEl=e.target,m.openCustom(),m.emitCustomEvent("open",e))},customCloseEvent(e){var t=m.reactData.customStore;t.visible&&(t.activeBtn=!1,m.closeCustom(),m.emitCustomEvent("close",e))},handleUpdateCustomColumn:u};return Object.assign(Object.assign({},e),g)},setupGrid(e){return e.extendTableMethods(tableCustomMethodKeys)},setupGantt(e){return e.extendTableMethods(tableCustomMethodKeys)}});
|