vxe-gantt 3.0.5 → 3.0.7

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 (42) hide show
  1. package/es/gantt/src/gantt-chart.js +18 -4
  2. package/es/gantt/src/gantt-header.js +19 -10
  3. package/es/gantt/src/gantt-view.js +265 -154
  4. package/es/gantt/src/gantt.js +10 -10
  5. package/es/gantt/style.css +7 -1
  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 +7 -1
  12. package/es/vxe-gantt/style.min.css +1 -1
  13. package/lib/gantt/src/gantt-chart.js +22 -5
  14. package/lib/gantt/src/gantt-chart.min.js +1 -1
  15. package/lib/gantt/src/gantt-header.js +24 -15
  16. package/lib/gantt/src/gantt-header.min.js +1 -1
  17. package/lib/gantt/src/gantt-view.js +285 -158
  18. package/lib/gantt/src/gantt-view.min.js +1 -1
  19. package/lib/gantt/src/gantt.js +9 -9
  20. package/lib/gantt/src/gantt.min.js +1 -1
  21. package/lib/gantt/style/style.css +7 -1
  22. package/lib/gantt/style/style.min.css +1 -1
  23. package/lib/index.umd.js +345 -190
  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 +7 -1
  32. package/lib/vxe-gantt/style/style.min.css +1 -1
  33. package/package.json +3 -3
  34. package/packages/gantt/src/gantt-chart.ts +20 -4
  35. package/packages/gantt/src/gantt-header.ts +20 -11
  36. package/packages/gantt/src/gantt-view.ts +289 -168
  37. package/packages/gantt/src/gantt.ts +8 -8
  38. package/styles/components/gantt-module/gantt-chart.scss +2 -0
  39. package/styles/components/gantt.scss +6 -1
  40. package/styles/theme/base.scss +1 -1
  41. package/styles/theme/dark.scss +1 -0
  42. package/styles/theme/light.scss +1 -0
@@ -41,13 +41,28 @@ export default defineVxeComponent({
41
41
  const progressField = $xeGantt.computeProgressField;
42
42
  const taskBarOpts = $xeGantt.computeTaskBarOpts;
43
43
  const { showProgress, showContent, contentMethod, barStyle } = taskBarOpts;
44
- const { round } = barStyle || {};
44
+ const isBarRowStyle = XEUtils.isFunction(barStyle);
45
+ const barStyObj = (barStyle ? (isBarRowStyle ? barStyle({ row, $gantt: $xeGantt }) : barStyle) : {}) || {};
46
+ const { round } = barStyObj;
45
47
  const rowRest = fullAllDataRowIdData[rowid] || {};
46
48
  const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
47
49
  const isRsHeight = resizeHeight > 0;
48
50
  const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
49
51
  let title = getStringValue(XEUtils.get(row, titleField));
50
52
  const progressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(row, progressField)))) : 0;
53
+ const vbStyle = {};
54
+ const vpStyle = {
55
+ width: `${progressValue || 0}%`
56
+ };
57
+ if (isBarRowStyle) {
58
+ const { bgColor, completedBgColor } = barStyObj;
59
+ if (bgColor) {
60
+ vbStyle.backgroundColor = bgColor;
61
+ }
62
+ if (completedBgColor) {
63
+ vpStyle.backgroundColor = completedBgColor;
64
+ }
65
+ }
51
66
  if (contentMethod) {
52
67
  title = getStringValue(contentMethod({ row, title }));
53
68
  }
@@ -66,6 +81,7 @@ export default defineVxeComponent({
66
81
  }, [
67
82
  h('div', {
68
83
  class: taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar',
84
+ style: vbStyle,
69
85
  attrs: {
70
86
  rowid
71
87
  },
@@ -83,9 +99,7 @@ export default defineVxeComponent({
83
99
  showProgress
84
100
  ? h('div', {
85
101
  class: 'vxe-gantt-view--chart-progress',
86
- style: {
87
- width: `${progressValue}%`
88
- }
102
+ style: vpStyle
89
103
  })
90
104
  : renderEmptyElement($xeGantt),
91
105
  showContent
@@ -18,9 +18,12 @@ export default defineVxeComponent({
18
18
  //
19
19
  renderVN(h) {
20
20
  const _vm = this;
21
+ const $xeGantt = _vm.$xeGantt;
21
22
  const $xeGanttView = _vm.$xeGanttView;
22
- const { reactData } = $xeGanttView;
23
- const { tableColumn, headerGroups, viewCellWidth } = reactData;
23
+ const reactData = $xeGanttView.reactData;
24
+ const internalData = $xeGanttView.internalData;
25
+ const { headerGroups, viewCellWidth } = reactData;
26
+ const { visibleColumn } = internalData;
24
27
  return h('div', {
25
28
  ref: 'refElem',
26
29
  class: 'vxe-gantt-view--header-wrapper'
@@ -40,7 +43,7 @@ export default defineVxeComponent({
40
43
  ref: 'refHeaderTable',
41
44
  class: 'vxe-gantt-view--header-table'
42
45
  }, [
43
- h('colgroup', {}, tableColumn.map((column, cIndex) => {
46
+ h('colgroup', {}, visibleColumn.map((column, cIndex) => {
44
47
  return h('col', {
45
48
  key: cIndex,
46
49
  style: {
@@ -49,11 +52,12 @@ export default defineVxeComponent({
49
52
  });
50
53
  })),
51
54
  h('thead', {}, headerGroups.map(({ scaleItem, columns }, $rowIndex) => {
52
- const { type, titleMethod } = scaleItem;
55
+ const { type, titleMethod, slots } = scaleItem;
56
+ const titleSlot = slots ? slots.title : null;
53
57
  return h('tr', {
54
58
  key: $rowIndex
55
59
  }, columns.map((column, cIndex) => {
56
- const dateObj = column.params;
60
+ const { childCount, dateObj } = column;
57
61
  let label = `${column.title}`;
58
62
  if ($rowIndex < headerGroups.length - 1) {
59
63
  if (scaleItem.type === 'day') {
@@ -63,17 +67,22 @@ export default defineVxeComponent({
63
67
  label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
64
68
  }
65
69
  }
66
- if (titleMethod) {
67
- label = `${titleMethod({ scaleObj: scaleItem, title: label, dateObj: dateObj, $rowIndex })}`;
70
+ let cellVNs = label;
71
+ const ctParams = { scaleObj: scaleItem, title: label, dateObj: dateObj, $rowIndex };
72
+ if (titleSlot) {
73
+ cellVNs = $xeGantt.callSlot(titleSlot, ctParams, h);
74
+ }
75
+ else if (titleMethod) {
76
+ cellVNs = `${titleMethod(ctParams)}`;
68
77
  }
69
78
  return h('th', {
70
79
  key: cIndex,
71
80
  class: 'vxe-gantt-view--header-column',
72
81
  attrs: {
73
- colspan: column.childCount || null,
74
- title: label
82
+ colspan: childCount || null,
83
+ title: titleSlot ? null : label
75
84
  }
76
- }, label);
85
+ }, cellVNs);
77
86
  }));
78
87
  }))
79
88
  ])