vxe-gantt 0.0.2 → 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 (94) hide show
  1. package/README.md +18 -24
  2. package/es/components.js +3 -2
  3. package/es/gantt/src/gantt-body.js +137 -0
  4. package/es/gantt/src/gantt-chart.js +125 -0
  5. package/es/gantt/src/gantt-header.js +97 -0
  6. package/es/gantt/src/gantt-view.js +820 -0
  7. package/es/gantt/src/gantt.js +1897 -43
  8. package/es/gantt/src/util.js +9 -0
  9. package/es/gantt/style.css +624 -0
  10. package/es/gantt/style.min.css +1 -0
  11. package/es/index.esm.js +5 -2
  12. package/es/style.css +1 -0
  13. package/es/style.min.css +1 -0
  14. package/es/ui/index.js +55 -5
  15. package/es/ui/src/comp.js +1 -2
  16. package/es/ui/src/dom.js +44 -105
  17. package/es/ui/src/log.js +3 -2
  18. package/es/ui/src/utils.js +4 -3
  19. package/es/ui/src/vn.js +1 -32
  20. package/es/vxe-gantt/style.css +624 -0
  21. package/es/vxe-gantt/style.min.css +1 -0
  22. package/helper/vetur/attributes.json +1 -1
  23. package/helper/vetur/tags.json +1 -1
  24. package/lib/components.js +20 -19
  25. package/lib/components.min.js +1 -1
  26. package/lib/gantt/index.js +3 -3
  27. package/lib/gantt/index.min.js +1 -1
  28. package/lib/gantt/src/gantt-body.js +140 -0
  29. package/lib/gantt/src/gantt-body.min.js +1 -0
  30. package/lib/gantt/src/gantt-chart.js +134 -0
  31. package/lib/gantt/src/gantt-chart.min.js +1 -0
  32. package/lib/gantt/src/gantt-header.js +97 -0
  33. package/lib/gantt/src/gantt-header.min.js +1 -0
  34. package/lib/gantt/src/gantt-view.js +808 -0
  35. package/lib/gantt/src/gantt-view.min.js +1 -0
  36. package/lib/gantt/src/gantt.js +2045 -48
  37. package/lib/gantt/src/gantt.min.js +1 -1
  38. package/lib/gantt/src/util.js +16 -0
  39. package/lib/gantt/src/util.min.js +1 -0
  40. package/lib/gantt/style/style.css +624 -0
  41. package/lib/gantt/style/style.min.css +1 -0
  42. package/lib/index.common.js +12 -7
  43. package/lib/index.umd.js +11484 -235
  44. package/lib/index.umd.min.js +1 -1
  45. package/lib/style.css +1 -0
  46. package/lib/style.min.css +1 -0
  47. package/lib/ui/index.js +54 -14
  48. package/lib/ui/index.min.js +1 -1
  49. package/lib/ui/src/comp.js +3 -2
  50. package/lib/ui/src/comp.min.js +1 -1
  51. package/lib/ui/src/dom.js +78 -138
  52. package/lib/ui/src/dom.min.js +1 -1
  53. package/lib/ui/src/log.js +4 -3
  54. package/lib/ui/src/log.min.js +1 -1
  55. package/lib/ui/src/utils.js +5 -4
  56. package/lib/ui/src/utils.min.js +1 -1
  57. package/lib/ui/src/vn.js +1 -43
  58. package/lib/ui/src/vn.min.js +0 -1
  59. package/lib/vxe-gantt/index.js +4 -2
  60. package/lib/vxe-gantt/index.min.js +1 -1
  61. package/lib/vxe-gantt/style/style.css +624 -0
  62. package/lib/vxe-gantt/style/style.min.css +1 -0
  63. package/lib/vxe-ui/index.js +4 -2
  64. package/lib/vxe-ui/index.min.js +1 -1
  65. package/package.json +13 -13
  66. package/packages/components.ts +8 -5
  67. package/packages/gantt/index.ts +2 -2
  68. package/packages/gantt/src/gantt-body.ts +155 -0
  69. package/packages/gantt/src/gantt-chart.ts +143 -0
  70. package/packages/gantt/src/gantt-header.ts +109 -0
  71. package/packages/gantt/src/gantt-view.ts +908 -0
  72. package/packages/gantt/src/gantt.ts +2048 -46
  73. package/packages/gantt/src/util.ts +12 -0
  74. package/packages/index.ts +6 -2
  75. package/packages/ui/index.ts +56 -4
  76. package/packages/ui/src/comp.ts +2 -2
  77. package/packages/ui/src/dom.ts +53 -110
  78. package/packages/ui/src/log.ts +4 -2
  79. package/packages/ui/src/utils.ts +5 -3
  80. package/packages/ui/src/vn.ts +0 -37
  81. package/styles/components/gantt-module/all.scss +1 -0
  82. package/styles/components/gantt-module/gantt-chart.scss +65 -0
  83. package/styles/components/gantt.scss +591 -0
  84. package/styles/helpers/baseMixin.scss +96 -0
  85. package/styles/helpers/baseVar.scss +4 -0
  86. package/styles/helpers/placement.scss +39 -0
  87. package/styles/theme/base.scss +11 -0
  88. package/styles/theme/dark.scss +5 -0
  89. package/styles/theme/light.scss +5 -0
  90. package/types/all.d.ts +3 -3
  91. package/types/index.d.ts +2 -2
  92. package/README.en.md +0 -72
  93. package/README.ja-JP.md +0 -72
  94. package/README.zh-TW.md +0 -73
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,46 +12,42 @@
14
12
 
15
13
  一个基于 [Vxe UI](https://github.com/x-extends/vxe-pc-ui) 的基于 PC 端甘特图组件
16
14
 
17
- * 设计理念
18
- * 面向现代浏览器,高效的简洁 API 设计
15
+ ## 浏览器支持
19
16
 
20
- * 版本说明
21
- * **V4**
22
- * [x] v4.0 基于 vue3.2+,只支持现代浏览器,不支持 IE
23
- * **V3**
24
- * [x] v3.0 基于 vue2.6+,只支持现代浏览器,不支持 IE
25
- * **V2**
26
- * [x] ~~v2.0 基于 vue2.6+,停止维护~~
27
- * **V1**
28
- * [x] ~~v1.0 基于 vue2.6+,停止维护~~
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)
18
+ --- | --- | --- | --- | --- |
19
+ 80+ | 80+ | 90+ ✔ | 75+ ✔ | 10+ ✔ |
29
20
 
30
21
  ## 安装
31
22
 
32
- 版本:[vue](https://www.npmjs.com/package/vue) 3.x
33
-
34
23
  ```shell
35
- npm install vxe-gantt
24
+ npm install vxe-pc-ui@3 vxe-table@3 vxe-gantt@3
36
25
  ```
37
26
 
38
- Get on [unpkg](https://unpkg.com/vxe-gantt/) and [cdnjs](https://cdn.jsdelivr.net/npm/vxe-gantt/)
39
-
40
- ### NPM
41
-
42
27
  ```javascript
28
+ import Vue from 'vue'
43
29
  // ...
44
30
  import VxeUIAll from 'vxe-pc-ui'
45
- import 'vxe-pc-ui/lib/style.css'
31
+ import 'vxe-pc-ui/es/style.css'
46
32
 
47
33
  import VxeUITable from 'vxe-table'
48
- import 'vxe-table/lib/style.css'
34
+ import 'vxe-table/es/style.css'
49
35
 
50
36
  import VxeUIGantt from 'vxe-gantt'
51
37
  import 'vxe-gantt/lib/style.css'
52
38
  // ...
53
39
 
54
- createApp(App).use(VxeUIAll).use(VxeUITable).use(VxeUIGantt).mount('#app')
40
+ Vue.use(VxeUIAll)
41
+ Vue.use(VxeUITable)
42
+ Vue.use(VxeUIGantt)
55
43
  ```
56
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
+
57
51
  ## License
58
52
 
59
- [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';
@@ -0,0 +1,137 @@
1
+ import { defineVxeComponent } from '../../ui/src/comp';
2
+ import { getCellRestHeight } from './util';
3
+ import GanttViewChartComponent from './gantt-chart';
4
+ export default defineVxeComponent({
5
+ name: 'VxeGanttViewBody',
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 || {};
30
+ let cellOpts = {};
31
+ let rowOpts = {};
32
+ let defaultRowHeight = 0;
33
+ if ($xeTable) {
34
+ cellOpts = $xeTable.computeCellOpts;
35
+ rowOpts = $xeTable.computeRowOpts;
36
+ defaultRowHeight = $xeTable.computeDefaultRowHeight;
37
+ }
38
+ const { reactData } = $xeGanttView;
39
+ const { tableData, tableColumn } = reactData;
40
+ const trVNs = [];
41
+ tableData.forEach((row, rIndex) => {
42
+ const rowid = $xeTable ? $xeTable.getRowid(row) : '';
43
+ const rowRest = fullAllDataRowIdData[rowid] || {};
44
+ const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
45
+ trVNs.push(h('tr', {
46
+ key: rIndex
47
+ }, tableColumn.map((column, cIndex) => {
48
+ return h('td', {
49
+ key: cIndex,
50
+ class: 'vxe-gantt-view--body-column',
51
+ style: {
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
+ }
61
+ }
62
+ });
63
+ })));
64
+ });
65
+ return trVNs;
66
+ },
67
+ renderVN(h) {
68
+ const _vm = this;
69
+ const $xeGanttView = _vm.$xeGanttView;
70
+ const { reactData } = $xeGanttView;
71
+ const { tableColumn, viewCellWidth } = reactData;
72
+ return h('div', {
73
+ ref: 'refElem',
74
+ class: 'vxe-gantt-view--body-wrapper'
75
+ }, [
76
+ h('div', {
77
+ ref: 'refBodyScroll',
78
+ class: 'vxe-gantt-view--body-inner-wrapper',
79
+ on: {
80
+ scroll: $xeGanttView.triggerBodyScrollEvent
81
+ }
82
+ }, [
83
+ h('div', {
84
+ ref: 'refBodyXSpace',
85
+ class: 'vxe-body--x-space'
86
+ }),
87
+ h('div', {
88
+ ref: 'refBodyYSpace',
89
+ class: 'vxe-body--y-space'
90
+ }),
91
+ h('table', {
92
+ ref: 'refBodyTable',
93
+ class: 'vxe-gantt-view--body-table'
94
+ }, [
95
+ h('colgroup', {}, tableColumn.map((column, cIndex) => {
96
+ return h('col', {
97
+ key: cIndex,
98
+ style: {
99
+ width: `${viewCellWidth}px`
100
+ }
101
+ });
102
+ })),
103
+ h('tbody', {}, _vm.renderRows(h))
104
+ ]),
105
+ h(GanttViewChartComponent)
106
+ ])
107
+ ]);
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);
136
+ }
137
+ });
@@ -0,0 +1,125 @@
1
+ import { defineVxeComponent } from '../../ui/src/comp';
2
+ import { VxeUI } from '@vxe-ui/core';
3
+ import XEUtils from 'xe-utils';
4
+ import { getCellRestHeight } from './util';
5
+ import { getStringValue } from '../../ui/src/utils';
6
+ const { renderEmptyElement } = VxeUI;
7
+ export default defineVxeComponent({
8
+ name: 'VxeGanttViewChart',
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 || {};
33
+ let cellOpts = {};
34
+ let rowOpts = {};
35
+ let defaultRowHeight = 0;
36
+ if ($xeTable) {
37
+ cellOpts = $xeTable.computeCellOpts;
38
+ rowOpts = $xeTable.computeRowOpts;
39
+ defaultRowHeight = $xeTable.computeDefaultRowHeight;
40
+ }
41
+ const { reactData } = $xeGanttView;
42
+ const { tableData } = reactData;
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 || {};
48
+ const trVNs = [];
49
+ tableData.forEach((row, rIndex) => {
50
+ const rowid = $xeTable ? $xeTable.getRowid(row) : '';
51
+ const rowRest = fullAllDataRowIdData[rowid] || {};
52
+ const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
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
+ }
58
+ trVNs.push(h('div', {
59
+ key: rIndex,
60
+ attrs: {
61
+ rowid
62
+ },
63
+ class: ['vxe-gantt-view--chart-row', {
64
+ 'is--round': round
65
+ }],
66
+ style: {
67
+ height: `${cellHeight}px`
68
+ }
69
+ }, [
70
+ h('div', {
71
+ class: 'vxe-gantt-view--chart-bar',
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
+ }
83
+ }, [
84
+ showProgress
85
+ ? h('div', {
86
+ class: 'vxe-gantt-view--chart-progress',
87
+ style: {
88
+ width: `${progressValue || 0}%`
89
+ }
90
+ })
91
+ : renderEmptyElement($xeGantt),
92
+ showContent
93
+ ? h('div', {
94
+ class: 'vxe-gantt-view--chart-content'
95
+ }, title)
96
+ : renderEmptyElement($xeGantt)
97
+ ])
98
+ ]));
99
+ });
100
+ return h('div', {
101
+ ref: 'refElem',
102
+ class: 'vxe-gantt-view--chart-wrapper'
103
+ }, trVNs);
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);
124
+ }
125
+ });
@@ -0,0 +1,97 @@
1
+ import { defineVxeComponent } from '../../ui/src/comp';
2
+ export default defineVxeComponent({
3
+ name: 'VxeGanttView',
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;
26
+ return h('div', {
27
+ ref: 'refElem',
28
+ class: 'vxe-gantt-view--header-wrapper'
29
+ }, [
30
+ h('div', {
31
+ ref: 'refHeaderScroll',
32
+ class: 'vxe-gantt-view--header-inner-wrapper',
33
+ on: {
34
+ scroll: $xeGanttView.triggerHeaderScrollEvent
35
+ }
36
+ }, [
37
+ h('div', {
38
+ ref: 'refHeaderXSpace',
39
+ class: 'vxe-body--x-space'
40
+ }),
41
+ h('table', {
42
+ ref: 'refHeaderTable',
43
+ class: 'vxe-gantt-view--header-table'
44
+ }, [
45
+ h('colgroup', {}, tableColumn.map((column, cIndex) => {
46
+ return h('col', {
47
+ key: cIndex,
48
+ style: {
49
+ width: `${viewCellWidth}px`
50
+ }
51
+ });
52
+ })),
53
+ h('thead', {}, headerGroups.map((cols, rIndex) => {
54
+ return h('tr', {
55
+ key: rIndex
56
+ }, cols.map((column, cIndex) => {
57
+ return h('th', {
58
+ key: cIndex,
59
+ class: 'vxe-gantt-view--header-column',
60
+ attrs: {
61
+ colspan: column.children ? column.children.length : null,
62
+ title: `${column.field}`
63
+ }
64
+ }, column.title);
65
+ }));
66
+ }))
67
+ ])
68
+ ])
69
+ ]);
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);
96
+ }
97
+ });