vxe-gantt 0.0.2 → 4.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 (93) hide show
  1. package/README.md +27 -1
  2. package/es/gantt/src/emits.js +4 -0
  3. package/es/gantt/src/gantt-body.js +103 -0
  4. package/es/gantt/src/gantt-chart.js +77 -0
  5. package/es/gantt/src/gantt-header.js +70 -0
  6. package/es/gantt/src/gantt-view.js +768 -0
  7. package/es/gantt/src/gantt.js +1707 -22
  8. package/es/gantt/src/grid-emits.js +16 -0
  9. package/es/gantt/src/grid-props.js +7 -0
  10. package/es/gantt/src/props.js +2 -0
  11. package/es/gantt/src/table-emits.js +97 -0
  12. package/es/gantt/src/table-props.js +298 -0
  13. package/es/gantt/src/util.js +12 -0
  14. package/es/gantt/style.css +599 -0
  15. package/es/gantt/style.min.css +1 -0
  16. package/es/style.css +1 -0
  17. package/es/style.min.css +1 -0
  18. package/es/ui/index.js +47 -3
  19. package/es/ui/src/dom.js +44 -105
  20. package/es/ui/src/log.js +1 -1
  21. package/es/ui/src/utils.js +18 -17
  22. package/es/ui/src/vn.js +1 -32
  23. package/es/vxe-gantt/style.css +599 -0
  24. package/es/vxe-gantt/style.min.css +1 -0
  25. package/lib/gantt/src/emits.js +8 -0
  26. package/lib/gantt/src/emits.min.js +1 -0
  27. package/lib/gantt/src/gantt-body.js +118 -0
  28. package/lib/gantt/src/gantt-body.min.js +1 -0
  29. package/lib/gantt/src/gantt-chart.js +94 -0
  30. package/lib/gantt/src/gantt-chart.min.js +1 -0
  31. package/lib/gantt/src/gantt-header.js +78 -0
  32. package/lib/gantt/src/gantt-header.min.js +1 -0
  33. package/lib/gantt/src/gantt-view.js +810 -0
  34. package/lib/gantt/src/gantt-view.min.js +1 -0
  35. package/lib/gantt/src/gantt.js +1945 -20
  36. package/lib/gantt/src/gantt.min.js +1 -1
  37. package/lib/gantt/src/grid-emits.js +8 -0
  38. package/lib/gantt/src/grid-emits.min.js +1 -0
  39. package/lib/gantt/src/grid-props.js +24 -0
  40. package/lib/gantt/src/grid-props.min.js +1 -0
  41. package/lib/gantt/src/props.js +13 -0
  42. package/lib/gantt/src/props.min.js +1 -0
  43. package/lib/gantt/src/table-emits.js +7 -0
  44. package/lib/gantt/src/table-emits.min.js +1 -0
  45. package/lib/gantt/src/table-props.js +306 -0
  46. package/lib/gantt/src/table-props.min.js +1 -0
  47. package/lib/gantt/src/util.js +19 -0
  48. package/lib/gantt/src/util.min.js +1 -0
  49. package/lib/gantt/style/style.css +599 -0
  50. package/lib/gantt/style/style.min.css +1 -0
  51. package/lib/index.umd.js +6554 -140
  52. package/lib/index.umd.min.js +1 -1
  53. package/lib/style.css +1 -0
  54. package/lib/style.min.css +1 -0
  55. package/lib/ui/index.js +47 -3
  56. package/lib/ui/index.min.js +1 -1
  57. package/lib/ui/src/dom.js +50 -110
  58. package/lib/ui/src/dom.min.js +1 -1
  59. package/lib/ui/src/log.js +1 -1
  60. package/lib/ui/src/log.min.js +1 -1
  61. package/lib/ui/src/utils.js +24 -20
  62. package/lib/ui/src/utils.min.js +1 -1
  63. package/lib/ui/src/vn.js +1 -43
  64. package/lib/ui/src/vn.min.js +0 -1
  65. package/lib/vxe-gantt/style/style.css +599 -0
  66. package/lib/vxe-gantt/style/style.min.css +1 -0
  67. package/package.json +4 -4
  68. package/packages/gantt/src/emits.ts +7 -0
  69. package/packages/gantt/src/gantt-body.ts +119 -0
  70. package/packages/gantt/src/gantt-chart.ts +97 -0
  71. package/packages/gantt/src/gantt-header.ts +79 -0
  72. package/packages/gantt/src/gantt-view.ts +840 -0
  73. package/packages/gantt/src/gantt.ts +1806 -24
  74. package/packages/gantt/src/grid-emits.ts +19 -0
  75. package/packages/gantt/src/grid-props.ts +23 -0
  76. package/packages/gantt/src/props.ts +13 -0
  77. package/packages/gantt/src/table-emits.ts +109 -0
  78. package/packages/gantt/src/table-props.ts +304 -0
  79. package/packages/gantt/src/util.ts +15 -0
  80. package/packages/ui/index.ts +48 -2
  81. package/packages/ui/src/dom.ts +53 -110
  82. package/packages/ui/src/log.ts +1 -1
  83. package/packages/ui/src/utils.ts +22 -21
  84. package/packages/ui/src/vn.ts +0 -37
  85. package/styles/components/gantt-module/all.scss +1 -0
  86. package/styles/components/gantt-module/gantt-chart.scss +46 -0
  87. package/styles/components/gantt.scss +586 -0
  88. package/styles/helpers/baseMixin.scss +96 -0
  89. package/styles/helpers/baseVar.scss +4 -0
  90. package/styles/helpers/placement.scss +39 -0
  91. package/styles/theme/base.scss +7 -0
  92. package/styles/theme/dark.scss +5 -0
  93. package/styles/theme/light.scss +5 -0
@@ -0,0 +1,119 @@
1
+ import { h, inject, VNode, ref, Ref, onMounted, onUnmounted } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
3
+ import { getCellRestHeight } from './util'
4
+ import GanttViewChartComponent from './gantt-chart'
5
+
6
+ import type { VxeTablePropTypes } from 'vxe-table'
7
+ import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
8
+
9
+ export default defineVxeComponent({
10
+ name: 'VxeGanttViewBody',
11
+ setup () {
12
+ const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
13
+ const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
14
+
15
+ const { reactData, internalData } = $xeGanttView
16
+ const { refTable } = $xeGantt.getRefMaps()
17
+
18
+ const refElem = ref() as Ref<HTMLDivElement>
19
+ const refBodyScroll = ref() as Ref<HTMLDivElement>
20
+ const refBodyTable = ref() as Ref<HTMLTableElement>
21
+ const refBodyXSpace = ref() as Ref<HTMLDivElement>
22
+ const refBodyYSpace = ref() as Ref<HTMLDivElement>
23
+
24
+ const renderRows = () => {
25
+ const $xeTable = refTable.value
26
+
27
+ const fullAllDataRowIdData = $xeTable ? $xeTable.internalData.fullAllDataRowIdData : {}
28
+ let cellOpts: VxeTablePropTypes.CellConfig = {}
29
+ let rowOpts : VxeTablePropTypes.RowConfig = {}
30
+ let defaultRowHeight = 0
31
+ if ($xeTable) {
32
+ const { computeCellOpts, computeRowOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps()
33
+ cellOpts = computeCellOpts.value
34
+ rowOpts = computeRowOpts.value
35
+ defaultRowHeight = computeDefaultRowHeight.value
36
+ }
37
+
38
+ const { tableData, tableColumn } = reactData
39
+
40
+ const trVNs:VNode[] = []
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(
46
+ h('tr', {
47
+ key: rIndex
48
+ }, tableColumn.map((column, cIndex) => {
49
+ return h('td', {
50
+ key: cIndex,
51
+ class: 'vxe-gantt-view--body-column',
52
+ style: {
53
+ height: `${cellHeight}px`
54
+ }
55
+ })
56
+ }))
57
+ )
58
+ })
59
+ return trVNs
60
+ }
61
+
62
+ const renderVN = () => {
63
+ const { tableColumn } = reactData
64
+ return h('div', {
65
+ ref: refElem,
66
+ class: 'vxe-gantt-view--body-wrapper'
67
+ }, [
68
+ h('div', {
69
+ ref: refBodyScroll,
70
+ class: 'vxe-gantt-view--body-inner-wrapper',
71
+ onScroll: $xeGanttView.triggerBodyScrollEvent
72
+ }, [
73
+ h('div', {
74
+ ref: refBodyXSpace,
75
+ class: 'vxe-body--x-space'
76
+ }),
77
+ h('div', {
78
+ ref: refBodyYSpace,
79
+ class: 'vxe-body--y-space'
80
+ }),
81
+ h('table', {
82
+ ref: refBodyTable,
83
+ class: 'vxe-gantt-view--body-table'
84
+ }, [
85
+ h('colgroup', {}, tableColumn.map((column, cIndex) => {
86
+ return h('col', {
87
+ key: cIndex
88
+ })
89
+ })),
90
+ h('tbody', {}, renderRows())
91
+ ]),
92
+ h(GanttViewChartComponent)
93
+ ])
94
+ ])
95
+ }
96
+
97
+ onMounted(() => {
98
+ const { elemStore } = internalData
99
+ const prefix = 'main-body-'
100
+ elemStore[`${prefix}wrapper`] = refElem
101
+ elemStore[`${prefix}scroll`] = refBodyScroll
102
+ elemStore[`${prefix}table`] = refBodyTable
103
+ elemStore[`${prefix}xSpace`] = refBodyXSpace
104
+ elemStore[`${prefix}ySpace`] = refBodyYSpace
105
+ })
106
+
107
+ onUnmounted(() => {
108
+ const { elemStore } = internalData
109
+ const prefix = 'main-body-'
110
+ elemStore[`${prefix}wrapper`] = null
111
+ elemStore[`${prefix}scroll`] = null
112
+ elemStore[`${prefix}table`] = null
113
+ elemStore[`${prefix}xSpace`] = null
114
+ elemStore[`${prefix}ySpace`] = null
115
+ })
116
+
117
+ return renderVN
118
+ }
119
+ })
@@ -0,0 +1,97 @@
1
+ import { h, inject, VNode, ref, Ref, onMounted, onUnmounted } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
3
+ import { VxeUI } from '../../ui'
4
+ import XEUtils from 'xe-utils'
5
+ import { getCellRestHeight } from './util'
6
+
7
+ import type { VxeTablePropTypes } from 'vxe-table'
8
+ import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods } from '../../../types'
9
+
10
+ const { renderEmptyElement } = VxeUI
11
+
12
+ export default defineVxeComponent({
13
+ name: 'VxeGanttViewChart',
14
+ setup () {
15
+ const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
16
+ const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
17
+
18
+ const { reactData, internalData } = $xeGanttView
19
+ const { refTable } = $xeGantt.getRefMaps()
20
+ const { computeProgressField, computeTaskBarOpts } = $xeGantt.getComputeMaps()
21
+
22
+ const refElem = ref() as Ref<HTMLDivElement>
23
+
24
+ const renderVN = () => {
25
+ const $xeTable = refTable.value
26
+
27
+ const fullAllDataRowIdData = $xeTable ? $xeTable.internalData.fullAllDataRowIdData : {}
28
+ let cellOpts: VxeTablePropTypes.CellConfig = {}
29
+ let rowOpts : VxeTablePropTypes.RowConfig = {}
30
+ let defaultRowHeight = 0
31
+ if ($xeTable) {
32
+ const { computeCellOpts, computeRowOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps()
33
+ cellOpts = computeCellOpts.value
34
+ rowOpts = computeRowOpts.value
35
+ defaultRowHeight = computeDefaultRowHeight.value
36
+ }
37
+
38
+ const { tableData } = reactData
39
+ const progressField = computeProgressField.value
40
+ const taskBarOpts = computeTaskBarOpts.value
41
+ const { showProgress } = taskBarOpts
42
+
43
+ const trVNs:VNode[] = []
44
+ tableData.forEach((row, rIndex) => {
45
+ const rowid = $xeTable ? $xeTable.getRowid(row) : ''
46
+ const rowRest = fullAllDataRowIdData[rowid] || {}
47
+ const cellHeight = getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
48
+ const progressValue = showProgress ? XEUtils.get(row, progressField) : 0
49
+ trVNs.push(
50
+ h('div', {
51
+ key: rIndex,
52
+ rowid,
53
+ class: 'vxe-gantt-view--chart-row',
54
+ style: {
55
+ height: `${cellHeight}px`
56
+ }
57
+ }, [
58
+ h('div', {
59
+ class: 'vxe-gantt-view--chart-bar',
60
+ rowid
61
+ }, [
62
+ showProgress
63
+ ? h('div', {
64
+ class: 'vxe-gantt-view--chart-progress',
65
+ style: {
66
+ width: `${progressValue || 0}%`
67
+ }
68
+ })
69
+ : renderEmptyElement($xeGantt),
70
+ h('div', {
71
+ class: 'vxe-gantt-view--chart-content'
72
+ })
73
+ ])
74
+ ])
75
+ )
76
+ })
77
+ return h('div', {
78
+ ref: refElem,
79
+ class: 'vxe-gantt-view--chart-wrapper'
80
+ }, trVNs)
81
+ }
82
+
83
+ onMounted(() => {
84
+ const { elemStore } = internalData
85
+ const prefix = 'main-chart-'
86
+ elemStore[`${prefix}wrapper`] = refElem
87
+ })
88
+
89
+ onUnmounted(() => {
90
+ const { elemStore } = internalData
91
+ const prefix = 'main-chart-'
92
+ elemStore[`${prefix}wrapper`] = null
93
+ })
94
+
95
+ return renderVN
96
+ }
97
+ })
@@ -0,0 +1,79 @@
1
+ import { h, inject, ref, Ref, onMounted, onUnmounted } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
3
+
4
+ import type { VxeGanttViewConstructor, VxeGanttViewPrivateMethods } from '../../../types'
5
+
6
+ export default defineVxeComponent({
7
+ name: 'VxeGanttView',
8
+ setup () {
9
+ const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
10
+
11
+ const { reactData, internalData } = $xeGanttView
12
+
13
+ const refElem = ref() as Ref<HTMLDivElement>
14
+ const refHeaderScroll = ref() as Ref<HTMLDivElement>
15
+ const refHeaderTable = ref() as Ref<HTMLTableElement>
16
+ const refHeaderXSpace = ref() as Ref<HTMLDivElement>
17
+
18
+ const renderVN = () => {
19
+ const { tableColumn, headerGroups } = reactData
20
+ return h('div', {
21
+ ref: refElem,
22
+ class: 'vxe-gantt-view--header-wrapper'
23
+ }, [
24
+ h('div', {
25
+ ref: refHeaderScroll,
26
+ class: 'vxe-gantt-view--header-inner-wrapper',
27
+ onScroll: $xeGanttView.triggerHeaderScrollEvent
28
+ }, [
29
+ h('div', {
30
+ ref: refHeaderXSpace,
31
+ class: 'vxe-body--x-space'
32
+ }),
33
+ h('table', {
34
+ ref: refHeaderTable,
35
+ class: 'vxe-gantt-view--header-table'
36
+ }, [
37
+ h('colgroup', {}, tableColumn.map((column, cIndex) => {
38
+ return h('col', {
39
+ key: cIndex
40
+ })
41
+ })),
42
+ h('thead', {}, headerGroups.map((cols, rIndex) => {
43
+ return h('tr', {
44
+ key: rIndex
45
+ }, cols.map((column, cIndex) => {
46
+ return h('th', {
47
+ key: cIndex,
48
+ class: 'vxe-gantt-view--header-column',
49
+ colspan: column.children ? column.children.length : null,
50
+ title: `${column.field}`
51
+ }, column.title)
52
+ }))
53
+ }))
54
+ ])
55
+ ])
56
+ ])
57
+ }
58
+
59
+ onMounted(() => {
60
+ const { elemStore } = internalData
61
+ const prefix = 'main-header-'
62
+ elemStore[`${prefix}wrapper`] = refElem
63
+ elemStore[`${prefix}scroll`] = refHeaderScroll
64
+ elemStore[`${prefix}table`] = refHeaderTable
65
+ elemStore[`${prefix}xSpace`] = refHeaderXSpace
66
+ })
67
+
68
+ onUnmounted(() => {
69
+ const { elemStore } = internalData
70
+ const prefix = 'main-header-'
71
+ elemStore[`${prefix}wrapper`] = null
72
+ elemStore[`${prefix}scroll`] = null
73
+ elemStore[`${prefix}table`] = null
74
+ elemStore[`${prefix}xSpace`] = null
75
+ })
76
+
77
+ return renderVN
78
+ }
79
+ })