vxe-gantt 4.0.0-beta.0 → 4.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/es/components.js +3 -2
- package/es/gantt/src/emits.js +5 -1
- package/es/gantt/src/gantt-body.js +14 -5
- package/es/gantt/src/gantt-chart.js +38 -17
- package/es/gantt/src/gantt-header.js +20 -3
- package/es/gantt/src/gantt-view.js +5 -1
- package/es/gantt/src/gantt.js +91 -36
- package/es/gantt/src/util.js +6 -0
- package/es/gantt/style.css +36 -25
- package/es/gantt/style.min.css +1 -1
- package/es/index.esm.js +2 -2
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +9 -3
- package/es/ui/src/log.js +3 -2
- package/es/ui/src/utils.js +3 -0
- package/es/vxe-gantt/style.css +36 -25
- package/es/vxe-gantt/style.min.css +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/components.js +14 -15
- package/lib/components.min.js +1 -1
- package/lib/gantt/src/emits.js +1 -1
- package/lib/gantt/src/emits.min.js +1 -1
- package/lib/gantt/src/gantt-body.js +19 -7
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +50 -15
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-header.js +24 -3
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +6 -2
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +122 -40
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/util.js +7 -0
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/gantt/style/style.css +36 -25
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.common.js +5 -5
- package/lib/index.umd.js +25388 -6143
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +13 -15
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +6 -3
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +4 -0
- package/lib/ui/src/utils.min.js +1 -1
- package/lib/vxe-gantt/style/style.css +36 -25
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/package.json +4 -4
- package/packages/components.ts +6 -3
- package/packages/gantt/src/emits.ts +6 -1
- package/packages/gantt/src/gantt-body.ts +15 -6
- package/packages/gantt/src/gantt-chart.ts +31 -14
- package/packages/gantt/src/gantt-header.ts +24 -3
- package/packages/gantt/src/gantt-view.ts +6 -1
- package/packages/gantt/src/gantt.ts +133 -39
- package/packages/gantt/src/util.ts +7 -0
- package/packages/index.ts +2 -2
- package/packages/ui/index.ts +9 -3
- package/packages/ui/src/log.ts +3 -1
- package/packages/ui/src/utils.ts +4 -0
- package/styles/components/gantt-module/gantt-chart.scss +28 -9
- package/styles/components/gantt.scss +12 -13
- package/styles/theme/base.scss +5 -1
- package/es/gantt/src/grid-props.js +0 -7
- package/es/gantt/src/props.js +0 -2
- package/es/gantt/src/table-props.js +0 -298
- package/lib/gantt/src/grid-props.js +0 -24
- package/lib/gantt/src/grid-props.min.js +0 -1
- package/lib/gantt/src/props.js +0 -13
- package/lib/gantt/src/props.min.js +0 -1
- package/lib/gantt/src/table-props.js +0 -306
- package/lib/gantt/src/table-props.min.js +0 -1
- package/packages/gantt/src/grid-props.ts +0 -23
- package/packages/gantt/src/props.ts +0 -13
- package/packages/gantt/src/table-props.ts +0 -304
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { h, inject, VNode, ref, Ref, onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
-
import { VxeUI } from '
|
|
3
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
4
4
|
import XEUtils from 'xe-utils'
|
|
5
5
|
import { getCellRestHeight } from './util'
|
|
6
|
+
import { getStringValue } from '../../ui/src/utils'
|
|
6
7
|
|
|
7
|
-
import type { VxeTablePropTypes } from 'vxe-table'
|
|
8
|
+
import type { VxeTablePropTypes, TableInternalData } from 'vxe-table'
|
|
8
9
|
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
|
|
9
10
|
|
|
10
11
|
const { renderEmptyElement } = VxeUI
|
|
@@ -16,15 +17,15 @@ export default defineVxeComponent({
|
|
|
16
17
|
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
17
18
|
|
|
18
19
|
const { reactData, internalData } = $xeGanttView
|
|
19
|
-
const {
|
|
20
|
-
const { computeProgressField, computeTaskBarOpts } = $xeGantt.getComputeMaps()
|
|
20
|
+
const { computeProgressField, computeTitleField, computeTaskBarOpts } = $xeGantt.getComputeMaps()
|
|
21
21
|
|
|
22
22
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
23
23
|
|
|
24
24
|
const renderVN = () => {
|
|
25
|
-
const $xeTable =
|
|
25
|
+
const $xeTable = $xeGanttView.internalData.xeTable
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const tableInternalData = $xeTable ? $xeTable.internalData : {} as TableInternalData
|
|
28
|
+
const fullAllDataRowIdData = tableInternalData.fullAllDataRowIdData || {}
|
|
28
29
|
let cellOpts: VxeTablePropTypes.CellConfig = {}
|
|
29
30
|
let rowOpts : VxeTablePropTypes.RowConfig = {}
|
|
30
31
|
let defaultRowHeight = 0
|
|
@@ -36,28 +37,42 @@ export default defineVxeComponent({
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
const { tableData } = reactData
|
|
40
|
+
const titleField = computeTitleField.value
|
|
39
41
|
const progressField = computeProgressField.value
|
|
40
42
|
const taskBarOpts = computeTaskBarOpts.value
|
|
41
|
-
const { showProgress } = taskBarOpts
|
|
43
|
+
const { showProgress, showContent, contentMethod, barStyle } = taskBarOpts
|
|
44
|
+
const { round } = barStyle || {}
|
|
42
45
|
|
|
43
|
-
const trVNs:VNode[] = []
|
|
46
|
+
const trVNs: VNode[] = []
|
|
44
47
|
tableData.forEach((row, rIndex) => {
|
|
45
48
|
const rowid = $xeTable ? $xeTable.getRowid(row) : ''
|
|
46
49
|
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
47
50
|
const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
48
|
-
|
|
51
|
+
let title = getStringValue(XEUtils.get(row, titleField))
|
|
52
|
+
const progressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(row, progressField)))) : 0
|
|
53
|
+
if (contentMethod) {
|
|
54
|
+
title = getStringValue(contentMethod({ row, title }))
|
|
55
|
+
}
|
|
49
56
|
trVNs.push(
|
|
50
57
|
h('div', {
|
|
51
58
|
key: rIndex,
|
|
52
59
|
rowid,
|
|
53
|
-
class: 'vxe-gantt-view--chart-row',
|
|
60
|
+
class: ['vxe-gantt-view--chart-row', {
|
|
61
|
+
'is--round': round
|
|
62
|
+
}],
|
|
54
63
|
style: {
|
|
55
64
|
height: `${cellHeight}px`
|
|
56
65
|
}
|
|
57
66
|
}, [
|
|
58
67
|
h('div', {
|
|
59
68
|
class: 'vxe-gantt-view--chart-bar',
|
|
60
|
-
rowid
|
|
69
|
+
rowid,
|
|
70
|
+
onClick (evnt) {
|
|
71
|
+
$xeGantt.handleTaskBarClickEvent(evnt, { row })
|
|
72
|
+
},
|
|
73
|
+
onDblclick (evnt) {
|
|
74
|
+
$xeGantt.handleTaskBarDblclickEvent(evnt, { row })
|
|
75
|
+
}
|
|
61
76
|
}, [
|
|
62
77
|
showProgress
|
|
63
78
|
? h('div', {
|
|
@@ -67,9 +82,11 @@ export default defineVxeComponent({
|
|
|
67
82
|
}
|
|
68
83
|
})
|
|
69
84
|
: renderEmptyElement($xeGantt),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
showContent
|
|
86
|
+
? h('div', {
|
|
87
|
+
class: 'vxe-gantt-view--chart-content'
|
|
88
|
+
}, title)
|
|
89
|
+
: renderEmptyElement($xeGantt)
|
|
73
90
|
])
|
|
74
91
|
])
|
|
75
92
|
)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { h, inject, ref, Ref, onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import { getCellHeight } from './util'
|
|
3
4
|
|
|
5
|
+
import type { VxeTablePropTypes } from 'vxe-table'
|
|
4
6
|
import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods } from '../../../types'
|
|
5
7
|
|
|
6
8
|
export default defineVxeComponent({
|
|
@@ -16,7 +18,20 @@ export default defineVxeComponent({
|
|
|
16
18
|
const refHeaderXSpace = ref() as Ref<HTMLDivElement>
|
|
17
19
|
|
|
18
20
|
const renderVN = () => {
|
|
19
|
-
const
|
|
21
|
+
const $xeTable = $xeGanttView.internalData.xeTable
|
|
22
|
+
|
|
23
|
+
const { tableColumn, headerGroups, viewCellWidth } = reactData
|
|
24
|
+
|
|
25
|
+
let defaultRowHeight: number = 0
|
|
26
|
+
let headerCellOpts : VxeTablePropTypes.HeaderCellConfig = {}
|
|
27
|
+
let currCellHeight = 0
|
|
28
|
+
if ($xeTable) {
|
|
29
|
+
const { computeDefaultRowHeight, computeHeaderCellOpts } = $xeTable.getComputeMaps()
|
|
30
|
+
defaultRowHeight = computeDefaultRowHeight.value
|
|
31
|
+
headerCellOpts = computeHeaderCellOpts.value
|
|
32
|
+
currCellHeight = getCellHeight(headerCellOpts.height) || defaultRowHeight
|
|
33
|
+
}
|
|
34
|
+
|
|
20
35
|
return h('div', {
|
|
21
36
|
ref: refElem,
|
|
22
37
|
class: 'vxe-gantt-view--header-wrapper'
|
|
@@ -32,11 +47,17 @@ export default defineVxeComponent({
|
|
|
32
47
|
}),
|
|
33
48
|
h('table', {
|
|
34
49
|
ref: refHeaderTable,
|
|
35
|
-
class: 'vxe-gantt-view--header-table'
|
|
50
|
+
class: 'vxe-gantt-view--header-table',
|
|
51
|
+
style: {
|
|
52
|
+
height: `${currCellHeight}px`
|
|
53
|
+
}
|
|
36
54
|
}, [
|
|
37
55
|
h('colgroup', {}, tableColumn.map((column, cIndex) => {
|
|
38
56
|
return h('col', {
|
|
39
|
-
key: cIndex
|
|
57
|
+
key: cIndex,
|
|
58
|
+
style: {
|
|
59
|
+
width: `${viewCellWidth}px`
|
|
60
|
+
}
|
|
40
61
|
})
|
|
41
62
|
})),
|
|
42
63
|
h('thead', {}, headerGroups.map((cols, rIndex) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, ref, reactive, nextTick, inject, watch, provide, onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { setScrollTop, setScrollLeft } from '../../ui/src/dom'
|
|
4
|
-
import { VxeUI } from '
|
|
4
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
5
5
|
import { getRefElem } from './util'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
7
7
|
import GanttViewHeaderComponent from './gantt-header'
|
|
@@ -295,6 +295,7 @@ export default defineVxeComponent({
|
|
|
295
295
|
const { scrollbarWidth, scrollbarHeight, tableColumn } = reactData
|
|
296
296
|
const { elemStore } = internalData
|
|
297
297
|
const $xeTable = internalData.xeTable
|
|
298
|
+
|
|
298
299
|
const el = refElem.value
|
|
299
300
|
if (!el || !el.clientHeight) {
|
|
300
301
|
return
|
|
@@ -544,6 +545,10 @@ export default defineVxeComponent({
|
|
|
544
545
|
}
|
|
545
546
|
|
|
546
547
|
const ganttViewMethods: VxeGanttViewMethods = {
|
|
548
|
+
refreshData () {
|
|
549
|
+
handleUpdateData()
|
|
550
|
+
return handleLazyRecalculate()
|
|
551
|
+
},
|
|
547
552
|
updateViewData () {
|
|
548
553
|
const $xeTable = internalData.xeTable
|
|
549
554
|
if ($xeTable) {
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import { h, ref, computed, provide, reactive, onUnmounted, watch, nextTick, VNode,
|
|
1
|
+
import { h, ref, PropType, computed, provide, reactive, onUnmounted, watch, nextTick, VNode, onMounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
4
|
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
5
5
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, addClass, removeClass } from '../../ui/src/dom'
|
|
6
|
-
import { VxeUI } from '
|
|
7
|
-
import { ganttProps } from './props'
|
|
6
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
8
7
|
import { ganttEmits } from './emits'
|
|
9
8
|
import { tableEmits } from './table-emits'
|
|
10
|
-
import { tableProps } from './table-props'
|
|
11
9
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
12
10
|
import GanttViewComponent from './gantt-view'
|
|
11
|
+
import { VxeTable as VxeTableComponent } from 'vxe-table'
|
|
13
12
|
|
|
14
13
|
import type { VxeGanttConstructor, VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, GanttMethods, GanttPrivateMethods, VxeGanttPrivateMethods, GanttPrivateRef, VxeGanttProps, VxeGanttPrivateComputed, VxeGanttViewInstance, VxeGanttDefines } from '../../../types'
|
|
15
14
|
import type { ValueOf, VxeFormEvents, VxeFormInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance, VxeComponentStyleType } from 'vxe-pc-ui'
|
|
16
|
-
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableEvents, VxeTableDefines, VxeTableEventProps, VxeToolbarInstance } from 'vxe-table'
|
|
15
|
+
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTablePropTypes, VxeTableConstructor, VxeTablePrivateMethods, VxeTableEvents, VxeTableDefines, VxeTableEventProps, VxeToolbarInstance, VxeGridPropTypes } from 'vxe-table'
|
|
17
16
|
|
|
18
17
|
const { getConfig, getIcon, getI18n, commands, hooks, useFns, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement, getSlotVNs } = VxeUI
|
|
19
18
|
|
|
19
|
+
const tableProps = (VxeTableComponent as any).props
|
|
20
|
+
|
|
20
21
|
const tableComponentPropKeys = Object.keys(tableProps) as (keyof VxeTableProps)[]
|
|
21
22
|
const tableComponentMethodKeys: (keyof VxeTableMethods)[] = ['clearAll', 'syncData', 'updateData', 'loadData', 'reloadData', 'reloadRow', 'loadColumn', 'reloadColumn', 'getRowNode', 'getColumnNode', 'getRowIndex', 'getVTRowIndex', 'getVMRowIndex', 'getColumnIndex', 'getVTColumnIndex', 'getVMColumnIndex', 'setRow', 'createData', 'createRow', 'revertData', 'clearData', 'isRemoveByRow', 'isInsertByRow', 'isUpdateByRow', 'getColumns', 'getColumnById', 'getColumnByField', 'getTableColumn', 'getFullColumns', 'getData', 'getCheckboxRecords', 'getParentRow', 'getTreeRowChildren', 'getTreeParentRow', 'getRowSeq', 'getRowById', 'getRowid', 'getTableData', 'getFullData', 'setColumnFixed', 'clearColumnFixed', 'setColumnWidth', 'getColumnWidth', 'recalcRowHeight', 'setRowHeightConf', 'getRowHeightConf', 'setRowHeight', 'getRowHeight', 'hideColumn', 'showColumn', 'resetColumn', 'refreshColumn', 'refreshScroll', 'recalculate', 'closeTooltip', 'isAllCheckboxChecked', 'isAllCheckboxIndeterminate', 'getCheckboxIndeterminateRecords', 'setCheckboxRow', 'setCheckboxRowKey', 'isCheckedByCheckboxRow', 'isCheckedByCheckboxRowKey', 'isIndeterminateByCheckboxRow', 'isIndeterminateByCheckboxRowKey', 'toggleCheckboxRow', 'setAllCheckboxRow', 'getRadioReserveRecord', 'clearRadioReserve', 'getCheckboxReserveRecords', 'clearCheckboxReserve', 'toggleAllCheckboxRow', 'clearCheckboxRow', 'setCurrentRow', 'isCheckedByRadioRow', 'isCheckedByRadioRowKey', 'setRadioRow', 'setRadioRowKey', 'clearCurrentRow', 'clearRadioRow', 'getCurrentRecord', 'getRadioRecord', 'getCurrentColumn', 'setCurrentColumn', 'clearCurrentColumn', 'setPendingRow', 'togglePendingRow', 'hasPendingByRow', 'isPendingByRow', 'getPendingRecords', 'clearPendingRow', 'setFilterByEvent', 'sort', 'setSort', 'setSortByEvent', 'clearSort', 'clearSortByEvent', 'isSort', 'getSortColumns', 'closeFilter', 'isFilter', 'clearFilterByEvent', 'isActiveFilterByColumn', 'isRowExpandLoaded', 'clearRowExpandLoaded', 'reloadRowExpand', 'reloadRowExpand', 'toggleRowExpand', 'setAllRowExpand', 'setRowExpand', 'isExpandByRow', 'isRowExpandByRow', 'clearRowExpand', 'clearRowExpandReserve', 'getRowExpandRecords', 'getTreeExpandRecords', 'isTreeExpandLoaded', 'clearTreeExpandLoaded', 'reloadTreeExpand', 'reloadTreeChilds', 'toggleTreeExpand', 'setAllTreeExpand', 'setTreeExpand', 'isTreeExpandByRow', 'clearTreeExpand', 'clearTreeExpandReserve', 'getScroll', 'scrollTo', 'scrollToRow', 'scrollToColumn', 'clearScroll', 'updateFooter', 'updateStatus', 'setMergeCells', 'removeInsertRow', 'removeMergeCells', 'getMergeCells', 'clearMergeCells', 'setMergeFooterItems', 'removeMergeFooterItems', 'getMergeFooterItems', 'clearMergeFooterItems', 'getCustomStoreData', 'setRowGroupExpand', 'setAllRowGroupExpand', 'clearRowGroupExpand', 'isRowGroupExpandByRow', 'isRowGroupRecord', 'isAggregateRecord', 'isAggregateExpandByRow', 'getAggregateContentByRow', 'getAggregateRowChildren', 'setRowGroups', 'clearRowGroups', 'openTooltip', 'moveColumnTo', 'moveRowTo', 'getCellLabel', 'getCellElement', 'focus', 'blur', 'connect']
|
|
22
23
|
|
|
24
|
+
const defaultLayouts: VxeGanttPropTypes.Layouts = [['Form'], ['Toolbar', 'Top', 'Gantt', 'Bottom', 'Pager']]
|
|
25
|
+
|
|
23
26
|
function createInternalData (): GanttInternalData {
|
|
24
27
|
return {
|
|
25
28
|
resizeTableWidth: 0
|
|
@@ -28,7 +31,42 @@ function createInternalData (): GanttInternalData {
|
|
|
28
31
|
|
|
29
32
|
export default defineVxeComponent({
|
|
30
33
|
name: 'VxeGantt',
|
|
31
|
-
props:
|
|
34
|
+
props: {
|
|
35
|
+
...(tableProps as {
|
|
36
|
+
border: PropType<VxeTablePropTypes.Border>
|
|
37
|
+
round: PropType<VxeTablePropTypes.Round>
|
|
38
|
+
loading: PropType<VxeTablePropTypes.Loading>
|
|
39
|
+
height: PropType<VxeTablePropTypes.Height>
|
|
40
|
+
minHeight: PropType<VxeTablePropTypes.MinHeight>
|
|
41
|
+
maxHeight: PropType<VxeTablePropTypes.MaxHeight>
|
|
42
|
+
seqConfig: PropType<VxeTablePropTypes.SeqConfig>
|
|
43
|
+
editConfig: PropType<VxeTablePropTypes.EditConfig>
|
|
44
|
+
sortConfig: PropType<VxeTablePropTypes.SortConfig>
|
|
45
|
+
filterConfig: PropType<VxeTablePropTypes.FilterConfig>
|
|
46
|
+
validConfig: PropType<VxeTablePropTypes.ValidConfig>
|
|
47
|
+
editRules: PropType<VxeTablePropTypes.EditRules>
|
|
48
|
+
animat: PropType<VxeTablePropTypes.Animat>
|
|
49
|
+
scrollbarConfig: PropType<VxeTablePropTypes.ScrollbarConfig>
|
|
50
|
+
params: PropType<VxeTablePropTypes.Params>
|
|
51
|
+
}),
|
|
52
|
+
|
|
53
|
+
columns: Array as PropType<VxeGridPropTypes.Columns<any>>,
|
|
54
|
+
pagerConfig: Object as PropType<VxeGridPropTypes.PagerConfig>,
|
|
55
|
+
proxyConfig: Object as PropType<VxeGridPropTypes.ProxyConfig<any>>,
|
|
56
|
+
toolbarConfig: Object as PropType<VxeGridPropTypes.ToolbarConfig>,
|
|
57
|
+
formConfig: Object as PropType<VxeGridPropTypes.FormConfig>,
|
|
58
|
+
zoomConfig: Object as PropType<VxeGridPropTypes.ZoomConfig>,
|
|
59
|
+
|
|
60
|
+
layouts: Array as PropType<VxeGanttPropTypes.Layouts>,
|
|
61
|
+
taskConfig: Object as PropType<VxeGanttPropTypes.TaskConfig>,
|
|
62
|
+
taskViewConfig: Object as PropType<VxeGanttPropTypes.TaskViewConfig>,
|
|
63
|
+
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
64
|
+
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
65
|
+
size: {
|
|
66
|
+
type: String as PropType<VxeGridPropTypes.Size>,
|
|
67
|
+
default: () => getConfig().gantt.size || getConfig().size
|
|
68
|
+
}
|
|
69
|
+
},
|
|
32
70
|
emits: ganttEmits,
|
|
33
71
|
setup (props, context) {
|
|
34
72
|
const { slots, emit } = context
|
|
@@ -41,8 +79,6 @@ export default defineVxeComponent({
|
|
|
41
79
|
const VxeTableComponent = VxeUI.getComponent('VxeTable')
|
|
42
80
|
const VxeToolbarComponent = VxeUI.getComponent('VxeToolbar')
|
|
43
81
|
|
|
44
|
-
const defaultLayouts: VxeGanttPropTypes.Layouts = [['Form'], ['Toolbar', 'Top', 'Gantt', 'Bottom', 'Pager']]
|
|
45
|
-
|
|
46
82
|
const { computeSize } = useFns.useSize(props)
|
|
47
83
|
|
|
48
84
|
const reactData = reactive<GanttReactData>({
|
|
@@ -66,7 +102,7 @@ export default defineVxeComponent({
|
|
|
66
102
|
const internalData = createInternalData()
|
|
67
103
|
|
|
68
104
|
const refElem = ref<HTMLDivElement>()
|
|
69
|
-
const refTable = ref<
|
|
105
|
+
const refTable = ref<VxeTableConstructor & VxeTablePrivateMethods>()
|
|
70
106
|
const refForm = ref<VxeFormInstance>()
|
|
71
107
|
const refToolbar = ref<VxeToolbarInstance>()
|
|
72
108
|
const refPager = ref<VxePagerInstance>()
|
|
@@ -149,6 +185,10 @@ export default defineVxeComponent({
|
|
|
149
185
|
return Object.assign({}, getConfig().gantt.taskBarConfig, props.taskBarConfig)
|
|
150
186
|
})
|
|
151
187
|
|
|
188
|
+
const computeTaskSplitOpts = computed(() => {
|
|
189
|
+
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig)
|
|
190
|
+
})
|
|
191
|
+
|
|
152
192
|
const computeTitleField = computed(() => {
|
|
153
193
|
const taskOpts = computeTaskOpts.value
|
|
154
194
|
return taskOpts.titleField || 'title'
|
|
@@ -186,6 +226,10 @@ export default defineVxeComponent({
|
|
|
186
226
|
const computeStyles = computed(() => {
|
|
187
227
|
const { height, maxHeight } = props
|
|
188
228
|
const { isZMax, tZindex } = reactData
|
|
229
|
+
const taskViewOpts = computeTaskViewOpts.value
|
|
230
|
+
const { tableStyle } = taskViewOpts
|
|
231
|
+
const taskBarOpts = computeTaskBarOpts.value
|
|
232
|
+
const { barStyle } = taskBarOpts
|
|
189
233
|
const stys: VxeComponentStyleType = {}
|
|
190
234
|
if (isZMax) {
|
|
191
235
|
stys.zIndex = tZindex
|
|
@@ -197,13 +241,28 @@ export default defineVxeComponent({
|
|
|
197
241
|
stys.maxHeight = maxHeight === 'auto' || maxHeight === '100%' ? '100%' : toCssUnit(maxHeight)
|
|
198
242
|
}
|
|
199
243
|
}
|
|
244
|
+
if (barStyle) {
|
|
245
|
+
const { bgColor, completedBgColor } = barStyle
|
|
246
|
+
if (bgColor) {
|
|
247
|
+
stys['--vxe-ui-gantt-view-task-bar-background-color'] = bgColor
|
|
248
|
+
}
|
|
249
|
+
if (completedBgColor) {
|
|
250
|
+
stys['--vxe-ui-gantt-view-task-bar-completed-background-color'] = completedBgColor
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (tableStyle) {
|
|
254
|
+
const { width: defTbWidth } = tableStyle
|
|
255
|
+
if (defTbWidth) {
|
|
256
|
+
stys['--vxe-ui-gantt-view-table-default-width'] = toCssUnit(defTbWidth)
|
|
257
|
+
}
|
|
258
|
+
}
|
|
200
259
|
return stys
|
|
201
260
|
})
|
|
202
261
|
|
|
203
262
|
const computeTableExtendProps = computed(() => {
|
|
204
263
|
const rest: Record<string, any> = {}
|
|
205
264
|
tableComponentPropKeys.forEach((key) => {
|
|
206
|
-
rest[key] = props[key]
|
|
265
|
+
rest[key] = (props as any)[key]
|
|
207
266
|
})
|
|
208
267
|
return rest
|
|
209
268
|
})
|
|
@@ -323,6 +382,7 @@ export default defineVxeComponent({
|
|
|
323
382
|
computeTaskOpts,
|
|
324
383
|
computeTaskViewOpts,
|
|
325
384
|
computeTaskBarOpts,
|
|
385
|
+
computeTaskSplitOpts,
|
|
326
386
|
computeTitleField,
|
|
327
387
|
computeStartField,
|
|
328
388
|
computeEndField,
|
|
@@ -1249,7 +1309,7 @@ export default defineVxeComponent({
|
|
|
1249
1309
|
}
|
|
1250
1310
|
}
|
|
1251
1311
|
return null
|
|
1252
|
-
}
|
|
1312
|
+
},
|
|
1253
1313
|
// setProxyInfo (options) {
|
|
1254
1314
|
// if (props.proxyConfig && options) {
|
|
1255
1315
|
// const { pager, form } = options
|
|
@@ -1267,7 +1327,14 @@ export default defineVxeComponent({
|
|
|
1267
1327
|
// }
|
|
1268
1328
|
// }
|
|
1269
1329
|
// return nextTick()
|
|
1270
|
-
// }
|
|
1330
|
+
// },
|
|
1331
|
+
refreshTaskView () {
|
|
1332
|
+
const $ganttView = refGanttView.value
|
|
1333
|
+
if ($ganttView) {
|
|
1334
|
+
return $ganttView.refreshData()
|
|
1335
|
+
}
|
|
1336
|
+
return nextTick()
|
|
1337
|
+
}
|
|
1271
1338
|
}
|
|
1272
1339
|
|
|
1273
1340
|
const ganttPrivateMethods: GanttPrivateMethods = {
|
|
@@ -1328,6 +1395,18 @@ export default defineVxeComponent({
|
|
|
1328
1395
|
triggerZoomEvent (evnt) {
|
|
1329
1396
|
$xeGantt.zoom()
|
|
1330
1397
|
$xeGantt.dispatchEvent('zoom', { type: reactData.isZMax ? 'max' : 'revert' }, evnt)
|
|
1398
|
+
},
|
|
1399
|
+
handleTaskCellClickEvent (evnt, params) {
|
|
1400
|
+
$xeGantt.dispatchEvent('task-cell-click', params, evnt)
|
|
1401
|
+
},
|
|
1402
|
+
handleTaskCellDblclickEvent (evnt, params) {
|
|
1403
|
+
$xeGantt.dispatchEvent('task-cell-dblclick', params, evnt)
|
|
1404
|
+
},
|
|
1405
|
+
handleTaskBarClickEvent (evnt, params) {
|
|
1406
|
+
$xeGantt.dispatchEvent('task-bar-click', params, evnt)
|
|
1407
|
+
},
|
|
1408
|
+
handleTaskBarDblclickEvent (evnt, params) {
|
|
1409
|
+
$xeGantt.dispatchEvent('task-bar-dblclick', params, evnt)
|
|
1331
1410
|
}
|
|
1332
1411
|
}
|
|
1333
1412
|
|
|
@@ -1625,37 +1704,52 @@ export default defineVxeComponent({
|
|
|
1625
1704
|
|
|
1626
1705
|
const renderSplitBar = () => {
|
|
1627
1706
|
const { showLeftView, showRightView } = reactData
|
|
1707
|
+
const taskSplitOpts = computeTaskSplitOpts.value
|
|
1708
|
+
const { enabled, resize, showCollapseTableButton, showCollapseTaskButton } = taskSplitOpts
|
|
1709
|
+
if (!enabled) {
|
|
1710
|
+
return renderEmptyElement($xeGantt)
|
|
1711
|
+
}
|
|
1712
|
+
const ons: {
|
|
1713
|
+
onMousedown?: typeof dragSplitEvent
|
|
1714
|
+
} = {}
|
|
1715
|
+
if (resize) {
|
|
1716
|
+
ons.onMousedown = dragSplitEvent
|
|
1717
|
+
}
|
|
1628
1718
|
return h('div', {
|
|
1629
|
-
class: 'vxe-gantt--view-split-bar'
|
|
1719
|
+
class: ['vxe-gantt--view-split-bar', {
|
|
1720
|
+
'is--resize': resize,
|
|
1721
|
+
...ons
|
|
1722
|
+
}]
|
|
1630
1723
|
}, [
|
|
1631
1724
|
h('div', {
|
|
1632
|
-
class: 'vxe-gantt--view-split-bar-handle'
|
|
1633
|
-
onMousedown: dragSplitEvent
|
|
1725
|
+
class: 'vxe-gantt--view-split-bar-handle'
|
|
1634
1726
|
}),
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1727
|
+
showCollapseTableButton || showCollapseTaskButton
|
|
1728
|
+
? h('div', {
|
|
1729
|
+
class: 'vxe-gantt--view-split-bar-btn-wrapper'
|
|
1730
|
+
}, [
|
|
1731
|
+
showCollapseTableButton && showRightView
|
|
1732
|
+
? h('div', {
|
|
1733
|
+
class: 'vxe-gantt--view-split-bar-left-btn',
|
|
1734
|
+
onClick: handleSplitLeftViewEvent
|
|
1735
|
+
}, [
|
|
1736
|
+
h('i', {
|
|
1737
|
+
class: showLeftView ? getIcon().GANTT_VIEW_LEFT_OPEN : getIcon().GANTT_VIEW_LEFT_CLOSE
|
|
1738
|
+
})
|
|
1739
|
+
])
|
|
1740
|
+
: renderEmptyElement($xeGantt),
|
|
1741
|
+
showCollapseTaskButton && showLeftView
|
|
1742
|
+
? h('div', {
|
|
1743
|
+
class: 'vxe-gantt--view-split-bar-right-btn',
|
|
1744
|
+
onClick: handleSplitRightViewEvent
|
|
1745
|
+
}, [
|
|
1746
|
+
h('i', {
|
|
1747
|
+
class: showRightView ? getIcon().GANTT_VIEW_RIGHT_OPEN : getIcon().GANTT_VIEW_RIGHT_CLOSE
|
|
1748
|
+
})
|
|
1749
|
+
])
|
|
1750
|
+
: renderEmptyElement($xeGantt)
|
|
1751
|
+
])
|
|
1752
|
+
: renderEmptyElement($xeGantt)
|
|
1659
1753
|
])
|
|
1660
1754
|
}
|
|
1661
1755
|
|
|
@@ -10,6 +10,13 @@ export function getRefElem (refEl: any) {
|
|
|
10
10
|
return null
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export function getCellHeight (height: number | 'unset' | undefined | null) {
|
|
14
|
+
if (height === 'unset') {
|
|
15
|
+
return 0
|
|
16
|
+
}
|
|
17
|
+
return height || 0
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
export function getCellRestHeight (rowRest: VxeTableDefines.RowCacheItem, cellOpts: VxeTablePropTypes.CellConfig, rowOpts: VxeTablePropTypes.RowConfig, defaultRowHeight: number) {
|
|
14
21
|
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
15
22
|
}
|
package/packages/index.ts
CHANGED
package/packages/ui/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { VxeUI
|
|
1
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
2
|
+
|
|
3
|
+
const { setConfig, setIcon } = VxeUI
|
|
2
4
|
|
|
3
5
|
VxeUI.ganttVersion = process.env.VUE_APP_VXE_VERSION as string
|
|
4
6
|
|
|
@@ -39,6 +41,12 @@ setConfig({
|
|
|
39
41
|
// afterDelete: null,
|
|
40
42
|
// beforeSave: null,
|
|
41
43
|
// afterSave: null
|
|
44
|
+
},
|
|
45
|
+
taskSplitConfig: {
|
|
46
|
+
enabled: true,
|
|
47
|
+
resize: true,
|
|
48
|
+
showCollapseTableButton: true,
|
|
49
|
+
showCollapseTaskButton: true
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
})
|
|
@@ -51,8 +59,6 @@ setIcon({
|
|
|
51
59
|
GANTT_VIEW_LEFT_CLOSE: iconPrefix + 'arrow-right',
|
|
52
60
|
GANTT_VIEW_RIGHT_OPEN: iconPrefix + 'arrow-right',
|
|
53
61
|
GANTT_VIEW_RIGHT_CLOSE: iconPrefix + 'arrow-left'
|
|
54
|
-
|
|
55
62
|
})
|
|
56
63
|
|
|
57
|
-
export * from '@vxe-ui/core'
|
|
58
64
|
export default VxeUI
|
package/packages/ui/src/log.ts
CHANGED
package/packages/ui/src/utils.ts
CHANGED
|
@@ -48,3 +48,7 @@ export function formatText (value: any, placeholder?: any) {
|
|
|
48
48
|
export function eqEmptyValue (cellValue: any) {
|
|
49
49
|
return cellValue === '' || XEUtils.eqNull(cellValue)
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
export function getStringValue (cellValue: any) {
|
|
53
|
+
return eqEmptyValue(cellValue) ? '' : cellValue
|
|
54
|
+
}
|
|
@@ -6,19 +6,31 @@
|
|
|
6
6
|
}
|
|
7
7
|
.vxe-gantt-view--chart-row {
|
|
8
8
|
position: relative;
|
|
9
|
+
&.is--round {
|
|
10
|
+
& > .vxe-gantt-view--chart-bar {
|
|
11
|
+
border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
|
|
12
|
+
&:hover {
|
|
13
|
+
&::after {
|
|
14
|
+
border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
& > .vxe-gantt-view--chart-progress {
|
|
18
|
+
border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius) 0 0 var(--vxe-ui-gantt-view-task-bar-border-radius);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
9
22
|
}
|
|
10
23
|
.vxe-gantt-view--chart-bar {
|
|
11
24
|
display: flex;
|
|
12
25
|
flex-direction: row;
|
|
26
|
+
align-items: center;
|
|
13
27
|
position: absolute;
|
|
14
|
-
width: 0;
|
|
15
28
|
top: 50%;
|
|
16
29
|
left: 0;
|
|
17
30
|
color: #ffffff;
|
|
18
31
|
transform: translateY(-50%);
|
|
19
|
-
border-radius: var(--vxe-ui-base-border-radius);
|
|
20
32
|
height: var(--vxe-ui-gantt-view-chart-bar-height);
|
|
21
|
-
background-color: var(--vxe-ui-
|
|
33
|
+
background-color: var(--vxe-ui-gantt-view-task-bar-background-color);
|
|
22
34
|
pointer-events: all;
|
|
23
35
|
&:hover {
|
|
24
36
|
&::after {
|
|
@@ -29,18 +41,25 @@
|
|
|
29
41
|
width: 100%;
|
|
30
42
|
height: 100%;
|
|
31
43
|
background-color: rgba(0, 0, 0, 0.1);
|
|
32
|
-
border-radius: var(--vxe-ui-base-border-radius);
|
|
33
44
|
}
|
|
34
45
|
}
|
|
35
46
|
}
|
|
36
47
|
.vxe-gantt-view--chart-progress {
|
|
37
48
|
flex-shrink: 0;
|
|
38
|
-
width:
|
|
49
|
+
width: 0;
|
|
50
|
+
height: 100%;
|
|
39
51
|
text-align: left;
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
background-color: var(--vxe-ui-gantt-view-task-bar-completed-background-color);
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
text-overflow: ellipsis;
|
|
55
|
+
white-space: nowrap;
|
|
42
56
|
}
|
|
43
57
|
.vxe-gantt-view--chart-content {
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
position: absolute;
|
|
59
|
+
width: 100%;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
text-overflow: ellipsis;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
font-size: 0.9em;
|
|
64
|
+
padding: 0 0.6em;
|
|
46
65
|
}
|