vxe-gantt 3.9.0 → 3.9.2

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 (112) hide show
  1. package/es/components.d.ts +6 -0
  2. package/es/components.js +11 -9
  3. package/es/gantt/index.d.ts +1421 -0
  4. package/es/gantt/index.js +27 -22
  5. package/es/gantt/src/gantt-body.d.ts +19 -0
  6. package/es/gantt/src/gantt-body.js +291 -288
  7. package/es/gantt/src/gantt-chart.d.ts +19 -0
  8. package/es/gantt/src/gantt-chart.js +486 -495
  9. package/es/gantt/src/gantt-footer.d.ts +16 -0
  10. package/es/gantt/src/gantt-footer.js +62 -57
  11. package/es/gantt/src/gantt-header.d.ts +16 -0
  12. package/es/gantt/src/gantt-header.js +172 -174
  13. package/es/gantt/src/gantt-view.d.ts +76 -0
  14. package/es/gantt/src/gantt-view.js +2437 -2512
  15. package/es/gantt/src/gantt.d.ts +729 -0
  16. package/es/gantt/src/gantt.js +2815 -2858
  17. package/es/gantt/src/static.d.ts +34 -0
  18. package/es/gantt/src/static.js +16 -36
  19. package/es/gantt/src/util.d.ts +9 -0
  20. package/es/gantt/src/util.js +28 -19
  21. package/es/gantt/style.css +1 -1
  22. package/es/gantt/style.mini.css +1 -0
  23. package/es/index.d.ts +6 -0
  24. package/es/index.esm.js +6 -6
  25. package/es/index.js +6 -0
  26. package/es/ui/index.d.ts +3 -0
  27. package/es/ui/index.js +123 -120
  28. package/es/ui/src/comp.d.ts +2 -0
  29. package/es/ui/src/comp.js +4 -1
  30. package/es/ui/src/depend.d.ts +1 -0
  31. package/es/ui/src/depend.js +14 -12
  32. package/es/ui/src/dom.d.ts +49 -0
  33. package/es/ui/src/dom.js +180 -169
  34. package/es/ui/src/log.d.ts +6 -0
  35. package/es/ui/src/log.js +18 -13
  36. package/es/ui/src/utils.d.ts +21 -0
  37. package/es/ui/src/utils.js +60 -62
  38. package/es/ui/src/vn.d.ts +2 -0
  39. package/es/ui/src/vn.js +12 -9
  40. package/es/vxe-gantt/index.d.ts +3 -0
  41. package/es/vxe-gantt/index.js +6 -3
  42. package/es/vxe-gantt/style.css +1 -1
  43. package/es/vxe-gantt/style.mini.css +1 -0
  44. package/es/vxe-ui/index.d.ts +3 -0
  45. package/es/vxe-ui/index.js +6 -3
  46. package/lib/components.js +39 -35
  47. package/lib/gantt/index.js +50 -36
  48. package/lib/gantt/src/gantt-body.js +240 -245
  49. package/lib/gantt/src/gantt-chart.js +405 -375
  50. package/lib/gantt/src/gantt-footer.js +63 -46
  51. package/lib/gantt/src/gantt-header.js +186 -162
  52. package/lib/gantt/src/gantt-view.js +1554 -1745
  53. package/lib/gantt/src/gantt.js +2455 -2676
  54. package/lib/gantt/src/static.js +34 -40
  55. package/lib/gantt/src/util.js +32 -15
  56. package/lib/gantt/style/index.js +1 -1
  57. package/lib/gantt/style/style.css +1 -1
  58. package/lib/gantt/style/style.mini.css +1 -0
  59. package/lib/index.common.js +35 -23
  60. package/lib/index.js +37 -0
  61. package/lib/index.umd.js +4910 -15882
  62. package/lib/index.umd.min.js +1 -1
  63. package/lib/style.css +989 -1
  64. package/lib/style.mini.css +1 -0
  65. package/lib/ui/index.js +36 -25
  66. package/lib/ui/src/comp.js +22 -7
  67. package/lib/ui/src/depend.js +30 -13
  68. package/lib/ui/src/dom.js +88 -95
  69. package/lib/ui/src/log.js +34 -18
  70. package/lib/ui/src/utils.js +58 -50
  71. package/lib/ui/src/vn.js +35 -9
  72. package/lib/ui/style/index.js +1 -1
  73. package/lib/vxe-gantt/index.js +35 -20
  74. package/lib/vxe-gantt/style/index.js +1 -1
  75. package/lib/vxe-gantt/style/style.css +1 -1
  76. package/lib/vxe-gantt/style/style.mini.css +1 -0
  77. package/lib/vxe-ui/index.js +35 -20
  78. package/lib/vxe-ui/style/index.js +1 -1
  79. package/package.json +7 -4
  80. package/packages/gantt/src/gantt-view.ts +2 -0
  81. package/packages/gantt/src/gantt.ts +4 -0
  82. package/packages/ui/src/utils.ts +3 -12
  83. package/es/gantt/style.min.css +0 -1
  84. package/es/style.css +0 -1
  85. package/es/style.min.css +0 -1
  86. package/es/vxe-gantt/style.min.css +0 -1
  87. package/lib/components.min.js +0 -1
  88. package/lib/gantt/index.min.js +0 -1
  89. package/lib/gantt/src/gantt-body.min.js +0 -1
  90. package/lib/gantt/src/gantt-chart.min.js +0 -1
  91. package/lib/gantt/src/gantt-footer.min.js +0 -1
  92. package/lib/gantt/src/gantt-header.min.js +0 -1
  93. package/lib/gantt/src/gantt-view.min.js +0 -1
  94. package/lib/gantt/src/gantt.min.js +0 -1
  95. package/lib/gantt/src/static.min.js +0 -1
  96. package/lib/gantt/src/util.min.js +0 -1
  97. package/lib/gantt/style/style.min.css +0 -1
  98. package/lib/style.min.css +0 -1
  99. package/lib/ui/index.min.js +0 -1
  100. package/lib/ui/src/comp.min.js +0 -1
  101. package/lib/ui/src/depend.min.js +0 -1
  102. package/lib/ui/src/dom.min.js +0 -1
  103. package/lib/ui/src/log.min.js +0 -1
  104. package/lib/ui/src/utils.min.js +0 -1
  105. package/lib/ui/src/vn.min.js +0 -1
  106. package/lib/vxe-gantt/index.min.js +0 -1
  107. package/lib/vxe-gantt/style/style.min.css +0 -1
  108. package/lib/vxe-ui/index.min.js +0 -1
  109. /package/es/ui/{style.min.css → style.mini.css} +0 -0
  110. /package/es/vxe-ui/{style.min.css → style.mini.css} +0 -0
  111. /package/lib/ui/style/{style.min.css → style.mini.css} +0 -0
  112. /package/lib/vxe-ui/style/{style.min.css → style.mini.css} +0 -0
package/es/gantt/index.js CHANGED
@@ -1,26 +1,31 @@
1
- import { VxeUI } from '@vxe-ui/core';
2
- import { checkDependVersion } from '../ui/src/depend';
3
- import VxeGanttComponent from './src/gantt';
1
+ import { VxeUI } from "@vxe-ui/core";
2
+ import { checkDependVersion } from "../ui/src/depend";
3
+ import VxeGanttComponent from "./src/gantt";
4
4
  let isReg = false;
5
- export const VxeGantt = Object.assign({}, VxeGanttComponent, {
6
- install(app) {
7
- if (typeof window !== 'undefined') {
8
- const VxeGanttExtendGanttChart = window.VxeGanttExtendGanttChart;
9
- if (VxeGanttExtendGanttChart && VxeGanttExtendGanttChart.use) {
10
- VxeGanttExtendGanttChart.use(VxeUI);
11
- }
12
- }
13
- if (!isReg) {
14
- isReg = true;
15
- if (VxeUI.dynamicApp) {
16
- VxeUI.dynamicApp.use(VxeGantt);
17
- }
18
- }
19
- checkDependVersion();
20
- app.component(VxeGanttComponent.name, VxeGanttComponent);
5
+ const VxeGantt = Object.assign({}, VxeGanttComponent, {
6
+ install(app) {
7
+ if (typeof window !== "undefined") {
8
+ const VxeGanttExtendGanttChart = window.VxeGanttExtendGanttChart;
9
+ if (VxeGanttExtendGanttChart && VxeGanttExtendGanttChart.use) {
10
+ VxeGanttExtendGanttChart.use(VxeUI);
11
+ }
21
12
  }
13
+ if (!isReg) {
14
+ isReg = true;
15
+ if (VxeUI.dynamicApp) {
16
+ VxeUI.dynamicApp.use(VxeGantt);
17
+ }
18
+ }
19
+ checkDependVersion();
20
+ app.component(VxeGanttComponent.name, VxeGanttComponent);
21
+ }
22
22
  });
23
23
  VxeUI.component(VxeGanttComponent);
24
- export * from './src/static';
25
- export const Gantt = VxeGantt;
26
- export default VxeGantt;
24
+ export * from "./src/static";
25
+ const Gantt = VxeGantt;
26
+ var gantt_default = VxeGantt;
27
+ export {
28
+ Gantt,
29
+ VxeGantt,
30
+ gantt_default as default
31
+ };
@@ -0,0 +1,19 @@
1
+ import { VNode, CreateElement } from 'vue';
2
+ import type { VxeTableConstructor, VxeTableMethods, VxeTablePrivateMethods } from 'vxe-table';
3
+ import type { VxeGanttViewPrivateMethods, VxeGanttConstructor, VxeGanttPrivateMethods, VxeGanttDefines } from '../../../types';
4
+ declare const _default: import("vue/types/vue").ExtendedVue<import("vue").default, unknown, {
5
+ renderColumn(h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, row: any, rowid: string, rowIndex: number, $rowIndex: number, _rowIndex: number, column: VxeGanttDefines.ViewColumn, $columnIndex: number): VNode;
6
+ renderRows(h: CreateElement, $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods, tableData: any[]): VNode[];
7
+ renderVN(h: CreateElement): VNode;
8
+ }, {
9
+ $xeGantt: import("vxe-pc-ui").VxeComponentBaseOptions & {
10
+ reactData: import("vxe-pc-ui/types/components/gantt").GanttReactData<any>;
11
+ internalData: import("vxe-pc-ui/types/components/gantt").GanttInternalData;
12
+ } & import("vxe-pc-ui/types/components/gantt").VxeGanttMethods<any> & import("vxe-pc-ui/types/components/gantt").VxeGanttPrivateComputed<any> & import("vxe-pc-ui/types/components/gantt").VxeGanttProps<any> & import("vue").default & VxeGanttPrivateMethods<any>;
13
+ $xeGanttView: import("vxe-pc-ui").VxeComponentBaseOptions & {
14
+ reactData: import("vxe-pc-ui/types/components/gantt-module").GanttViewReactData;
15
+ internalData: import("vxe-pc-ui/types/components/gantt-module").GanttViewInternalData;
16
+ $xeGantt: VxeGanttConstructor;
17
+ } & import("vxe-pc-ui/types/components/gantt-module").VxeGanttViewMethods & import("vxe-pc-ui/types/components/gantt-module").GanttViewPrivateComputed & import("vxe-pc-ui/types/components/gantt-module").VxeGanttViewProps & import("vue").default & VxeGanttViewPrivateMethods;
18
+ }, Record<never, any>>;
19
+ export default _default;
@@ -1,296 +1,299 @@
1
- import { defineVxeComponent } from '../../ui/src/comp';
2
- import { getCellRestHeight } from './util';
3
- import { getClass } from '../../ui/src/utils';
4
- import XEUtils from 'xe-utils';
5
- import GanttViewChartComponent from './gantt-chart';
6
- const sourceType = 'gantt';
7
- const viewType = 'body';
8
- export default defineVxeComponent({
9
- name: 'VxeGanttViewBody',
10
- inject: {
11
- $xeGantt: {
12
- default: null
13
- },
14
- $xeGanttView: {
15
- default: null
16
- }
1
+ import { defineVxeComponent } from "../../ui/src/comp";
2
+ import { getCellRestHeight } from "./util";
3
+ import { getClass } from "../../ui/src/utils";
4
+ import XEUtils from "xe-utils";
5
+ import GanttViewChartComponent from "./gantt-chart";
6
+ const sourceType = "gantt";
7
+ const viewType = "body";
8
+ var gantt_body_default = defineVxeComponent({
9
+ name: "VxeGanttViewBody",
10
+ inject: {
11
+ $xeGantt: {
12
+ default: null
17
13
  },
18
- computed: Object.assign({}, {}),
19
- methods: {
20
- //
21
- // Render
22
- //
23
- renderColumn(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex) {
24
- const _vm = this;
25
- const $xeGanttView = _vm.$xeGanttView;
26
- const $xeGantt = _vm.$xeGantt;
27
- const { reactData, internalData } = $xeGanttView;
28
- const tableReactData = $xeTable.getReactData();
29
- const { resizeHeightFlag } = tableReactData;
30
- const tableInternalData = $xeTable.getInternalData();
31
- const { fullAllDataRowIdData, visibleColumn } = tableInternalData;
32
- const cellOpts = $xeTable.computeCellOpts;
33
- const rowOpts = $xeTable.computeRowOpts;
34
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
35
- const resizableOpts = $xeTable.computeResizableOpts;
36
- const { isAllRowDrag } = resizableOpts;
37
- const { headerGroups } = reactData;
38
- const { todayDateMaps } = internalData;
39
- const taskViewOpts = $xeGantt.computeTaskViewOpts;
40
- const { showNowLine, viewStyle } = taskViewOpts;
41
- const scaleUnit = $xeGantt.computeScaleUnit;
42
- const { scaleItem } = headerGroups[headerGroups.length - 1] || {};
43
- const { field, dateObj, startDateObj, endDateObj } = column;
44
- const { cellClassName, cellStyle } = viewStyle || {};
45
- const todayValue = showNowLine && scaleItem ? todayDateMaps[scaleItem.type] : null;
46
- const rowRest = fullAllDataRowIdData[rowid] || {};
47
- const cellHeight = resizeHeightFlag ? getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) : 0;
48
- const tdVNs = [];
49
- if (isAllRowDrag && rowOpts.resizable) {
50
- const cellParams = {
51
- $table: $xeTable,
52
- $grid: null,
53
- $gantt: $xeGantt,
54
- seq: -1,
55
- rowid,
56
- row,
57
- rowIndex,
58
- $rowIndex,
59
- _rowIndex,
60
- column: visibleColumn[0],
61
- columnIndex: 0,
62
- $columnIndex: 0,
63
- _columnIndex: 0,
64
- fixed: '',
65
- source: sourceType,
66
- type: viewType,
67
- isHidden: false,
68
- isEdit: false,
69
- level: -1,
70
- // 已废弃属性
71
- visibleData: [],
72
- data: [],
73
- items: []
74
- };
75
- tdVNs.push(h('div', {
76
- class: 'vxe-gantt-view-cell--row-resizable',
77
- on: {
78
- mousedown: (evnt) => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
79
- dblclick: (evnt) => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
80
- }
81
- }));
14
+ $xeGanttView: {
15
+ default: null
16
+ }
17
+ },
18
+ computed: {
19
+ ...{}
20
+ },
21
+ methods: {
22
+ //
23
+ // Render
24
+ //
25
+ renderColumn(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex) {
26
+ const _vm = this;
27
+ const $xeGanttView = _vm.$xeGanttView;
28
+ const $xeGantt = _vm.$xeGantt;
29
+ const { reactData, internalData } = $xeGanttView;
30
+ const tableReactData = $xeTable.getReactData();
31
+ const { resizeHeightFlag } = tableReactData;
32
+ const tableInternalData = $xeTable.getInternalData();
33
+ const { fullAllDataRowIdData, visibleColumn } = tableInternalData;
34
+ const cellOpts = $xeTable.computeCellOpts;
35
+ const rowOpts = $xeTable.computeRowOpts;
36
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
37
+ const resizableOpts = $xeTable.computeResizableOpts;
38
+ const { isAllRowDrag } = resizableOpts;
39
+ const { headerGroups } = reactData;
40
+ const { todayDateMaps } = internalData;
41
+ const taskViewOpts = $xeGantt.computeTaskViewOpts;
42
+ const { showNowLine, viewStyle } = taskViewOpts;
43
+ const scaleUnit = $xeGantt.computeScaleUnit;
44
+ const { scaleItem } = headerGroups[headerGroups.length - 1] || {};
45
+ const { field, dateObj, startDateObj, endDateObj } = column;
46
+ const { cellClassName, cellStyle } = viewStyle || {};
47
+ const todayValue = showNowLine && scaleItem ? todayDateMaps[scaleItem.type] : null;
48
+ const rowRest = fullAllDataRowIdData[rowid] || {};
49
+ const cellHeight = resizeHeightFlag ? getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) : 0;
50
+ const tdVNs = [];
51
+ if (isAllRowDrag && rowOpts.resizable) {
52
+ const cellParams = {
53
+ $table: $xeTable,
54
+ $grid: null,
55
+ $gantt: $xeGantt,
56
+ seq: -1,
57
+ rowid,
58
+ row,
59
+ rowIndex,
60
+ $rowIndex,
61
+ _rowIndex,
62
+ column: visibleColumn[0],
63
+ columnIndex: 0,
64
+ $columnIndex: 0,
65
+ _columnIndex: 0,
66
+ fixed: "",
67
+ source: sourceType,
68
+ type: viewType,
69
+ isHidden: false,
70
+ isEdit: false,
71
+ level: -1,
72
+ // 已废弃属性
73
+ visibleData: [],
74
+ data: [],
75
+ items: []
76
+ };
77
+ tdVNs.push(
78
+ h("div", {
79
+ class: "vxe-gantt-view-cell--row-resizable",
80
+ on: {
81
+ mousedown: (evnt) => $xeTable.handleRowResizeMousedownEvent(evnt, cellParams),
82
+ dblclick: (evnt) => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
82
83
  }
83
- const ctParams = {
84
- $gantt: $xeGantt,
85
- source: sourceType,
86
- type: viewType,
87
- scaleType: scaleUnit,
88
- dateObj,
89
- startDateObj,
90
- endDateObj,
91
- row,
92
- column,
93
- $rowIndex,
94
- rowIndex,
95
- _rowIndex
96
- };
97
- return h('td', {
98
- key: cellClassName || cellStyle ? field : $columnIndex,
99
- class: [
100
- 'vxe-gantt-view--body-column',
101
- {
102
- 'is--now': showNowLine && todayValue === field
103
- },
104
- getClass(cellClassName, ctParams)
105
- ],
106
- style: cellStyle
107
- ? Object.assign({}, XEUtils.isFunction(cellStyle) ? cellStyle(ctParams) : cellStyle, {
108
- height: `${cellHeight}px`
109
- })
110
- : {
111
- height: `${cellHeight}px`
112
- },
113
- on: {
114
- click(evnt) {
115
- $xeGantt.handleTaskCellClickEvent(evnt, { row, column });
116
- },
117
- dblclick(evnt) {
118
- $xeGantt.handleTaskCellDblclickEvent(evnt, { row, column });
119
- },
120
- contextmenu(evnt) {
121
- $xeGantt.handleTaskBodyContextmenuEvent(evnt, ctParams);
122
- }
123
- }
124
- }, tdVNs);
125
- },
126
- renderRows(h, $xeTable, tableData) {
127
- const _vm = this;
128
- const $xeGanttView = _vm.$xeGanttView;
129
- const $xeGantt = _vm.$xeGantt;
130
- const { reactData } = $xeGanttView;
131
- const tableProps = $xeTable;
132
- const { treeConfig, stripe, highlightHoverRow, editConfig } = tableProps;
133
- const tableReactData = $xeTable.getReactData();
134
- const { treeExpandedFlag, selectRadioRow, pendingRowFlag, isRowGroupStatus } = tableReactData;
135
- const tableInternalData = $xeTable.getInternalData();
136
- const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps } = tableInternalData;
137
- const radioOpts = $xeTable.computeRadioOpts;
138
- const checkboxOpts = $xeTable.computeCheckboxOpts;
139
- const rowOpts = $xeTable.computeRowOpts;
140
- const treeOpts = $xeTable.computeTreeOpts;
141
- const { transform } = treeOpts;
142
- const childrenField = treeOpts.children || treeOpts.childrenField;
143
- const scaleUnit = $xeGantt.computeScaleUnit;
144
- const taskViewOpts = $xeGantt.computeTaskViewOpts;
145
- const { viewStyle } = taskViewOpts;
146
- const { rowClassName, rowStyle, cellClassName, cellStyle } = viewStyle || {};
147
- const { tableColumn, scrollYLoad } = reactData;
148
- const trVNs = [];
149
- tableData.forEach((row, $rowIndex) => {
150
- const rowid = $xeTable.getRowid(row);
151
- const rowRest = fullAllDataRowIdData[rowid] || {};
152
- const trOns = {};
153
- let rowIndex = $rowIndex;
154
- let _rowIndex = -1;
155
- if (rowRest) {
156
- rowIndex = rowRest.index;
157
- _rowIndex = rowRest._index;
158
- }
159
- // 是否新增行
160
- let isNewRow = false;
161
- if (editConfig) {
162
- isNewRow = $xeTable.isInsertByRow(row);
163
- }
164
- // 当前行事件
165
- if (rowOpts.isHover || highlightHoverRow) {
166
- trOns.mouseenter = (evnt) => {
167
- $xeTable.triggerHoverEvent(evnt, { row, rowIndex });
168
- };
169
- trOns.mouseleave = () => {
170
- $xeTable.clearHoverRow();
171
- };
172
- }
173
- // 拖拽行事件
174
- if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
175
- trOns.dragstart = $xeTable.handleRowDragDragstartEvent;
176
- trOns.dragend = $xeTable.handleRowDragDragendEvent;
177
- trOns.dragover = $xeTable.handleRowDragDragoverEvent;
178
- }
179
- const rowParams = {
180
- $gantt: $xeGantt,
181
- source: sourceType,
182
- type: viewType,
183
- scaleType: scaleUnit,
184
- row,
185
- rowIndex,
186
- $rowIndex,
187
- _rowIndex
188
- };
189
- trVNs.push(h('tr', {
190
- key: rowClassName || rowStyle || cellClassName || cellStyle ? rowid : $rowIndex,
191
- class: [
192
- 'vxe-gantt-view--body-row',
193
- {
194
- 'row--stripe': stripe && (_rowIndex + 1) % 2 === 0,
195
- 'is--new': isNewRow,
196
- 'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
197
- 'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
198
- 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
199
- },
200
- getClass(rowClassName, rowParams)
201
- ],
202
- style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(rowParams) || undefined : rowStyle) : undefined,
203
- attrs: {
204
- rowid
205
- },
206
- on: trOns
207
- }, tableColumn.map((column, $columnIndex) => _vm.renderColumn(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex))));
208
- let isExpandTree = false;
209
- let rowChildren = [];
210
- if (treeConfig && !scrollYLoad && !transform) {
211
- rowChildren = row[childrenField];
212
- isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
213
- }
214
- // 如果是树形表格
215
- if (isExpandTree) {
216
- trVNs.push(..._vm.renderRows(h, $xeTable, rowChildren));
217
- }
218
- });
219
- return trVNs;
84
+ })
85
+ );
86
+ }
87
+ const ctParams = {
88
+ $gantt: $xeGantt,
89
+ source: sourceType,
90
+ type: viewType,
91
+ scaleType: scaleUnit,
92
+ dateObj,
93
+ startDateObj,
94
+ endDateObj,
95
+ row,
96
+ column,
97
+ $rowIndex,
98
+ rowIndex,
99
+ _rowIndex
100
+ };
101
+ return h("td", {
102
+ key: cellClassName || cellStyle ? field : $columnIndex,
103
+ class: [
104
+ "vxe-gantt-view--body-column",
105
+ {
106
+ "is--now": showNowLine && todayValue === field
107
+ },
108
+ getClass(cellClassName, ctParams)
109
+ ],
110
+ style: cellStyle ? Object.assign({}, XEUtils.isFunction(cellStyle) ? cellStyle(ctParams) : cellStyle, {
111
+ height: `${cellHeight}px`
112
+ }) : {
113
+ height: `${cellHeight}px`
220
114
  },
221
- renderVN(h) {
222
- const _vm = this;
223
- const $xeGantt = _vm.$xeGantt;
224
- const $xeGanttView = _vm.$xeGanttView;
225
- const { reactData } = $xeGanttView;
226
- const $xeTable = $xeGanttView.internalData.xeTable;
227
- const { tableData, tableColumn, viewCellWidth } = reactData;
228
- return h('div', {
229
- ref: 'refElem',
230
- class: 'vxe-gantt-view--body-wrapper'
231
- }, [
232
- h('div', {
233
- ref: 'refBodyScroll',
234
- class: 'vxe-gantt-view--body-inner-wrapper',
235
- on: {
236
- scroll: $xeGanttView.triggerBodyScrollEvent,
237
- contextmenu(evnt) {
238
- $xeGantt.handleTaskBodyContextmenuEvent(evnt, { source: sourceType, type: viewType, rowIndex: -1, $rowIndex: -1, _rowIndex: -1 });
239
- }
240
- }
241
- }, [
242
- h('div', {
243
- ref: 'refBodyXSpace',
244
- class: 'vxe-body--x-space'
245
- }),
246
- h('div', {
247
- ref: 'refBodyYSpace',
248
- class: 'vxe-body--y-space'
249
- }),
250
- h('table', {
251
- ref: 'refBodyTable',
252
- class: 'vxe-gantt-view--body-table'
253
- }, [
254
- h('colgroup', {}, tableColumn.map((column, cIndex) => {
255
- return h('col', {
256
- key: cIndex,
257
- style: {
258
- width: `${viewCellWidth}px`
259
- }
260
- });
261
- })),
262
- h('tbody', {}, $xeTable ? _vm.renderRows(h, $xeTable, tableData) : [])
263
- ]),
264
- h(GanttViewChartComponent)
265
- ])
266
- ]);
115
+ on: {
116
+ click(evnt) {
117
+ $xeGantt.handleTaskCellClickEvent(evnt, { row, column });
118
+ },
119
+ dblclick(evnt) {
120
+ $xeGantt.handleTaskCellDblclickEvent(evnt, { row, column });
121
+ },
122
+ contextmenu(evnt) {
123
+ $xeGantt.handleTaskBodyContextmenuEvent(evnt, ctParams);
124
+ }
267
125
  }
126
+ }, tdVNs);
268
127
  },
269
- mounted() {
270
- const _vm = this;
271
- const $xeGanttView = _vm.$xeGanttView;
272
- const { internalData } = $xeGanttView;
273
- const { elemStore } = internalData;
274
- const prefix = 'main-body-';
275
- elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
276
- elemStore[`${prefix}scroll`] = _vm.$refs.refBodyScroll;
277
- elemStore[`${prefix}table`] = _vm.$refs.refBodyTable;
278
- elemStore[`${prefix}xSpace`] = _vm.$refs.refBodyXSpace;
279
- elemStore[`${prefix}ySpace`] = _vm.$refs.refBodyYSpace;
280
- },
281
- destroyed() {
282
- const _vm = this;
283
- const $xeGanttView = _vm.$xeGanttView;
284
- const { internalData } = $xeGanttView;
285
- const { elemStore } = internalData;
286
- const prefix = 'main-body-';
287
- elemStore[`${prefix}wrapper`] = null;
288
- elemStore[`${prefix}scroll`] = null;
289
- elemStore[`${prefix}table`] = null;
290
- elemStore[`${prefix}xSpace`] = null;
291
- elemStore[`${prefix}ySpace`] = null;
128
+ renderRows(h, $xeTable, tableData) {
129
+ const _vm = this;
130
+ const $xeGanttView = _vm.$xeGanttView;
131
+ const $xeGantt = _vm.$xeGantt;
132
+ const { reactData } = $xeGanttView;
133
+ const tableProps = $xeTable;
134
+ const { treeConfig, stripe, highlightHoverRow, editConfig } = tableProps;
135
+ const tableReactData = $xeTable.getReactData();
136
+ const { treeExpandedFlag, selectRadioRow, pendingRowFlag, isRowGroupStatus } = tableReactData;
137
+ const tableInternalData = $xeTable.getInternalData();
138
+ const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps } = tableInternalData;
139
+ const radioOpts = $xeTable.computeRadioOpts;
140
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
141
+ const rowOpts = $xeTable.computeRowOpts;
142
+ const treeOpts = $xeTable.computeTreeOpts;
143
+ const { transform } = treeOpts;
144
+ const childrenField = treeOpts.children || treeOpts.childrenField;
145
+ const scaleUnit = $xeGantt.computeScaleUnit;
146
+ const taskViewOpts = $xeGantt.computeTaskViewOpts;
147
+ const { viewStyle } = taskViewOpts;
148
+ const { rowClassName, rowStyle, cellClassName, cellStyle } = viewStyle || {};
149
+ const { tableColumn, scrollYLoad } = reactData;
150
+ const trVNs = [];
151
+ tableData.forEach((row, $rowIndex) => {
152
+ const rowid = $xeTable.getRowid(row);
153
+ const rowRest = fullAllDataRowIdData[rowid] || {};
154
+ const trOns = {};
155
+ let rowIndex = $rowIndex;
156
+ let _rowIndex = -1;
157
+ if (rowRest) {
158
+ rowIndex = rowRest.index;
159
+ _rowIndex = rowRest._index;
160
+ }
161
+ let isNewRow = false;
162
+ if (editConfig) {
163
+ isNewRow = $xeTable.isInsertByRow(row);
164
+ }
165
+ if (rowOpts.isHover || highlightHoverRow) {
166
+ trOns.mouseenter = (evnt) => {
167
+ $xeTable.triggerHoverEvent(evnt, { row, rowIndex });
168
+ };
169
+ trOns.mouseleave = () => {
170
+ $xeTable.clearHoverRow();
171
+ };
172
+ }
173
+ if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
174
+ trOns.dragstart = $xeTable.handleRowDragDragstartEvent;
175
+ trOns.dragend = $xeTable.handleRowDragDragendEvent;
176
+ trOns.dragover = $xeTable.handleRowDragDragoverEvent;
177
+ }
178
+ const rowParams = {
179
+ $gantt: $xeGantt,
180
+ source: sourceType,
181
+ type: viewType,
182
+ scaleType: scaleUnit,
183
+ row,
184
+ rowIndex,
185
+ $rowIndex,
186
+ _rowIndex
187
+ };
188
+ trVNs.push(
189
+ h("tr", {
190
+ key: rowClassName || rowStyle || cellClassName || cellStyle ? rowid : $rowIndex,
191
+ class: [
192
+ "vxe-gantt-view--body-row",
193
+ {
194
+ "row--stripe": stripe && (_rowIndex + 1) % 2 === 0,
195
+ "is--new": isNewRow,
196
+ "row--radio": radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
197
+ "row--checked": checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
198
+ "row--pending": !!pendingRowFlag && !!pendingRowMaps[rowid]
199
+ },
200
+ getClass(rowClassName, rowParams)
201
+ ],
202
+ style: rowStyle ? XEUtils.isFunction(rowStyle) ? rowStyle(rowParams) || void 0 : rowStyle : void 0,
203
+ attrs: {
204
+ rowid
205
+ },
206
+ on: trOns
207
+ }, tableColumn.map((column, $columnIndex) => _vm.renderColumn(h, $xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex)))
208
+ );
209
+ let isExpandTree = false;
210
+ let rowChildren = [];
211
+ if (treeConfig && !scrollYLoad && !transform) {
212
+ rowChildren = row[childrenField];
213
+ isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
214
+ }
215
+ if (isExpandTree) {
216
+ trVNs.push(..._vm.renderRows(h, $xeTable, rowChildren));
217
+ }
218
+ });
219
+ return trVNs;
292
220
  },
293
- render(h) {
294
- return this.renderVN(h);
221
+ renderVN(h) {
222
+ const _vm = this;
223
+ const $xeGantt = _vm.$xeGantt;
224
+ const $xeGanttView = _vm.$xeGanttView;
225
+ const { reactData } = $xeGanttView;
226
+ const $xeTable = $xeGanttView.internalData.xeTable;
227
+ const { tableData, tableColumn, viewCellWidth } = reactData;
228
+ return h("div", {
229
+ ref: "refElem",
230
+ class: "vxe-gantt-view--body-wrapper"
231
+ }, [
232
+ h("div", {
233
+ ref: "refBodyScroll",
234
+ class: "vxe-gantt-view--body-inner-wrapper",
235
+ on: {
236
+ scroll: $xeGanttView.triggerBodyScrollEvent,
237
+ contextmenu(evnt) {
238
+ $xeGantt.handleTaskBodyContextmenuEvent(evnt, { source: sourceType, type: viewType, rowIndex: -1, $rowIndex: -1, _rowIndex: -1 });
239
+ }
240
+ }
241
+ }, [
242
+ h("div", {
243
+ ref: "refBodyXSpace",
244
+ class: "vxe-body--x-space"
245
+ }),
246
+ h("div", {
247
+ ref: "refBodyYSpace",
248
+ class: "vxe-body--y-space"
249
+ }),
250
+ h("table", {
251
+ ref: "refBodyTable",
252
+ class: "vxe-gantt-view--body-table"
253
+ }, [
254
+ h("colgroup", {}, tableColumn.map((column, cIndex) => {
255
+ return h("col", {
256
+ key: cIndex,
257
+ style: {
258
+ width: `${viewCellWidth}px`
259
+ }
260
+ });
261
+ })),
262
+ h("tbody", {}, $xeTable ? _vm.renderRows(h, $xeTable, tableData) : [])
263
+ ]),
264
+ h(GanttViewChartComponent)
265
+ ])
266
+ ]);
295
267
  }
268
+ },
269
+ mounted() {
270
+ const _vm = this;
271
+ const $xeGanttView = _vm.$xeGanttView;
272
+ const { internalData } = $xeGanttView;
273
+ const { elemStore } = internalData;
274
+ const prefix = "main-body-";
275
+ elemStore[`${prefix}wrapper`] = _vm.$refs.refElem;
276
+ elemStore[`${prefix}scroll`] = _vm.$refs.refBodyScroll;
277
+ elemStore[`${prefix}table`] = _vm.$refs.refBodyTable;
278
+ elemStore[`${prefix}xSpace`] = _vm.$refs.refBodyXSpace;
279
+ elemStore[`${prefix}ySpace`] = _vm.$refs.refBodyYSpace;
280
+ },
281
+ destroyed() {
282
+ const _vm = this;
283
+ const $xeGanttView = _vm.$xeGanttView;
284
+ const { internalData } = $xeGanttView;
285
+ const { elemStore } = internalData;
286
+ const prefix = "main-body-";
287
+ elemStore[`${prefix}wrapper`] = null;
288
+ elemStore[`${prefix}scroll`] = null;
289
+ elemStore[`${prefix}table`] = null;
290
+ elemStore[`${prefix}xSpace`] = null;
291
+ elemStore[`${prefix}ySpace`] = null;
292
+ },
293
+ render(h) {
294
+ return this.renderVN(h);
295
+ }
296
296
  });
297
+ export {
298
+ gantt_body_default as default
299
+ };