vxe-gantt 3.2.4 → 3.2.6

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.
Files changed (48) hide show
  1. package/es/gantt/src/gantt-chart.js +91 -14
  2. package/es/gantt/src/gantt-view.js +46 -10
  3. package/es/gantt/src/gantt.js +13 -4
  4. package/es/gantt/src/static.js +6 -2
  5. package/es/gantt/src/util.js +8 -4
  6. package/es/gantt/style.css +28 -6
  7. package/es/gantt/style.min.css +1 -1
  8. package/es/style.css +1 -1
  9. package/es/style.min.css +1 -1
  10. package/es/ui/index.js +4 -1
  11. package/es/ui/src/log.js +1 -1
  12. package/es/ui/src/utils.js +3 -0
  13. package/es/vxe-gantt/style.css +28 -6
  14. package/es/vxe-gantt/style.min.css +1 -1
  15. package/lib/gantt/src/gantt-chart.js +75 -12
  16. package/lib/gantt/src/gantt-chart.min.js +1 -1
  17. package/lib/gantt/src/gantt-view.js +50 -15
  18. package/lib/gantt/src/gantt-view.min.js +1 -1
  19. package/lib/gantt/src/gantt.js +14 -2
  20. package/lib/gantt/src/gantt.min.js +1 -1
  21. package/lib/gantt/src/static.js +6 -2
  22. package/lib/gantt/src/static.min.js +1 -1
  23. package/lib/gantt/src/util.js +10 -5
  24. package/lib/gantt/src/util.min.js +1 -1
  25. package/lib/gantt/style/style.css +28 -6
  26. package/lib/gantt/style/style.min.css +1 -1
  27. package/lib/index.umd.js +163 -37
  28. package/lib/index.umd.min.js +1 -1
  29. package/lib/style.css +1 -1
  30. package/lib/style.min.css +1 -1
  31. package/lib/ui/index.js +4 -1
  32. package/lib/ui/index.min.js +1 -1
  33. package/lib/ui/src/log.js +1 -1
  34. package/lib/ui/src/log.min.js +1 -1
  35. package/lib/ui/src/utils.js +4 -0
  36. package/lib/ui/src/utils.min.js +1 -1
  37. package/lib/vxe-gantt/style/style.css +28 -6
  38. package/lib/vxe-gantt/style/style.min.css +1 -1
  39. package/package.json +3 -3
  40. package/packages/gantt/src/gantt-chart.ts +97 -14
  41. package/packages/gantt/src/gantt-view.ts +44 -10
  42. package/packages/gantt/src/gantt.ts +14 -3
  43. package/packages/gantt/src/static.ts +7 -3
  44. package/packages/gantt/src/util.ts +11 -7
  45. package/packages/ui/index.ts +3 -0
  46. package/packages/ui/src/utils.ts +4 -0
  47. package/styles/components/gantt-module/gantt-chart.scss +31 -4
  48. package/styles/theme/base.scss +1 -0
@@ -2,8 +2,8 @@ import { VNode, CreateElement } 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 { getCellRestHeight, hasMilestoneTask, gettaskType } from './util'
6
- import { getStringValue, isEnableConf } from '../../ui/src/utils'
5
+ import { getCellRestHeight, hasMilestoneTask, getTaskType, hasSubviewTask } from './util'
6
+ import { getStringValue, isEnableConf, hasEnableConf } from '../../ui/src/utils'
7
7
 
8
8
  import type { VxeComponentStyleType } from 'vxe-pc-ui'
9
9
  import type { TableInternalData, TableReactData, VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods } from 'vxe-table'
@@ -38,7 +38,7 @@ export default defineVxeComponent({
38
38
  //
39
39
  // Render
40
40
  //
41
- renderTaskBar (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, row: any, rowid: string, rowIndex: number, $rowIndex: number, _rowIndex: number) {
41
+ renderTaskBar (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, row: any, rowid: string, rowIndex: number, $rowIndex: number, _rowIndex: number, rowChildren: any[], isExpandTree: boolean) {
42
42
  const _vm = this
43
43
  const $xeGantt = _vm.$xeGantt
44
44
 
@@ -56,13 +56,14 @@ export default defineVxeComponent({
56
56
  const ganttSlots = $xeGantt.$scopedSlots
57
57
  const taskBarSlot = ganttSlots.taskBar || ganttSlots['task-bar']
58
58
 
59
- const { taskBarMilestoneConfig } = ganttProps
59
+ const { taskBarMilestoneConfig, taskBarSubviewConfig } = ganttProps
60
60
  const { activeLink, activeBarRowid } = ganttReactData
61
61
  const titleField = $xeGantt.computeTitleField
62
62
  const progressField = $xeGantt.computeProgressField
63
63
  const typeField = $xeGantt.computeTypeField
64
64
  const taskBarOpts = $xeGantt.computeTaskBarOpts
65
65
  const taskBarMilestoneOpts = $xeGantt.computeTaskBarMilestoneOpts
66
+ const taskBarSubviewOpts = $xeGantt.computeTaskBarSubviewOpts
66
67
  const scaleUnit = $xeGantt.computeScaleUnit
67
68
  const barParams = { $gantt: $xeGantt, row, scaleType: scaleUnit }
68
69
  const { showProgress, showContent, contentMethod, barStyle, moveable, showTooltip } = taskBarOpts
@@ -75,8 +76,9 @@ export default defineVxeComponent({
75
76
 
76
77
  let title = getStringValue(XEUtils.get(row, titleField))
77
78
  const progressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(row, progressField)))) : 0
78
- const typeValue = gettaskType(XEUtils.get(row, typeField))
79
- const isMilestone = !!(taskBarMilestoneConfig && hasMilestoneTask(typeValue))
79
+ const renderTaskType = getTaskType(XEUtils.get(row, typeField))
80
+ const isMilestone = !!(hasEnableConf(taskBarMilestoneConfig, taskBarMilestoneOpts) && hasMilestoneTask(renderTaskType))
81
+ const isSubview = !!(hasEnableConf(taskBarSubviewConfig, taskBarSubviewOpts) && hasSubviewTask(renderTaskType))
80
82
 
81
83
  const vbStyle: VxeComponentStyleType = {}
82
84
  const vpStyle: VxeComponentStyleType = {
@@ -148,7 +150,89 @@ export default defineVxeComponent({
148
150
  }, $xeGantt.callSlot(taskBarSlot, barParams, h))
149
151
  )
150
152
  } else {
151
- if (isMilestone) {
153
+ if (isSubview && rowChildren && rowChildren.length) {
154
+ if (isExpandTree) {
155
+ if (taskBarSubviewOpts.showOverview) {
156
+ cbVNs.push(
157
+ h('div', {
158
+ key: 'vcso',
159
+ class: ['vxe-gantt-view--chart-subview-wrapper is--overview', {
160
+ 'is--round': round,
161
+ 'is--move': moveable
162
+ }]
163
+ }, [
164
+ h('div', {
165
+ key: rowid,
166
+ attrs: {
167
+ rowid: rowid
168
+ },
169
+ class: 'vxe-gantt-view--chart-subview-bar'
170
+ }, [
171
+ h('div', {
172
+ class: 'vxe-gantt-view--chart-subview-bar-content-wrapper'
173
+ }, [
174
+ showContent
175
+ ? h('div', {
176
+ class: 'vxe-gantt-view--chart-content'
177
+ }, title)
178
+ : renderEmptyElement($xeGantt)
179
+ ])
180
+ ])
181
+ ])
182
+ )
183
+ }
184
+ } else {
185
+ cbVNs.push(
186
+ h('div', {
187
+ key: 'vcsc',
188
+ class: 'vxe-gantt-view--chart-subview-wrapper is--inline'
189
+ }, rowChildren.map(childRow => {
190
+ const childRowid = $xeTable.getRowid(childRow)
191
+ let childTitle = getStringValue(XEUtils.get(childRow, titleField))
192
+ const childProgressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(childRow, progressField)))) : 0
193
+ const childRenderTaskType = getTaskType(XEUtils.get(childRow, typeField))
194
+
195
+ const vpcStyle: VxeComponentStyleType = {
196
+ width: `${childProgressValue || 0}%`
197
+ }
198
+ if (isBarRowStyle) {
199
+ const { completedBgColor } = barStyObj
200
+ if (completedBgColor) {
201
+ vpcStyle.backgroundColor = completedBgColor
202
+ }
203
+ }
204
+
205
+ if (contentMethod) {
206
+ childTitle = getStringValue(contentMethod({ row: childRow, title: childTitle, scaleType: scaleUnit }))
207
+ }
208
+
209
+ return h('div', {
210
+ key: childRowid,
211
+ attrs: {
212
+ rowid: childRowid
213
+ },
214
+ class: ['vxe-gantt-view--chart-subview-bar', `is--${childRenderTaskType}`]
215
+ }, [
216
+ h('div', {
217
+ class: 'vxe-gantt-view--chart-subview-bar-content-wrapper'
218
+ }, [
219
+ showProgress
220
+ ? h('div', {
221
+ class: 'vxe-gantt-view--chart-progress',
222
+ style: vpcStyle
223
+ })
224
+ : renderEmptyElement($xeGantt),
225
+ showContent
226
+ ? h('div', {
227
+ class: 'vxe-gantt-view--chart-content'
228
+ }, childTitle)
229
+ : renderEmptyElement($xeGantt)
230
+ ])
231
+ ])
232
+ }))
233
+ )
234
+ }
235
+ } else if (isMilestone) {
152
236
  const { icon, iconStatus, iconStyle } = taskBarMilestoneOpts
153
237
  const tbmParams = { $gantt: $xeGantt, row }
154
238
  cbVNs.push(
@@ -181,14 +265,12 @@ export default defineVxeComponent({
181
265
  }, [
182
266
  showProgress
183
267
  ? h('div', {
184
- key: 'vcp',
185
268
  class: 'vxe-gantt-view--chart-progress',
186
269
  style: vpStyle
187
270
  })
188
271
  : renderEmptyElement($xeGantt),
189
272
  showContent
190
273
  ? h('div', {
191
- key: 'vcc',
192
274
  class: 'vxe-gantt-view--chart-content'
193
275
  }, title)
194
276
  : renderEmptyElement($xeGantt)
@@ -202,7 +284,7 @@ export default defineVxeComponent({
202
284
  attrs: {
203
285
  rowid
204
286
  },
205
- class: ['vxe-gantt-view--chart-row', `is--${gettaskType(typeValue)}`, {
287
+ class: ['vxe-gantt-view--chart-row', `is--${renderTaskType}`, {
206
288
  'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid],
207
289
  'is--round': round,
208
290
  'is--move': moveable
@@ -217,7 +299,7 @@ export default defineVxeComponent({
217
299
  }
218
300
  }, [
219
301
  h('div', {
220
- class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${gettaskType(typeValue)}`, {
302
+ class: [taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar', `is--${renderTaskType}`, {
221
303
  'is--active': activeBarRowid === rowid,
222
304
  'active--link': activeLink && (rowid === `${activeLink.from}` || rowid === `${activeLink.to}`)
223
305
  }],
@@ -268,16 +350,17 @@ export default defineVxeComponent({
268
350
  rowIndex = rowRest.index
269
351
  _rowIndex = rowRest._index
270
352
  }
271
- trVNs.push(_vm.renderTaskBar(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex))
272
353
  let isExpandTree = false
273
354
  let rowChildren: any[] = []
274
355
 
275
- if (treeConfig && !scrollYLoad && !transform) {
356
+ if (treeConfig) {
276
357
  rowChildren = row[childrenField]
277
358
  isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid]
278
359
  }
360
+
361
+ trVNs.push(_vm.renderTaskBar(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, rowChildren, isExpandTree))
279
362
  // 如果是树形表格
280
- if (isExpandTree) {
363
+ if (treeConfig && isExpandTree && !scrollYLoad && !transform) {
281
364
  trVNs.push(..._vm.renderTaskRows(h, $xeTable, rowChildren))
282
365
  }
283
366
  })
@@ -2,7 +2,7 @@ import { VNode, CreateElement } from 'vue'
2
2
  import { defineVxeComponent } from '../../ui/src/comp'
3
3
  import { VxeUI } from '@vxe-ui/core'
4
4
  import { setScrollTop, setScrollLeft, removeClass, addClass, hasClass } from '../../ui/src/dom'
5
- import { getRefElem, getStandardGapTime, getTaskBarLeft, getTaskBarWidth, hasMilestoneTask } from './util'
5
+ import { getRefElem, getStandardGapTime, getTaskBarLeft, getTaskBarWidth, hasMilestoneTask, getTaskType, hasSubviewTask } from './util'
6
6
  import XEUtils from 'xe-utils'
7
7
  import GanttViewHeaderComponent from './gantt-header'
8
8
  import GanttViewBodyComponent from './gantt-body'
@@ -96,13 +96,20 @@ function updateTodayData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPr
96
96
 
97
97
  const ganttReactData = $xeGantt.reactData
98
98
  const { taskScaleList } = ganttReactData
99
+ const minScale = $xeGantt.computeMinScale
99
100
  const weekScale = taskScaleList.find(item => item.type === 'week')
101
+ const isMinWeek = minScale.type === 'week'
100
102
  const itemDate = new Date()
101
- const [yyyy, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-')
103
+ let [yyyy, M, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-MM-dd-HH-mm-ss').split('-')
102
104
  const e = itemDate.getDay()
103
105
  const E = e + 1
104
106
  const q = Math.ceil((itemDate.getMonth() + 1) / 3)
105
- const W = XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)
107
+ const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`
108
+ if (isMinWeek && checkWeekOfsetYear(W, M)) {
109
+ yyyy = `${Number(yyyy) + 1}`
110
+ M = '1'
111
+ MM = '0' + M
112
+ }
106
113
  internalData.todayDateMaps = {
107
114
  year: yyyy,
108
115
  quarter: `${yyyy}_q${q}`,
@@ -549,14 +556,23 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
549
556
  const rowid = $xeTable.getRowid(row)
550
557
  let startValue = XEUtils.get(row, startField)
551
558
  let endValue = XEUtils.get(row, endField)
552
- const isMilestone = hasMilestoneTask(XEUtils.get(row, typeField))
559
+ const renderTaskType = getTaskType(XEUtils.get(row, typeField))
560
+ const isMilestone = hasMilestoneTask(renderTaskType)
561
+ const isSubview = hasSubviewTask(renderTaskType)
553
562
  if (isMilestone) {
554
563
  if (!startValue) {
555
564
  startValue = endValue
556
565
  }
557
566
  endValue = startValue
558
567
  }
559
- if (startValue && endValue) {
568
+ if (isSubview) {
569
+ ctMaps[rowid] = {
570
+ row,
571
+ rowid,
572
+ oLeftSize: 0,
573
+ oWidthSize: 0
574
+ }
575
+ } else if (startValue && endValue) {
560
576
  const { offsetLeftSize, offsetWidthSize } = renderFn(startValue, endValue)
561
577
  ctMaps[rowid] = {
562
578
  row,
@@ -691,7 +707,7 @@ function calcScrollbar ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPriv
691
707
  }
692
708
  }
693
709
 
694
- function updateTaskChart ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
710
+ function updateTaskChartStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
695
711
  const $xeGantt = $xeGanttView.$xeGantt
696
712
  const reactData = $xeGanttView.reactData
697
713
  const internalData = $xeGanttView.internalData
@@ -713,9 +729,27 @@ function updateTaskChart ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPr
713
729
  return
714
730
  }
715
731
  const chartRest = rowid ? chartMaps[rowid] : null
716
- barEl.style.left = `${getTaskBarLeft(chartRest, viewCellWidth)}px`
717
- if (!hasClass(barEl, 'is--milestone')) {
718
- barEl.style.width = `${getTaskBarWidth(chartRest, viewCellWidth)}px`
732
+ // 子任务视图
733
+ if (hasClass(barEl, 'is--subview')) {
734
+ const childWrapperEl = barEl.firstElementChild as HTMLDivElement
735
+ if (childWrapperEl) {
736
+ XEUtils.arrayEach(childWrapperEl.children, (childEl) => {
737
+ const childBarEl = childEl as HTMLDivElement
738
+ const childRowid = childBarEl.getAttribute('rowid') || ''
739
+ const childChartRest = childRowid ? chartMaps[childRowid] : null
740
+ childBarEl.style.left = `${getTaskBarLeft(childChartRest, viewCellWidth)}px`
741
+ // 里程碑不需要宽度
742
+ if (!hasClass(childBarEl, 'is--milestone')) {
743
+ childBarEl.style.width = `${getTaskBarWidth(childChartRest, viewCellWidth)}px`
744
+ }
745
+ })
746
+ }
747
+ } else {
748
+ barEl.style.left = `${getTaskBarLeft(chartRest, viewCellWidth)}px`
749
+ // 里程碑不需要宽度
750
+ if (!hasClass(barEl, 'is--milestone')) {
751
+ barEl.style.width = `${getTaskBarWidth(chartRest, viewCellWidth)}px`
752
+ }
719
753
  }
720
754
  })
721
755
  }
@@ -852,7 +886,7 @@ function updateStyle ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
852
886
  reactData.scrollXWidth = viewTableWidth
853
887
 
854
888
  return Promise.all([
855
- updateTaskChart($xeGanttView),
889
+ updateTaskChartStyle($xeGanttView),
856
890
  $xeGantt.handleUpdateTaskLinkStyle ? $xeGantt.handleUpdateTaskLinkStyle($xeGanttView) : null
857
891
  ])
858
892
  }
@@ -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, formatText } from '../../ui/src/utils'
5
+ import { getLastZIndex, nextZIndex, isEnableConf, hasEnableConf, 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'
@@ -174,6 +174,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
174
174
  taskLinkConfig: Object as PropType<VxeGanttPropTypes.TaskLinkConfig>,
175
175
  taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
176
176
  taskBarMilestoneConfig: Object as PropType<VxeGanttPropTypes.TaskBarMilestoneConfig>,
177
+ taskBarSubviewConfig: Object as PropType<VxeGanttPropTypes.TaskBarSubviewConfig>,
177
178
  taskBarTooltipConfig: Object as PropType<VxeGanttPropTypes.TaskBarTooltipConfig>,
178
179
  taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
179
180
  taskBarResizeConfig: Object as PropType<VxeGanttPropTypes.TaskBarResizeConfig>,
@@ -299,6 +300,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
299
300
 
300
301
  return Object.assign({}, getConfig().gantt.taskBarMilestoneConfig, props.taskBarMilestoneConfig)
301
302
  },
303
+ computeTaskBarSubviewOpts () {
304
+ const $xeGantt = this
305
+ const props = $xeGantt
306
+
307
+ return Object.assign({}, getConfig().gantt.taskBarSubviewConfig, props.taskBarSubviewConfig)
308
+ },
302
309
  computeTaskBarTooltipOpts () {
303
310
  const $xeGantt = this
304
311
  const props = $xeGantt
@@ -404,12 +411,13 @@ export default /* define-vxe-component start */ defineVxeComponent({
404
411
  const props = $xeGantt
405
412
  const reactData = $xeGantt.reactData
406
413
 
407
- const { height, maxHeight } = props
414
+ const { height, maxHeight, taskBarSubviewConfig } = props
408
415
  const { isZMax, tZindex } = reactData
409
416
  const taskViewOpts = $xeGantt.computeTaskViewOpts as VxeGanttPropTypes.TaskViewConfig
410
417
  const { tableStyle } = taskViewOpts
411
418
  const taskBarOpts = $xeGantt.computeTaskBarOpts as VxeGanttPropTypes.TaskBarConfig
412
419
  const { barStyle } = taskBarOpts
420
+ const taskBarSubviewOpts = $xeGantt.computeTaskBarSubviewOpts
413
421
  const stys: VxeComponentStyleType = {}
414
422
  if (isZMax) {
415
423
  stys.zIndex = tZindex
@@ -422,13 +430,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
422
430
  }
423
431
  }
424
432
  if (barStyle && !XEUtils.isFunction(barStyle)) {
425
- const { bgColor, completedBgColor } = barStyle
433
+ const { bgColor, completedBgColor, overviewBgColor } = barStyle
426
434
  if (bgColor) {
427
435
  stys['--vxe-ui-gantt-view-task-bar-background-color'] = bgColor
428
436
  }
429
437
  if (completedBgColor) {
430
438
  stys['--vxe-ui-gantt-view-task-bar-completed-background-color'] = completedBgColor
431
439
  }
440
+ if (overviewBgColor && hasEnableConf(taskBarSubviewConfig, taskBarSubviewOpts)) {
441
+ stys['--vxe-ui-gantt-view-task-bar-overview-background-color'] = overviewBgColor
442
+ }
432
443
  }
433
444
  if (tableStyle) {
434
445
  const { width: defTbWidth } = tableStyle
@@ -21,11 +21,15 @@ export enum VxeGanttDependencyType {
21
21
  }
22
22
 
23
23
  /**
24
- * 任务类型
24
+ * 任务渲染类型
25
25
  */
26
26
  export enum VxeGanttTaskType {
27
27
  /**
28
- * 里程碑
28
+ * 里程碑类型,该类型节点不需要结束日期
29
29
  */
30
- Milestone = 'milestone'
30
+ Milestone = 'milestone',
31
+ /**
32
+ * 子视图类型,该类型会将子任务渲染到一行,无需开始日期和结束日期
33
+ */
34
+ Subview = 'subview'
31
35
  }
@@ -1,4 +1,4 @@
1
- import type { VxeGanttDefines } from '../../../types'
1
+ import type { VxeGanttDefines, VxeGanttTaskType } from '../../../types'
2
2
  import type { VxeTableDefines, VxeTablePropTypes } from 'vxe-table'
3
3
 
4
4
  export function getRefElem (refEl: any) {
@@ -29,15 +29,19 @@ export function getTaskBarLeft (chartRest: VxeGanttDefines.RowCacheItem | null,
29
29
  }
30
30
 
31
31
  export function getTaskBarWidth (chartRest: VxeGanttDefines.RowCacheItem | null, viewCellWidth: number) {
32
- return Math.max(1, chartRest ? (Math.floor(viewCellWidth * chartRest.oWidthSize) - 1) : 0)
32
+ return chartRest && chartRest.oWidthSize ? Math.max(1, chartRest ? (Math.floor(viewCellWidth * chartRest.oWidthSize) - 1) : 0) : 0
33
33
  }
34
34
 
35
- const taskTypeMaps: Record<string, boolean> = {
36
- milestone: true
35
+ const taskTypeMaps: Record<VxeGanttTaskType, boolean> = {
36
+ milestone: true,
37
+ subview: true
37
38
  }
38
39
  export function hasMilestoneTask (type: string) {
39
- return taskTypeMaps[type]
40
+ return type === 'milestone'
40
41
  }
41
- export function gettaskType (type: string) {
42
- return taskTypeMaps[type] ? type : 'default'
42
+ export function hasSubviewTask (type: string) {
43
+ return type === 'subview'
44
+ }
45
+ export function getTaskType (type: string) {
46
+ return taskTypeMaps[type as VxeGanttTaskType] ? type as VxeGanttTaskType : 'default'
43
47
  }
@@ -95,6 +95,9 @@ setConfig({
95
95
  resize: true,
96
96
  showCollapseTableButton: true,
97
97
  showCollapseTaskButton: true
98
+ },
99
+ taskBarSubviewConfig: {
100
+ // showOverview: false
98
101
  }
99
102
  }
100
103
  })
@@ -8,6 +8,10 @@ export function isEnableConf (conf: any): boolean {
8
8
  return conf && conf.enabled !== false
9
9
  }
10
10
 
11
+ export function hasEnableConf (conf: any, opts: any): boolean {
12
+ return opts && (conf ? opts.enabled !== false : opts.enabled)
13
+ }
14
+
11
15
  export function isEmptyValue (cellValue: any) {
12
16
  return cellValue === null || cellValue === undefined || cellValue === ''
13
17
  }
@@ -13,7 +13,8 @@
13
13
  width: 100%;
14
14
  height: 0;
15
15
  &.row--pending {
16
- .vxe-gantt-view--chart-bar {
16
+ .vxe-gantt-view--chart-bar,
17
+ .vxe-gantt-view--chart-subview-bar {
17
18
  color: var(--vxe-ui-font-disabled-color);
18
19
  opacity: 0.5;
19
20
  text-decoration: line-through;
@@ -35,7 +36,30 @@
35
36
  }
36
37
  }
37
38
  }
39
+ .vxe-gantt-view--chart-subview-wrapper {
40
+ &.is--round {
41
+ & > .vxe-gantt-view--chart-subview-bar {
42
+ border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
43
+ .vxe-gantt-view--chart-subview-bar-content-wrapper {
44
+ border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
45
+ }
46
+ &:hover {
47
+ &::after {
48
+ border-radius: var(--vxe-ui-gantt-view-task-bar-border-radius);
49
+ }
50
+ }
51
+ }
52
+ }
53
+ &.is--overview {
54
+ & > .vxe-gantt-view--chart-subview-bar {
55
+ color: #ffffff;
56
+ background-color: var(--vxe-ui-gantt-view-task-bar-overview-background-color);
57
+ }
58
+ }
59
+ }
60
+
38
61
  .vxe-gantt-view--chart-bar,
62
+ .vxe-gantt-view--chart-subview-bar,
39
63
  .vxe-gantt-view--chart-custom-bar {
40
64
  display: flex;
41
65
  flex-direction: row;
@@ -50,18 +74,21 @@
50
74
  }
51
75
  }
52
76
  .vxe-gantt-view--chart-bar-content-wrapper,
53
- .vxe-gantt-view--chart-custom-bar-content-wrapper {
77
+ .vxe-gantt-view--chart-custom-bar-content-wrapper,
78
+ .vxe-gantt-view--chart-subview-bar-content-wrapper {
54
79
  width: 100%;
55
80
  overflow: hidden;
56
81
  }
57
- .vxe-gantt-view--chart-bar-content-wrapper {
82
+ .vxe-gantt-view--chart-bar-content-wrapper,
83
+ .vxe-gantt-view--chart-subview-bar-content-wrapper {
58
84
  width: 100%;
59
85
  height: 100%;
60
86
  display: flex;
61
87
  flex-direction: row;
62
88
  align-items: center;
63
89
  }
64
- .vxe-gantt-view--chart-bar {
90
+ .vxe-gantt-view--chart-bar,
91
+ .vxe-gantt-view--chart-subview-bar {
65
92
  align-items: center;
66
93
  height: var(--vxe-ui-gantt-view-chart-bar-height);
67
94
  &.is--default {
@@ -8,6 +8,7 @@
8
8
  --vxe-ui-gantt-view-task-bar-border-radius: calc(var(--vxe-ui-gantt-view-split-bar-height) / 2);
9
9
  --vxe-ui-gantt-view-task-bar-background-color: var(--vxe-ui-font-primary-lighten-color);
10
10
  --vxe-ui-gantt-view-task-bar-completed-background-color: var(--vxe-ui-font-primary-color);
11
+ --vxe-ui-gantt-view-task-bar-overview-background-color: var(--vxe-ui-font-primary-darken-color);
11
12
  --vxe-ui-gantt-view-task-line-color: var(--vxe-ui-font-primary-color);
12
13
  --vxe-ui-gantt-view-task-line-width: 2px;
13
14
  --vxe-ui-gantt-view-task-line-arrow-width: 5;