vxe-gantt 3.0.27 → 3.1.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/gantt/src/gantt-chart.js +24 -15
- package/es/gantt/src/gantt-header.js +18 -6
- package/es/gantt/src/gantt-view.js +311 -47
- package/es/gantt/src/gantt.js +170 -7
- package/es/gantt/src/util.js +11 -0
- package/es/ui/index.js +4 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.js +6 -0
- package/lib/gantt/src/gantt-chart.js +30 -15
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-header.js +15 -5
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +346 -51
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +168 -5
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/util.js +12 -0
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/index.umd.js +588 -83
- package/lib/index.umd.min.js +1 -1
- package/lib/ui/index.js +4 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +8 -0
- package/lib/ui/src/utils.min.js +1 -1
- package/package.json +3 -3
- package/packages/gantt/src/gantt-chart.ts +30 -15
- package/packages/gantt/src/gantt-header.ts +15 -6
- package/packages/gantt/src/gantt-view.ts +321 -49
- package/packages/gantt/src/gantt.ts +179 -7
- package/packages/gantt/src/util.ts +13 -0
- package/packages/ui/index.ts +3 -0
- package/packages/ui/src/utils.ts +8 -0
|
@@ -2,7 +2,7 @@ import { PropType, VNode, CreateElement, Component } from 'vue'
|
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { VxeUI } from '@vxe-ui/core'
|
|
4
4
|
import XEUtils from 'xe-utils'
|
|
5
|
-
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
5
|
+
import { getLastZIndex, nextZIndex, isEnableConf, formatText } from '../../ui/src/utils'
|
|
6
6
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, addClass, removeClass } from '../../ui/src/dom'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
@@ -10,7 +10,7 @@ import GanttViewComponent from './gantt-view'
|
|
|
10
10
|
import { VxeTable as VxeTableComponent } from 'vxe-table'
|
|
11
11
|
|
|
12
12
|
import type { ValueOf, VxeFormInstance, VxeFormItemProps, VxePagerInstance, VxePagerDefines, VxeComponentStyleType, VxeComponentSizeType, VxeFormDefines, VxeFormItemPropTypes } from 'vxe-pc-ui'
|
|
13
|
-
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, TableReactData, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes, VxeGridDefines } from 'vxe-table'
|
|
13
|
+
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTooltipInstance, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, TableReactData, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes, VxeGridDefines } from 'vxe-table'
|
|
14
14
|
import type { VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, VxeGanttViewInstance, VxeGanttDefines, VxeGanttConstructor } from '../../../types'
|
|
15
15
|
|
|
16
16
|
const { getConfig, getIcon, getI18n, commands, globalMixins, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
|
|
@@ -78,6 +78,7 @@ function createInternalData (): GanttInternalData {
|
|
|
78
78
|
return {
|
|
79
79
|
uFoot: false,
|
|
80
80
|
resizeTableWidth: 0
|
|
81
|
+
// barTipTimeout: undefined
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -120,6 +121,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
120
121
|
taskViewScaleConfig: Object as PropType<VxeGanttPropTypes.TaskViewScaleConfig>,
|
|
121
122
|
taskViewConfig: Object as PropType<VxeGanttPropTypes.TaskViewConfig>,
|
|
122
123
|
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
124
|
+
taskBarTooltipConfig: Object as PropType<VxeGanttPropTypes.TaskBarTooltipConfig>,
|
|
123
125
|
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
124
126
|
taskBarResizeConfig: Object as PropType<VxeGanttPropTypes.TaskBarResizeConfig>,
|
|
125
127
|
taskBarDragConfig: Object as PropType<VxeGanttPropTypes.TaskBarDragConfig>,
|
|
@@ -157,7 +159,14 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
157
159
|
},
|
|
158
160
|
showLeftView: true,
|
|
159
161
|
showRightView: true,
|
|
160
|
-
taskScaleList: []
|
|
162
|
+
taskScaleList: [],
|
|
163
|
+
|
|
164
|
+
barTipStore: {
|
|
165
|
+
row: null,
|
|
166
|
+
content: '',
|
|
167
|
+
visible: false,
|
|
168
|
+
params: null
|
|
169
|
+
}
|
|
161
170
|
}
|
|
162
171
|
|
|
163
172
|
const internalData = createInternalData()
|
|
@@ -256,13 +265,46 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
256
265
|
|
|
257
266
|
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig)
|
|
258
267
|
},
|
|
259
|
-
|
|
268
|
+
computeTaskBarTooltipOpts () {
|
|
269
|
+
const $xeGantt = this
|
|
270
|
+
const props = $xeGantt
|
|
271
|
+
|
|
272
|
+
return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig)
|
|
273
|
+
},
|
|
274
|
+
computeScaleUnit () {
|
|
275
|
+
const $xeGantt = this
|
|
276
|
+
|
|
277
|
+
const minScale = $xeGantt.computeMinScale as VxeGanttDefines.ColumnScaleObj
|
|
278
|
+
return minScale ? minScale.type : 'date'
|
|
279
|
+
},
|
|
280
|
+
computeMinScale () {
|
|
281
|
+
const $xeGantt = this
|
|
282
|
+
const reactData = ($xeGantt as any).reactData as GanttReactData
|
|
283
|
+
|
|
284
|
+
const { taskScaleList } = reactData
|
|
285
|
+
return XEUtils.last(taskScaleList)
|
|
286
|
+
},
|
|
287
|
+
computeWeekScale () {
|
|
288
|
+
const $xeGantt = this
|
|
289
|
+
const reactData = ($xeGantt as any).reactData as GanttReactData
|
|
290
|
+
|
|
291
|
+
const { taskScaleList } = reactData
|
|
292
|
+
return taskScaleList.find(item => item.type === 'week')
|
|
293
|
+
},
|
|
294
|
+
computeTaskViewScales () {
|
|
260
295
|
const $xeGantt = this
|
|
261
296
|
|
|
262
297
|
const taskViewOpts = $xeGantt.computeTaskViewOpts as VxeGanttPropTypes.TaskViewConfig
|
|
263
298
|
const { scales } = taskViewOpts
|
|
264
299
|
return scales
|
|
265
300
|
},
|
|
301
|
+
/**
|
|
302
|
+
* 已废弃,保留兼容
|
|
303
|
+
* @deprecated
|
|
304
|
+
*/
|
|
305
|
+
computeTaskScaleConfs () {
|
|
306
|
+
return this.computeTaskViewScales
|
|
307
|
+
},
|
|
266
308
|
computeTitleField () {
|
|
267
309
|
const $xeGantt = this
|
|
268
310
|
|
|
@@ -530,10 +572,11 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
530
572
|
|
|
531
573
|
$xeGantt.initProxy()
|
|
532
574
|
},
|
|
533
|
-
|
|
575
|
+
computeTaskViewScales () {
|
|
534
576
|
const $xeGantt = this
|
|
535
577
|
|
|
536
578
|
$xeGantt.handleTaskScaleConfig()
|
|
579
|
+
$xeGantt.refreshTaskView()
|
|
537
580
|
}
|
|
538
581
|
},
|
|
539
582
|
methods: {
|
|
@@ -547,7 +590,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
547
590
|
const $xeGantt = this
|
|
548
591
|
const reactData = $xeGantt.reactData
|
|
549
592
|
|
|
550
|
-
const taskScaleConfs = $xeGantt.
|
|
593
|
+
const taskScaleConfs = $xeGantt.computeTaskViewScales
|
|
551
594
|
const taskViewScaleOpts = $xeGantt.computeTaskViewScaleOpts
|
|
552
595
|
const scaleConfs: VxeGanttDefines.ColumnScaleObj[] = []
|
|
553
596
|
if (taskScaleConfs) {
|
|
@@ -1691,6 +1734,28 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1691
1734
|
reactData.showRightView = false
|
|
1692
1735
|
return $xeGantt.$nextTick()
|
|
1693
1736
|
},
|
|
1737
|
+
/**
|
|
1738
|
+
* 关闭 bar tooltip
|
|
1739
|
+
*/
|
|
1740
|
+
closeTaskBarTooltip () {
|
|
1741
|
+
const $xeGantt = this
|
|
1742
|
+
const reactData = $xeGantt.reactData
|
|
1743
|
+
|
|
1744
|
+
const { barTipStore } = reactData
|
|
1745
|
+
const $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1746
|
+
if (barTipStore.visible) {
|
|
1747
|
+
Object.assign(barTipStore, {
|
|
1748
|
+
row: null,
|
|
1749
|
+
content: null,
|
|
1750
|
+
visible: false,
|
|
1751
|
+
params: {}
|
|
1752
|
+
})
|
|
1753
|
+
if ($tooltip && $tooltip.close) {
|
|
1754
|
+
$tooltip.close()
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
return $xeGantt.$nextTick()
|
|
1758
|
+
},
|
|
1694
1759
|
callSlot (slotFunc: any, params: any, h: CreateElement) {
|
|
1695
1760
|
const $xeGantt = this
|
|
1696
1761
|
const slots = $xeGantt.$scopedSlots
|
|
@@ -1825,6 +1890,72 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1825
1890
|
|
|
1826
1891
|
$xeGantt.dispatchEvent('task-bar-dblclick', params, evnt)
|
|
1827
1892
|
},
|
|
1893
|
+
triggerTaskBarTooltipEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskBarMouseoverParams) {
|
|
1894
|
+
const $xeGantt = this
|
|
1895
|
+
const reactData = $xeGantt.reactData
|
|
1896
|
+
|
|
1897
|
+
const { barTipStore } = reactData
|
|
1898
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts
|
|
1899
|
+
const titleField = $xeGantt.computeTitleField
|
|
1900
|
+
const { contentMethod } = taskBarTooltipOpts
|
|
1901
|
+
const { row } = params
|
|
1902
|
+
let content = formatText(XEUtils.get(row, titleField))
|
|
1903
|
+
if (contentMethod) {
|
|
1904
|
+
content = formatText(contentMethod(params))
|
|
1905
|
+
}
|
|
1906
|
+
$xeGantt.handleTargetEnterEvent(barTipStore.row !== row)
|
|
1907
|
+
const tipContent = formatText(content)
|
|
1908
|
+
Object.assign(barTipStore, {
|
|
1909
|
+
row,
|
|
1910
|
+
visible: true,
|
|
1911
|
+
content: tipContent,
|
|
1912
|
+
params
|
|
1913
|
+
})
|
|
1914
|
+
$xeGantt.$nextTick(() => {
|
|
1915
|
+
const $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1916
|
+
if ($tooltip) {
|
|
1917
|
+
if ($tooltip.openByEvent) {
|
|
1918
|
+
$tooltip.openByEvent(evnt, evnt.currentTarget, tipContent)
|
|
1919
|
+
} else if ($tooltip.open) {
|
|
1920
|
+
$tooltip.open(evnt.currentTarget, tipContent)
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
})
|
|
1924
|
+
},
|
|
1925
|
+
handleTargetEnterEvent (isClear: boolean) {
|
|
1926
|
+
const $xeGantt = this
|
|
1927
|
+
const internalData = $xeGantt.internalData
|
|
1928
|
+
|
|
1929
|
+
const $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1930
|
+
clearTimeout(internalData.barTipTimeout)
|
|
1931
|
+
if (isClear) {
|
|
1932
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1933
|
+
} else {
|
|
1934
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1935
|
+
$tooltip.setActived(true)
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
},
|
|
1939
|
+
handleTaskBarTooltipLeaveEvent () {
|
|
1940
|
+
const $xeGantt = this
|
|
1941
|
+
const internalData = $xeGantt.internalData
|
|
1942
|
+
|
|
1943
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts
|
|
1944
|
+
let $tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1945
|
+
if ($tooltip && $tooltip.setActived) {
|
|
1946
|
+
$tooltip.setActived(false)
|
|
1947
|
+
}
|
|
1948
|
+
if (taskBarTooltipOpts.enterable) {
|
|
1949
|
+
internalData.barTipTimeout = setTimeout(() => {
|
|
1950
|
+
$tooltip = $xeGantt.$refs.refTooltip as VxeTooltipInstance
|
|
1951
|
+
if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
|
|
1952
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1953
|
+
}
|
|
1954
|
+
}, taskBarTooltipOpts.leaveDelay)
|
|
1955
|
+
} else {
|
|
1956
|
+
$xeGantt.closeTaskBarTooltip()
|
|
1957
|
+
}
|
|
1958
|
+
},
|
|
1828
1959
|
handleTaskHeaderContextmenuEvent (evnt: Event, params: VxeGanttDefines.TaskHeaderContextmenuParams) {
|
|
1829
1960
|
const $xeGantt = this
|
|
1830
1961
|
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -2335,13 +2466,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2335
2466
|
return childVNs
|
|
2336
2467
|
},
|
|
2337
2468
|
renderLayout (h: CreateElement) {
|
|
2469
|
+
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
|
|
2470
|
+
|
|
2338
2471
|
const $xeGantt = this
|
|
2472
|
+
const reactData = $xeGantt.reactData
|
|
2339
2473
|
const slots = $xeGantt.$scopedSlots
|
|
2340
2474
|
|
|
2475
|
+
const { barTipStore } = reactData
|
|
2341
2476
|
const currLayoutConf = $xeGantt.computeCurrLayoutConf
|
|
2342
2477
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf
|
|
2478
|
+
const taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts
|
|
2343
2479
|
const asideLeftSlot = slots.asideLeft || slots['aside-left']
|
|
2344
2480
|
const asideRightSlot = slots.asideRight || slots['aside-right']
|
|
2481
|
+
const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip']
|
|
2345
2482
|
return [
|
|
2346
2483
|
h('div', {
|
|
2347
2484
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
@@ -2368,7 +2505,42 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
2368
2505
|
}, $xeGantt.renderChildLayout(h, footKeys)),
|
|
2369
2506
|
h('div', {
|
|
2370
2507
|
ref: 'refPopupContainerElem'
|
|
2371
|
-
})
|
|
2508
|
+
}),
|
|
2509
|
+
h('div', {}, [
|
|
2510
|
+
/**
|
|
2511
|
+
* 任务条提示
|
|
2512
|
+
*/
|
|
2513
|
+
h(VxeUITooltipComponent, {
|
|
2514
|
+
key: 'gtp',
|
|
2515
|
+
ref: 'refTooltip',
|
|
2516
|
+
props: {
|
|
2517
|
+
theme: taskBarTooltipOpts.theme,
|
|
2518
|
+
enterable: taskBarTooltipOpts.enterable,
|
|
2519
|
+
enterDelay: taskBarTooltipOpts.enterDelay,
|
|
2520
|
+
leaveDelay: taskBarTooltipOpts.leaveDelay,
|
|
2521
|
+
useHTML: taskBarTooltipOpts.useHTML,
|
|
2522
|
+
width: taskBarTooltipOpts.width,
|
|
2523
|
+
height: taskBarTooltipOpts.height,
|
|
2524
|
+
minWidth: taskBarTooltipOpts.minWidth,
|
|
2525
|
+
minHeight: taskBarTooltipOpts.minHeight,
|
|
2526
|
+
maxWidth: taskBarTooltipOpts.maxWidth,
|
|
2527
|
+
maxHeight: taskBarTooltipOpts.maxHeight,
|
|
2528
|
+
isArrow: false
|
|
2529
|
+
},
|
|
2530
|
+
scopedSlots: taskBarTooltipSlot
|
|
2531
|
+
? {
|
|
2532
|
+
content: () => {
|
|
2533
|
+
const { row, content: tooltipContent } = barTipStore
|
|
2534
|
+
if (row) {
|
|
2535
|
+
return h('div', {
|
|
2536
|
+
}, taskBarTooltipSlot(Object.assign({ tooltipContent, $gantt: $xeGantt }, barTipStore.params)))
|
|
2537
|
+
}
|
|
2538
|
+
return renderEmptyElement($xeGantt)
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
: {}
|
|
2542
|
+
})
|
|
2543
|
+
])
|
|
2372
2544
|
]
|
|
2373
2545
|
},
|
|
2374
2546
|
renderVN (h: CreateElement): VNode {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { VxeGanttDefines } from '../../../types'
|
|
1
2
|
import type { VxeTableDefines, VxeTablePropTypes } from 'vxe-table'
|
|
2
3
|
|
|
3
4
|
export function getRefElem (refEl: any) {
|
|
@@ -10,3 +11,15 @@ export function getRefElem (refEl: any) {
|
|
|
10
11
|
export function getCellRestHeight (rowRest: VxeTableDefines.RowCacheItem, cellOpts: VxeTablePropTypes.CellConfig, rowOpts: VxeTablePropTypes.RowConfig, defaultRowHeight: number) {
|
|
11
12
|
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
export function getStandardGapTime (type: VxeGanttDefines.ColumnScaleType) {
|
|
16
|
+
switch (type) {
|
|
17
|
+
case 'hour':
|
|
18
|
+
return 1000 * 60 * 60
|
|
19
|
+
case 'minute':
|
|
20
|
+
return 1000 * 60
|
|
21
|
+
case 'second':
|
|
22
|
+
return 1000
|
|
23
|
+
}
|
|
24
|
+
return 1000 * 60 * 60 * 24
|
|
25
|
+
}
|
package/packages/ui/index.ts
CHANGED
package/packages/ui/src/utils.ts
CHANGED
|
@@ -8,6 +8,10 @@ export function isEnableConf (conf: any): boolean {
|
|
|
8
8
|
return conf && conf.enabled !== false
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export function isEmptyValue (cellValue: any) {
|
|
12
|
+
return cellValue === null || cellValue === undefined || cellValue === ''
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
export function nextZIndex () {
|
|
12
16
|
return DomZIndex.getNext()
|
|
13
17
|
}
|
|
@@ -39,6 +43,10 @@ export function getFuncText (content: string | number | boolean | null | undefin
|
|
|
39
43
|
return ''
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
export function formatText (value: any, placeholder?: any) {
|
|
47
|
+
return '' + (isEmptyValue(value) ? (placeholder ? VxeUI.getConfig().emptyCell : '') : value)
|
|
48
|
+
}
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* 判断值为:'' | null | undefined 时都属于空值
|
|
44
52
|
*/
|