vxe-gantt 0.0.3 → 3.0.0-beta.0

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 (106) hide show
  1. package/README.md +14 -46
  2. package/es/components.js +3 -2
  3. package/es/gantt/src/gantt-body.js +83 -49
  4. package/es/gantt/src/gantt-chart.js +91 -43
  5. package/es/gantt/src/gantt-header.js +63 -36
  6. package/es/gantt/src/gantt-view.js +638 -586
  7. package/es/gantt/src/gantt.js +1347 -1178
  8. package/es/gantt/src/util.js +1 -4
  9. package/es/gantt/style.css +42 -17
  10. package/es/gantt/style.min.css +1 -1
  11. package/es/index.esm.js +5 -2
  12. package/es/style.css +1 -1
  13. package/es/style.min.css +1 -1
  14. package/es/ui/index.js +9 -3
  15. package/es/ui/src/comp.js +1 -2
  16. package/es/ui/src/log.js +3 -2
  17. package/es/ui/src/utils.js +17 -17
  18. package/es/vxe-gantt/style.css +42 -17
  19. package/es/vxe-gantt/style.min.css +1 -1
  20. package/helper/vetur/attributes.json +1 -1
  21. package/helper/vetur/tags.json +1 -1
  22. package/lib/components.js +20 -19
  23. package/lib/components.min.js +1 -1
  24. package/lib/gantt/index.js +3 -3
  25. package/lib/gantt/index.min.js +1 -1
  26. package/lib/gantt/src/gantt-body.js +109 -87
  27. package/lib/gantt/src/gantt-body.min.js +1 -1
  28. package/lib/gantt/src/gantt-chart.js +109 -69
  29. package/lib/gantt/src/gantt-chart.min.js +1 -1
  30. package/lib/gantt/src/gantt-header.js +75 -56
  31. package/lib/gantt/src/gantt-header.min.js +1 -1
  32. package/lib/gantt/src/gantt-view.js +684 -686
  33. package/lib/gantt/src/gantt-view.min.js +1 -1
  34. package/lib/gantt/src/gantt.js +1631 -1559
  35. package/lib/gantt/src/gantt.min.js +1 -1
  36. package/lib/gantt/src/util.js +1 -4
  37. package/lib/gantt/src/util.min.js +1 -1
  38. package/lib/gantt/style/style.css +42 -17
  39. package/lib/gantt/style/style.min.css +1 -1
  40. package/lib/index.common.js +12 -7
  41. package/lib/index.umd.js +10705 -5870
  42. package/lib/index.umd.min.js +1 -1
  43. package/lib/style.css +1 -1
  44. package/lib/style.min.css +1 -1
  45. package/lib/ui/index.js +12 -16
  46. package/lib/ui/index.min.js +1 -1
  47. package/lib/ui/src/comp.js +3 -2
  48. package/lib/ui/src/comp.min.js +1 -1
  49. package/lib/ui/src/dom.js +33 -33
  50. package/lib/ui/src/dom.min.js +1 -1
  51. package/lib/ui/src/log.js +4 -3
  52. package/lib/ui/src/log.min.js +1 -1
  53. package/lib/ui/src/utils.js +21 -24
  54. package/lib/ui/src/utils.min.js +1 -1
  55. package/lib/vxe-gantt/index.js +4 -2
  56. package/lib/vxe-gantt/index.min.js +1 -1
  57. package/lib/vxe-gantt/style/style.css +42 -17
  58. package/lib/vxe-gantt/style/style.min.css +1 -1
  59. package/lib/vxe-ui/index.js +4 -2
  60. package/lib/vxe-ui/index.min.js +1 -1
  61. package/package.json +13 -13
  62. package/packages/components.ts +8 -5
  63. package/packages/gantt/index.ts +2 -2
  64. package/packages/gantt/src/gantt-body.ts +89 -53
  65. package/packages/gantt/src/gantt-chart.ts +100 -49
  66. package/packages/gantt/src/gantt-header.ts +69 -39
  67. package/packages/gantt/src/gantt-view.ts +692 -624
  68. package/packages/gantt/src/gantt.ts +1460 -1240
  69. package/packages/gantt/src/util.ts +1 -4
  70. package/packages/index.ts +6 -2
  71. package/packages/ui/index.ts +9 -3
  72. package/packages/ui/src/comp.ts +2 -2
  73. package/packages/ui/src/log.ts +3 -1
  74. package/packages/ui/src/utils.ts +22 -21
  75. package/styles/components/gantt-module/gantt-chart.scss +28 -9
  76. package/styles/components/gantt.scss +12 -7
  77. package/styles/theme/base.scss +5 -1
  78. package/types/all.d.ts +3 -3
  79. package/types/index.d.ts +2 -2
  80. package/README.en.md +0 -72
  81. package/README.ja-JP.md +0 -72
  82. package/README.zh-TW.md +0 -73
  83. package/es/gantt/src/emits.js +0 -4
  84. package/es/gantt/src/grid-emits.js +0 -16
  85. package/es/gantt/src/grid-props.js +0 -7
  86. package/es/gantt/src/props.js +0 -2
  87. package/es/gantt/src/table-emits.js +0 -97
  88. package/es/gantt/src/table-props.js +0 -298
  89. package/lib/gantt/src/emits.js +0 -8
  90. package/lib/gantt/src/emits.min.js +0 -1
  91. package/lib/gantt/src/grid-emits.js +0 -8
  92. package/lib/gantt/src/grid-emits.min.js +0 -1
  93. package/lib/gantt/src/grid-props.js +0 -24
  94. package/lib/gantt/src/grid-props.min.js +0 -1
  95. package/lib/gantt/src/props.js +0 -13
  96. package/lib/gantt/src/props.min.js +0 -1
  97. package/lib/gantt/src/table-emits.js +0 -7
  98. package/lib/gantt/src/table-emits.min.js +0 -1
  99. package/lib/gantt/src/table-props.js +0 -306
  100. package/lib/gantt/src/table-props.min.js +0 -1
  101. package/packages/gantt/src/emits.ts +0 -7
  102. package/packages/gantt/src/grid-emits.ts +0 -19
  103. package/packages/gantt/src/grid-props.ts +0 -23
  104. package/packages/gantt/src/props.ts +0 -13
  105. package/packages/gantt/src/table-emits.ts +0 -109
  106. package/packages/gantt/src/table-props.ts +0 -304
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # vxe-gantt
2
2
 
3
- 简体中文 | [繁體中文](README.zh-TW.md) | [English](README.en.md) | [日本語](README.ja-JP.md)
4
-
5
3
  [![star](https://gitee.com/x-extends/vxe-gantt/badge/star.svg?theme=gvp)](https://gitee.com/x-extends/vxe-gantt/stargazers)
6
4
  [![npm version](https://img.shields.io/npm/v/vxe-gantt.svg?style=flat-square)](https://www.npmjs.com/package/vxe-gantt)
7
5
  [![NodeJS with Webpack](https://github.com/x-extends/vxe-gantt/actions/workflows/webpack.yml/badge.svg)](https://github.com/x-extends/vxe-gantt/actions/workflows/webpack.yml)
@@ -14,72 +12,42 @@
14
12
 
15
13
  一个基于 [Vxe UI](https://github.com/x-extends/vxe-pc-ui) 的基于 PC 端甘特图组件
16
14
 
17
- * 设计理念
18
- * 面向现代浏览器,高效的简洁 API 设计
19
-
20
- * 版本说明
21
- * **V4**
22
- * [x] v4.0 基于 vue3.2+,只支持现代浏览器,不支持 IE
23
- * **V3**
24
- * [x] v3.0 基于 vue2.6~2.7,只支持现代浏览器,不支持 IE
25
- * **V2**
26
- * [x] ~~v2.0 基于 vue2.6+,停止维护~~
27
- * **V1**
28
- * [x] ~~v1.0 基于 vue2.6+,停止维护~~
29
-
30
15
  ## 浏览器支持
31
16
 
32
17
  ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png)
33
18
  --- | --- | --- | --- | --- |
34
19
  80+ ✔ | 80+ ✔ | 90+ ✔ | 75+ ✔ | 10+ ✔ |
35
20
 
36
- ## 在线文档
37
-
38
- 👉 [基础库](https://vxeui.com)
39
- 👉 [表格库](https://vxetable.cn)
40
- 👉 [甘特图](https://gantt.vxeui.com)
41
- 👉 [可视化](https://design.vxeui.com)
42
-
43
- ## QQ 交流群
44
-
45
- 该群供大家交流問題,如果群人数已满,将会不定期剔除不活跃的。
46
-
47
- ![qq](https://vxeui.com/resource/donation/qq1.png)
48
- ![qq](https://vxeui.com/resource/donation/qq2.png)
49
-
50
- ## 功能点
51
-
52
- [👀 Vxe Gantt](https://gantt.vxeui.com/)
53
-
54
- * [x] gantt 甘特图
55
-
56
21
  ## 安装
57
22
 
58
- 版本:[vue](https://www.npmjs.com/package/vue) 3.x
59
-
60
23
  ```shell
61
- npm install vxe-gantt
24
+ npm install vxe-pc-ui@3 vxe-table@3 vxe-gantt@3
62
25
  ```
63
26
 
64
- Get on [unpkg](https://unpkg.com/vxe-gantt/) and [cdnjs](https://cdn.jsdelivr.net/npm/vxe-gantt/)
65
-
66
- ### NPM
67
-
68
27
  ```javascript
28
+ import Vue from 'vue'
69
29
  // ...
70
30
  import VxeUIAll from 'vxe-pc-ui'
71
- import 'vxe-pc-ui/lib/style.css'
31
+ import 'vxe-pc-ui/es/style.css'
72
32
 
73
33
  import VxeUITable from 'vxe-table'
74
- import 'vxe-table/lib/style.css'
34
+ import 'vxe-table/es/style.css'
75
35
 
76
36
  import VxeUIGantt from 'vxe-gantt'
77
37
  import 'vxe-gantt/lib/style.css'
78
38
  // ...
79
39
 
80
- createApp(App).use(VxeUIAll).use(VxeUITable).use(VxeUIGantt).mount('#app')
40
+ Vue.use(VxeUIAll)
41
+ Vue.use(VxeUITable)
42
+ Vue.use(VxeUIGantt)
81
43
  ```
82
44
 
45
+ ## Contributors
46
+
47
+ Thank you to everyone who contributed to this project.
48
+
49
+ [![vxe-gantt](https://contrib.rocks/image?repo=x-extends/vxe-gantt)](https://github.com/x-extends/vxe-gantt/graphs/contributors)
50
+
83
51
  ## License
84
52
 
85
- [MIT](LICENSE) © 2025-present, Xu Liangzhan
53
+ [MIT](LICENSE) © 2019-present, Xu Liangzhan
package/es/components.js CHANGED
@@ -1,5 +1,6 @@
1
- import { setConfig } from '@vxe-ui/core';
1
+ import VxeUI from './ui';
2
2
  import VxeGantt from './gantt';
3
+ const { setConfig } = VxeUI;
3
4
  const components = [
4
5
  VxeGantt
5
6
  ];
@@ -7,6 +8,6 @@ export function install(app, options) {
7
8
  setConfig(options);
8
9
  components.forEach(component => app.use(component));
9
10
  }
10
- export * from './ui';
11
+ export { VxeUI };
11
12
  // Components
12
13
  export * from './gantt';
@@ -1,31 +1,41 @@
1
- import { h, inject, ref, onMounted, onUnmounted } from 'vue';
2
1
  import { defineVxeComponent } from '../../ui/src/comp';
3
2
  import { getCellRestHeight } from './util';
4
3
  import GanttViewChartComponent from './gantt-chart';
5
4
  export default defineVxeComponent({
6
5
  name: 'VxeGanttViewBody',
7
- setup() {
8
- const $xeGantt = inject('$xeGantt', {});
9
- const $xeGanttView = inject('$xeGanttView', {});
10
- const { reactData, internalData } = $xeGanttView;
11
- const { refTable } = $xeGantt.getRefMaps();
12
- const refElem = ref();
13
- const refBodyScroll = ref();
14
- const refBodyTable = ref();
15
- const refBodyXSpace = ref();
16
- const refBodyYSpace = ref();
17
- const renderRows = () => {
18
- const $xeTable = refTable.value;
19
- const fullAllDataRowIdData = $xeTable ? $xeTable.internalData.fullAllDataRowIdData : {};
6
+ inject: {
7
+ $xeGantt: {
8
+ default: null
9
+ },
10
+ $xeGanttView: {
11
+ default: null
12
+ }
13
+ },
14
+ props: {},
15
+ data() {
16
+ return {};
17
+ },
18
+ computed: Object.assign({}, {}),
19
+ methods: {
20
+ //
21
+ // Render
22
+ //
23
+ renderRows(h) {
24
+ const _vm = this;
25
+ const $xeGantt = _vm.$xeGantt;
26
+ const $xeGanttView = _vm.$xeGanttView;
27
+ const $xeTable = $xeGanttView.internalData.xeTable;
28
+ const tableInternalData = ($xeTable ? $xeTable : {});
29
+ const fullAllDataRowIdData = tableInternalData.fullAllDataRowIdData || {};
20
30
  let cellOpts = {};
21
31
  let rowOpts = {};
22
32
  let defaultRowHeight = 0;
23
33
  if ($xeTable) {
24
- const { computeCellOpts, computeRowOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps();
25
- cellOpts = computeCellOpts.value;
26
- rowOpts = computeRowOpts.value;
27
- defaultRowHeight = computeDefaultRowHeight.value;
34
+ cellOpts = $xeTable.computeCellOpts;
35
+ rowOpts = $xeTable.computeRowOpts;
36
+ defaultRowHeight = $xeTable.computeDefaultRowHeight;
28
37
  }
38
+ const { reactData } = $xeGanttView;
29
39
  const { tableData, tableColumn } = reactData;
30
40
  const trVNs = [];
31
41
  tableData.forEach((row, rIndex) => {
@@ -40,64 +50,88 @@ export default defineVxeComponent({
40
50
  class: 'vxe-gantt-view--body-column',
41
51
  style: {
42
52
  height: `${cellHeight}px`
53
+ },
54
+ on: {
55
+ click(evnt) {
56
+ $xeGantt.handleTaskCellClickEvent(evnt, { row });
57
+ },
58
+ dblclick(evnt) {
59
+ $xeGantt.handleTaskCellDblclickEvent(evnt, { row });
60
+ }
43
61
  }
44
62
  });
45
63
  })));
46
64
  });
47
65
  return trVNs;
48
- };
49
- const renderVN = () => {
50
- const { tableColumn } = reactData;
66
+ },
67
+ renderVN(h) {
68
+ const _vm = this;
69
+ const $xeGanttView = _vm.$xeGanttView;
70
+ const { reactData } = $xeGanttView;
71
+ const { tableColumn, viewCellWidth } = reactData;
51
72
  return h('div', {
52
- ref: refElem,
73
+ ref: 'refElem',
53
74
  class: 'vxe-gantt-view--body-wrapper'
54
75
  }, [
55
76
  h('div', {
56
- ref: refBodyScroll,
77
+ ref: 'refBodyScroll',
57
78
  class: 'vxe-gantt-view--body-inner-wrapper',
58
- onScroll: $xeGanttView.triggerBodyScrollEvent
79
+ on: {
80
+ scroll: $xeGanttView.triggerBodyScrollEvent
81
+ }
59
82
  }, [
60
83
  h('div', {
61
- ref: refBodyXSpace,
84
+ ref: 'refBodyXSpace',
62
85
  class: 'vxe-body--x-space'
63
86
  }),
64
87
  h('div', {
65
- ref: refBodyYSpace,
88
+ ref: 'refBodyYSpace',
66
89
  class: 'vxe-body--y-space'
67
90
  }),
68
91
  h('table', {
69
- ref: refBodyTable,
92
+ ref: 'refBodyTable',
70
93
  class: 'vxe-gantt-view--body-table'
71
94
  }, [
72
95
  h('colgroup', {}, tableColumn.map((column, cIndex) => {
73
96
  return h('col', {
74
- key: cIndex
97
+ key: cIndex,
98
+ style: {
99
+ width: `${viewCellWidth}px`
100
+ }
75
101
  });
76
102
  })),
77
- h('tbody', {}, renderRows())
103
+ h('tbody', {}, _vm.renderRows(h))
78
104
  ]),
79
105
  h(GanttViewChartComponent)
80
106
  ])
81
107
  ]);
82
- };
83
- onMounted(() => {
84
- const { elemStore } = internalData;
85
- const prefix = 'main-body-';
86
- elemStore[`${prefix}wrapper`] = refElem;
87
- elemStore[`${prefix}scroll`] = refBodyScroll;
88
- elemStore[`${prefix}table`] = refBodyTable;
89
- elemStore[`${prefix}xSpace`] = refBodyXSpace;
90
- elemStore[`${prefix}ySpace`] = refBodyYSpace;
91
- });
92
- onUnmounted(() => {
93
- const { elemStore } = internalData;
94
- const prefix = 'main-body-';
95
- elemStore[`${prefix}wrapper`] = null;
96
- elemStore[`${prefix}scroll`] = null;
97
- elemStore[`${prefix}table`] = null;
98
- elemStore[`${prefix}xSpace`] = null;
99
- elemStore[`${prefix}ySpace`] = null;
100
- });
101
- return renderVN;
108
+ }
109
+ },
110
+ mounted() {
111
+ const _vm = this;
112
+ const $xeGanttView = _vm.$xeGanttView;
113
+ const { internalData } = $xeGanttView;
114
+ const { elemStore } = internalData;
115
+ const prefix = 'main-body-';
116
+ elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
117
+ elemStore[`${prefix}scroll`] = _vm.$refs.refBodyScroll;
118
+ elemStore[`${prefix}table`] = _vm.$refs.refBodyTable;
119
+ elemStore[`${prefix}xSpace`] = _vm.$refs.refBodyXSpace;
120
+ elemStore[`${prefix}ySpace`] = _vm.$refs.refBodyYSpace;
121
+ },
122
+ destroyed() {
123
+ const _vm = this;
124
+ const $xeGanttView = _vm.$xeGanttView;
125
+ const { internalData } = $xeGanttView;
126
+ const { elemStore } = internalData;
127
+ const prefix = 'main-body-';
128
+ elemStore[`${prefix}wrapper`] = null;
129
+ elemStore[`${prefix}scroll`] = null;
130
+ elemStore[`${prefix}table`] = null;
131
+ elemStore[`${prefix}xSpace`] = null;
132
+ elemStore[`${prefix}ySpace`] = null;
133
+ },
134
+ render(h) {
135
+ return this.renderVN(h);
102
136
  }
103
137
  });
@@ -1,77 +1,125 @@
1
- import { h, inject, ref, onMounted, onUnmounted } from 'vue';
2
1
  import { defineVxeComponent } from '../../ui/src/comp';
2
+ import { VxeUI } from '@vxe-ui/core';
3
3
  import XEUtils from 'xe-utils';
4
4
  import { getCellRestHeight } from './util';
5
+ import { getStringValue } from '../../ui/src/utils';
6
+ const { renderEmptyElement } = VxeUI;
5
7
  export default defineVxeComponent({
6
8
  name: 'VxeGanttViewChart',
7
- setup() {
8
- const $xeGantt = inject('$xeGantt', {});
9
- const $xeGanttView = inject('$xeGanttView', {});
10
- const { reactData, internalData } = $xeGanttView;
11
- const { refTable } = $xeGantt.getRefMaps();
12
- const { computeProgressField } = $xeGantt.getComputeMaps();
13
- const refElem = ref();
14
- const renderVN = () => {
15
- const $xeTable = refTable.value;
16
- const fullAllDataRowIdData = $xeTable ? $xeTable.internalData.fullAllDataRowIdData : {};
9
+ inject: {
10
+ $xeGantt: {
11
+ default: null
12
+ },
13
+ $xeGanttView: {
14
+ default: null
15
+ }
16
+ },
17
+ props: {},
18
+ data() {
19
+ return {};
20
+ },
21
+ computed: Object.assign({}, {}),
22
+ methods: {
23
+ //
24
+ // Render
25
+ //
26
+ renderVN(h) {
27
+ const _vm = this;
28
+ const $xeGantt = _vm.$xeGantt;
29
+ const $xeGanttView = _vm.$xeGanttView;
30
+ const $xeTable = $xeGanttView.internalData.xeTable;
31
+ const tableInternalData = ($xeTable ? $xeTable : {});
32
+ const fullAllDataRowIdData = tableInternalData.fullAllDataRowIdData || {};
17
33
  let cellOpts = {};
18
34
  let rowOpts = {};
19
35
  let defaultRowHeight = 0;
20
36
  if ($xeTable) {
21
- const { computeCellOpts, computeRowOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps();
22
- cellOpts = computeCellOpts.value;
23
- rowOpts = computeRowOpts.value;
24
- defaultRowHeight = computeDefaultRowHeight.value;
37
+ cellOpts = $xeTable.computeCellOpts;
38
+ rowOpts = $xeTable.computeRowOpts;
39
+ defaultRowHeight = $xeTable.computeDefaultRowHeight;
25
40
  }
41
+ const { reactData } = $xeGanttView;
26
42
  const { tableData } = reactData;
27
- const progressField = computeProgressField.value;
43
+ const titleField = $xeGantt.computeTitleField;
44
+ const progressField = $xeGantt.computeProgressField;
45
+ const taskBarOpts = $xeGantt.computeTaskBarOpts;
46
+ const { showProgress, showContent, contentMethod, barStyle } = taskBarOpts;
47
+ const { round } = barStyle || {};
28
48
  const trVNs = [];
29
49
  tableData.forEach((row, rIndex) => {
30
50
  const rowid = $xeTable ? $xeTable.getRowid(row) : '';
31
51
  const rowRest = fullAllDataRowIdData[rowid] || {};
32
52
  const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
33
- const progressValue = XEUtils.get(row, progressField);
53
+ let title = getStringValue(XEUtils.get(row, titleField));
54
+ const progressValue = showProgress ? Math.min(100, Math.max(0, XEUtils.toNumber(XEUtils.get(row, progressField)))) : 0;
55
+ if (contentMethod) {
56
+ title = getStringValue(contentMethod({ row, title }));
57
+ }
34
58
  trVNs.push(h('div', {
35
59
  key: rIndex,
36
- rowid,
37
- class: 'vxe-gantt-view--chart-row',
60
+ attrs: {
61
+ rowid
62
+ },
63
+ class: ['vxe-gantt-view--chart-row', {
64
+ 'is--round': round
65
+ }],
38
66
  style: {
39
67
  height: `${cellHeight}px`
40
68
  }
41
69
  }, [
42
70
  h('div', {
43
71
  class: 'vxe-gantt-view--chart-bar',
44
- rowid
72
+ attrs: {
73
+ rowid
74
+ },
75
+ on: {
76
+ click(evnt) {
77
+ $xeGantt.handleTaskBarClickEvent(evnt, { row });
78
+ },
79
+ dblclick(evnt) {
80
+ $xeGantt.handleTaskBarDblclickEvent(evnt, { row });
81
+ }
82
+ }
45
83
  }, [
46
- h('div', {
47
- class: 'vxe-gantt-view--chart-progress',
48
- style: progressValue
49
- ? {
50
- width: `${progressValue}%`
84
+ showProgress
85
+ ? h('div', {
86
+ class: 'vxe-gantt-view--chart-progress',
87
+ style: {
88
+ width: `${progressValue || 0}%`
51
89
  }
52
- : undefined
53
- }),
54
- h('div', {
55
- class: 'vxe-gantt-view--chart-content'
56
- })
90
+ })
91
+ : renderEmptyElement($xeGantt),
92
+ showContent
93
+ ? h('div', {
94
+ class: 'vxe-gantt-view--chart-content'
95
+ }, title)
96
+ : renderEmptyElement($xeGantt)
57
97
  ])
58
98
  ]));
59
99
  });
60
100
  return h('div', {
61
- ref: refElem,
101
+ ref: 'refElem',
62
102
  class: 'vxe-gantt-view--chart-wrapper'
63
103
  }, trVNs);
64
- };
65
- onMounted(() => {
66
- const { elemStore } = internalData;
67
- const prefix = 'main-chart-';
68
- elemStore[`${prefix}wrapper`] = refElem;
69
- });
70
- onUnmounted(() => {
71
- const { elemStore } = internalData;
72
- const prefix = 'main-chart-';
73
- elemStore[`${prefix}wrapper`] = null;
74
- });
75
- return renderVN;
104
+ }
105
+ },
106
+ mounted() {
107
+ const _vm = this;
108
+ const $xeGanttView = _vm.$xeGanttView;
109
+ const { internalData } = $xeGanttView;
110
+ const { elemStore } = internalData;
111
+ const prefix = 'main-chart-';
112
+ elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
113
+ },
114
+ destroyed() {
115
+ const _vm = this;
116
+ const $xeGanttView = _vm.$xeGanttView;
117
+ const { internalData } = $xeGanttView;
118
+ const { elemStore } = internalData;
119
+ const prefix = 'main-chart-';
120
+ elemStore[`${prefix}wrapper`] = null;
121
+ },
122
+ render(h) {
123
+ return this.renderVN(h);
76
124
  }
77
125
  });
@@ -1,36 +1,53 @@
1
- import { h, inject, ref, onMounted, onUnmounted } from 'vue';
2
1
  import { defineVxeComponent } from '../../ui/src/comp';
3
2
  export default defineVxeComponent({
4
3
  name: 'VxeGanttView',
5
- setup() {
6
- const $xeGanttView = inject('$xeGanttView', {});
7
- const { reactData, internalData } = $xeGanttView;
8
- const refElem = ref();
9
- const refHeaderScroll = ref();
10
- const refHeaderTable = ref();
11
- const refHeaderXSpace = ref();
12
- const renderVN = () => {
13
- const { tableColumn, headerGroups } = reactData;
4
+ inject: {
5
+ $xeGantt: {
6
+ default: null
7
+ },
8
+ $xeGanttView: {
9
+ default: null
10
+ }
11
+ },
12
+ props: {},
13
+ data() {
14
+ return {};
15
+ },
16
+ computed: Object.assign({}, {}),
17
+ methods: {
18
+ //
19
+ // Render
20
+ //
21
+ renderVN(h) {
22
+ const _vm = this;
23
+ const $xeGanttView = _vm.$xeGanttView;
24
+ const { reactData } = $xeGanttView;
25
+ const { tableColumn, headerGroups, viewCellWidth } = reactData;
14
26
  return h('div', {
15
- ref: refElem,
27
+ ref: 'refElem',
16
28
  class: 'vxe-gantt-view--header-wrapper'
17
29
  }, [
18
30
  h('div', {
19
- ref: refHeaderScroll,
31
+ ref: 'refHeaderScroll',
20
32
  class: 'vxe-gantt-view--header-inner-wrapper',
21
- onScroll: $xeGanttView.triggerHeaderScrollEvent
33
+ on: {
34
+ scroll: $xeGanttView.triggerHeaderScrollEvent
35
+ }
22
36
  }, [
23
37
  h('div', {
24
- ref: refHeaderXSpace,
38
+ ref: 'refHeaderXSpace',
25
39
  class: 'vxe-body--x-space'
26
40
  }),
27
41
  h('table', {
28
- ref: refHeaderTable,
42
+ ref: 'refHeaderTable',
29
43
  class: 'vxe-gantt-view--header-table'
30
44
  }, [
31
45
  h('colgroup', {}, tableColumn.map((column, cIndex) => {
32
46
  return h('col', {
33
- key: cIndex
47
+ key: cIndex,
48
+ style: {
49
+ width: `${viewCellWidth}px`
50
+ }
34
51
  });
35
52
  })),
36
53
  h('thead', {}, headerGroups.map((cols, rIndex) => {
@@ -40,31 +57,41 @@ export default defineVxeComponent({
40
57
  return h('th', {
41
58
  key: cIndex,
42
59
  class: 'vxe-gantt-view--header-column',
43
- colspan: column.children ? column.children.length : null,
44
- title: `${column.field}`
60
+ attrs: {
61
+ colspan: column.children ? column.children.length : null,
62
+ title: `${column.field}`
63
+ }
45
64
  }, column.title);
46
65
  }));
47
66
  }))
48
67
  ])
49
68
  ])
50
69
  ]);
51
- };
52
- onMounted(() => {
53
- const { elemStore } = internalData;
54
- const prefix = 'main-header-';
55
- elemStore[`${prefix}wrapper`] = refElem;
56
- elemStore[`${prefix}scroll`] = refHeaderScroll;
57
- elemStore[`${prefix}table`] = refHeaderTable;
58
- elemStore[`${prefix}xSpace`] = refHeaderXSpace;
59
- });
60
- onUnmounted(() => {
61
- const { elemStore } = internalData;
62
- const prefix = 'main-header-';
63
- elemStore[`${prefix}wrapper`] = null;
64
- elemStore[`${prefix}scroll`] = null;
65
- elemStore[`${prefix}table`] = null;
66
- elemStore[`${prefix}xSpace`] = null;
67
- });
68
- return renderVN;
70
+ }
71
+ },
72
+ mounted() {
73
+ const _vm = this;
74
+ const $xeGanttView = _vm.$xeGanttView;
75
+ const { internalData } = $xeGanttView;
76
+ const { elemStore } = internalData;
77
+ const prefix = 'main-header-';
78
+ elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
79
+ elemStore[`${prefix}scroll`] = _vm.$refs.refHeaderScroll;
80
+ elemStore[`${prefix}table`] = _vm.$refs.refHeaderTable;
81
+ elemStore[`${prefix}xSpace`] = _vm.$refs.refHeaderXSpace;
82
+ },
83
+ destroyed() {
84
+ const _vm = this;
85
+ const $xeGanttView = _vm.$xeGanttView;
86
+ const { internalData } = $xeGanttView;
87
+ const { elemStore } = internalData;
88
+ const prefix = 'main-header-';
89
+ elemStore[`${prefix}wrapper`] = null;
90
+ elemStore[`${prefix}scroll`] = null;
91
+ elemStore[`${prefix}table`] = null;
92
+ elemStore[`${prefix}xSpace`] = null;
93
+ },
94
+ render(h) {
95
+ return this.renderVN(h);
69
96
  }
70
97
  });