vxe-table 3.19.39 → 3.20.0-beta.1
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/index.css +1 -1
- package/es/index.esm.js +2 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/mixin.js +6 -4
- package/es/table/module/custom/panel.js +806 -799
- package/es/table/module/edit/mixin.js +43 -31
- package/es/table/module/export/export-panel.js +511 -458
- package/es/table/module/export/import-panel.js +224 -192
- package/es/table/module/keyboard/mixin.js +2 -2
- package/es/table/module/menu/panel.js +165 -161
- package/es/table/module/validator/mixin.js +255 -236
- package/es/table/src/body.js +2 -1
- package/es/table/src/cell.js +2 -2
- package/es/table/src/methods.js +33 -43
- package/es/table/src/table.js +13 -249
- package/es/table/src/util.js +242 -0
- package/es/table/style.css +23 -50
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +2 -2
- package/es/ui/src/dom.js +22 -0
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +23 -50
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.common.js +2 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +3640 -4790
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/mixin.js +6 -4
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +693 -685
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +47 -31
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/export-panel.js +450 -384
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +200 -159
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +2 -2
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/panel.js +119 -114
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/module/validator/mixin.js +271 -259
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +2 -1
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +2 -2
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +33 -45
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +12 -248
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +243 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +23 -50
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +22 -0
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/v-x-e-table/index.js +2 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/vxe-colgroup/index.js +2 -1
- package/lib/vxe-colgroup/index.min.js +1 -1
- package/lib/vxe-column/index.js +2 -1
- package/lib/vxe-column/index.min.js +1 -1
- package/lib/vxe-grid/index.js +2 -1
- package/lib/vxe-grid/index.min.js +1 -1
- package/lib/vxe-table/index.js +2 -1
- package/lib/vxe-table/index.min.js +1 -1
- package/lib/vxe-table/style/style.css +23 -50
- package/lib/vxe-table/style/style.min.css +1 -1
- package/lib/vxe-toolbar/index.js +2 -1
- package/lib/vxe-toolbar/index.min.js +1 -1
- package/lib/vxe-ui/index.js +2 -1
- package/lib/vxe-ui/index.min.js +1 -1
- package/lib/vxe-v-x-e-table/index.js +2 -1
- package/lib/vxe-v-x-e-table/index.min.js +1 -1
- package/package.json +1 -1
- package/packages/table/module/custom/mixin.ts +7 -4
- package/packages/table/module/custom/panel.ts +846 -839
- package/packages/table/module/edit/mixin.ts +55 -35
- package/packages/table/module/export/export-panel.ts +545 -469
- package/packages/table/module/export/import-panel.ts +245 -202
- package/packages/table/module/filter/panel.ts +4 -18
- package/packages/table/module/keyboard/mixin.ts +2 -2
- package/packages/table/module/menu/panel.ts +171 -163
- package/packages/table/module/validator/mixin.ts +279 -240
- package/packages/table/src/body.ts +2 -1
- package/packages/table/src/cell.ts +2 -2
- package/packages/table/src/methods.ts +43 -45
- package/packages/table/src/table.ts +14 -260
- package/packages/table/src/util.ts +254 -0
- package/packages/ui/index.ts +1 -1
- package/packages/ui/src/dom.ts +22 -0
- package/styles/components/table.scss +5 -2
- package/styles/theme/base.scss +2 -1
- /package/es/{iconfont.1767145426781.ttf → iconfont.1767492234857.ttf} +0 -0
- /package/es/{iconfont.1767145426781.woff → iconfont.1767492234857.woff} +0 -0
- /package/es/{iconfont.1767145426781.woff2 → iconfont.1767492234857.woff2} +0 -0
- /package/lib/{iconfont.1767145426781.ttf → iconfont.1767492234857.ttf} +0 -0
- /package/lib/{iconfont.1767145426781.woff → iconfont.1767492234857.woff} +0 -0
- /package/lib/{iconfont.1767145426781.woff2 → iconfont.1767492234857.woff2} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defineVxeComponent } from '../../../ui/src/comp';
|
|
1
2
|
import { VxeUI } from '../../../ui';
|
|
2
3
|
import { formatText } from '../../../ui/src/utils';
|
|
3
4
|
import { getTpImg, addClass, removeClass, hasControlKey } from '../../../ui/src/dom';
|
|
@@ -58,794 +59,6 @@ function hideDropTip($xeTableCustomPanel) {
|
|
|
58
59
|
dragLineEl.style.display = '';
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
const renderDragTip = (h, $xeTableCustomPanel) => {
|
|
62
|
-
const $xeTable = $xeTableCustomPanel.$xeTable;
|
|
63
|
-
const customPanelReactData = $xeTableCustomPanel.reactData;
|
|
64
|
-
const { dragTipText } = customPanelReactData;
|
|
65
|
-
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
66
|
-
return h('div', {}, [
|
|
67
|
-
h('div', {
|
|
68
|
-
ref: 'refDragLineElem',
|
|
69
|
-
class: ['vxe-table-custom-popup--drag-line', {
|
|
70
|
-
'is--guides': columnDragOpts.showGuidesStatus
|
|
71
|
-
}]
|
|
72
|
-
}),
|
|
73
|
-
h('div', {
|
|
74
|
-
ref: 'refDragTipElem',
|
|
75
|
-
class: 'vxe-table-custom-popup--drag-tip'
|
|
76
|
-
}, [
|
|
77
|
-
h('div', {
|
|
78
|
-
class: 'vxe-table-custom-popup--drag-tip-wrapper'
|
|
79
|
-
}, [
|
|
80
|
-
h('div', {
|
|
81
|
-
class: 'vxe-table-custom-popup--drag-tip-status'
|
|
82
|
-
}, [
|
|
83
|
-
h('span', {
|
|
84
|
-
class: ['vxe-table-custom-popup--drag-tip-normal-status', getIcon().TABLE_DRAG_STATUS_ROW]
|
|
85
|
-
}),
|
|
86
|
-
h('span', {
|
|
87
|
-
class: ['vxe-table-custom-popup--drag-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
|
|
88
|
-
}),
|
|
89
|
-
h('span', {
|
|
90
|
-
class: ['vxe-table-custom-popup--drag-tip-group-status', getIcon().TABLE_DRAG_STATUS_AGG_GROUP]
|
|
91
|
-
}),
|
|
92
|
-
h('span', {
|
|
93
|
-
class: ['vxe-table-custom-popup--drag-tip-values-status', getIcon().TABLE_DRAG_STATUS_AGG_VALUES]
|
|
94
|
-
}),
|
|
95
|
-
h('span', {
|
|
96
|
-
class: ['vxe-table-custom-popup--drag-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
|
|
97
|
-
})
|
|
98
|
-
]),
|
|
99
|
-
h('div', {
|
|
100
|
-
class: 'vxe-table-custom-popup--drag-tip-content'
|
|
101
|
-
}, `${dragTipText || ''}`)
|
|
102
|
-
])
|
|
103
|
-
])
|
|
104
|
-
]);
|
|
105
|
-
};
|
|
106
|
-
const renderSimplePanel = (h, _vm) => {
|
|
107
|
-
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
108
|
-
const props = _vm;
|
|
109
|
-
const $xeTable = _vm.$xeTable;
|
|
110
|
-
const tableProps = $xeTable;
|
|
111
|
-
const tableReactData = $xeTable;
|
|
112
|
-
const $xeGrid = $xeTable.$xeGrid;
|
|
113
|
-
const $xeGantt = $xeTable.$xeGantt;
|
|
114
|
-
const { customStore } = props;
|
|
115
|
-
const { treeConfig, rowGroupConfig, aggregateConfig } = tableProps;
|
|
116
|
-
const { isCustomStatus, customColumnList } = tableReactData;
|
|
117
|
-
const customOpts = $xeTable.computeCustomOpts;
|
|
118
|
-
const { immediate } = customOpts;
|
|
119
|
-
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
120
|
-
const { maxHeight } = customStore;
|
|
121
|
-
const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts;
|
|
122
|
-
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
123
|
-
const { isCrossDrag } = columnDragOpts;
|
|
124
|
-
const slots = customOpts.slots || {};
|
|
125
|
-
const headerSlot = slots.header;
|
|
126
|
-
const topSlot = slots.top;
|
|
127
|
-
const bottomSlot = slots.bottom;
|
|
128
|
-
const defaultSlot = slots.default;
|
|
129
|
-
const footerSlot = slots.footer;
|
|
130
|
-
const colVNs = [];
|
|
131
|
-
const customWrapperOns = {};
|
|
132
|
-
const isAllChecked = customStore.isAll;
|
|
133
|
-
const isAllIndeterminate = customStore.isIndeterminate;
|
|
134
|
-
// hover 触发
|
|
135
|
-
if (trigger === 'hover') {
|
|
136
|
-
customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent;
|
|
137
|
-
customWrapperOns.mouseleave = _vm.handleWrapperMouseleaveEvent;
|
|
138
|
-
}
|
|
139
|
-
const params = {
|
|
140
|
-
$table: $xeTable,
|
|
141
|
-
$grid: $xeGrid,
|
|
142
|
-
$gantt: $xeGantt,
|
|
143
|
-
columns: customColumnList,
|
|
144
|
-
isAllChecked,
|
|
145
|
-
isAllIndeterminate,
|
|
146
|
-
isCustomStatus
|
|
147
|
-
};
|
|
148
|
-
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
149
|
-
const isVisible = visibleMethod ? visibleMethod({ $table: $xeTable, column }) : true;
|
|
150
|
-
if (isVisible) {
|
|
151
|
-
const isChecked = column.renderVisible;
|
|
152
|
-
const isIndeterminate = column.halfVisible;
|
|
153
|
-
const isColGroup = column.children && column.children.length;
|
|
154
|
-
const colTitle = formatText(column.getTitle(), 1);
|
|
155
|
-
const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false;
|
|
156
|
-
const isHidden = !isChecked;
|
|
157
|
-
colVNs.push(h('li', {
|
|
158
|
-
key: column.id,
|
|
159
|
-
attrs: {
|
|
160
|
-
colid: column.id
|
|
161
|
-
},
|
|
162
|
-
class: ['vxe-table-custom--option', `level--${column.level}`, {
|
|
163
|
-
'is--hidden': isDisabled || isHidden,
|
|
164
|
-
'is--group': isColGroup
|
|
165
|
-
}],
|
|
166
|
-
on: {
|
|
167
|
-
dragstart: _vm.sortDragstartEvent,
|
|
168
|
-
dragend: _vm.sortDragendEvent,
|
|
169
|
-
dragover: _vm.sortDragoverEvent
|
|
170
|
-
}
|
|
171
|
-
}, [
|
|
172
|
-
allowVisible
|
|
173
|
-
? h('div', {
|
|
174
|
-
class: ['vxe-table-custom--checkbox-option', {
|
|
175
|
-
'is--checked': isChecked,
|
|
176
|
-
'is--indeterminate': isIndeterminate,
|
|
177
|
-
'is--disabled': isDisabled
|
|
178
|
-
}],
|
|
179
|
-
attrs: {
|
|
180
|
-
title: getI18n('vxe.custom.setting.colVisible')
|
|
181
|
-
},
|
|
182
|
-
on: {
|
|
183
|
-
click: (evnt) => {
|
|
184
|
-
if (!isDisabled) {
|
|
185
|
-
_vm.changeCheckboxOption(column, evnt);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}, [
|
|
190
|
-
h('span', {
|
|
191
|
-
class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
192
|
-
})
|
|
193
|
-
])
|
|
194
|
-
: renderEmptyElement($xeTable),
|
|
195
|
-
h('div', {
|
|
196
|
-
class: 'vxe-table-custom--name-option'
|
|
197
|
-
}, [
|
|
198
|
-
allowSort && ((isCrossDrag ? immediate : false) || column.level === 1)
|
|
199
|
-
? h('div', {
|
|
200
|
-
class: 'vxe-table-custom--sort-option'
|
|
201
|
-
}, [
|
|
202
|
-
h('span', {
|
|
203
|
-
class: ['vxe-table-custom--sort-btn', {
|
|
204
|
-
'is--disabled': isHidden
|
|
205
|
-
}],
|
|
206
|
-
attrs: {
|
|
207
|
-
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
208
|
-
},
|
|
209
|
-
on: isHidden
|
|
210
|
-
? {}
|
|
211
|
-
: {
|
|
212
|
-
mousedown: _vm.sortMousedownEvent,
|
|
213
|
-
mouseup: _vm.sortMouseupEvent
|
|
214
|
-
}
|
|
215
|
-
}, [
|
|
216
|
-
h('i', {
|
|
217
|
-
class: getIcon().TABLE_CUSTOM_SORT
|
|
218
|
-
})
|
|
219
|
-
])
|
|
220
|
-
])
|
|
221
|
-
: renderEmptyElement($xeTable),
|
|
222
|
-
column.type === 'html'
|
|
223
|
-
? h('div', {
|
|
224
|
-
key: '1',
|
|
225
|
-
class: 'vxe-table-custom--checkbox-label',
|
|
226
|
-
domProps: {
|
|
227
|
-
innerHTML: colTitle
|
|
228
|
-
}
|
|
229
|
-
})
|
|
230
|
-
: h('div', {
|
|
231
|
-
key: '0',
|
|
232
|
-
class: 'vxe-table-custom--checkbox-label',
|
|
233
|
-
attrs: {
|
|
234
|
-
title: colTitle
|
|
235
|
-
}
|
|
236
|
-
}, colTitle)
|
|
237
|
-
]),
|
|
238
|
-
!parent && allowFixed
|
|
239
|
-
? h('div', {
|
|
240
|
-
class: 'vxe-table-custom--fixed-option'
|
|
241
|
-
}, [
|
|
242
|
-
h(VxeUIButtonComponent, {
|
|
243
|
-
props: {
|
|
244
|
-
mode: 'text',
|
|
245
|
-
icon: column.renderFixed === 'left' ? getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_LEFT,
|
|
246
|
-
status: column.renderFixed === 'left' ? 'primary' : '',
|
|
247
|
-
disabled: isHidden || (isMaxFixedColumn && !column.renderFixed),
|
|
248
|
-
title: getI18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft')
|
|
249
|
-
},
|
|
250
|
-
on: {
|
|
251
|
-
click: ({ $event }) => {
|
|
252
|
-
_vm.changeFixedOption(column, 'left', $event);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}),
|
|
256
|
-
h(VxeUIButtonComponent, {
|
|
257
|
-
props: {
|
|
258
|
-
mode: 'text',
|
|
259
|
-
icon: column.renderFixed === 'right' ? getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,
|
|
260
|
-
status: column.renderFixed === 'right' ? 'primary' : '',
|
|
261
|
-
disabled: isHidden || (isMaxFixedColumn && !column.renderFixed),
|
|
262
|
-
title: getI18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight')
|
|
263
|
-
},
|
|
264
|
-
on: {
|
|
265
|
-
click: ({ $event }) => {
|
|
266
|
-
_vm.changeFixedOption(column, 'right', $event);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
})
|
|
270
|
-
])
|
|
271
|
-
: renderEmptyElement($xeTable)
|
|
272
|
-
]));
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
return h('div', {
|
|
276
|
-
ref: 'refElem',
|
|
277
|
-
key: 'simple',
|
|
278
|
-
class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
|
|
279
|
-
'is--active': customStore.visible
|
|
280
|
-
}],
|
|
281
|
-
style: maxHeight && !['left', 'right'].includes(placement || '')
|
|
282
|
-
? {
|
|
283
|
-
maxHeight: `${maxHeight}px`
|
|
284
|
-
}
|
|
285
|
-
: {}
|
|
286
|
-
}, customStore.visible
|
|
287
|
-
? [
|
|
288
|
-
h('div', {
|
|
289
|
-
ref: 'refBodyWrapperElem',
|
|
290
|
-
class: 'vxe-table-custom-simple--body-wrapper'
|
|
291
|
-
}, [
|
|
292
|
-
!treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregateSimplePanel
|
|
293
|
-
? h($xeTable.getPivotTableAggregateSimplePanel(), {
|
|
294
|
-
props: {
|
|
295
|
-
customStore
|
|
296
|
-
}
|
|
297
|
-
})
|
|
298
|
-
: renderEmptyElement($xeTable),
|
|
299
|
-
h('div', {
|
|
300
|
-
ref: 'refCustomBodyElem',
|
|
301
|
-
class: 'vxe-table-custom--handle-wrapper'
|
|
302
|
-
}, [
|
|
303
|
-
h('div', {
|
|
304
|
-
class: 'vxe-table-custom--header'
|
|
305
|
-
}, headerSlot
|
|
306
|
-
? $xeTable.callSlot(headerSlot, params, h)
|
|
307
|
-
: [
|
|
308
|
-
h('ul', {
|
|
309
|
-
class: 'vxe-table-custom--panel-list'
|
|
310
|
-
}, [
|
|
311
|
-
h('li', {
|
|
312
|
-
class: 'vxe-table-custom--option'
|
|
313
|
-
}, [
|
|
314
|
-
allowVisible
|
|
315
|
-
? h('div', {
|
|
316
|
-
class: ['vxe-table-custom--checkbox-option', {
|
|
317
|
-
'is--checked': isAllChecked,
|
|
318
|
-
'is--indeterminate': isAllIndeterminate
|
|
319
|
-
}],
|
|
320
|
-
attrs: {
|
|
321
|
-
title: getI18n('vxe.table.allTitle')
|
|
322
|
-
},
|
|
323
|
-
on: {
|
|
324
|
-
click: _vm.allOptionEvent
|
|
325
|
-
}
|
|
326
|
-
}, [
|
|
327
|
-
h('span', {
|
|
328
|
-
class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
329
|
-
}),
|
|
330
|
-
h('span', {
|
|
331
|
-
class: 'vxe-checkbox--label'
|
|
332
|
-
}, getI18n('vxe.toolbar.customAll'))
|
|
333
|
-
])
|
|
334
|
-
: h('span', {
|
|
335
|
-
class: 'vxe-checkbox--label'
|
|
336
|
-
}, getI18n('vxe.table.customTitle'))
|
|
337
|
-
])
|
|
338
|
-
])
|
|
339
|
-
]),
|
|
340
|
-
h('div', {
|
|
341
|
-
class: 'vxe-table-custom--body'
|
|
342
|
-
}, [
|
|
343
|
-
topSlot
|
|
344
|
-
? h('div', {
|
|
345
|
-
class: 'vxe-table-custom--panel-top'
|
|
346
|
-
}, $xeTable.callSlot(topSlot, params, h))
|
|
347
|
-
: renderEmptyElement($xeTable),
|
|
348
|
-
defaultSlot
|
|
349
|
-
? h('div', {
|
|
350
|
-
class: 'vxe-table-custom--panel-body'
|
|
351
|
-
}, $xeTable.callSlot(defaultSlot, params, h))
|
|
352
|
-
: h('transition-group', {
|
|
353
|
-
class: 'vxe-table-custom--panel-list',
|
|
354
|
-
props: {
|
|
355
|
-
name: 'vxe-table-custom--list',
|
|
356
|
-
tag: 'ul'
|
|
357
|
-
},
|
|
358
|
-
on: customWrapperOns
|
|
359
|
-
}, colVNs),
|
|
360
|
-
bottomSlot
|
|
361
|
-
? h('div', {
|
|
362
|
-
class: 'vxe-table-custom--panel-bottom'
|
|
363
|
-
}, $xeTable.callSlot(bottomSlot, params, h))
|
|
364
|
-
: renderEmptyElement($xeTable)
|
|
365
|
-
]),
|
|
366
|
-
customOpts.showFooter
|
|
367
|
-
? h('div', {
|
|
368
|
-
class: 'vxe-table-custom--footer'
|
|
369
|
-
}, footerSlot
|
|
370
|
-
? $xeTable.callSlot(footerSlot, params, h)
|
|
371
|
-
: [
|
|
372
|
-
h('div', {
|
|
373
|
-
class: 'vxe-table-custom--footer-buttons'
|
|
374
|
-
}, [
|
|
375
|
-
h(VxeUIButtonComponent, {
|
|
376
|
-
props: {
|
|
377
|
-
mode: 'text',
|
|
378
|
-
content: customOpts.resetButtonText || getI18n('vxe.table.customRestore'),
|
|
379
|
-
disabled: !isCustomStatus
|
|
380
|
-
},
|
|
381
|
-
on: {
|
|
382
|
-
click: _vm.resetCustomEvent
|
|
383
|
-
}
|
|
384
|
-
}),
|
|
385
|
-
immediate
|
|
386
|
-
? h(VxeUIButtonComponent, {
|
|
387
|
-
props: {
|
|
388
|
-
mode: 'text',
|
|
389
|
-
content: customOpts.closeButtonText || getI18n('vxe.table.customClose')
|
|
390
|
-
},
|
|
391
|
-
on: {
|
|
392
|
-
click: _vm.cancelCloseEvent
|
|
393
|
-
}
|
|
394
|
-
})
|
|
395
|
-
: h(VxeUIButtonComponent, {
|
|
396
|
-
props: {
|
|
397
|
-
mode: 'text',
|
|
398
|
-
content: customOpts.resetButtonText || getI18n('vxe.table.customCancel')
|
|
399
|
-
},
|
|
400
|
-
on: {
|
|
401
|
-
click: _vm.cancelCustomEvent
|
|
402
|
-
}
|
|
403
|
-
}),
|
|
404
|
-
immediate
|
|
405
|
-
? renderEmptyElement($xeTable)
|
|
406
|
-
: h(VxeUIButtonComponent, {
|
|
407
|
-
props: {
|
|
408
|
-
mode: 'text',
|
|
409
|
-
status: 'primary',
|
|
410
|
-
content: customOpts.confirmButtonText || getI18n('vxe.table.customConfirm')
|
|
411
|
-
},
|
|
412
|
-
on: {
|
|
413
|
-
click: _vm.confirmCustomEvent
|
|
414
|
-
}
|
|
415
|
-
})
|
|
416
|
-
])
|
|
417
|
-
])
|
|
418
|
-
: null
|
|
419
|
-
]),
|
|
420
|
-
renderDragTip(h, _vm)
|
|
421
|
-
])
|
|
422
|
-
]
|
|
423
|
-
: []);
|
|
424
|
-
};
|
|
425
|
-
const renderPopupPanel = (h, $xeTableCustomPanel) => {
|
|
426
|
-
const VxeUIModalComponent = VxeUI.getComponent('VxeModal');
|
|
427
|
-
const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer');
|
|
428
|
-
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
429
|
-
const VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput');
|
|
430
|
-
const _vm = $xeTableCustomPanel;
|
|
431
|
-
const props = $xeTableCustomPanel;
|
|
432
|
-
const $xeTable = $xeTableCustomPanel.$xeTable;
|
|
433
|
-
const tableProps = $xeTable;
|
|
434
|
-
const tableReactData = $xeTable;
|
|
435
|
-
const $xeGrid = $xeTable.$xeGrid;
|
|
436
|
-
const $xeGantt = $xeTable.$xeGantt;
|
|
437
|
-
const { customStore } = props;
|
|
438
|
-
const { treeConfig, rowGroupConfig, aggregateConfig, resizable: allResizable } = tableProps;
|
|
439
|
-
const { isCustomStatus, customColumnList } = tableReactData;
|
|
440
|
-
const customOpts = $xeTable.computeCustomOpts;
|
|
441
|
-
const { immediate } = customOpts;
|
|
442
|
-
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
443
|
-
const { mode, modalOptions, drawerOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts;
|
|
444
|
-
const columnOpts = $xeTable.computeColumnOpts;
|
|
445
|
-
const { maxFixedSize } = columnOpts;
|
|
446
|
-
const resizableOpts = $xeTable.computeResizableOpts;
|
|
447
|
-
const { minWidth: reMinWidth, maxWidth: reMaxWidth } = resizableOpts;
|
|
448
|
-
const modalOpts = Object.assign({}, modalOptions);
|
|
449
|
-
const drawerOpts = Object.assign({}, drawerOptions);
|
|
450
|
-
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
451
|
-
const { isCrossDrag } = columnDragOpts;
|
|
452
|
-
const slots = customOpts.slots || {};
|
|
453
|
-
const headerSlot = slots.header;
|
|
454
|
-
const topSlot = slots.top;
|
|
455
|
-
const bottomSlot = slots.bottom;
|
|
456
|
-
const defaultSlot = slots.default;
|
|
457
|
-
const footerSlot = slots.footer;
|
|
458
|
-
const trVNs = [];
|
|
459
|
-
const isAllChecked = customStore.isAll;
|
|
460
|
-
const isAllIndeterminate = customStore.isIndeterminate;
|
|
461
|
-
const params = {
|
|
462
|
-
$table: $xeTable,
|
|
463
|
-
$grid: $xeGrid,
|
|
464
|
-
$gantt: $xeGantt,
|
|
465
|
-
columns: customColumnList,
|
|
466
|
-
isAllChecked,
|
|
467
|
-
isAllIndeterminate,
|
|
468
|
-
isCustomStatus
|
|
469
|
-
};
|
|
470
|
-
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
471
|
-
const isVisible = visibleMethod ? visibleMethod({ $table: $xeTable, column }) : true;
|
|
472
|
-
if (isVisible) {
|
|
473
|
-
// 默认继承调整宽度
|
|
474
|
-
let customMinWidth = 0;
|
|
475
|
-
let customMaxWidth = 0;
|
|
476
|
-
if (allowResizable) {
|
|
477
|
-
const resizeParams = {
|
|
478
|
-
$table: $xeTable,
|
|
479
|
-
column,
|
|
480
|
-
columnIndex: index,
|
|
481
|
-
$columnIndex: index,
|
|
482
|
-
$rowIndex: -1
|
|
483
|
-
};
|
|
484
|
-
if (reMinWidth) {
|
|
485
|
-
customMinWidth = XEUtils.toNumber(XEUtils.isFunction(reMinWidth) ? reMinWidth(resizeParams) : reMinWidth);
|
|
486
|
-
}
|
|
487
|
-
if (reMaxWidth) {
|
|
488
|
-
customMaxWidth = XEUtils.toNumber(XEUtils.isFunction(reMaxWidth) ? reMaxWidth(resizeParams) : reMaxWidth);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
const isChecked = column.renderVisible;
|
|
492
|
-
const isIndeterminate = column.halfVisible;
|
|
493
|
-
const colTitle = formatText(column.getTitle(), 1);
|
|
494
|
-
const isColGroup = column.children && column.children.length;
|
|
495
|
-
const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false;
|
|
496
|
-
const isHidden = !isChecked;
|
|
497
|
-
trVNs.push(h('tr', {
|
|
498
|
-
key: column.id,
|
|
499
|
-
attrs: {
|
|
500
|
-
colid: column.id
|
|
501
|
-
},
|
|
502
|
-
class: [`vxe-table-custom-popup--row level--${column.level}`, {
|
|
503
|
-
'is--group': isColGroup
|
|
504
|
-
}],
|
|
505
|
-
on: {
|
|
506
|
-
dragstart: _vm.sortDragstartEvent,
|
|
507
|
-
dragend: _vm.sortDragendEvent,
|
|
508
|
-
dragover: _vm.sortDragoverEvent
|
|
509
|
-
}
|
|
510
|
-
}, [
|
|
511
|
-
allowVisible
|
|
512
|
-
? h('td', {
|
|
513
|
-
class: 'vxe-table-custom-popup--column-item col--visible'
|
|
514
|
-
}, [
|
|
515
|
-
h('div', {
|
|
516
|
-
class: ['vxe-table-custom--checkbox-option', {
|
|
517
|
-
'is--checked': isChecked,
|
|
518
|
-
'is--indeterminate': isIndeterminate,
|
|
519
|
-
'is--disabled': isDisabled
|
|
520
|
-
}],
|
|
521
|
-
attrs: {
|
|
522
|
-
title: getI18n('vxe.custom.setting.colVisible')
|
|
523
|
-
},
|
|
524
|
-
on: {
|
|
525
|
-
click: (evnt) => {
|
|
526
|
-
if (!isDisabled) {
|
|
527
|
-
_vm.changeCheckboxOption(column, evnt);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
}, [
|
|
532
|
-
h('span', {
|
|
533
|
-
class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
534
|
-
})
|
|
535
|
-
])
|
|
536
|
-
])
|
|
537
|
-
: renderEmptyElement($xeTable),
|
|
538
|
-
h('td', {
|
|
539
|
-
class: 'vxe-table-custom-popup--column-item col--name'
|
|
540
|
-
}, [
|
|
541
|
-
h('div', {
|
|
542
|
-
class: 'vxe-table-custom-popup--name'
|
|
543
|
-
}, [
|
|
544
|
-
allowSort
|
|
545
|
-
? ((isCrossDrag ? immediate : false) || column.level === 1
|
|
546
|
-
? h('div', {
|
|
547
|
-
class: ['vxe-table-custom-popup--column-sort-btn', {
|
|
548
|
-
'is--disabled': isHidden
|
|
549
|
-
}],
|
|
550
|
-
attrs: {
|
|
551
|
-
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
552
|
-
},
|
|
553
|
-
on: (isHidden
|
|
554
|
-
? {}
|
|
555
|
-
: {
|
|
556
|
-
mousedown: _vm.sortMousedownEvent,
|
|
557
|
-
mouseup: _vm.sortMouseupEvent
|
|
558
|
-
})
|
|
559
|
-
}, [
|
|
560
|
-
h('i', {
|
|
561
|
-
class: getIcon().TABLE_CUSTOM_SORT
|
|
562
|
-
})
|
|
563
|
-
])
|
|
564
|
-
: h('div', {
|
|
565
|
-
class: 'vxe-table-custom-popup--column-sort-placeholder'
|
|
566
|
-
}))
|
|
567
|
-
: renderEmptyElement($xeTable),
|
|
568
|
-
column.type === 'html'
|
|
569
|
-
? h('div', {
|
|
570
|
-
key: '1',
|
|
571
|
-
class: 'vxe-table-custom-popup--title',
|
|
572
|
-
domProps: {
|
|
573
|
-
innerHTML: colTitle
|
|
574
|
-
}
|
|
575
|
-
})
|
|
576
|
-
: h('div', {
|
|
577
|
-
key: '0',
|
|
578
|
-
class: 'vxe-table-custom-popup--title',
|
|
579
|
-
attrs: {
|
|
580
|
-
title: colTitle
|
|
581
|
-
}
|
|
582
|
-
}, colTitle)
|
|
583
|
-
])
|
|
584
|
-
]),
|
|
585
|
-
allowResizable
|
|
586
|
-
? h('td', {
|
|
587
|
-
class: 'vxe-table-custom-popup--column-item col--resizable'
|
|
588
|
-
}, [
|
|
589
|
-
((column.children && column.children.length) ||
|
|
590
|
-
!(XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable)))
|
|
591
|
-
? h('span', '-')
|
|
592
|
-
: (VxeUINumberInputComponent
|
|
593
|
-
? h(VxeUINumberInputComponent, {
|
|
594
|
-
props: {
|
|
595
|
-
type: 'integer',
|
|
596
|
-
immediate: false,
|
|
597
|
-
disabled: isHidden,
|
|
598
|
-
value: column.renderResizeWidth,
|
|
599
|
-
min: customMinWidth || undefined,
|
|
600
|
-
max: customMaxWidth || undefined
|
|
601
|
-
},
|
|
602
|
-
on: {
|
|
603
|
-
modelValue(value) {
|
|
604
|
-
column.renderResizeWidth = Math.max(0, Number(value));
|
|
605
|
-
},
|
|
606
|
-
change() {
|
|
607
|
-
_vm.changeColumnWidth(column);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
})
|
|
611
|
-
: renderEmptyElement($xeTableCustomPanel))
|
|
612
|
-
])
|
|
613
|
-
: renderEmptyElement($xeTable),
|
|
614
|
-
allowFixed
|
|
615
|
-
? h('td', {
|
|
616
|
-
class: 'vxe-table-custom-popup--column-item col--fixed'
|
|
617
|
-
}, [
|
|
618
|
-
parent
|
|
619
|
-
? h('span', '-')
|
|
620
|
-
: h('vxe-radio-group', {
|
|
621
|
-
props: {
|
|
622
|
-
value: column.renderFixed || '',
|
|
623
|
-
type: 'button',
|
|
624
|
-
size: 'mini',
|
|
625
|
-
disabled: isHidden,
|
|
626
|
-
options: [
|
|
627
|
-
{ label: getI18n('vxe.custom.setting.fixedLeft'), value: 'left', disabled: isHidden || isMaxFixedColumn },
|
|
628
|
-
{ label: getI18n('vxe.custom.setting.fixedUnset'), value: '', disabled: isHidden },
|
|
629
|
-
{ label: getI18n('vxe.custom.setting.fixedRight'), value: 'right', disabled: isHidden || isMaxFixedColumn }
|
|
630
|
-
]
|
|
631
|
-
},
|
|
632
|
-
on: {
|
|
633
|
-
change({ label, $event }) {
|
|
634
|
-
_vm.changeFixedOption(column, label, $event);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
})
|
|
638
|
-
])
|
|
639
|
-
: renderEmptyElement($xeTable)
|
|
640
|
-
]));
|
|
641
|
-
}
|
|
642
|
-
});
|
|
643
|
-
const scopedSlots = {
|
|
644
|
-
default: () => {
|
|
645
|
-
return h('div', {
|
|
646
|
-
ref: 'refBodyWrapperElem',
|
|
647
|
-
class: 'vxe-table-custom-popup--body-wrapper'
|
|
648
|
-
}, defaultSlot
|
|
649
|
-
? $xeTable.callSlot(defaultSlot, params, h)
|
|
650
|
-
: [
|
|
651
|
-
h('div', {
|
|
652
|
-
ref: 'refCustomBodyElem',
|
|
653
|
-
class: 'vxe-table-custom-popup--handle-wrapper'
|
|
654
|
-
}, [
|
|
655
|
-
topSlot
|
|
656
|
-
? h('div', {
|
|
657
|
-
class: 'vxe-table-custom-popup--table-top'
|
|
658
|
-
}, $xeTable.callSlot(topSlot, params, h))
|
|
659
|
-
: renderEmptyElement($xeTable),
|
|
660
|
-
h('div', {
|
|
661
|
-
class: 'vxe-table-custom-popup--table-wrapper'
|
|
662
|
-
}, [
|
|
663
|
-
h('table', {}, [
|
|
664
|
-
h('colgroup', {}, [
|
|
665
|
-
allowVisible
|
|
666
|
-
? h('col', {
|
|
667
|
-
class: 'vxe-table-custom-popup--table-col-seq'
|
|
668
|
-
})
|
|
669
|
-
: renderEmptyElement($xeTable),
|
|
670
|
-
h('col', {
|
|
671
|
-
class: 'vxe-table-custom-popup--table-col-title'
|
|
672
|
-
}),
|
|
673
|
-
allowResizable
|
|
674
|
-
? h('col', {
|
|
675
|
-
class: 'vxe-table-custom-popup--table-col-width'
|
|
676
|
-
})
|
|
677
|
-
: renderEmptyElement($xeTable),
|
|
678
|
-
allowFixed
|
|
679
|
-
? h('col', {
|
|
680
|
-
class: 'vxe-table-custom-popup--table-col-fixed'
|
|
681
|
-
})
|
|
682
|
-
: renderEmptyElement($xeTable)
|
|
683
|
-
]),
|
|
684
|
-
h('thead', {}, [
|
|
685
|
-
h('tr', {}, [
|
|
686
|
-
allowVisible
|
|
687
|
-
? h('th', {}, [
|
|
688
|
-
h('div', {
|
|
689
|
-
class: ['vxe-table-custom--checkbox-option', {
|
|
690
|
-
'is--checked': isAllChecked,
|
|
691
|
-
'is--indeterminate': isAllIndeterminate
|
|
692
|
-
}],
|
|
693
|
-
attrs: {
|
|
694
|
-
title: getI18n('vxe.table.allTitle')
|
|
695
|
-
},
|
|
696
|
-
on: {
|
|
697
|
-
click: _vm.allOptionEvent
|
|
698
|
-
}
|
|
699
|
-
}, [
|
|
700
|
-
h('span', {
|
|
701
|
-
class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
702
|
-
}),
|
|
703
|
-
h('span', {
|
|
704
|
-
class: 'vxe-checkbox--label'
|
|
705
|
-
}, getI18n('vxe.toolbar.customAll'))
|
|
706
|
-
])
|
|
707
|
-
])
|
|
708
|
-
: renderEmptyElement($xeTable),
|
|
709
|
-
h('th', {}, getI18n('vxe.custom.setting.colTitle')),
|
|
710
|
-
allowResizable
|
|
711
|
-
? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
|
|
712
|
-
: renderEmptyElement($xeTable),
|
|
713
|
-
allowFixed
|
|
714
|
-
? h('th', {}, getI18n(`vxe.custom.setting.${maxFixedSize ? 'colFixedMax' : 'colFixed'}`, [maxFixedSize]))
|
|
715
|
-
: renderEmptyElement($xeTable)
|
|
716
|
-
])
|
|
717
|
-
]),
|
|
718
|
-
h('transition-group', {
|
|
719
|
-
class: 'vxe-table-custom--panel-list',
|
|
720
|
-
props: {
|
|
721
|
-
tag: 'tbody',
|
|
722
|
-
name: 'vxe-table-custom--list'
|
|
723
|
-
}
|
|
724
|
-
}, trVNs)
|
|
725
|
-
])
|
|
726
|
-
]),
|
|
727
|
-
bottomSlot
|
|
728
|
-
? h('div', {
|
|
729
|
-
class: 'vxe-table-custom-popup--table-bottom'
|
|
730
|
-
}, $xeTable.callSlot(bottomSlot, params, h))
|
|
731
|
-
: renderEmptyElement($xeTable),
|
|
732
|
-
renderDragTip(h, _vm)
|
|
733
|
-
]),
|
|
734
|
-
!treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregatePopupPanel
|
|
735
|
-
? h($xeTable.getPivotTableAggregatePopupPanel(), {
|
|
736
|
-
props: {
|
|
737
|
-
customStore
|
|
738
|
-
}
|
|
739
|
-
})
|
|
740
|
-
: renderEmptyElement($xeTable)
|
|
741
|
-
]);
|
|
742
|
-
},
|
|
743
|
-
footer: () => {
|
|
744
|
-
if (footerSlot) {
|
|
745
|
-
return $xeTable.callSlot(footerSlot, params, h);
|
|
746
|
-
}
|
|
747
|
-
return h('div', {
|
|
748
|
-
class: 'vxe-table-custom-popup--footer'
|
|
749
|
-
}, [
|
|
750
|
-
h(VxeUIButtonComponent, {
|
|
751
|
-
props: {
|
|
752
|
-
content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore'),
|
|
753
|
-
disabled: !isCustomStatus
|
|
754
|
-
},
|
|
755
|
-
on: {
|
|
756
|
-
click: _vm.resetCustomEvent
|
|
757
|
-
}
|
|
758
|
-
}),
|
|
759
|
-
immediate
|
|
760
|
-
? h(VxeUIButtonComponent, {
|
|
761
|
-
props: {
|
|
762
|
-
content: customOpts.resetButtonText || getI18n('vxe.table.customClose')
|
|
763
|
-
},
|
|
764
|
-
on: {
|
|
765
|
-
click: _vm.cancelCloseEvent
|
|
766
|
-
}
|
|
767
|
-
})
|
|
768
|
-
: h(VxeUIButtonComponent, {
|
|
769
|
-
props: {
|
|
770
|
-
content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel')
|
|
771
|
-
},
|
|
772
|
-
on: {
|
|
773
|
-
click: _vm.cancelCustomEvent
|
|
774
|
-
}
|
|
775
|
-
}),
|
|
776
|
-
immediate
|
|
777
|
-
? renderEmptyElement($xeTable)
|
|
778
|
-
: h(VxeUIButtonComponent, {
|
|
779
|
-
props: {
|
|
780
|
-
status: 'primary',
|
|
781
|
-
content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm')
|
|
782
|
-
},
|
|
783
|
-
on: {
|
|
784
|
-
click: _vm.confirmCustomEvent
|
|
785
|
-
}
|
|
786
|
-
})
|
|
787
|
-
]);
|
|
788
|
-
}
|
|
789
|
-
};
|
|
790
|
-
if (headerSlot) {
|
|
791
|
-
scopedSlots.header = () => $xeTable.callSlot(headerSlot, params, h);
|
|
792
|
-
}
|
|
793
|
-
if (mode === 'drawer') {
|
|
794
|
-
return VxeUIDrawerComponent
|
|
795
|
-
? h(VxeUIDrawerComponent, {
|
|
796
|
-
key: 'drawer',
|
|
797
|
-
props: {
|
|
798
|
-
className: ['vxe-table-custom-drawer-wrapper', 'vxe-table--ignore-clear', drawerOpts.className || ''].join(' '),
|
|
799
|
-
value: customStore.visible,
|
|
800
|
-
title: drawerOpts.title || getI18n('vxe.custom.cstmTitle'),
|
|
801
|
-
width: drawerOpts.width || Math.min(880, Math.floor(document.documentElement.clientWidth * 0.6)),
|
|
802
|
-
position: drawerOpts.position,
|
|
803
|
-
resize: !!drawerOpts.resize,
|
|
804
|
-
escClosable: !!drawerOpts.escClosable,
|
|
805
|
-
maskClosable: !!drawerOpts.maskClosable,
|
|
806
|
-
destroyOnClose: true,
|
|
807
|
-
showFooter: true
|
|
808
|
-
},
|
|
809
|
-
on: {
|
|
810
|
-
input(value) {
|
|
811
|
-
customStore.visible = value;
|
|
812
|
-
}
|
|
813
|
-
},
|
|
814
|
-
scopedSlots
|
|
815
|
-
})
|
|
816
|
-
: renderEmptyElement($xeTableCustomPanel);
|
|
817
|
-
}
|
|
818
|
-
return VxeUIModalComponent
|
|
819
|
-
? h(VxeUIModalComponent, {
|
|
820
|
-
key: 'modal',
|
|
821
|
-
props: {
|
|
822
|
-
className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
|
|
823
|
-
value: customStore.visible,
|
|
824
|
-
title: modalOpts.title || getI18n('vxe.custom.cstmTitle'),
|
|
825
|
-
width: modalOpts.width || Math.min(880, document.documentElement.clientWidth),
|
|
826
|
-
minWidth: modalOpts.minWidth || 700,
|
|
827
|
-
height: modalOpts.height || Math.min(680, document.documentElement.clientHeight),
|
|
828
|
-
minHeight: modalOpts.minHeight || 400,
|
|
829
|
-
showZoom: modalOpts.showZoom,
|
|
830
|
-
showMaximize: modalOpts.showMaximize,
|
|
831
|
-
showMinimize: modalOpts.showMinimize,
|
|
832
|
-
mask: modalOpts.mask,
|
|
833
|
-
lockView: modalOpts.lockView,
|
|
834
|
-
resize: modalOpts.resize,
|
|
835
|
-
escClosable: !!modalOpts.escClosable,
|
|
836
|
-
maskClosable: !!modalOpts.maskClosable,
|
|
837
|
-
destroyOnClose: true,
|
|
838
|
-
showFooter: true
|
|
839
|
-
},
|
|
840
|
-
on: {
|
|
841
|
-
input(value) {
|
|
842
|
-
customStore.visible = value;
|
|
843
|
-
}
|
|
844
|
-
},
|
|
845
|
-
scopedSlots
|
|
846
|
-
})
|
|
847
|
-
: renderEmptyElement($xeTableCustomPanel);
|
|
848
|
-
};
|
|
849
62
|
export default {
|
|
850
63
|
name: 'VxeTableCustomPanel',
|
|
851
64
|
props: {
|
|
@@ -884,7 +97,7 @@ export default {
|
|
|
884
97
|
internalData
|
|
885
98
|
};
|
|
886
99
|
},
|
|
887
|
-
computed: {},
|
|
100
|
+
computed: Object.assign({}, {}),
|
|
888
101
|
created() {
|
|
889
102
|
const $xeTableCustomPanel = this;
|
|
890
103
|
const VxeUIModalComponent = VxeUI.getComponent('VxeModal');
|
|
@@ -913,20 +126,12 @@ export default {
|
|
|
913
126
|
}
|
|
914
127
|
});
|
|
915
128
|
},
|
|
916
|
-
render(h) {
|
|
917
|
-
const $xeTableCustomPanel = this;
|
|
918
|
-
const $xeTable = $xeTableCustomPanel.$xeTable;
|
|
919
|
-
const customOpts = $xeTable.computeCustomOpts;
|
|
920
|
-
if (['modal', 'drawer', 'popup'].includes(`${customOpts.mode}`)) {
|
|
921
|
-
return renderPopupPanel(h, $xeTableCustomPanel);
|
|
922
|
-
}
|
|
923
|
-
return renderSimplePanel(h, $xeTableCustomPanel);
|
|
924
|
-
},
|
|
925
129
|
methods: {
|
|
926
130
|
handleWrapperMouseenterEvent(evnt) {
|
|
927
131
|
const $xeTableCustomPanel = this;
|
|
132
|
+
const props = $xeTableCustomPanel;
|
|
928
133
|
const $xeTable = $xeTableCustomPanel.$xeTable;
|
|
929
|
-
const { customStore } =
|
|
134
|
+
const { customStore } = props;
|
|
930
135
|
customStore.activeWrapper = true;
|
|
931
136
|
$xeTable.customOpenEvent(evnt);
|
|
932
137
|
},
|
|
@@ -1387,6 +592,808 @@ export default {
|
|
|
1387
592
|
customPanelInternalData.prevDragPos = dragPos;
|
|
1388
593
|
showDropTip($xeTableCustomPanel, evnt, optEl, true, dragPos);
|
|
1389
594
|
}
|
|
595
|
+
},
|
|
596
|
+
renderDragTip(h) {
|
|
597
|
+
const $xeTableCustomPanel = this;
|
|
598
|
+
const $xeTable = $xeTableCustomPanel.$xeTable;
|
|
599
|
+
const customPanelReactData = $xeTableCustomPanel.reactData;
|
|
600
|
+
const { dragTipText } = customPanelReactData;
|
|
601
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
602
|
+
return h('div', {}, [
|
|
603
|
+
h('div', {
|
|
604
|
+
ref: 'refDragLineElem',
|
|
605
|
+
class: ['vxe-table-custom-popup--drag-line', {
|
|
606
|
+
'is--guides': columnDragOpts.showGuidesStatus
|
|
607
|
+
}]
|
|
608
|
+
}),
|
|
609
|
+
h('div', {
|
|
610
|
+
ref: 'refDragTipElem',
|
|
611
|
+
class: 'vxe-table-custom-popup--drag-tip'
|
|
612
|
+
}, [
|
|
613
|
+
h('div', {
|
|
614
|
+
class: 'vxe-table-custom-popup--drag-tip-wrapper'
|
|
615
|
+
}, [
|
|
616
|
+
h('div', {
|
|
617
|
+
class: 'vxe-table-custom-popup--drag-tip-status'
|
|
618
|
+
}, [
|
|
619
|
+
h('span', {
|
|
620
|
+
class: ['vxe-table-custom-popup--drag-tip-normal-status', getIcon().TABLE_DRAG_STATUS_ROW]
|
|
621
|
+
}),
|
|
622
|
+
h('span', {
|
|
623
|
+
class: ['vxe-table-custom-popup--drag-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
|
|
624
|
+
}),
|
|
625
|
+
h('span', {
|
|
626
|
+
class: ['vxe-table-custom-popup--drag-tip-group-status', getIcon().TABLE_DRAG_STATUS_AGG_GROUP]
|
|
627
|
+
}),
|
|
628
|
+
h('span', {
|
|
629
|
+
class: ['vxe-table-custom-popup--drag-tip-values-status', getIcon().TABLE_DRAG_STATUS_AGG_VALUES]
|
|
630
|
+
}),
|
|
631
|
+
h('span', {
|
|
632
|
+
class: ['vxe-table-custom-popup--drag-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
|
|
633
|
+
})
|
|
634
|
+
]),
|
|
635
|
+
h('div', {
|
|
636
|
+
class: 'vxe-table-custom-popup--drag-tip-content'
|
|
637
|
+
}, `${dragTipText || ''}`)
|
|
638
|
+
])
|
|
639
|
+
])
|
|
640
|
+
]);
|
|
641
|
+
},
|
|
642
|
+
renderSimplePanel(h) {
|
|
643
|
+
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
644
|
+
const $xeTableCustomPanel = this;
|
|
645
|
+
const props = $xeTableCustomPanel;
|
|
646
|
+
const $xeTable = $xeTableCustomPanel.$xeTable;
|
|
647
|
+
const tableProps = $xeTable;
|
|
648
|
+
const tableReactData = $xeTable;
|
|
649
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
650
|
+
const $xeGantt = $xeTable.$xeGantt;
|
|
651
|
+
const { customStore } = props;
|
|
652
|
+
const { treeConfig, rowGroupConfig, aggregateConfig } = tableProps;
|
|
653
|
+
const { isCustomStatus, customColumnList } = tableReactData;
|
|
654
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
655
|
+
const { immediate } = customOpts;
|
|
656
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
657
|
+
const { maxHeight } = customStore;
|
|
658
|
+
const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts;
|
|
659
|
+
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
660
|
+
const { isCrossDrag } = columnDragOpts;
|
|
661
|
+
const slots = customOpts.slots || {};
|
|
662
|
+
const headerSlot = slots.header;
|
|
663
|
+
const topSlot = slots.top;
|
|
664
|
+
const bottomSlot = slots.bottom;
|
|
665
|
+
const defaultSlot = slots.default;
|
|
666
|
+
const footerSlot = slots.footer;
|
|
667
|
+
const colVNs = [];
|
|
668
|
+
const customWrapperOns = {};
|
|
669
|
+
const isAllChecked = customStore.isAll;
|
|
670
|
+
const isAllIndeterminate = customStore.isIndeterminate;
|
|
671
|
+
// hover 触发
|
|
672
|
+
if (trigger === 'hover') {
|
|
673
|
+
customWrapperOns.mouseenter = $xeTableCustomPanel.handleWrapperMouseenterEvent;
|
|
674
|
+
customWrapperOns.mouseleave = $xeTableCustomPanel.handleWrapperMouseleaveEvent;
|
|
675
|
+
}
|
|
676
|
+
const params = {
|
|
677
|
+
$table: $xeTable,
|
|
678
|
+
$grid: $xeGrid,
|
|
679
|
+
$gantt: $xeGantt,
|
|
680
|
+
columns: customColumnList,
|
|
681
|
+
isAllChecked,
|
|
682
|
+
isAllIndeterminate,
|
|
683
|
+
isCustomStatus
|
|
684
|
+
};
|
|
685
|
+
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
686
|
+
const isVisible = visibleMethod ? visibleMethod({ $table: $xeTable, column }) : true;
|
|
687
|
+
if (isVisible) {
|
|
688
|
+
const isChecked = column.renderVisible;
|
|
689
|
+
const isIndeterminate = column.halfVisible;
|
|
690
|
+
const isColGroup = column.children && column.children.length;
|
|
691
|
+
const colTitle = formatText(column.getTitle(), 1);
|
|
692
|
+
const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false;
|
|
693
|
+
const isHidden = !isChecked;
|
|
694
|
+
colVNs.push(h('li', {
|
|
695
|
+
key: column.id,
|
|
696
|
+
attrs: {
|
|
697
|
+
colid: column.id
|
|
698
|
+
},
|
|
699
|
+
class: ['vxe-table-custom--option', `level--${column.level}`, {
|
|
700
|
+
'is--hidden': isDisabled || isHidden,
|
|
701
|
+
'is--group': isColGroup
|
|
702
|
+
}],
|
|
703
|
+
on: {
|
|
704
|
+
dragstart: $xeTableCustomPanel.sortDragstartEvent,
|
|
705
|
+
dragend: $xeTableCustomPanel.sortDragendEvent,
|
|
706
|
+
dragover: $xeTableCustomPanel.sortDragoverEvent
|
|
707
|
+
}
|
|
708
|
+
}, [
|
|
709
|
+
allowVisible
|
|
710
|
+
? h('div', {
|
|
711
|
+
class: ['vxe-table-custom--checkbox-option', {
|
|
712
|
+
'is--checked': isChecked,
|
|
713
|
+
'is--indeterminate': isIndeterminate,
|
|
714
|
+
'is--disabled': isDisabled
|
|
715
|
+
}],
|
|
716
|
+
attrs: {
|
|
717
|
+
title: getI18n('vxe.custom.setting.colVisible')
|
|
718
|
+
},
|
|
719
|
+
on: {
|
|
720
|
+
click: (evnt) => {
|
|
721
|
+
if (!isDisabled) {
|
|
722
|
+
$xeTableCustomPanel.changeCheckboxOption(column, evnt);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}, [
|
|
727
|
+
h('span', {
|
|
728
|
+
class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
729
|
+
})
|
|
730
|
+
])
|
|
731
|
+
: renderEmptyElement($xeTable),
|
|
732
|
+
h('div', {
|
|
733
|
+
class: 'vxe-table-custom--name-option'
|
|
734
|
+
}, [
|
|
735
|
+
allowSort && ((isCrossDrag ? immediate : false) || column.level === 1)
|
|
736
|
+
? h('div', {
|
|
737
|
+
class: 'vxe-table-custom--sort-option'
|
|
738
|
+
}, [
|
|
739
|
+
h('span', {
|
|
740
|
+
class: ['vxe-table-custom--sort-btn', {
|
|
741
|
+
'is--disabled': isHidden
|
|
742
|
+
}],
|
|
743
|
+
attrs: {
|
|
744
|
+
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
745
|
+
},
|
|
746
|
+
on: isHidden
|
|
747
|
+
? {}
|
|
748
|
+
: {
|
|
749
|
+
mousedown: $xeTableCustomPanel.sortMousedownEvent,
|
|
750
|
+
mouseup: $xeTableCustomPanel.sortMouseupEvent
|
|
751
|
+
}
|
|
752
|
+
}, [
|
|
753
|
+
h('i', {
|
|
754
|
+
class: getIcon().TABLE_CUSTOM_SORT
|
|
755
|
+
})
|
|
756
|
+
])
|
|
757
|
+
])
|
|
758
|
+
: renderEmptyElement($xeTable),
|
|
759
|
+
column.type === 'html'
|
|
760
|
+
? h('div', {
|
|
761
|
+
key: '1',
|
|
762
|
+
class: 'vxe-table-custom--checkbox-label',
|
|
763
|
+
domProps: {
|
|
764
|
+
innerHTML: colTitle
|
|
765
|
+
}
|
|
766
|
+
})
|
|
767
|
+
: h('div', {
|
|
768
|
+
key: '0',
|
|
769
|
+
class: 'vxe-table-custom--checkbox-label',
|
|
770
|
+
attrs: {
|
|
771
|
+
title: colTitle
|
|
772
|
+
}
|
|
773
|
+
}, colTitle)
|
|
774
|
+
]),
|
|
775
|
+
!parent && allowFixed
|
|
776
|
+
? h('div', {
|
|
777
|
+
class: 'vxe-table-custom--fixed-option'
|
|
778
|
+
}, [
|
|
779
|
+
h(VxeUIButtonComponent, {
|
|
780
|
+
props: {
|
|
781
|
+
mode: 'text',
|
|
782
|
+
icon: column.renderFixed === 'left' ? getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_LEFT,
|
|
783
|
+
status: column.renderFixed === 'left' ? 'primary' : '',
|
|
784
|
+
disabled: isHidden || (isMaxFixedColumn && !column.renderFixed),
|
|
785
|
+
title: getI18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft')
|
|
786
|
+
},
|
|
787
|
+
on: {
|
|
788
|
+
click: ({ $event }) => {
|
|
789
|
+
$xeTableCustomPanel.changeFixedOption(column, 'left', $event);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}),
|
|
793
|
+
h(VxeUIButtonComponent, {
|
|
794
|
+
props: {
|
|
795
|
+
mode: 'text',
|
|
796
|
+
icon: column.renderFixed === 'right' ? getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,
|
|
797
|
+
status: column.renderFixed === 'right' ? 'primary' : '',
|
|
798
|
+
disabled: isHidden || (isMaxFixedColumn && !column.renderFixed),
|
|
799
|
+
title: getI18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight')
|
|
800
|
+
},
|
|
801
|
+
on: {
|
|
802
|
+
click: ({ $event }) => {
|
|
803
|
+
$xeTableCustomPanel.changeFixedOption(column, 'right', $event);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
})
|
|
807
|
+
])
|
|
808
|
+
: renderEmptyElement($xeTable)
|
|
809
|
+
]));
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
return h('div', {
|
|
813
|
+
ref: 'refElem',
|
|
814
|
+
key: 'simple',
|
|
815
|
+
class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
|
|
816
|
+
'is--active': customStore.visible
|
|
817
|
+
}],
|
|
818
|
+
style: maxHeight && !['left', 'right'].includes(placement || '')
|
|
819
|
+
? {
|
|
820
|
+
maxHeight: `${maxHeight}px`
|
|
821
|
+
}
|
|
822
|
+
: {}
|
|
823
|
+
}, customStore.visible
|
|
824
|
+
? [
|
|
825
|
+
h('div', {
|
|
826
|
+
ref: 'refBodyWrapperElem',
|
|
827
|
+
class: 'vxe-table-custom-simple--body-wrapper'
|
|
828
|
+
}, [
|
|
829
|
+
!treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregateSimplePanel
|
|
830
|
+
? h($xeTable.getPivotTableAggregateSimplePanel(), {
|
|
831
|
+
props: {
|
|
832
|
+
customStore
|
|
833
|
+
}
|
|
834
|
+
})
|
|
835
|
+
: renderEmptyElement($xeTable),
|
|
836
|
+
h('div', {
|
|
837
|
+
ref: 'refCustomBodyElem',
|
|
838
|
+
class: 'vxe-table-custom--handle-wrapper'
|
|
839
|
+
}, [
|
|
840
|
+
h('div', {
|
|
841
|
+
class: 'vxe-table-custom--header'
|
|
842
|
+
}, headerSlot
|
|
843
|
+
? $xeTable.callSlot(headerSlot, params, h)
|
|
844
|
+
: [
|
|
845
|
+
h('ul', {
|
|
846
|
+
class: 'vxe-table-custom--panel-list'
|
|
847
|
+
}, [
|
|
848
|
+
h('li', {
|
|
849
|
+
class: 'vxe-table-custom--option'
|
|
850
|
+
}, [
|
|
851
|
+
allowVisible
|
|
852
|
+
? h('div', {
|
|
853
|
+
class: ['vxe-table-custom--checkbox-option', {
|
|
854
|
+
'is--checked': isAllChecked,
|
|
855
|
+
'is--indeterminate': isAllIndeterminate
|
|
856
|
+
}],
|
|
857
|
+
attrs: {
|
|
858
|
+
title: getI18n('vxe.table.allTitle')
|
|
859
|
+
},
|
|
860
|
+
on: {
|
|
861
|
+
click: $xeTableCustomPanel.allOptionEvent
|
|
862
|
+
}
|
|
863
|
+
}, [
|
|
864
|
+
h('span', {
|
|
865
|
+
class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
866
|
+
}),
|
|
867
|
+
h('span', {
|
|
868
|
+
class: 'vxe-checkbox--label'
|
|
869
|
+
}, getI18n('vxe.toolbar.customAll'))
|
|
870
|
+
])
|
|
871
|
+
: h('span', {
|
|
872
|
+
class: 'vxe-checkbox--label'
|
|
873
|
+
}, getI18n('vxe.table.customTitle'))
|
|
874
|
+
])
|
|
875
|
+
])
|
|
876
|
+
]),
|
|
877
|
+
h('div', {
|
|
878
|
+
class: 'vxe-table-custom--body'
|
|
879
|
+
}, [
|
|
880
|
+
topSlot
|
|
881
|
+
? h('div', {
|
|
882
|
+
class: 'vxe-table-custom--panel-top'
|
|
883
|
+
}, $xeTable.callSlot(topSlot, params, h))
|
|
884
|
+
: renderEmptyElement($xeTable),
|
|
885
|
+
defaultSlot
|
|
886
|
+
? h('div', {
|
|
887
|
+
class: 'vxe-table-custom--panel-body'
|
|
888
|
+
}, $xeTable.callSlot(defaultSlot, params, h))
|
|
889
|
+
: h('transition-group', {
|
|
890
|
+
class: 'vxe-table-custom--panel-list',
|
|
891
|
+
props: {
|
|
892
|
+
name: 'vxe-table-custom--list',
|
|
893
|
+
tag: 'ul'
|
|
894
|
+
},
|
|
895
|
+
on: customWrapperOns
|
|
896
|
+
}, colVNs),
|
|
897
|
+
bottomSlot
|
|
898
|
+
? h('div', {
|
|
899
|
+
class: 'vxe-table-custom--panel-bottom'
|
|
900
|
+
}, $xeTable.callSlot(bottomSlot, params, h))
|
|
901
|
+
: renderEmptyElement($xeTable)
|
|
902
|
+
]),
|
|
903
|
+
customOpts.showFooter
|
|
904
|
+
? h('div', {
|
|
905
|
+
class: 'vxe-table-custom--footer'
|
|
906
|
+
}, footerSlot
|
|
907
|
+
? $xeTable.callSlot(footerSlot, params, h)
|
|
908
|
+
: [
|
|
909
|
+
h('div', {
|
|
910
|
+
class: 'vxe-table-custom--footer-buttons'
|
|
911
|
+
}, [
|
|
912
|
+
h(VxeUIButtonComponent, {
|
|
913
|
+
props: {
|
|
914
|
+
mode: 'text',
|
|
915
|
+
content: customOpts.resetButtonText || getI18n('vxe.table.customRestore'),
|
|
916
|
+
disabled: !isCustomStatus
|
|
917
|
+
},
|
|
918
|
+
on: {
|
|
919
|
+
click: $xeTableCustomPanel.resetCustomEvent
|
|
920
|
+
}
|
|
921
|
+
}),
|
|
922
|
+
immediate
|
|
923
|
+
? h(VxeUIButtonComponent, {
|
|
924
|
+
props: {
|
|
925
|
+
mode: 'text',
|
|
926
|
+
content: customOpts.closeButtonText || getI18n('vxe.table.customClose')
|
|
927
|
+
},
|
|
928
|
+
on: {
|
|
929
|
+
click: $xeTableCustomPanel.cancelCloseEvent
|
|
930
|
+
}
|
|
931
|
+
})
|
|
932
|
+
: h(VxeUIButtonComponent, {
|
|
933
|
+
props: {
|
|
934
|
+
mode: 'text',
|
|
935
|
+
content: customOpts.resetButtonText || getI18n('vxe.table.customCancel')
|
|
936
|
+
},
|
|
937
|
+
on: {
|
|
938
|
+
click: $xeTableCustomPanel.cancelCustomEvent
|
|
939
|
+
}
|
|
940
|
+
}),
|
|
941
|
+
immediate
|
|
942
|
+
? renderEmptyElement($xeTable)
|
|
943
|
+
: h(VxeUIButtonComponent, {
|
|
944
|
+
props: {
|
|
945
|
+
mode: 'text',
|
|
946
|
+
status: 'primary',
|
|
947
|
+
content: customOpts.confirmButtonText || getI18n('vxe.table.customConfirm')
|
|
948
|
+
},
|
|
949
|
+
on: {
|
|
950
|
+
click: $xeTableCustomPanel.confirmCustomEvent
|
|
951
|
+
}
|
|
952
|
+
})
|
|
953
|
+
])
|
|
954
|
+
])
|
|
955
|
+
: null
|
|
956
|
+
]),
|
|
957
|
+
$xeTableCustomPanel.renderDragTip(h)
|
|
958
|
+
])
|
|
959
|
+
]
|
|
960
|
+
: []);
|
|
961
|
+
},
|
|
962
|
+
renderPopupPanel(h) {
|
|
963
|
+
const VxeUIModalComponent = VxeUI.getComponent('VxeModal');
|
|
964
|
+
const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer');
|
|
965
|
+
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
966
|
+
const VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput');
|
|
967
|
+
const $xeTableCustomPanel = this;
|
|
968
|
+
const props = $xeTableCustomPanel;
|
|
969
|
+
const $xeTable = $xeTableCustomPanel.$xeTable;
|
|
970
|
+
const tableProps = $xeTable;
|
|
971
|
+
const tableReactData = $xeTable;
|
|
972
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
973
|
+
const $xeGantt = $xeTable.$xeGantt;
|
|
974
|
+
const { customStore } = props;
|
|
975
|
+
const { treeConfig, rowGroupConfig, aggregateConfig, resizable: allResizable } = tableProps;
|
|
976
|
+
const { isCustomStatus, customColumnList } = tableReactData;
|
|
977
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
978
|
+
const { immediate } = customOpts;
|
|
979
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
980
|
+
const { mode, modalOptions, drawerOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts;
|
|
981
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
982
|
+
const { maxFixedSize } = columnOpts;
|
|
983
|
+
const resizableOpts = $xeTable.computeResizableOpts;
|
|
984
|
+
const { minWidth: reMinWidth, maxWidth: reMaxWidth } = resizableOpts;
|
|
985
|
+
const modalOpts = Object.assign({}, modalOptions);
|
|
986
|
+
const drawerOpts = Object.assign({}, drawerOptions);
|
|
987
|
+
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
988
|
+
const { isCrossDrag } = columnDragOpts;
|
|
989
|
+
const slots = customOpts.slots || {};
|
|
990
|
+
const headerSlot = slots.header;
|
|
991
|
+
const topSlot = slots.top;
|
|
992
|
+
const bottomSlot = slots.bottom;
|
|
993
|
+
const defaultSlot = slots.default;
|
|
994
|
+
const footerSlot = slots.footer;
|
|
995
|
+
const trVNs = [];
|
|
996
|
+
const isAllChecked = customStore.isAll;
|
|
997
|
+
const isAllIndeterminate = customStore.isIndeterminate;
|
|
998
|
+
const params = {
|
|
999
|
+
$table: $xeTable,
|
|
1000
|
+
$grid: $xeGrid,
|
|
1001
|
+
$gantt: $xeGantt,
|
|
1002
|
+
columns: customColumnList,
|
|
1003
|
+
isAllChecked,
|
|
1004
|
+
isAllIndeterminate,
|
|
1005
|
+
isCustomStatus
|
|
1006
|
+
};
|
|
1007
|
+
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
1008
|
+
const isVisible = visibleMethod ? visibleMethod({ $table: $xeTable, column }) : true;
|
|
1009
|
+
if (isVisible) {
|
|
1010
|
+
// 默认继承调整宽度
|
|
1011
|
+
let customMinWidth = 0;
|
|
1012
|
+
let customMaxWidth = 0;
|
|
1013
|
+
if (allowResizable) {
|
|
1014
|
+
const resizeParams = {
|
|
1015
|
+
$table: $xeTable,
|
|
1016
|
+
column,
|
|
1017
|
+
columnIndex: index,
|
|
1018
|
+
$columnIndex: index,
|
|
1019
|
+
$rowIndex: -1
|
|
1020
|
+
};
|
|
1021
|
+
if (reMinWidth) {
|
|
1022
|
+
customMinWidth = XEUtils.toNumber(XEUtils.isFunction(reMinWidth) ? reMinWidth(resizeParams) : reMinWidth);
|
|
1023
|
+
}
|
|
1024
|
+
if (reMaxWidth) {
|
|
1025
|
+
customMaxWidth = XEUtils.toNumber(XEUtils.isFunction(reMaxWidth) ? reMaxWidth(resizeParams) : reMaxWidth);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
const isChecked = column.renderVisible;
|
|
1029
|
+
const isIndeterminate = column.halfVisible;
|
|
1030
|
+
const colTitle = formatText(column.getTitle(), 1);
|
|
1031
|
+
const isColGroup = column.children && column.children.length;
|
|
1032
|
+
const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false;
|
|
1033
|
+
const isHidden = !isChecked;
|
|
1034
|
+
trVNs.push(h('tr', {
|
|
1035
|
+
key: column.id,
|
|
1036
|
+
attrs: {
|
|
1037
|
+
colid: column.id
|
|
1038
|
+
},
|
|
1039
|
+
class: [`vxe-table-custom-popup--row level--${column.level}`, {
|
|
1040
|
+
'is--group': isColGroup
|
|
1041
|
+
}],
|
|
1042
|
+
on: {
|
|
1043
|
+
dragstart: $xeTableCustomPanel.sortDragstartEvent,
|
|
1044
|
+
dragend: $xeTableCustomPanel.sortDragendEvent,
|
|
1045
|
+
dragover: $xeTableCustomPanel.sortDragoverEvent
|
|
1046
|
+
}
|
|
1047
|
+
}, [
|
|
1048
|
+
allowVisible
|
|
1049
|
+
? h('td', {
|
|
1050
|
+
class: 'vxe-table-custom-popup--column-item col--visible'
|
|
1051
|
+
}, [
|
|
1052
|
+
h('div', {
|
|
1053
|
+
class: ['vxe-table-custom--checkbox-option', {
|
|
1054
|
+
'is--checked': isChecked,
|
|
1055
|
+
'is--indeterminate': isIndeterminate,
|
|
1056
|
+
'is--disabled': isDisabled
|
|
1057
|
+
}],
|
|
1058
|
+
attrs: {
|
|
1059
|
+
title: getI18n('vxe.custom.setting.colVisible')
|
|
1060
|
+
},
|
|
1061
|
+
on: {
|
|
1062
|
+
click: (evnt) => {
|
|
1063
|
+
if (!isDisabled) {
|
|
1064
|
+
$xeTableCustomPanel.changeCheckboxOption(column, evnt);
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}, [
|
|
1069
|
+
h('span', {
|
|
1070
|
+
class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
1071
|
+
})
|
|
1072
|
+
])
|
|
1073
|
+
])
|
|
1074
|
+
: renderEmptyElement($xeTable),
|
|
1075
|
+
h('td', {
|
|
1076
|
+
class: 'vxe-table-custom-popup--column-item col--name'
|
|
1077
|
+
}, [
|
|
1078
|
+
h('div', {
|
|
1079
|
+
class: 'vxe-table-custom-popup--name'
|
|
1080
|
+
}, [
|
|
1081
|
+
allowSort
|
|
1082
|
+
? ((isCrossDrag ? immediate : false) || column.level === 1
|
|
1083
|
+
? h('div', {
|
|
1084
|
+
class: ['vxe-table-custom-popup--column-sort-btn', {
|
|
1085
|
+
'is--disabled': isHidden
|
|
1086
|
+
}],
|
|
1087
|
+
attrs: {
|
|
1088
|
+
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
1089
|
+
},
|
|
1090
|
+
on: (isHidden
|
|
1091
|
+
? {}
|
|
1092
|
+
: {
|
|
1093
|
+
mousedown: $xeTableCustomPanel.sortMousedownEvent,
|
|
1094
|
+
mouseup: $xeTableCustomPanel.sortMouseupEvent
|
|
1095
|
+
})
|
|
1096
|
+
}, [
|
|
1097
|
+
h('i', {
|
|
1098
|
+
class: getIcon().TABLE_CUSTOM_SORT
|
|
1099
|
+
})
|
|
1100
|
+
])
|
|
1101
|
+
: h('div', {
|
|
1102
|
+
class: 'vxe-table-custom-popup--column-sort-placeholder'
|
|
1103
|
+
}))
|
|
1104
|
+
: renderEmptyElement($xeTable),
|
|
1105
|
+
column.type === 'html'
|
|
1106
|
+
? h('div', {
|
|
1107
|
+
key: '1',
|
|
1108
|
+
class: 'vxe-table-custom-popup--title',
|
|
1109
|
+
domProps: {
|
|
1110
|
+
innerHTML: colTitle
|
|
1111
|
+
}
|
|
1112
|
+
})
|
|
1113
|
+
: h('div', {
|
|
1114
|
+
key: '0',
|
|
1115
|
+
class: 'vxe-table-custom-popup--title',
|
|
1116
|
+
attrs: {
|
|
1117
|
+
title: colTitle
|
|
1118
|
+
}
|
|
1119
|
+
}, colTitle)
|
|
1120
|
+
])
|
|
1121
|
+
]),
|
|
1122
|
+
allowResizable
|
|
1123
|
+
? h('td', {
|
|
1124
|
+
class: 'vxe-table-custom-popup--column-item col--resizable'
|
|
1125
|
+
}, [
|
|
1126
|
+
((column.children && column.children.length) ||
|
|
1127
|
+
!(XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable)))
|
|
1128
|
+
? h('span', '-')
|
|
1129
|
+
: (VxeUINumberInputComponent
|
|
1130
|
+
? h(VxeUINumberInputComponent, {
|
|
1131
|
+
props: {
|
|
1132
|
+
type: 'integer',
|
|
1133
|
+
immediate: false,
|
|
1134
|
+
disabled: isHidden,
|
|
1135
|
+
value: column.renderResizeWidth,
|
|
1136
|
+
min: customMinWidth || undefined,
|
|
1137
|
+
max: customMaxWidth || undefined
|
|
1138
|
+
},
|
|
1139
|
+
on: {
|
|
1140
|
+
modelValue(value) {
|
|
1141
|
+
column.renderResizeWidth = Math.max(0, Number(value));
|
|
1142
|
+
},
|
|
1143
|
+
change() {
|
|
1144
|
+
$xeTableCustomPanel.changeColumnWidth(column);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
})
|
|
1148
|
+
: renderEmptyElement($xeTableCustomPanel))
|
|
1149
|
+
])
|
|
1150
|
+
: renderEmptyElement($xeTable),
|
|
1151
|
+
allowFixed
|
|
1152
|
+
? h('td', {
|
|
1153
|
+
class: 'vxe-table-custom-popup--column-item col--fixed'
|
|
1154
|
+
}, [
|
|
1155
|
+
parent
|
|
1156
|
+
? h('span', '-')
|
|
1157
|
+
: h('vxe-radio-group', {
|
|
1158
|
+
props: {
|
|
1159
|
+
value: column.renderFixed || '',
|
|
1160
|
+
type: 'button',
|
|
1161
|
+
size: 'mini',
|
|
1162
|
+
disabled: isHidden,
|
|
1163
|
+
options: [
|
|
1164
|
+
{ label: getI18n('vxe.custom.setting.fixedLeft'), value: 'left', disabled: isHidden || isMaxFixedColumn },
|
|
1165
|
+
{ label: getI18n('vxe.custom.setting.fixedUnset'), value: '', disabled: isHidden },
|
|
1166
|
+
{ label: getI18n('vxe.custom.setting.fixedRight'), value: 'right', disabled: isHidden || isMaxFixedColumn }
|
|
1167
|
+
]
|
|
1168
|
+
},
|
|
1169
|
+
on: {
|
|
1170
|
+
change({ label, $event }) {
|
|
1171
|
+
$xeTableCustomPanel.changeFixedOption(column, label, $event);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
})
|
|
1175
|
+
])
|
|
1176
|
+
: renderEmptyElement($xeTable)
|
|
1177
|
+
]));
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
const scopedSlots = {
|
|
1181
|
+
default: () => {
|
|
1182
|
+
return h('div', {
|
|
1183
|
+
ref: 'refBodyWrapperElem',
|
|
1184
|
+
class: 'vxe-table-custom-popup--body-wrapper'
|
|
1185
|
+
}, defaultSlot
|
|
1186
|
+
? $xeTable.callSlot(defaultSlot, params, h)
|
|
1187
|
+
: [
|
|
1188
|
+
h('div', {
|
|
1189
|
+
ref: 'refCustomBodyElem',
|
|
1190
|
+
class: 'vxe-table-custom-popup--handle-wrapper'
|
|
1191
|
+
}, [
|
|
1192
|
+
topSlot
|
|
1193
|
+
? h('div', {
|
|
1194
|
+
class: 'vxe-table-custom-popup--table-top'
|
|
1195
|
+
}, $xeTable.callSlot(topSlot, params, h))
|
|
1196
|
+
: renderEmptyElement($xeTable),
|
|
1197
|
+
h('div', {
|
|
1198
|
+
class: 'vxe-table-custom-popup--table-wrapper'
|
|
1199
|
+
}, [
|
|
1200
|
+
h('table', {}, [
|
|
1201
|
+
h('colgroup', {}, [
|
|
1202
|
+
allowVisible
|
|
1203
|
+
? h('col', {
|
|
1204
|
+
class: 'vxe-table-custom-popup--table-col-seq'
|
|
1205
|
+
})
|
|
1206
|
+
: renderEmptyElement($xeTable),
|
|
1207
|
+
h('col', {
|
|
1208
|
+
class: 'vxe-table-custom-popup--table-col-title'
|
|
1209
|
+
}),
|
|
1210
|
+
allowResizable
|
|
1211
|
+
? h('col', {
|
|
1212
|
+
class: 'vxe-table-custom-popup--table-col-width'
|
|
1213
|
+
})
|
|
1214
|
+
: renderEmptyElement($xeTable),
|
|
1215
|
+
allowFixed
|
|
1216
|
+
? h('col', {
|
|
1217
|
+
class: 'vxe-table-custom-popup--table-col-fixed'
|
|
1218
|
+
})
|
|
1219
|
+
: renderEmptyElement($xeTable)
|
|
1220
|
+
]),
|
|
1221
|
+
h('thead', {}, [
|
|
1222
|
+
h('tr', {}, [
|
|
1223
|
+
allowVisible
|
|
1224
|
+
? h('th', {}, [
|
|
1225
|
+
h('div', {
|
|
1226
|
+
class: ['vxe-table-custom--checkbox-option', {
|
|
1227
|
+
'is--checked': isAllChecked,
|
|
1228
|
+
'is--indeterminate': isAllIndeterminate
|
|
1229
|
+
}],
|
|
1230
|
+
attrs: {
|
|
1231
|
+
title: getI18n('vxe.table.allTitle')
|
|
1232
|
+
},
|
|
1233
|
+
on: {
|
|
1234
|
+
click: $xeTableCustomPanel.allOptionEvent
|
|
1235
|
+
}
|
|
1236
|
+
}, [
|
|
1237
|
+
h('span', {
|
|
1238
|
+
class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
1239
|
+
}),
|
|
1240
|
+
h('span', {
|
|
1241
|
+
class: 'vxe-checkbox--label'
|
|
1242
|
+
}, getI18n('vxe.toolbar.customAll'))
|
|
1243
|
+
])
|
|
1244
|
+
])
|
|
1245
|
+
: renderEmptyElement($xeTable),
|
|
1246
|
+
h('th', {}, getI18n('vxe.custom.setting.colTitle')),
|
|
1247
|
+
allowResizable
|
|
1248
|
+
? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
|
|
1249
|
+
: renderEmptyElement($xeTable),
|
|
1250
|
+
allowFixed
|
|
1251
|
+
? h('th', {}, getI18n(`vxe.custom.setting.${maxFixedSize ? 'colFixedMax' : 'colFixed'}`, [maxFixedSize]))
|
|
1252
|
+
: renderEmptyElement($xeTable)
|
|
1253
|
+
])
|
|
1254
|
+
]),
|
|
1255
|
+
h('transition-group', {
|
|
1256
|
+
class: 'vxe-table-custom--panel-list',
|
|
1257
|
+
props: {
|
|
1258
|
+
tag: 'tbody',
|
|
1259
|
+
name: 'vxe-table-custom--list'
|
|
1260
|
+
}
|
|
1261
|
+
}, trVNs)
|
|
1262
|
+
])
|
|
1263
|
+
]),
|
|
1264
|
+
bottomSlot
|
|
1265
|
+
? h('div', {
|
|
1266
|
+
class: 'vxe-table-custom-popup--table-bottom'
|
|
1267
|
+
}, $xeTable.callSlot(bottomSlot, params, h))
|
|
1268
|
+
: renderEmptyElement($xeTable),
|
|
1269
|
+
$xeTableCustomPanel.renderDragTip(h)
|
|
1270
|
+
]),
|
|
1271
|
+
!treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregatePopupPanel
|
|
1272
|
+
? h($xeTable.getPivotTableAggregatePopupPanel(), {
|
|
1273
|
+
props: {
|
|
1274
|
+
customStore
|
|
1275
|
+
}
|
|
1276
|
+
})
|
|
1277
|
+
: renderEmptyElement($xeTable)
|
|
1278
|
+
]);
|
|
1279
|
+
},
|
|
1280
|
+
footer: () => {
|
|
1281
|
+
if (footerSlot) {
|
|
1282
|
+
return $xeTable.callSlot(footerSlot, params, h);
|
|
1283
|
+
}
|
|
1284
|
+
return h('div', {
|
|
1285
|
+
class: 'vxe-table-custom-popup--footer'
|
|
1286
|
+
}, [
|
|
1287
|
+
h(VxeUIButtonComponent, {
|
|
1288
|
+
props: {
|
|
1289
|
+
content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore'),
|
|
1290
|
+
disabled: !isCustomStatus
|
|
1291
|
+
},
|
|
1292
|
+
on: {
|
|
1293
|
+
click: $xeTableCustomPanel.resetCustomEvent
|
|
1294
|
+
}
|
|
1295
|
+
}),
|
|
1296
|
+
immediate
|
|
1297
|
+
? h(VxeUIButtonComponent, {
|
|
1298
|
+
props: {
|
|
1299
|
+
content: customOpts.resetButtonText || getI18n('vxe.table.customClose')
|
|
1300
|
+
},
|
|
1301
|
+
on: {
|
|
1302
|
+
click: $xeTableCustomPanel.cancelCloseEvent
|
|
1303
|
+
}
|
|
1304
|
+
})
|
|
1305
|
+
: h(VxeUIButtonComponent, {
|
|
1306
|
+
props: {
|
|
1307
|
+
content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel')
|
|
1308
|
+
},
|
|
1309
|
+
on: {
|
|
1310
|
+
click: $xeTableCustomPanel.cancelCustomEvent
|
|
1311
|
+
}
|
|
1312
|
+
}),
|
|
1313
|
+
immediate
|
|
1314
|
+
? renderEmptyElement($xeTable)
|
|
1315
|
+
: h(VxeUIButtonComponent, {
|
|
1316
|
+
props: {
|
|
1317
|
+
status: 'primary',
|
|
1318
|
+
content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm')
|
|
1319
|
+
},
|
|
1320
|
+
on: {
|
|
1321
|
+
click: $xeTableCustomPanel.confirmCustomEvent
|
|
1322
|
+
}
|
|
1323
|
+
})
|
|
1324
|
+
]);
|
|
1325
|
+
}
|
|
1326
|
+
};
|
|
1327
|
+
if (headerSlot) {
|
|
1328
|
+
scopedSlots.header = () => $xeTable.callSlot(headerSlot, params, h);
|
|
1329
|
+
}
|
|
1330
|
+
if (mode === 'drawer') {
|
|
1331
|
+
return VxeUIDrawerComponent
|
|
1332
|
+
? h(VxeUIDrawerComponent, {
|
|
1333
|
+
key: 'drawer',
|
|
1334
|
+
props: {
|
|
1335
|
+
className: ['vxe-table-custom-drawer-wrapper', 'vxe-table--ignore-clear', drawerOpts.className || ''].join(' '),
|
|
1336
|
+
value: customStore.visible,
|
|
1337
|
+
title: drawerOpts.title || getI18n('vxe.custom.cstmTitle'),
|
|
1338
|
+
width: drawerOpts.width || Math.min(880, Math.floor(document.documentElement.clientWidth * 0.6)),
|
|
1339
|
+
position: drawerOpts.position,
|
|
1340
|
+
resize: !!drawerOpts.resize,
|
|
1341
|
+
escClosable: !!drawerOpts.escClosable,
|
|
1342
|
+
maskClosable: !!drawerOpts.maskClosable,
|
|
1343
|
+
destroyOnClose: true,
|
|
1344
|
+
showFooter: true
|
|
1345
|
+
},
|
|
1346
|
+
on: {
|
|
1347
|
+
input(value) {
|
|
1348
|
+
customStore.visible = value;
|
|
1349
|
+
}
|
|
1350
|
+
},
|
|
1351
|
+
scopedSlots
|
|
1352
|
+
})
|
|
1353
|
+
: renderEmptyElement($xeTableCustomPanel);
|
|
1354
|
+
}
|
|
1355
|
+
return VxeUIModalComponent
|
|
1356
|
+
? h(VxeUIModalComponent, {
|
|
1357
|
+
key: 'modal',
|
|
1358
|
+
props: {
|
|
1359
|
+
className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
|
|
1360
|
+
value: customStore.visible,
|
|
1361
|
+
title: modalOpts.title || getI18n('vxe.custom.cstmTitle'),
|
|
1362
|
+
width: modalOpts.width || Math.min(880, document.documentElement.clientWidth),
|
|
1363
|
+
minWidth: modalOpts.minWidth || 700,
|
|
1364
|
+
height: modalOpts.height || Math.min(680, document.documentElement.clientHeight),
|
|
1365
|
+
minHeight: modalOpts.minHeight || 400,
|
|
1366
|
+
showZoom: modalOpts.showZoom,
|
|
1367
|
+
showMaximize: modalOpts.showMaximize,
|
|
1368
|
+
showMinimize: modalOpts.showMinimize,
|
|
1369
|
+
mask: modalOpts.mask,
|
|
1370
|
+
lockView: modalOpts.lockView,
|
|
1371
|
+
resize: modalOpts.resize,
|
|
1372
|
+
escClosable: !!modalOpts.escClosable,
|
|
1373
|
+
maskClosable: !!modalOpts.maskClosable,
|
|
1374
|
+
destroyOnClose: true,
|
|
1375
|
+
showFooter: true
|
|
1376
|
+
},
|
|
1377
|
+
on: {
|
|
1378
|
+
input(value) {
|
|
1379
|
+
customStore.visible = value;
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1382
|
+
scopedSlots
|
|
1383
|
+
})
|
|
1384
|
+
: renderEmptyElement($xeTableCustomPanel);
|
|
1385
|
+
},
|
|
1386
|
+
renderVN(h) {
|
|
1387
|
+
const $xeTableCustomPanel = this;
|
|
1388
|
+
const $xeTable = $xeTableCustomPanel.$xeTable;
|
|
1389
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
1390
|
+
if (['modal', 'drawer', 'popup'].includes(`${customOpts.mode}`)) {
|
|
1391
|
+
return $xeTableCustomPanel.renderPopupPanel(h);
|
|
1392
|
+
}
|
|
1393
|
+
return $xeTableCustomPanel.renderSimplePanel(h);
|
|
1390
1394
|
}
|
|
1395
|
+
},
|
|
1396
|
+
render(h) {
|
|
1397
|
+
return this.renderVN(h);
|
|
1391
1398
|
}
|
|
1392
1399
|
};
|