vxe-gantt 3.4.2 → 3.4.3
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/LICENSE +21 -21
- package/README.md +53 -53
- package/es/gantt/src/gantt.js +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/gantt/src/gantt.js +1 -1
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +50 -50
- package/lib/index.umd.min.js +1 -1
- 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/package.json +88 -88
- package/packages/components.ts +22 -22
- package/packages/gantt/index.ts +32 -32
- package/packages/gantt/src/gantt-body.ts +323 -323
- package/packages/gantt/src/gantt-chart.ts +542 -542
- package/packages/gantt/src/gantt-footer.ts +73 -73
- package/packages/gantt/src/gantt-header.ts +162 -162
- package/packages/gantt/src/gantt-view.ts +1954 -1954
- package/packages/gantt/src/gantt.ts +2827 -2827
- package/packages/gantt/src/static.ts +35 -35
- package/packages/gantt/src/util.ts +47 -47
- package/packages/index.ts +8 -8
- package/packages/ui/index.ts +119 -119
- package/packages/ui/src/comp.ts +3 -3
- package/packages/ui/src/depend.ts +14 -14
- package/packages/ui/src/dom.ts +196 -196
- package/packages/ui/src/log.ts +8 -8
- package/packages/ui/src/utils.ts +67 -67
- package/packages/ui/src/vn.ts +13 -13
- package/styles/all.scss +3 -3
- package/styles/base.scss +2 -2
- package/styles/components/gantt-module/gantt-chart.scss +261 -261
- package/styles/components/gantt.scss +707 -707
- package/styles/helpers/baseMixin.scss +95 -95
- package/styles/helpers/baseVar.scss +3 -3
- package/styles/helpers/placement.scss +38 -38
- package/styles/theme/base.scss +14 -14
- package/styles/theme/dark.scss +8 -8
- package/styles/theme/light.scss +8 -8
- package/types/all.d.ts +16 -16
- package/types/index.d.ts +4 -4
|
@@ -1,323 +1,323 @@
|
|
|
1
|
-
import { VNode, CreateElement } from 'vue'
|
|
2
|
-
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
-
import { getCellRestHeight } from './util'
|
|
4
|
-
import { getClass } from '../../ui/src/utils'
|
|
5
|
-
import XEUtils from 'xe-utils'
|
|
6
|
-
import GanttViewChartComponent from './gantt-chart'
|
|
7
|
-
|
|
8
|
-
import type { TableInternalData, TableReactData, VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods, VxeTableDefines } from 'vxe-table'
|
|
9
|
-
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods, VxeGanttDefines } from '../../../types'
|
|
10
|
-
|
|
11
|
-
const sourceType = 'gantt'
|
|
12
|
-
const viewType = 'body'
|
|
13
|
-
|
|
14
|
-
export default defineVxeComponent({
|
|
15
|
-
name: 'VxeGanttViewBody',
|
|
16
|
-
inject: {
|
|
17
|
-
$xeGantt: {
|
|
18
|
-
default: null
|
|
19
|
-
},
|
|
20
|
-
$xeGanttView: {
|
|
21
|
-
default: null
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
computed: {
|
|
25
|
-
...({} as {
|
|
26
|
-
$xeGantt(): (VxeGanttConstructor & VxeGanttPrivateMethods)
|
|
27
|
-
$xeGanttView(): (VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
28
|
-
})
|
|
29
|
-
},
|
|
30
|
-
methods: {
|
|
31
|
-
//
|
|
32
|
-
// Render
|
|
33
|
-
//
|
|
34
|
-
renderColumn (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, row: any, rowid: string, rowIndex: number, $rowIndex: number, _rowIndex: number, column: VxeGanttDefines.ViewColumn, $columnIndex: number) {
|
|
35
|
-
const _vm = this
|
|
36
|
-
const $xeGanttView = _vm.$xeGanttView
|
|
37
|
-
const $xeGantt = _vm.$xeGantt
|
|
38
|
-
const { reactData, internalData } = $xeGanttView
|
|
39
|
-
|
|
40
|
-
const tableReactData = $xeTable as unknown as TableReactData
|
|
41
|
-
const { resizeHeightFlag } = tableReactData
|
|
42
|
-
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
43
|
-
const { fullAllDataRowIdData, visibleColumn } = tableInternalData
|
|
44
|
-
const cellOpts = $xeTable.computeCellOpts
|
|
45
|
-
const rowOpts = $xeTable.computeRowOpts
|
|
46
|
-
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
47
|
-
const resizableOpts = $xeTable.computeResizableOpts
|
|
48
|
-
const { isAllRowDrag } = resizableOpts
|
|
49
|
-
|
|
50
|
-
const { headerGroups } = reactData
|
|
51
|
-
const { todayDateMaps } = internalData
|
|
52
|
-
const taskViewOpts = $xeGantt.computeTaskViewOpts
|
|
53
|
-
const { showNowLine, viewStyle } = taskViewOpts
|
|
54
|
-
const scaleUnit = $xeGantt.computeScaleUnit
|
|
55
|
-
const { scaleItem } = headerGroups[headerGroups.length - 1] || {}
|
|
56
|
-
const { field, dateObj } = column
|
|
57
|
-
const { cellClassName, cellStyle } = viewStyle || {}
|
|
58
|
-
const todayValue = showNowLine && scaleItem ? todayDateMaps[scaleItem.type] : null
|
|
59
|
-
|
|
60
|
-
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
61
|
-
const cellHeight = resizeHeightFlag ? getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) : 0
|
|
62
|
-
|
|
63
|
-
const tdVNs: VNode[] = []
|
|
64
|
-
if (isAllRowDrag && rowOpts.resizable) {
|
|
65
|
-
const cellParams: VxeTableDefines.CellRenderBodyParams = {
|
|
66
|
-
$table: $xeTable,
|
|
67
|
-
$grid: null,
|
|
68
|
-
$gantt: $xeGantt,
|
|
69
|
-
seq: -1,
|
|
70
|
-
rowid,
|
|
71
|
-
row,
|
|
72
|
-
rowIndex,
|
|
73
|
-
$rowIndex,
|
|
74
|
-
_rowIndex,
|
|
75
|
-
column: visibleColumn[0],
|
|
76
|
-
columnIndex: 0,
|
|
77
|
-
$columnIndex: 0,
|
|
78
|
-
_columnIndex: 0,
|
|
79
|
-
fixed: '',
|
|
80
|
-
source: sourceType,
|
|
81
|
-
type: viewType,
|
|
82
|
-
isHidden: false,
|
|
83
|
-
isEdit: false,
|
|
84
|
-
level: -1,
|
|
85
|
-
|
|
86
|
-
// 已废弃属性
|
|
87
|
-
visibleData: [],
|
|
88
|
-
data: [],
|
|
89
|
-
items: []
|
|
90
|
-
}
|
|
91
|
-
tdVNs.push(
|
|
92
|
-
h('div', {
|
|
93
|
-
class: 'vxe-gantt-view-cell--row-resizable',
|
|
94
|
-
on: {
|
|
95
|
-
mousedown: (evnt: MouseEvent) => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
|
|
96
|
-
dblclick: (evnt: MouseEvent) => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
const ctParams = {
|
|
102
|
-
$gantt: $xeGantt,
|
|
103
|
-
source: sourceType,
|
|
104
|
-
type: viewType,
|
|
105
|
-
scaleType: scaleUnit,
|
|
106
|
-
dateObj,
|
|
107
|
-
row,
|
|
108
|
-
column,
|
|
109
|
-
$rowIndex,
|
|
110
|
-
rowIndex,
|
|
111
|
-
_rowIndex
|
|
112
|
-
}
|
|
113
|
-
return h('td', {
|
|
114
|
-
key: cellClassName || cellStyle ? field : $columnIndex,
|
|
115
|
-
class: [
|
|
116
|
-
'vxe-gantt-view--body-column',
|
|
117
|
-
{
|
|
118
|
-
'is--now': showNowLine && todayValue === field
|
|
119
|
-
},
|
|
120
|
-
getClass(cellClassName, ctParams)
|
|
121
|
-
],
|
|
122
|
-
style: cellStyle
|
|
123
|
-
? Object.assign({}, XEUtils.isFunction(cellStyle) ? cellStyle(ctParams) : cellStyle, {
|
|
124
|
-
height: `${cellHeight}px`
|
|
125
|
-
})
|
|
126
|
-
: {
|
|
127
|
-
height: `${cellHeight}px`
|
|
128
|
-
},
|
|
129
|
-
on: {
|
|
130
|
-
click (evnt: MouseEvent) {
|
|
131
|
-
$xeGantt.handleTaskCellClickEvent(evnt, { row, column })
|
|
132
|
-
},
|
|
133
|
-
dblclick (evnt: MouseEvent) {
|
|
134
|
-
$xeGantt.handleTaskCellDblclickEvent(evnt, { row, column })
|
|
135
|
-
},
|
|
136
|
-
contextmenu (evnt: Event) {
|
|
137
|
-
$xeGantt.handleTaskBodyContextmenuEvent(evnt, ctParams)
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}, tdVNs)
|
|
141
|
-
},
|
|
142
|
-
renderRows (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, tableData: any[]) {
|
|
143
|
-
const _vm = this
|
|
144
|
-
const $xeGanttView = _vm.$xeGanttView
|
|
145
|
-
const $xeGantt = _vm.$xeGantt
|
|
146
|
-
const { reactData } = $xeGanttView
|
|
147
|
-
|
|
148
|
-
const tableProps = $xeTable
|
|
149
|
-
const { treeConfig, stripe, highlightHoverRow, editConfig } = tableProps
|
|
150
|
-
const tableReactData = $xeTable as unknown as TableReactData
|
|
151
|
-
const { treeExpandedFlag, selectRadioRow, pendingRowFlag, isRowGroupStatus } = tableReactData
|
|
152
|
-
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
153
|
-
const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps } = tableInternalData
|
|
154
|
-
const radioOpts = $xeTable.computeRadioOpts
|
|
155
|
-
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
156
|
-
const rowOpts = $xeTable.computeRowOpts
|
|
157
|
-
const treeOpts = $xeTable.computeTreeOpts
|
|
158
|
-
const { transform } = treeOpts
|
|
159
|
-
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
160
|
-
|
|
161
|
-
const scaleUnit = $xeGantt.computeScaleUnit
|
|
162
|
-
const taskViewOpts = $xeGantt.computeTaskViewOpts
|
|
163
|
-
const { viewStyle } = taskViewOpts
|
|
164
|
-
const { rowClassName, rowStyle, cellClassName, cellStyle } = viewStyle || {}
|
|
165
|
-
|
|
166
|
-
const { tableColumn, scrollYLoad } = reactData
|
|
167
|
-
|
|
168
|
-
const trVNs:VNode[] = []
|
|
169
|
-
tableData.forEach((row, $rowIndex) => {
|
|
170
|
-
const rowid = $xeTable.getRowid(row)
|
|
171
|
-
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
172
|
-
const trOns: Record<string, any> = {}
|
|
173
|
-
let rowIndex = $rowIndex
|
|
174
|
-
let _rowIndex = -1
|
|
175
|
-
if (rowRest) {
|
|
176
|
-
rowIndex = rowRest.index
|
|
177
|
-
_rowIndex = rowRest._index
|
|
178
|
-
}
|
|
179
|
-
// 是否新增行
|
|
180
|
-
let isNewRow = false
|
|
181
|
-
if (editConfig) {
|
|
182
|
-
isNewRow = $xeTable.isInsertByRow(row)
|
|
183
|
-
}
|
|
184
|
-
// 当前行事件
|
|
185
|
-
if (rowOpts.isHover || highlightHoverRow) {
|
|
186
|
-
trOns.mouseenter = (evnt: MouseEvent) => {
|
|
187
|
-
$xeTable.triggerHoverEvent(evnt, { row, rowIndex })
|
|
188
|
-
}
|
|
189
|
-
trOns.mouseleave = () => {
|
|
190
|
-
$xeTable.clearHoverRow()
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
// 拖拽行事件
|
|
194
|
-
if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
|
|
195
|
-
trOns.dragstart = $xeTable.handleRowDragDragstartEvent
|
|
196
|
-
trOns.dragend = $xeTable.handleRowDragDragendEvent
|
|
197
|
-
trOns.dragover = $xeTable.handleRowDragDragoverEvent
|
|
198
|
-
}
|
|
199
|
-
const rowParams = {
|
|
200
|
-
$gantt: $xeGantt,
|
|
201
|
-
source: sourceType,
|
|
202
|
-
type: viewType,
|
|
203
|
-
scaleType: scaleUnit,
|
|
204
|
-
row,
|
|
205
|
-
rowIndex,
|
|
206
|
-
$rowIndex,
|
|
207
|
-
_rowIndex
|
|
208
|
-
}
|
|
209
|
-
trVNs.push(
|
|
210
|
-
h('tr', {
|
|
211
|
-
key: rowClassName || rowStyle || cellClassName || cellStyle ? rowid : $rowIndex,
|
|
212
|
-
class: [
|
|
213
|
-
'vxe-gantt-view--body-row',
|
|
214
|
-
{
|
|
215
|
-
'row--stripe': stripe && (_rowIndex + 1) % 2 === 0,
|
|
216
|
-
'is--new': isNewRow,
|
|
217
|
-
'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
|
|
218
|
-
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
219
|
-
'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
|
|
220
|
-
},
|
|
221
|
-
getClass(rowClassName, rowParams)
|
|
222
|
-
],
|
|
223
|
-
style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(rowParams) || undefined : rowStyle) : undefined,
|
|
224
|
-
attrs: {
|
|
225
|
-
rowid
|
|
226
|
-
},
|
|
227
|
-
on: trOns
|
|
228
|
-
}, tableColumn.map((column, $columnIndex) => _vm.renderColumn(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex)))
|
|
229
|
-
)
|
|
230
|
-
let isExpandTree = false
|
|
231
|
-
let rowChildren: any[] = []
|
|
232
|
-
|
|
233
|
-
if (treeConfig && !scrollYLoad && !transform) {
|
|
234
|
-
rowChildren = row[childrenField]
|
|
235
|
-
isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid]
|
|
236
|
-
}
|
|
237
|
-
// 如果是树形表格
|
|
238
|
-
if (isExpandTree) {
|
|
239
|
-
trVNs.push(..._vm.renderRows(h, $xeTable, rowChildren))
|
|
240
|
-
}
|
|
241
|
-
})
|
|
242
|
-
return trVNs
|
|
243
|
-
},
|
|
244
|
-
renderVN (h: CreateElement) {
|
|
245
|
-
const _vm = this
|
|
246
|
-
const $xeGantt = _vm.$xeGantt
|
|
247
|
-
const $xeGanttView = _vm.$xeGanttView
|
|
248
|
-
const { reactData } = $xeGanttView
|
|
249
|
-
|
|
250
|
-
const $xeTable = $xeGanttView.internalData.xeTable
|
|
251
|
-
|
|
252
|
-
const { tableData, tableColumn, viewCellWidth } = reactData
|
|
253
|
-
return h('div', {
|
|
254
|
-
ref: 'refElem',
|
|
255
|
-
class: 'vxe-gantt-view--body-wrapper'
|
|
256
|
-
}, [
|
|
257
|
-
h('div', {
|
|
258
|
-
ref: 'refBodyScroll',
|
|
259
|
-
class: 'vxe-gantt-view--body-inner-wrapper',
|
|
260
|
-
on: {
|
|
261
|
-
scroll: $xeGanttView.triggerBodyScrollEvent,
|
|
262
|
-
contextmenu (evnt: Event) {
|
|
263
|
-
$xeGantt.handleTaskBodyContextmenuEvent(evnt, { source: sourceType, type: viewType, rowIndex: -1, $rowIndex: -1, _rowIndex: -1 })
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}, [
|
|
267
|
-
h('div', {
|
|
268
|
-
ref: 'refBodyXSpace',
|
|
269
|
-
class: 'vxe-body--x-space'
|
|
270
|
-
}),
|
|
271
|
-
h('div', {
|
|
272
|
-
ref: 'refBodyYSpace',
|
|
273
|
-
class: 'vxe-body--y-space'
|
|
274
|
-
}),
|
|
275
|
-
h('table', {
|
|
276
|
-
ref: 'refBodyTable',
|
|
277
|
-
class: 'vxe-gantt-view--body-table'
|
|
278
|
-
}, [
|
|
279
|
-
h('colgroup', {}, tableColumn.map((column, cIndex) => {
|
|
280
|
-
return h('col', {
|
|
281
|
-
key: cIndex,
|
|
282
|
-
style: {
|
|
283
|
-
width: `${viewCellWidth}px`
|
|
284
|
-
}
|
|
285
|
-
})
|
|
286
|
-
})),
|
|
287
|
-
h('tbody', {}, $xeTable ? _vm.renderRows(h, $xeTable, tableData) : [])
|
|
288
|
-
]),
|
|
289
|
-
h(GanttViewChartComponent)
|
|
290
|
-
])
|
|
291
|
-
])
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
mounted () {
|
|
295
|
-
const _vm = this
|
|
296
|
-
const $xeGanttView = _vm.$xeGanttView
|
|
297
|
-
const { internalData } = $xeGanttView
|
|
298
|
-
|
|
299
|
-
const { elemStore } = internalData
|
|
300
|
-
const prefix = 'main-body-'
|
|
301
|
-
elemStore[`${prefix}wrapper`] = _vm.$refs.refElem as HTMLDivElement
|
|
302
|
-
elemStore[`${prefix}scroll`] = _vm.$refs.refBodyScroll as HTMLDivElement
|
|
303
|
-
elemStore[`${prefix}table`] = _vm.$refs.refBodyTable as HTMLDivElement
|
|
304
|
-
elemStore[`${prefix}xSpace`] = _vm.$refs.refBodyXSpace as HTMLDivElement
|
|
305
|
-
elemStore[`${prefix}ySpace`] = _vm.$refs.refBodyYSpace as HTMLDivElement
|
|
306
|
-
},
|
|
307
|
-
destroyed () {
|
|
308
|
-
const _vm = this
|
|
309
|
-
const $xeGanttView = _vm.$xeGanttView
|
|
310
|
-
const { internalData } = $xeGanttView
|
|
311
|
-
|
|
312
|
-
const { elemStore } = internalData
|
|
313
|
-
const prefix = 'main-body-'
|
|
314
|
-
elemStore[`${prefix}wrapper`] = null
|
|
315
|
-
elemStore[`${prefix}scroll`] = null
|
|
316
|
-
elemStore[`${prefix}table`] = null
|
|
317
|
-
elemStore[`${prefix}xSpace`] = null
|
|
318
|
-
elemStore[`${prefix}ySpace`] = null
|
|
319
|
-
},
|
|
320
|
-
render (this: any, h) {
|
|
321
|
-
return this.renderVN(h)
|
|
322
|
-
}
|
|
323
|
-
})
|
|
1
|
+
import { VNode, CreateElement } from 'vue'
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import { getCellRestHeight } from './util'
|
|
4
|
+
import { getClass } from '../../ui/src/utils'
|
|
5
|
+
import XEUtils from 'xe-utils'
|
|
6
|
+
import GanttViewChartComponent from './gantt-chart'
|
|
7
|
+
|
|
8
|
+
import type { TableInternalData, TableReactData, VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods, VxeTableDefines } from 'vxe-table'
|
|
9
|
+
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods, VxeGanttDefines } from '../../../types'
|
|
10
|
+
|
|
11
|
+
const sourceType = 'gantt'
|
|
12
|
+
const viewType = 'body'
|
|
13
|
+
|
|
14
|
+
export default defineVxeComponent({
|
|
15
|
+
name: 'VxeGanttViewBody',
|
|
16
|
+
inject: {
|
|
17
|
+
$xeGantt: {
|
|
18
|
+
default: null
|
|
19
|
+
},
|
|
20
|
+
$xeGanttView: {
|
|
21
|
+
default: null
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
...({} as {
|
|
26
|
+
$xeGantt(): (VxeGanttConstructor & VxeGanttPrivateMethods)
|
|
27
|
+
$xeGanttView(): (VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
//
|
|
32
|
+
// Render
|
|
33
|
+
//
|
|
34
|
+
renderColumn (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, row: any, rowid: string, rowIndex: number, $rowIndex: number, _rowIndex: number, column: VxeGanttDefines.ViewColumn, $columnIndex: number) {
|
|
35
|
+
const _vm = this
|
|
36
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
37
|
+
const $xeGantt = _vm.$xeGantt
|
|
38
|
+
const { reactData, internalData } = $xeGanttView
|
|
39
|
+
|
|
40
|
+
const tableReactData = $xeTable as unknown as TableReactData
|
|
41
|
+
const { resizeHeightFlag } = tableReactData
|
|
42
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
43
|
+
const { fullAllDataRowIdData, visibleColumn } = tableInternalData
|
|
44
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
45
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
46
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
47
|
+
const resizableOpts = $xeTable.computeResizableOpts
|
|
48
|
+
const { isAllRowDrag } = resizableOpts
|
|
49
|
+
|
|
50
|
+
const { headerGroups } = reactData
|
|
51
|
+
const { todayDateMaps } = internalData
|
|
52
|
+
const taskViewOpts = $xeGantt.computeTaskViewOpts
|
|
53
|
+
const { showNowLine, viewStyle } = taskViewOpts
|
|
54
|
+
const scaleUnit = $xeGantt.computeScaleUnit
|
|
55
|
+
const { scaleItem } = headerGroups[headerGroups.length - 1] || {}
|
|
56
|
+
const { field, dateObj } = column
|
|
57
|
+
const { cellClassName, cellStyle } = viewStyle || {}
|
|
58
|
+
const todayValue = showNowLine && scaleItem ? todayDateMaps[scaleItem.type] : null
|
|
59
|
+
|
|
60
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
61
|
+
const cellHeight = resizeHeightFlag ? getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) : 0
|
|
62
|
+
|
|
63
|
+
const tdVNs: VNode[] = []
|
|
64
|
+
if (isAllRowDrag && rowOpts.resizable) {
|
|
65
|
+
const cellParams: VxeTableDefines.CellRenderBodyParams = {
|
|
66
|
+
$table: $xeTable,
|
|
67
|
+
$grid: null,
|
|
68
|
+
$gantt: $xeGantt,
|
|
69
|
+
seq: -1,
|
|
70
|
+
rowid,
|
|
71
|
+
row,
|
|
72
|
+
rowIndex,
|
|
73
|
+
$rowIndex,
|
|
74
|
+
_rowIndex,
|
|
75
|
+
column: visibleColumn[0],
|
|
76
|
+
columnIndex: 0,
|
|
77
|
+
$columnIndex: 0,
|
|
78
|
+
_columnIndex: 0,
|
|
79
|
+
fixed: '',
|
|
80
|
+
source: sourceType,
|
|
81
|
+
type: viewType,
|
|
82
|
+
isHidden: false,
|
|
83
|
+
isEdit: false,
|
|
84
|
+
level: -1,
|
|
85
|
+
|
|
86
|
+
// 已废弃属性
|
|
87
|
+
visibleData: [],
|
|
88
|
+
data: [],
|
|
89
|
+
items: []
|
|
90
|
+
}
|
|
91
|
+
tdVNs.push(
|
|
92
|
+
h('div', {
|
|
93
|
+
class: 'vxe-gantt-view-cell--row-resizable',
|
|
94
|
+
on: {
|
|
95
|
+
mousedown: (evnt: MouseEvent) => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
|
|
96
|
+
dblclick: (evnt: MouseEvent) => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
const ctParams = {
|
|
102
|
+
$gantt: $xeGantt,
|
|
103
|
+
source: sourceType,
|
|
104
|
+
type: viewType,
|
|
105
|
+
scaleType: scaleUnit,
|
|
106
|
+
dateObj,
|
|
107
|
+
row,
|
|
108
|
+
column,
|
|
109
|
+
$rowIndex,
|
|
110
|
+
rowIndex,
|
|
111
|
+
_rowIndex
|
|
112
|
+
}
|
|
113
|
+
return h('td', {
|
|
114
|
+
key: cellClassName || cellStyle ? field : $columnIndex,
|
|
115
|
+
class: [
|
|
116
|
+
'vxe-gantt-view--body-column',
|
|
117
|
+
{
|
|
118
|
+
'is--now': showNowLine && todayValue === field
|
|
119
|
+
},
|
|
120
|
+
getClass(cellClassName, ctParams)
|
|
121
|
+
],
|
|
122
|
+
style: cellStyle
|
|
123
|
+
? Object.assign({}, XEUtils.isFunction(cellStyle) ? cellStyle(ctParams) : cellStyle, {
|
|
124
|
+
height: `${cellHeight}px`
|
|
125
|
+
})
|
|
126
|
+
: {
|
|
127
|
+
height: `${cellHeight}px`
|
|
128
|
+
},
|
|
129
|
+
on: {
|
|
130
|
+
click (evnt: MouseEvent) {
|
|
131
|
+
$xeGantt.handleTaskCellClickEvent(evnt, { row, column })
|
|
132
|
+
},
|
|
133
|
+
dblclick (evnt: MouseEvent) {
|
|
134
|
+
$xeGantt.handleTaskCellDblclickEvent(evnt, { row, column })
|
|
135
|
+
},
|
|
136
|
+
contextmenu (evnt: Event) {
|
|
137
|
+
$xeGantt.handleTaskBodyContextmenuEvent(evnt, ctParams)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, tdVNs)
|
|
141
|
+
},
|
|
142
|
+
renderRows (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, tableData: any[]) {
|
|
143
|
+
const _vm = this
|
|
144
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
145
|
+
const $xeGantt = _vm.$xeGantt
|
|
146
|
+
const { reactData } = $xeGanttView
|
|
147
|
+
|
|
148
|
+
const tableProps = $xeTable
|
|
149
|
+
const { treeConfig, stripe, highlightHoverRow, editConfig } = tableProps
|
|
150
|
+
const tableReactData = $xeTable as unknown as TableReactData
|
|
151
|
+
const { treeExpandedFlag, selectRadioRow, pendingRowFlag, isRowGroupStatus } = tableReactData
|
|
152
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
153
|
+
const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps } = tableInternalData
|
|
154
|
+
const radioOpts = $xeTable.computeRadioOpts
|
|
155
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
156
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
157
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
158
|
+
const { transform } = treeOpts
|
|
159
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
160
|
+
|
|
161
|
+
const scaleUnit = $xeGantt.computeScaleUnit
|
|
162
|
+
const taskViewOpts = $xeGantt.computeTaskViewOpts
|
|
163
|
+
const { viewStyle } = taskViewOpts
|
|
164
|
+
const { rowClassName, rowStyle, cellClassName, cellStyle } = viewStyle || {}
|
|
165
|
+
|
|
166
|
+
const { tableColumn, scrollYLoad } = reactData
|
|
167
|
+
|
|
168
|
+
const trVNs:VNode[] = []
|
|
169
|
+
tableData.forEach((row, $rowIndex) => {
|
|
170
|
+
const rowid = $xeTable.getRowid(row)
|
|
171
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
172
|
+
const trOns: Record<string, any> = {}
|
|
173
|
+
let rowIndex = $rowIndex
|
|
174
|
+
let _rowIndex = -1
|
|
175
|
+
if (rowRest) {
|
|
176
|
+
rowIndex = rowRest.index
|
|
177
|
+
_rowIndex = rowRest._index
|
|
178
|
+
}
|
|
179
|
+
// 是否新增行
|
|
180
|
+
let isNewRow = false
|
|
181
|
+
if (editConfig) {
|
|
182
|
+
isNewRow = $xeTable.isInsertByRow(row)
|
|
183
|
+
}
|
|
184
|
+
// 当前行事件
|
|
185
|
+
if (rowOpts.isHover || highlightHoverRow) {
|
|
186
|
+
trOns.mouseenter = (evnt: MouseEvent) => {
|
|
187
|
+
$xeTable.triggerHoverEvent(evnt, { row, rowIndex })
|
|
188
|
+
}
|
|
189
|
+
trOns.mouseleave = () => {
|
|
190
|
+
$xeTable.clearHoverRow()
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// 拖拽行事件
|
|
194
|
+
if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
|
|
195
|
+
trOns.dragstart = $xeTable.handleRowDragDragstartEvent
|
|
196
|
+
trOns.dragend = $xeTable.handleRowDragDragendEvent
|
|
197
|
+
trOns.dragover = $xeTable.handleRowDragDragoverEvent
|
|
198
|
+
}
|
|
199
|
+
const rowParams = {
|
|
200
|
+
$gantt: $xeGantt,
|
|
201
|
+
source: sourceType,
|
|
202
|
+
type: viewType,
|
|
203
|
+
scaleType: scaleUnit,
|
|
204
|
+
row,
|
|
205
|
+
rowIndex,
|
|
206
|
+
$rowIndex,
|
|
207
|
+
_rowIndex
|
|
208
|
+
}
|
|
209
|
+
trVNs.push(
|
|
210
|
+
h('tr', {
|
|
211
|
+
key: rowClassName || rowStyle || cellClassName || cellStyle ? rowid : $rowIndex,
|
|
212
|
+
class: [
|
|
213
|
+
'vxe-gantt-view--body-row',
|
|
214
|
+
{
|
|
215
|
+
'row--stripe': stripe && (_rowIndex + 1) % 2 === 0,
|
|
216
|
+
'is--new': isNewRow,
|
|
217
|
+
'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
|
|
218
|
+
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
219
|
+
'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
|
|
220
|
+
},
|
|
221
|
+
getClass(rowClassName, rowParams)
|
|
222
|
+
],
|
|
223
|
+
style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(rowParams) || undefined : rowStyle) : undefined,
|
|
224
|
+
attrs: {
|
|
225
|
+
rowid
|
|
226
|
+
},
|
|
227
|
+
on: trOns
|
|
228
|
+
}, tableColumn.map((column, $columnIndex) => _vm.renderColumn(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex)))
|
|
229
|
+
)
|
|
230
|
+
let isExpandTree = false
|
|
231
|
+
let rowChildren: any[] = []
|
|
232
|
+
|
|
233
|
+
if (treeConfig && !scrollYLoad && !transform) {
|
|
234
|
+
rowChildren = row[childrenField]
|
|
235
|
+
isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid]
|
|
236
|
+
}
|
|
237
|
+
// 如果是树形表格
|
|
238
|
+
if (isExpandTree) {
|
|
239
|
+
trVNs.push(..._vm.renderRows(h, $xeTable, rowChildren))
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
return trVNs
|
|
243
|
+
},
|
|
244
|
+
renderVN (h: CreateElement) {
|
|
245
|
+
const _vm = this
|
|
246
|
+
const $xeGantt = _vm.$xeGantt
|
|
247
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
248
|
+
const { reactData } = $xeGanttView
|
|
249
|
+
|
|
250
|
+
const $xeTable = $xeGanttView.internalData.xeTable
|
|
251
|
+
|
|
252
|
+
const { tableData, tableColumn, viewCellWidth } = reactData
|
|
253
|
+
return h('div', {
|
|
254
|
+
ref: 'refElem',
|
|
255
|
+
class: 'vxe-gantt-view--body-wrapper'
|
|
256
|
+
}, [
|
|
257
|
+
h('div', {
|
|
258
|
+
ref: 'refBodyScroll',
|
|
259
|
+
class: 'vxe-gantt-view--body-inner-wrapper',
|
|
260
|
+
on: {
|
|
261
|
+
scroll: $xeGanttView.triggerBodyScrollEvent,
|
|
262
|
+
contextmenu (evnt: Event) {
|
|
263
|
+
$xeGantt.handleTaskBodyContextmenuEvent(evnt, { source: sourceType, type: viewType, rowIndex: -1, $rowIndex: -1, _rowIndex: -1 })
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}, [
|
|
267
|
+
h('div', {
|
|
268
|
+
ref: 'refBodyXSpace',
|
|
269
|
+
class: 'vxe-body--x-space'
|
|
270
|
+
}),
|
|
271
|
+
h('div', {
|
|
272
|
+
ref: 'refBodyYSpace',
|
|
273
|
+
class: 'vxe-body--y-space'
|
|
274
|
+
}),
|
|
275
|
+
h('table', {
|
|
276
|
+
ref: 'refBodyTable',
|
|
277
|
+
class: 'vxe-gantt-view--body-table'
|
|
278
|
+
}, [
|
|
279
|
+
h('colgroup', {}, tableColumn.map((column, cIndex) => {
|
|
280
|
+
return h('col', {
|
|
281
|
+
key: cIndex,
|
|
282
|
+
style: {
|
|
283
|
+
width: `${viewCellWidth}px`
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
})),
|
|
287
|
+
h('tbody', {}, $xeTable ? _vm.renderRows(h, $xeTable, tableData) : [])
|
|
288
|
+
]),
|
|
289
|
+
h(GanttViewChartComponent)
|
|
290
|
+
])
|
|
291
|
+
])
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
mounted () {
|
|
295
|
+
const _vm = this
|
|
296
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
297
|
+
const { internalData } = $xeGanttView
|
|
298
|
+
|
|
299
|
+
const { elemStore } = internalData
|
|
300
|
+
const prefix = 'main-body-'
|
|
301
|
+
elemStore[`${prefix}wrapper`] = _vm.$refs.refElem as HTMLDivElement
|
|
302
|
+
elemStore[`${prefix}scroll`] = _vm.$refs.refBodyScroll as HTMLDivElement
|
|
303
|
+
elemStore[`${prefix}table`] = _vm.$refs.refBodyTable as HTMLDivElement
|
|
304
|
+
elemStore[`${prefix}xSpace`] = _vm.$refs.refBodyXSpace as HTMLDivElement
|
|
305
|
+
elemStore[`${prefix}ySpace`] = _vm.$refs.refBodyYSpace as HTMLDivElement
|
|
306
|
+
},
|
|
307
|
+
destroyed () {
|
|
308
|
+
const _vm = this
|
|
309
|
+
const $xeGanttView = _vm.$xeGanttView
|
|
310
|
+
const { internalData } = $xeGanttView
|
|
311
|
+
|
|
312
|
+
const { elemStore } = internalData
|
|
313
|
+
const prefix = 'main-body-'
|
|
314
|
+
elemStore[`${prefix}wrapper`] = null
|
|
315
|
+
elemStore[`${prefix}scroll`] = null
|
|
316
|
+
elemStore[`${prefix}table`] = null
|
|
317
|
+
elemStore[`${prefix}xSpace`] = null
|
|
318
|
+
elemStore[`${prefix}ySpace`] = null
|
|
319
|
+
},
|
|
320
|
+
render (this: any, h) {
|
|
321
|
+
return this.renderVN(h)
|
|
322
|
+
}
|
|
323
|
+
})
|