vxe-gantt 3.0.7 → 3.0.9

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 (38) hide show
  1. package/es/gantt/src/gantt-body.js +8 -0
  2. package/es/gantt/src/gantt-header.js +19 -5
  3. package/es/gantt/src/gantt-view.js +57 -42
  4. package/es/gantt/src/gantt.js +0 -3
  5. package/es/gantt/style.css +19 -4
  6. package/es/gantt/style.min.css +1 -1
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-gantt/style.css +19 -4
  12. package/es/vxe-gantt/style.min.css +1 -1
  13. package/lib/gantt/src/gantt-body.js +10 -0
  14. package/lib/gantt/src/gantt-body.min.js +1 -1
  15. package/lib/gantt/src/gantt-header.js +21 -4
  16. package/lib/gantt/src/gantt-header.min.js +1 -1
  17. package/lib/gantt/src/gantt-view.js +78 -50
  18. package/lib/gantt/src/gantt-view.min.js +1 -1
  19. package/lib/gantt/src/gantt.js +0 -3
  20. package/lib/gantt/src/gantt.min.js +1 -1
  21. package/lib/gantt/style/style.css +19 -4
  22. package/lib/gantt/style/style.min.css +1 -1
  23. package/lib/index.umd.js +110 -59
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/ui/index.js +1 -1
  28. package/lib/ui/index.min.js +1 -1
  29. package/lib/ui/src/log.js +1 -1
  30. package/lib/ui/src/log.min.js +1 -1
  31. package/lib/vxe-gantt/style/style.css +19 -4
  32. package/lib/vxe-gantt/style/style.min.css +1 -1
  33. package/package.json +2 -2
  34. package/packages/gantt/src/gantt-body.ts +9 -0
  35. package/packages/gantt/src/gantt-header.ts +18 -5
  36. package/packages/gantt/src/gantt-view.ts +57 -43
  37. package/packages/gantt/src/gantt.ts +0 -3
  38. package/styles/components/gantt.scss +21 -3
@@ -20,6 +20,7 @@ function createInternalData (): GanttViewInternalData {
20
20
  startMaps: {},
21
21
  endMaps: {},
22
22
  chartMaps: {},
23
+ todayDateMaps: {},
23
24
  elemStore: {},
24
25
  // 存放横向 X 虚拟滚动相关的信息
25
26
  scrollXStore: {
@@ -47,6 +48,32 @@ function parseStringDate ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPr
47
48
  return XEUtils.toStringDate(dateValue, dateFormat || null)
48
49
  }
49
50
 
51
+ function updateTodayData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
52
+ const $xeGantt = $xeGanttView.$xeGantt
53
+ const internalData = $xeGanttView.internalData
54
+
55
+ const ganttReactData = $xeGantt.reactData
56
+ const { taskScaleList } = ganttReactData
57
+ const weekScale = taskScaleList.find(item => item.type === 'week')
58
+ const itemDate = new Date()
59
+ const [yyyy, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-')
60
+ const e = itemDate.getDay()
61
+ const E = e + 1
62
+ const q = Math.ceil((itemDate.getMonth() + 1) / 3)
63
+ const W = XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)
64
+ internalData.todayDateMaps = {
65
+ year: yyyy,
66
+ quarter: `${yyyy}_q${q}`,
67
+ month: `${yyyy}_${MM}`,
68
+ week: `${yyyy}_W${W}`,
69
+ day: `${yyyy}_${MM}_${dd}_E${E}`,
70
+ date: `${yyyy}_${MM}_${dd}`,
71
+ hour: `${yyyy}_${MM}_${dd}_${HH}`,
72
+ minute: `${yyyy}_${MM}_${dd}_${HH}_${mm}`,
73
+ second: `${yyyy}_${MM}_${dd}_${HH}_${mm}_${ss}`
74
+ }
75
+ }
76
+
50
77
  function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods) {
51
78
  const $xeGantt = $xeGanttView.$xeGantt
52
79
  const reactData = $xeGanttView.reactData
@@ -57,12 +84,9 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
57
84
  const { treeConfig } = ganttProps
58
85
  const { taskScaleList } = ganttReactData
59
86
  const { minViewDate, maxViewDate } = reactData
60
- const { scrollXStore } = internalData
61
87
  const minScale = XEUtils.last(taskScaleList)
62
88
  const fullCols: VxeGanttDefines.ViewColumn[] = []
63
89
  const groupCols: VxeGanttDefines.GroupColumn[] = []
64
- scrollXStore.startIndex = 0
65
- scrollXStore.endIndex = 1
66
90
  if (minScale && minViewDate && maxViewDate) {
67
91
  const minSType = minScale.type
68
92
  const weekScale = taskScaleList.find(item => item.type === 'week')
@@ -85,38 +109,6 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
85
109
  const diffDayNum = maxViewDate.getTime() - minViewDate.getTime()
86
110
  const countSize = Math.max(5, Math.floor(diffDayNum / gapTime) + 1)
87
111
 
88
- // switch (minScale.type) {
89
- // case 'day':
90
- // case 'date':
91
- // if (diffDayNum > (1000 * 60 * 60 * 24 * 366 * 3)) {
92
- // reactData.tableColumn = []
93
- // reactData.headerGroups = []
94
- // return
95
- // }
96
- // break
97
- // case 'hour':
98
- // if (diffDayNum > (1000 * 60 * 60 * 24 * 31 * 3)) {
99
- // reactData.tableColumn = []
100
- // reactData.headerGroups = []
101
- // return
102
- // }
103
- // break
104
- // case 'minute':
105
- // if (diffDayNum > (1000 * 60 * 60 * 24 * 3)) {
106
- // reactData.tableColumn = []
107
- // reactData.headerGroups = []
108
- // return
109
- // }
110
- // break
111
- // case 'second':
112
- // if (diffDayNum > (1000 * 60 * 60 * 3)) {
113
- // reactData.tableColumn = []
114
- // reactData.headerGroups = []
115
- // return
116
- // }
117
- // break
118
- // }
119
-
120
112
  const renderListMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn[]> = {
121
113
  year: [],
122
114
  quarter: [],
@@ -269,8 +261,11 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
269
261
  if ($xeTable) {
270
262
  const startField = $xeGantt.computeStartField
271
263
  const endField = $xeGantt.computeEndField
264
+ const tableReactData = $xeTable as unknown as TableReactData
265
+ const { isRowGroupStatus } = tableReactData
272
266
  const tableInternalData = $xeTable as unknown as TableInternalData
273
- const { afterFullData, afterTreeFullData } = tableInternalData
267
+ const { afterFullData, afterTreeFullData, afterGroupFullData } = tableInternalData
268
+ const aggregateOpts = $xeTable.computeAggregateOpts
274
269
  const treeOpts = $xeTable.computeTreeOpts
275
270
  const { transform } = treeOpts
276
271
  const childrenField = treeOpts.children || treeOpts.childrenField
@@ -294,7 +289,14 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
294
289
  }
295
290
  }
296
291
 
297
- if (treeConfig) {
292
+ if (isRowGroupStatus) {
293
+ // 行分组
294
+ const mapChildrenField = aggregateOpts.mapChildrenField
295
+ if (mapChildrenField) {
296
+ XEUtils.eachTree(afterGroupFullData, handleParseRender, { children: mapChildrenField })
297
+ }
298
+ } else if (treeConfig) {
299
+ // 树结构
298
300
  XEUtils.eachTree(afterTreeFullData, handleParseRender, { children: transform ? treeOpts.mapChildrenField : childrenField })
299
301
  } else {
300
302
  afterFullData.forEach(handleParseRender)
@@ -304,6 +306,7 @@ function handleParseColumn ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
304
306
  }
305
307
  internalData.visibleColumn = fullCols
306
308
  reactData.headerGroups = groupCols
309
+ updateTodayData($xeGanttView)
307
310
  updateScrollXStatus($xeGanttView)
308
311
  handleTableColumn($xeGanttView)
309
312
  }
@@ -315,6 +318,7 @@ function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewP
315
318
 
316
319
  const ganttProps = $xeGantt
317
320
  const { treeConfig } = ganttProps
321
+ const { scrollXStore } = internalData
318
322
  const $xeTable = internalData.xeTable
319
323
  const sdMaps: Record<string, any> = {}
320
324
  const edMaps: Record<string, any> = {}
@@ -323,8 +327,11 @@ function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewP
323
327
  if ($xeTable) {
324
328
  const startField = $xeGantt.computeStartField
325
329
  const endField = $xeGantt.computeEndField
330
+ const tableReactData = $xeTable as unknown as TableReactData
331
+ const { isRowGroupStatus } = tableReactData
326
332
  const tableInternalData = $xeTable as unknown as TableInternalData
327
- const { afterFullData, afterTreeFullData } = tableInternalData
333
+ const { afterFullData, afterTreeFullData, afterGroupFullData } = tableInternalData
334
+ const aggregateOpts = $xeTable.computeAggregateOpts
328
335
  const treeOpts = $xeTable.computeTreeOpts
329
336
  const { transform } = treeOpts
330
337
  const childrenField = treeOpts.children || treeOpts.childrenField
@@ -344,12 +351,21 @@ function handleUpdateData ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewP
344
351
  }
345
352
  }
346
353
 
347
- if (treeConfig) {
354
+ if (isRowGroupStatus) {
355
+ // 行分组
356
+ const mapChildrenField = aggregateOpts.mapChildrenField
357
+ if (mapChildrenField) {
358
+ XEUtils.eachTree(afterGroupFullData, handleMinMaxData, { children: mapChildrenField })
359
+ }
360
+ } else if (treeConfig) {
361
+ // 树结构
348
362
  XEUtils.eachTree(afterTreeFullData, handleMinMaxData, { children: transform ? treeOpts.mapChildrenField : childrenField })
349
363
  } else {
350
364
  afterFullData.forEach(handleMinMaxData)
351
365
  }
352
366
  }
367
+ scrollXStore.startIndex = 0
368
+ scrollXStore.endIndex = Math.max(1, scrollXStore.visibleSize)
353
369
  reactData.minViewDate = minDate
354
370
  reactData.maxViewDate = maxDate
355
371
  internalData.startMaps = sdMaps
@@ -401,10 +417,8 @@ function updateChart ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
401
417
  }
402
418
  const rowid = rowEl.getAttribute('rowid')
403
419
  const rowRest = rowid ? chartMaps[rowid] : null
404
- if (rowRest) {
405
- barEl.style.left = `${viewCellWidth * rowRest.oLeftSize}px`
406
- barEl.style.width = `${viewCellWidth * rowRest.oWidthSize}px`
407
- }
420
+ barEl.style.left = `${rowRest ? viewCellWidth * rowRest.oLeftSize : 0}px`
421
+ barEl.style.width = `${rowRest ? viewCellWidth * rowRest.oWidthSize : 0}px`
408
422
  })
409
423
  }
410
424
  return $xeGanttView.$nextTick()
@@ -2221,9 +2221,6 @@ export default /* define-vxe-component start */ defineVxeComponent({
2221
2221
  if (props.expandConfig) {
2222
2222
  warnLog('vxe.error.notProp', ['expand-config'])
2223
2223
  }
2224
- if (props.aggregateConfig) {
2225
- warnLog('vxe.error.notProp', ['aggregate-config'])
2226
- }
2227
2224
 
2228
2225
  $xeGantt.$nextTick(() => {
2229
2226
  if (props.formConfig) {
@@ -76,14 +76,16 @@
76
76
  .vxe-gantt--view-split-bar {
77
77
  flex-shrink: 0;
78
78
  width: var(--vxe-ui-gantt-view-split-bar-width);
79
+ &.is--resize {
80
+ cursor: col-resize;
81
+ }
82
+ }
83
+ .vxe-gantt--view-split-bar-handle {
79
84
  background-color: var(--vxe-ui-gantt-view-split-bar-background-color);
80
85
  &:hover,
81
86
  &:active {
82
87
  background-color: var(--vxe-ui-gantt-view-split-bar-hover-background-color);
83
88
  }
84
- &.is--resize {
85
- cursor: col-resize;
86
- }
87
89
  }
88
90
  &.show--left {
89
91
  .vxe-gantt--table-wrapper {
@@ -588,6 +590,22 @@
588
590
  text-align: center;
589
591
  font-size: 1em;
590
592
  height: var(--vxe-ui-gantt-view-cell-height, var(--vxe-ui-table-row-line-height));
593
+ &.is--now {
594
+ color: var(--vxe-ui-font-primary-color);
595
+ }
596
+ }
597
+ .vxe-gantt-view--body-column {
598
+ &.is--now {
599
+ &::before {
600
+ content: "";
601
+ position: absolute;
602
+ top: 0;
603
+ left: 0;
604
+ width: 1px;
605
+ height: 100%;
606
+ background-color: var(--vxe-ui-font-primary-color);
607
+ }
608
+ }
591
609
  }
592
610
  .vxe-gantt-view--header-column,
593
611
  .vxe-gantt-view--body-column,