@syncfusion/ej2-gantt 19.4.56 → 20.1.47-1460716
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.
- package/CHANGELOG.md +1072 -1060
- package/README.md +75 -75
- package/dist/ej2-gantt.umd.min.js +1 -10
- package/dist/ej2-gantt.umd.min.js.map +1 -1
- package/dist/es6/ej2-gantt.es2015.js +274 -176
- package/dist/es6/ej2-gantt.es2015.js.map +1 -1
- package/dist/es6/ej2-gantt.es5.js +642 -534
- package/dist/es6/ej2-gantt.es5.js.map +1 -1
- package/dist/global/ej2-gantt.min.js +1 -10
- package/dist/global/ej2-gantt.min.js.map +1 -1
- package/dist/global/index.d.ts +0 -9
- package/dist/ts/components.ts +4 -0
- package/dist/ts/gantt/actions/actions.ts +18 -0
- package/dist/ts/gantt/actions/cell-edit.ts +606 -0
- package/dist/ts/gantt/actions/chart-scroll.ts +167 -0
- package/dist/ts/gantt/actions/column-menu.ts +35 -0
- package/dist/ts/gantt/actions/column-reorder.ts +52 -0
- package/dist/ts/gantt/actions/column-resize.ts +52 -0
- package/dist/ts/gantt/actions/connector-line-edit.ts +829 -0
- package/dist/ts/gantt/actions/context-menu.ts +754 -0
- package/dist/ts/gantt/actions/day-markers.ts +80 -0
- package/dist/ts/gantt/actions/dependency.ts +692 -0
- package/dist/ts/gantt/actions/dialog-edit.ts +2208 -0
- package/dist/ts/gantt/actions/edit.ts +3499 -0
- package/dist/ts/gantt/actions/excel-export.ts +61 -0
- package/dist/ts/gantt/actions/filter.ts +302 -0
- package/dist/ts/gantt/actions/keyboard.ts +306 -0
- package/dist/ts/gantt/actions/pdf-export.ts +214 -0
- package/dist/ts/gantt/actions/rowdragdrop.ts +839 -0
- package/dist/ts/gantt/actions/selection.ts +536 -0
- package/dist/ts/gantt/actions/sort.ts +98 -0
- package/dist/ts/gantt/actions/taskbar-edit.ts +1940 -0
- package/dist/ts/gantt/actions/toolbar.ts +489 -0
- package/dist/ts/gantt/actions/virtual-scroll.ts +60 -0
- package/dist/ts/gantt/base/common.ts +9 -0
- package/dist/ts/gantt/base/constant.ts +13 -0
- package/dist/ts/gantt/base/css-constants.ts +148 -0
- package/dist/ts/gantt/base/date-processor.ts +1257 -0
- package/dist/ts/gantt/base/enum.ts +372 -0
- package/dist/ts/gantt/base/gantt-chart.ts +1248 -0
- package/dist/ts/gantt/base/gantt.ts +4069 -0
- package/dist/ts/gantt/base/interface.ts +955 -0
- package/dist/ts/gantt/base/splitter.ts +174 -0
- package/dist/ts/gantt/base/task-processor.ts +2217 -0
- package/dist/ts/gantt/base/tree-grid.ts +694 -0
- package/dist/ts/gantt/base/utils.ts +208 -0
- package/dist/ts/gantt/export/export-helper.ts +552 -0
- package/dist/ts/gantt/export/pdf-base/dictionary.ts +152 -0
- package/dist/ts/gantt/export/pdf-base/pdf-borders.ts +277 -0
- package/dist/ts/gantt/export/pdf-base/pdf-grid-table.ts +901 -0
- package/dist/ts/gantt/export/pdf-base/pdf-style/gantt-theme.ts +131 -0
- package/dist/ts/gantt/export/pdf-base/pdf-style/style.ts +91 -0
- package/dist/ts/gantt/export/pdf-base/treegrid-layouter.ts +414 -0
- package/dist/ts/gantt/export/pdf-connector-line.ts +422 -0
- package/dist/ts/gantt/export/pdf-gantt.ts +282 -0
- package/dist/ts/gantt/export/pdf-taskbar.ts +395 -0
- package/dist/ts/gantt/export/pdf-timeline.ts +202 -0
- package/dist/ts/gantt/export/pdf-treegrid.ts +406 -0
- package/dist/ts/gantt/models/add-dialog-field-settings.ts +33 -0
- package/dist/ts/gantt/models/column.ts +464 -0
- package/dist/ts/gantt/models/day-working-time.ts +22 -0
- package/dist/ts/gantt/models/edit-dialog-field-settings.ts +33 -0
- package/dist/ts/gantt/models/edit-settings.ts +79 -0
- package/dist/ts/gantt/models/event-marker.ts +27 -0
- package/dist/ts/gantt/models/filter-settings.ts +53 -0
- package/dist/ts/gantt/models/holiday.ts +34 -0
- package/dist/ts/gantt/models/label-settings.ts +30 -0
- package/dist/ts/gantt/models/models.ts +36 -0
- package/dist/ts/gantt/models/resource-fields.ts +38 -0
- package/dist/ts/gantt/models/search-settings.ts +77 -0
- package/dist/ts/gantt/models/selection-settings.ts +56 -0
- package/dist/ts/gantt/models/sort-settings.ts +50 -0
- package/dist/ts/gantt/models/splitter-settings.ts +47 -0
- package/dist/ts/gantt/models/task-fields.ts +171 -0
- package/dist/ts/gantt/models/timeline-settings.ts +112 -0
- package/dist/ts/gantt/models/tooltip-settings.ts +46 -0
- package/dist/ts/gantt/renderer/chart-rows.ts +1838 -0
- package/dist/ts/gantt/renderer/connector-line.ts +1025 -0
- package/dist/ts/gantt/renderer/edit-tooltip.ts +228 -0
- package/dist/ts/gantt/renderer/event-marker.ts +96 -0
- package/dist/ts/gantt/renderer/nonworking-day.ts +205 -0
- package/dist/ts/gantt/renderer/render.ts +5 -0
- package/dist/ts/gantt/renderer/timeline.ts +1397 -0
- package/dist/ts/gantt/renderer/tooltip.ts +450 -0
- package/dist/ts/gantt/renderer/virtual-content-render.ts +50 -0
- package/license +9 -9
- package/package.json +80 -80
- package/src/gantt/actions/cell-edit.js +2 -1
- package/src/gantt/actions/dialog-edit.js +2 -1
- package/src/gantt/actions/edit.js +11 -2
- package/src/gantt/actions/rowdragdrop.js +37 -15
- package/src/gantt/actions/taskbar-edit.js +24 -24
- package/src/gantt/base/date-processor.js +0 -1
- package/src/gantt/base/gantt-chart.js +9 -4
- package/src/gantt/base/gantt-model.d.ts +779 -779
- package/src/gantt/base/gantt.d.ts +27 -27
- package/src/gantt/base/gantt.js +22 -22
- package/src/gantt/base/splitter.js +1 -0
- package/src/gantt/base/task-processor.js +13 -13
- package/src/gantt/base/tree-grid.js +3 -1
- package/src/gantt/export/pdf-base/treegrid-layouter.js +13 -13
- package/src/gantt/export/pdf-connector-line.js +11 -11
- package/src/gantt/export/pdf-gantt.js +24 -24
- package/src/gantt/export/pdf-taskbar.js +11 -11
- package/src/gantt/export/pdf-treegrid.js +13 -13
- package/src/gantt/models/add-dialog-field-settings-model.d.ts +21 -21
- package/src/gantt/models/add-dialog-field-settings.js +19 -19
- package/src/gantt/models/day-working-time-model.d.ts +11 -11
- package/src/gantt/models/day-working-time.js +19 -19
- package/src/gantt/models/edit-dialog-field-settings-model.d.ts +21 -21
- package/src/gantt/models/edit-dialog-field-settings.js +19 -19
- package/src/gantt/models/edit-settings-model.d.ts +50 -50
- package/src/gantt/models/edit-settings.js +19 -19
- package/src/gantt/models/event-marker-model.d.ts +16 -16
- package/src/gantt/models/event-marker.js +19 -19
- package/src/gantt/models/filter-settings-model.d.ts +34 -34
- package/src/gantt/models/filter-settings.js +19 -19
- package/src/gantt/models/holiday-model.d.ts +21 -21
- package/src/gantt/models/holiday.js +19 -19
- package/src/gantt/models/label-settings-model.d.ts +16 -16
- package/src/gantt/models/label-settings.js +19 -19
- package/src/gantt/models/resource-fields-model.d.ts +21 -21
- package/src/gantt/models/resource-fields.js +19 -19
- package/src/gantt/models/search-settings-model.d.ts +56 -56
- package/src/gantt/models/search-settings.js +19 -19
- package/src/gantt/models/selection-settings-model.d.ts +35 -35
- package/src/gantt/models/selection-settings.js +19 -19
- package/src/gantt/models/sort-settings-model.d.ts +24 -24
- package/src/gantt/models/sort-settings.js +19 -19
- package/src/gantt/models/splitter-settings-model.d.ts +30 -30
- package/src/gantt/models/splitter-settings.js +19 -19
- package/src/gantt/models/task-fields-model.d.ts +110 -110
- package/src/gantt/models/task-fields.js +19 -19
- package/src/gantt/models/timeline-settings-model.d.ts +71 -71
- package/src/gantt/models/timeline-settings.js +19 -19
- package/src/gantt/models/tooltip-settings-model.d.ts +26 -26
- package/src/gantt/models/tooltip-settings.js +19 -19
- package/src/gantt/renderer/chart-rows.js +49 -37
- package/src/gantt/renderer/connector-line.js +22 -18
- package/src/gantt/renderer/event-marker.js +1 -0
- package/src/gantt/renderer/nonworking-day.js +13 -6
- package/src/gantt/renderer/timeline.d.ts +1 -0
- package/src/gantt/renderer/timeline.js +48 -12
- package/src/gantt/renderer/tooltip.js +11 -3
- package/styles/bootstrap-dark.css +442 -427
- package/styles/bootstrap.css +442 -433
- package/styles/bootstrap4.css +454 -479
- package/styles/bootstrap5-dark.css +457 -433
- package/styles/bootstrap5.css +457 -433
- package/styles/fabric-dark.css +438 -421
- package/styles/fabric.css +445 -428
- package/styles/fluent-dark.css +1938 -0
- package/styles/fluent-dark.scss +1 -0
- package/styles/fluent.css +1938 -0
- package/styles/fluent.scss +1 -0
- package/styles/gantt/_all.scss +2 -2
- package/styles/gantt/_bootstrap-dark-definition.scss +210 -156
- package/styles/gantt/_bootstrap-definition.scss +211 -157
- package/styles/gantt/_bootstrap4-definition.scss +213 -158
- package/styles/gantt/_bootstrap5-definition.scss +215 -162
- package/styles/gantt/_fabric-dark-definition.scss +211 -157
- package/styles/gantt/_fabric-definition.scss +211 -157
- package/styles/gantt/_fluent-dark-definition.scss +1 -0
- package/styles/gantt/_fluent-definition.scss +215 -162
- package/styles/gantt/_fusionnew-definition.scss +214 -0
- package/styles/gantt/_highcontrast-definition.scss +211 -157
- package/styles/gantt/_highcontrast-light-definition.scss +211 -157
- package/styles/gantt/_layout.scss +1446 -1027
- package/styles/gantt/_material-dark-definition.scss +212 -157
- package/styles/gantt/_material-definition.scss +212 -157
- package/styles/gantt/_material3-definition.scss +215 -0
- package/styles/gantt/_tailwind-definition.scss +215 -161
- package/styles/gantt/_theme.scss +702 -668
- package/styles/gantt/bootstrap-dark.css +442 -427
- package/styles/gantt/bootstrap.css +442 -433
- package/styles/gantt/bootstrap4.css +454 -479
- package/styles/gantt/bootstrap5-dark.css +457 -433
- package/styles/gantt/bootstrap5.css +457 -433
- package/styles/gantt/fabric-dark.css +438 -421
- package/styles/gantt/fabric.css +445 -428
- package/styles/gantt/fluent-dark.css +1938 -0
- package/styles/gantt/fluent-dark.scss +22 -0
- package/styles/gantt/fluent.css +1938 -0
- package/styles/gantt/fluent.scss +22 -0
- package/styles/gantt/highcontrast-light.css +405 -405
- package/styles/gantt/highcontrast.css +444 -456
- package/styles/gantt/icons/_bootstrap-dark.scss +124 -113
- package/styles/gantt/icons/_bootstrap.scss +124 -113
- package/styles/gantt/icons/_bootstrap4.scss +124 -113
- package/styles/gantt/icons/_bootstrap5.scss +124 -112
- package/styles/gantt/icons/_fabric-dark.scss +124 -112
- package/styles/gantt/icons/_fabric.scss +124 -112
- package/styles/gantt/icons/_fluent-dark.scss +1 -0
- package/styles/gantt/icons/_fluent.scss +124 -112
- package/styles/gantt/icons/_fusionnew.scss +120 -0
- package/styles/gantt/icons/_highcontrast.scss +124 -112
- package/styles/gantt/icons/_material-dark.scss +124 -112
- package/styles/gantt/icons/_material.scss +124 -112
- package/styles/gantt/icons/_material3.scss +124 -0
- package/styles/gantt/icons/_tailwind-dark.scss +124 -113
- package/styles/gantt/icons/_tailwind.scss +124 -113
- package/styles/gantt/material-dark.css +446 -417
- package/styles/gantt/material.css +445 -419
- package/styles/gantt/tailwind-dark.css +452 -482
- package/styles/gantt/tailwind.css +449 -479
- package/styles/highcontrast-light.css +405 -405
- package/styles/highcontrast.css +444 -456
- package/styles/material-dark.css +446 -417
- package/styles/material.css +445 -419
- package/styles/tailwind-dark.css +452 -482
- package/styles/tailwind.css +449 -479
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { PdfGantt } from './pdf-gantt';
|
|
2
|
+
import { PdfGanttCellStyle} from './../base/interface';
|
|
3
|
+
import {
|
|
4
|
+
PointF, PdfPage, PdfGraphics, PdfColor, PdfPen, PdfBrush, PdfSolidBrush,
|
|
5
|
+
PdfTrueTypeFont, PdfStandardFont, PdfStringFormat, PdfVerticalAlignment,
|
|
6
|
+
PdfTextAlignment, PdfWordWrapType
|
|
7
|
+
} from '@syncfusion/ej2-pdf-export';
|
|
8
|
+
import { TimelineDetails, TimelineFormat, IGanttStyle, PdfQueryTimelineCellInfoEventArgs } from '../base/interface';
|
|
9
|
+
import { extend, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
10
|
+
import { pixelToPoint } from '../base/utils';
|
|
11
|
+
import { Gantt } from '../base/gantt';
|
|
12
|
+
import { PdfPaddings } from './pdf-base';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*/
|
|
16
|
+
export class PdfTimeline {
|
|
17
|
+
public parent: Gantt;
|
|
18
|
+
private gantt: PdfGantt;
|
|
19
|
+
public topTier: TimelineFormat[];
|
|
20
|
+
public bottomTier: TimelineFormat[];
|
|
21
|
+
public width: number;
|
|
22
|
+
public height: number;
|
|
23
|
+
public topTierCellWidth: number;
|
|
24
|
+
public bottomTierCellWidth: number;
|
|
25
|
+
public topTierHeight: number;
|
|
26
|
+
public bottomTierHeight: number;
|
|
27
|
+
private topTierPoint: PointF;
|
|
28
|
+
private bottomTierPoint: PointF;
|
|
29
|
+
private topTierIndex: number;
|
|
30
|
+
private bottomTierIndex: number;
|
|
31
|
+
private prevTopTierIndex: number;
|
|
32
|
+
private prevBottomTierIndex: number;
|
|
33
|
+
|
|
34
|
+
constructor(gantt?: PdfGantt) {
|
|
35
|
+
this.width = 0;
|
|
36
|
+
this.gantt = gantt;
|
|
37
|
+
this.parent = gantt.parent;
|
|
38
|
+
this.topTierPoint = new PointF();
|
|
39
|
+
this.bottomTierPoint = new PointF();
|
|
40
|
+
this.topTierIndex = 0;
|
|
41
|
+
this.bottomTierIndex = 0;
|
|
42
|
+
this.prevTopTierIndex = 0;
|
|
43
|
+
this.prevBottomTierIndex = 0;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @private
|
|
47
|
+
* @param {PdfPage} page .
|
|
48
|
+
* @param {PointF} startPoint .
|
|
49
|
+
* @param {TimelineDetails} detail .
|
|
50
|
+
* @returns {void}
|
|
51
|
+
*/
|
|
52
|
+
public drawTimeline(page: PdfPage, startPoint: PointF, detail: TimelineDetails): void {
|
|
53
|
+
let remainWidth: number = Math.floor(detail.totalWidth);
|
|
54
|
+
let renderWidth: number = 0;
|
|
55
|
+
this.topTierPoint.x = startPoint.x;
|
|
56
|
+
this.topTierPoint.y = startPoint.y;
|
|
57
|
+
this.prevTopTierIndex = this.topTierIndex;
|
|
58
|
+
this.prevBottomTierIndex = this.bottomTierIndex;
|
|
59
|
+
while (remainWidth > 0) {
|
|
60
|
+
const pHeader: TimelineFormat = this.topTier[this.topTierIndex];
|
|
61
|
+
if (this.topTier.length > this.topTierIndex) {
|
|
62
|
+
let isCompleted: boolean = false;
|
|
63
|
+
if (!this.topTier[this.topTierIndex].isFinished) {
|
|
64
|
+
if (remainWidth >= pHeader.width) {
|
|
65
|
+
renderWidth = pHeader.width;
|
|
66
|
+
pHeader.isFinished = true;
|
|
67
|
+
pHeader.completedWidth = renderWidth;
|
|
68
|
+
isCompleted = true;
|
|
69
|
+
} else {
|
|
70
|
+
renderWidth = remainWidth;
|
|
71
|
+
isCompleted = false;
|
|
72
|
+
pHeader.isFinished = false;
|
|
73
|
+
pHeader.width = pHeader.width - remainWidth;
|
|
74
|
+
pHeader.completedWidth = renderWidth;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//Primary header Event Arguments
|
|
78
|
+
/* eslint-disable-next-line */
|
|
79
|
+
this.triggerQueryTimelinecell(page, this.topTierPoint.x, this.topTierPoint.y, this.topTierHeight, renderWidth, pHeader.value, true);
|
|
80
|
+
this.topTierPoint.x += pixelToPoint(renderWidth);
|
|
81
|
+
remainWidth -= renderWidth;
|
|
82
|
+
if (isCompleted) {
|
|
83
|
+
this.topTierIndex++;
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
remainWidth = 0;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
remainWidth = Math.floor(detail.totalWidth);
|
|
90
|
+
const height: number = this.parent.timelineModule.isSingleTier ? 0 : this.topTierHeight;
|
|
91
|
+
this.bottomTierPoint = new PointF(startPoint.x, pixelToPoint(startPoint.y + height));
|
|
92
|
+
while (remainWidth > 0) {
|
|
93
|
+
const secondHeader: TimelineFormat = this.bottomTier[this.bottomTierIndex];
|
|
94
|
+
if (this.bottomTier.length > this.bottomTierIndex) {
|
|
95
|
+
let isCompleted: boolean = true;
|
|
96
|
+
let width: number = secondHeader.width;
|
|
97
|
+
if (remainWidth < width) {
|
|
98
|
+
width = remainWidth;
|
|
99
|
+
isCompleted = false;
|
|
100
|
+
secondHeader.completedWidth = width;
|
|
101
|
+
}
|
|
102
|
+
//Secondary header Event Arguments
|
|
103
|
+
/* eslint-disable-next-line */
|
|
104
|
+
this.triggerQueryTimelinecell(page, this.bottomTierPoint.x, this.bottomTierPoint.y, this.bottomTierHeight, width, secondHeader.value, false);
|
|
105
|
+
this.bottomTierPoint.x = this.bottomTierPoint.x + pixelToPoint(width);
|
|
106
|
+
remainWidth -= width;
|
|
107
|
+
secondHeader.completedWidth = width;
|
|
108
|
+
if (isCompleted) {
|
|
109
|
+
this.bottomTierIndex++;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
remainWidth = 0;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @param {PdfPage} page .
|
|
120
|
+
* @param {PointF} startPoint .
|
|
121
|
+
* @param {TimelineDetails} detail .
|
|
122
|
+
* @returns {void} .
|
|
123
|
+
* Draw the specific gantt chart side header when the taskbar exceeds the page
|
|
124
|
+
* @private
|
|
125
|
+
*/
|
|
126
|
+
/* eslint-disable-next-line */
|
|
127
|
+
public drawPageTimeline(page: PdfPage, startPoint: PointF, detail: TimelineDetails): void {
|
|
128
|
+
this.topTierPoint = extend({}, {}, startPoint, true) as PointF;
|
|
129
|
+
for (let index: number = this.prevTopTierIndex; index <= this.topTierIndex; index++) {
|
|
130
|
+
if (this.topTier.length > index) {
|
|
131
|
+
const pHeader: TimelineFormat = this.topTier[index];
|
|
132
|
+
if (pHeader.completedWidth > 0) {
|
|
133
|
+
//Primary header Event Arguments
|
|
134
|
+
/* eslint-disable-next-line */
|
|
135
|
+
this.triggerQueryTimelinecell(page, this.topTierPoint.x, this.topTierPoint.y, this.topTierHeight, pHeader.completedWidth, pHeader.value, true);
|
|
136
|
+
this.topTierPoint.x += pixelToPoint(pHeader.completedWidth);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
this.bottomTierPoint.x = startPoint.x;
|
|
141
|
+
this.bottomTierPoint.y = pixelToPoint(startPoint.y + this.topTierHeight);
|
|
142
|
+
for (let index: number = this.prevBottomTierIndex; index <= this.bottomTierIndex; index++) {
|
|
143
|
+
if (this.bottomTier.length > index) {
|
|
144
|
+
const secondHeader: TimelineFormat = this.bottomTier[index];
|
|
145
|
+
if (secondHeader.completedWidth > 0) {
|
|
146
|
+
//Secondary header Event Arguments
|
|
147
|
+
/* eslint-disable-next-line */
|
|
148
|
+
this.triggerQueryTimelinecell(page, this.bottomTierPoint.x, this.bottomTierPoint.y, this.bottomTierHeight, secondHeader.width, secondHeader.value, false);
|
|
149
|
+
this.bottomTierPoint.x = this.bottomTierPoint.x + pixelToPoint(secondHeader.width);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Method to trigger pdf query timelinecell event
|
|
156
|
+
*/
|
|
157
|
+
/* eslint-disable-next-line */
|
|
158
|
+
private triggerQueryTimelinecell(page: PdfPage, x: number, y: number, height: number, width: number, value: string, isTopTier: boolean): void {
|
|
159
|
+
const graphics: PdfGraphics = page.graphics;
|
|
160
|
+
const timelineStyle: PdfGanttCellStyle = {};
|
|
161
|
+
const ganttStyle: IGanttStyle = this.gantt.ganttStyle;
|
|
162
|
+
timelineStyle.borderColor = new PdfColor(ganttStyle.timeline.borderColor);
|
|
163
|
+
timelineStyle.fontColor = new PdfColor(ganttStyle.timeline.fontColor);
|
|
164
|
+
timelineStyle.fontSize = ganttStyle.timeline.fontSize;
|
|
165
|
+
timelineStyle.fontStyle = ganttStyle.timeline.fontStyle;
|
|
166
|
+
timelineStyle.backgroundColor = new PdfColor(ganttStyle.timeline.backgroundColor);
|
|
167
|
+
if (ganttStyle.timeline.padding) {
|
|
168
|
+
timelineStyle.padding = ganttStyle.timeline.padding;
|
|
169
|
+
}
|
|
170
|
+
let format: PdfStringFormat = new PdfStringFormat();
|
|
171
|
+
if (isNullOrUndefined(ganttStyle.timeline.format)) {
|
|
172
|
+
if (isTopTier) {
|
|
173
|
+
format.lineAlignment = PdfVerticalAlignment.Middle;
|
|
174
|
+
format.alignment = PdfTextAlignment.Left;
|
|
175
|
+
} else {
|
|
176
|
+
format.lineAlignment = PdfVerticalAlignment.Middle;
|
|
177
|
+
format.alignment = PdfTextAlignment.Center;
|
|
178
|
+
format.wordWrap = PdfWordWrapType.Character;
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
format = ganttStyle.timeline.format;
|
|
182
|
+
}
|
|
183
|
+
timelineStyle.format = format;
|
|
184
|
+
const eventArgs: PdfQueryTimelineCellInfoEventArgs = {
|
|
185
|
+
timelineCell: timelineStyle,
|
|
186
|
+
value: value
|
|
187
|
+
};
|
|
188
|
+
if (this.parent.pdfQueryTimelineCellInfo) {
|
|
189
|
+
this.parent.trigger('pdfQueryTimelineCellInfo', eventArgs);
|
|
190
|
+
}
|
|
191
|
+
const e: PdfGanttCellStyle = eventArgs.timelineCell;
|
|
192
|
+
const rectPen: PdfPen = new PdfPen(eventArgs.timelineCell.borderColor);
|
|
193
|
+
const rectBrush: PdfBrush = new PdfSolidBrush(eventArgs.timelineCell.backgroundColor);
|
|
194
|
+
graphics.drawRectangle(rectPen, rectBrush, x, y, pixelToPoint(width), pixelToPoint(height));
|
|
195
|
+
const font: PdfTrueTypeFont | PdfStandardFont = new PdfStandardFont(ganttStyle.fontFamily, e.fontSize, e.fontStyle);
|
|
196
|
+
const textBrush: PdfBrush = new PdfSolidBrush(eventArgs.timelineCell.fontColor);
|
|
197
|
+
const pLeft: PdfPaddings | number = ganttStyle.timeline.padding ? eventArgs.timelineCell.padding.left : 0;
|
|
198
|
+
const pTop: PdfPaddings | number = ganttStyle.timeline.padding ? eventArgs.timelineCell.padding.top : 0;
|
|
199
|
+
/* eslint-disable-next-line */
|
|
200
|
+
graphics.drawString(eventArgs.value, font, null, textBrush, x + pLeft, y + pTop, pixelToPoint(width), pixelToPoint(height), e.format);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { PdfGanttCellStyle, IGanttStyle } from './../base/interface';
|
|
2
|
+
import {
|
|
3
|
+
PdfTreeGridColumnCollection, PdfTreeGridCell, PdfTreeGridRow, PdfTreeGridHeaderCollection, PdfTreeGridRowCollection
|
|
4
|
+
} from './pdf-base/index';
|
|
5
|
+
import { PdfTreeGridStyle, PdfBorders, PdfTreeGridLayouter, PdfTreeGridLayoutResult, PdfTreeGridLayoutFormat
|
|
6
|
+
} from './pdf-base/index';
|
|
7
|
+
import {
|
|
8
|
+
PdfLayoutElement, PdfLayoutParams, RectangleF, PdfLayoutFormat, PdfPage, PointF, PdfLayoutResult,
|
|
9
|
+
SizeF, PdfGridBeginCellDrawEventArgs, PdfGridEndCellDrawEventArgs
|
|
10
|
+
} from '@syncfusion/ej2-pdf-export';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* PdfTreeGrid Class for EJ2-PDF
|
|
14
|
+
*/
|
|
15
|
+
export class PdfTreeGrid extends PdfLayoutElement {
|
|
16
|
+
public columns: PdfTreeGridColumnCollection;
|
|
17
|
+
public rows: PdfTreeGridRowCollection;
|
|
18
|
+
public style: PdfTreeGridStyle;
|
|
19
|
+
private initialWidth: number;
|
|
20
|
+
private treeGridSize: SizeF = new SizeF(0, 0);
|
|
21
|
+
public layouter: PdfTreeGridLayouter;
|
|
22
|
+
public headers: PdfTreeGridHeaderCollection;
|
|
23
|
+
private layoutFormat: PdfLayoutFormat;
|
|
24
|
+
public beginCellDraw: Function;
|
|
25
|
+
public endCellDraw: Function;
|
|
26
|
+
private treegridLocation: RectangleF;
|
|
27
|
+
public treeColumnIndex: number = 0;
|
|
28
|
+
public rowHeight: number;
|
|
29
|
+
public allowRowBreakAcrossPages: boolean = true;
|
|
30
|
+
public enableHeader: boolean = true;
|
|
31
|
+
public isFitToWidth: boolean = false;
|
|
32
|
+
public ganttStyle: IGanttStyle;
|
|
33
|
+
|
|
34
|
+
constructor() {
|
|
35
|
+
super();
|
|
36
|
+
this.columns = new PdfTreeGridColumnCollection(this);
|
|
37
|
+
this.rows = new PdfTreeGridRowCollection(this);
|
|
38
|
+
this.headers = new PdfTreeGridHeaderCollection(this);
|
|
39
|
+
this.style = new PdfTreeGridStyle();
|
|
40
|
+
this.rowHeight = 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//Properties
|
|
44
|
+
/**
|
|
45
|
+
* Gets a value indicating whether the `start cell layout event` should be raised.
|
|
46
|
+
*
|
|
47
|
+
* @returns {boolean} .
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
public get raiseBeginCellDraw(): boolean {
|
|
51
|
+
// eslint-disable-next-line
|
|
52
|
+
return (typeof this.beginCellDraw !== 'undefined' && typeof this.beginCellDraw !== null);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Gets a value indicating whether the `end cell layout event` should be raised.
|
|
56
|
+
*
|
|
57
|
+
* @returns {boolean} .
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
public get raiseEndCellDraw(): boolean {
|
|
61
|
+
// eslint-disable-next-line
|
|
62
|
+
return (typeof this.endCellDraw !== 'undefined' && typeof this.endCellDraw !== null);
|
|
63
|
+
}
|
|
64
|
+
public get size(): SizeF {
|
|
65
|
+
if ((this.treeGridSize.width === 0 && this.treeGridSize.height === 0)) {
|
|
66
|
+
this.treeGridSize = this.calculateTreeGridSize();
|
|
67
|
+
}
|
|
68
|
+
return this.treeGridSize;
|
|
69
|
+
}
|
|
70
|
+
public set size(value: SizeF) {
|
|
71
|
+
this.treeGridSize = value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//Implementation
|
|
75
|
+
/**
|
|
76
|
+
* `Draws` the element on the page with the specified page and 'PointF' class
|
|
77
|
+
*
|
|
78
|
+
* @param {PdfPage} page .
|
|
79
|
+
* @param {PointF} location .
|
|
80
|
+
* @returns {PdfLayoutResult} .
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
public draw(page: PdfPage, location: PointF): PdfLayoutResult
|
|
84
|
+
/**
|
|
85
|
+
* `Draws` the element on the page with the specified page and pair of coordinates
|
|
86
|
+
*
|
|
87
|
+
* @param {PdfPage} page .
|
|
88
|
+
* @param {number} x .
|
|
89
|
+
* @param {number} y .
|
|
90
|
+
* @returns {PdfLayoutResult} .
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
public draw(page: PdfPage, x: number, y: number): PdfLayoutResult
|
|
94
|
+
/**
|
|
95
|
+
* `Draws` the element on the page with the specified page and 'RectangleF' class
|
|
96
|
+
*
|
|
97
|
+
* @param {PdfPage} page .
|
|
98
|
+
* @param {RectangleF} layoutRectangle .
|
|
99
|
+
* @returns {PdfLayoutResult} .
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
public draw(page: PdfPage, layoutRectangle: RectangleF): PdfLayoutResult
|
|
103
|
+
/**
|
|
104
|
+
* `Draws` the element on the page with the specified page, 'PointF' class and layout format
|
|
105
|
+
*
|
|
106
|
+
* @param {PdfPage} page .
|
|
107
|
+
* @param {PointF} location .
|
|
108
|
+
* @param {PdfTreeGridLayoutFormat} format .
|
|
109
|
+
* @returns {PdfLayoutResult} .
|
|
110
|
+
* @private
|
|
111
|
+
*/
|
|
112
|
+
public draw(page: PdfPage, location: PointF, format: PdfLayoutFormat): PdfLayoutResult
|
|
113
|
+
/**
|
|
114
|
+
* `Draws` the element on the page with the specified page, pair of coordinates and layout format
|
|
115
|
+
*
|
|
116
|
+
* @param {PdfPage} page .
|
|
117
|
+
* @param {number} x .
|
|
118
|
+
* @param {number} y .
|
|
119
|
+
* @param {PdfLayoutFormat} format .
|
|
120
|
+
* @returns {PdfLayoutResult}
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
public draw(page: PdfPage, x: number, y: number, format: PdfLayoutFormat): PdfLayoutResult
|
|
124
|
+
/**
|
|
125
|
+
* `Draws` the element on the page.
|
|
126
|
+
*
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
public draw(page: PdfPage, layoutRectangle: RectangleF, embedFonts: boolean): PdfLayoutResult
|
|
130
|
+
/**
|
|
131
|
+
* `Draws` the element on the page with the specified page, 'RectangleF' class and layout format
|
|
132
|
+
*
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
/* eslint-disable-next-line */
|
|
136
|
+
public draw(arg1: PdfPage, arg2: RectangleF | PointF | number, arg3?: PdfLayoutFormat | number | boolean, arg4?: PdfLayoutFormat): PdfLayoutResult {
|
|
137
|
+
if (arg2 instanceof PointF && typeof (arg2 as RectangleF).width === 'undefined' && typeof arg3 === 'undefined') {
|
|
138
|
+
return this.drawHelper(arg1, arg2.x, arg2.y);
|
|
139
|
+
} else if (typeof arg2 === 'number' && typeof arg3 === 'number' && typeof arg4 === 'undefined') {
|
|
140
|
+
return this.drawHelper(arg1, arg2, arg3, null);
|
|
141
|
+
} else if (arg2 instanceof RectangleF && typeof arg2.width !== 'undefined' && typeof arg3 === 'undefined') {
|
|
142
|
+
return this.drawHelper(arg1, arg2, null);
|
|
143
|
+
} else if (arg2 instanceof PointF && typeof (arg2 as RectangleF).width === 'undefined' && arg3 instanceof PdfLayoutFormat) {
|
|
144
|
+
return this.drawHelper(arg1, arg2.x, arg2.y, arg3);
|
|
145
|
+
} else if (typeof arg2 === 'number' && typeof arg3 === 'number' && (arg4 instanceof PdfLayoutFormat || arg4 == null)) {
|
|
146
|
+
const width: number = (arg1.graphics.clientSize.width - arg2);
|
|
147
|
+
const layoutRectangle: RectangleF = new RectangleF(arg2, arg3, width, 0);
|
|
148
|
+
return this.drawHelper(arg1, layoutRectangle, arg4);
|
|
149
|
+
} else if (arg2 instanceof RectangleF && typeof arg2.width !== 'undefined' && typeof arg3 === 'boolean') {
|
|
150
|
+
return this.drawHelper(arg1, arg2, null);
|
|
151
|
+
} else {
|
|
152
|
+
return this.drawHelper(arg1, (arg2 as RectangleF), arg3 as PdfLayoutFormat);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
public measureColumnsWidth(bounds?: RectangleF): void {
|
|
157
|
+
if (typeof bounds !== 'undefined') {
|
|
158
|
+
const widths: number[] = this.columns.getDefaultWidths(bounds.width - bounds.x);
|
|
159
|
+
for (let i: number = 0; i < this.columns.count; i++) {
|
|
160
|
+
if (this.columns.getColumn(i).width < 0) {
|
|
161
|
+
this.columns.getColumn(i).width = widths[i];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
const widths: number[] = [];
|
|
166
|
+
let cellWidth: number = 0;
|
|
167
|
+
let totalWidth: number = 0;
|
|
168
|
+
let rowLevel: number = 0;
|
|
169
|
+
// if(this.headers.count > 0){
|
|
170
|
+
// let colCount: number = this.headers.getHeader(0).cells.count;
|
|
171
|
+
// for(let i: number = 0; i < colCount; i++){
|
|
172
|
+
// let rowCount: number = this.headers.count;
|
|
173
|
+
// for(let j: number = 0; j < rowCount; j++){
|
|
174
|
+
// let tempWidth: number = this.headers.getHeader(j).cells.getCell(i).width;
|
|
175
|
+
// let rowWidth: number = this.initialWidth > 0 ? Math.min(this.initialWidth, tempWidth) :
|
|
176
|
+
// tempWidth;
|
|
177
|
+
// cellWidth = Math.max(cellWidth, rowWidth);
|
|
178
|
+
// }
|
|
179
|
+
// widths.push(cellWidth);
|
|
180
|
+
// }
|
|
181
|
+
// }
|
|
182
|
+
const colCount: number = this.columns.count;
|
|
183
|
+
for (let i: number = 0; i < colCount; i++) {
|
|
184
|
+
const rowCount: number = this.rows.count;
|
|
185
|
+
for (let j: number = 0; j < rowCount; j++) {
|
|
186
|
+
const tempWidth: number = this.rows.getRow(j).cells.getCell(i).width;
|
|
187
|
+
const rowWidth: number = this.initialWidth > 0 ? Math.min(this.initialWidth, tempWidth) : tempWidth;
|
|
188
|
+
cellWidth = Math.max(cellWidth, rowWidth);
|
|
189
|
+
cellWidth = Math.max(this.columns.getColumn(i).width, cellWidth);
|
|
190
|
+
if (this.columns.getColumn(i).isTreeColumn) {
|
|
191
|
+
rowLevel = Math.max(rowLevel, this.rows.getRow(j).level);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (this.columns.getColumn(i).isTreeColumn) {
|
|
195
|
+
widths.push(cellWidth + (rowLevel * 10));
|
|
196
|
+
} else {
|
|
197
|
+
widths.push(cellWidth);
|
|
198
|
+
}
|
|
199
|
+
// eslint-disable-next-line
|
|
200
|
+
totalWidth += cellWidth;
|
|
201
|
+
cellWidth = 0;
|
|
202
|
+
}
|
|
203
|
+
for (let i: number = 0; i < this.columns.count; i++) {
|
|
204
|
+
if (this.columns.getColumn(i).width < 0) {
|
|
205
|
+
this.columns.getColumn(i).width = widths[i];
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private calculateTreeGridSize(): SizeF {
|
|
212
|
+
let height: number = 0;
|
|
213
|
+
const width: number = this.columns.width;
|
|
214
|
+
for (let i: number = 0; i < this.headers.count; i++) {
|
|
215
|
+
const row: PdfTreeGridRow = this.headers.getHeader(i);
|
|
216
|
+
height += row.height;
|
|
217
|
+
}
|
|
218
|
+
for (let i: number = 0; i < this.rows.count; i++) {
|
|
219
|
+
const row: PdfTreeGridRow = this.rows.getRow(i);
|
|
220
|
+
height += row.height;
|
|
221
|
+
}
|
|
222
|
+
return new SizeF(width, height);
|
|
223
|
+
}
|
|
224
|
+
public drawGrid(page: PdfPage, x: number, y: number, format: PdfTreeGridLayoutFormat): PdfTreeGridLayoutResult {
|
|
225
|
+
this.initialWidth = page.graphics.clientSize.width;
|
|
226
|
+
const layout: RectangleF = new RectangleF(0, 0, page.getClientSize().height, 0);
|
|
227
|
+
return this.draw(page, layout, format);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
protected layout(param: PdfLayoutParams): PdfLayoutResult {
|
|
231
|
+
if (this.rows.count !== 0) {
|
|
232
|
+
const style: PdfGanttCellStyle = this.rows.getRow(0).cells.getCell(0).style;
|
|
233
|
+
if (style.borders.left.width !== 1) {
|
|
234
|
+
const x: number = style.borders.left.width / 2;
|
|
235
|
+
const y: number = style.borders.top.width / 2;
|
|
236
|
+
if (param.bounds.x === PdfBorders.default.right.width / 2 &&
|
|
237
|
+
param.bounds.y === PdfBorders.default.right.width / 2) {
|
|
238
|
+
const newBound: RectangleF = new RectangleF(new PointF(x, y), new SizeF(this.size.width, this.size.height));
|
|
239
|
+
param.bounds = newBound;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
this.setSpan();
|
|
244
|
+
this.layouter = new PdfTreeGridLayouter(this);
|
|
245
|
+
const result: PdfTreeGridLayoutResult = this.layouter.layoutInternal(param);
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
public onBeginCellDraw(args: PdfGridBeginCellDrawEventArgs): void {
|
|
250
|
+
if (this.raiseBeginCellDraw) {
|
|
251
|
+
this.beginCellDraw(this, args);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
public onEndCellDraw(args: PdfGridEndCellDrawEventArgs): void {
|
|
255
|
+
if (this.raiseEndCellDraw) {
|
|
256
|
+
this.endCellDraw(this, args);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
public setSpan(): void {
|
|
260
|
+
let colSpan: number = 1;
|
|
261
|
+
let rowSpan: number = 1;
|
|
262
|
+
let currentCellIndex: number = 0;
|
|
263
|
+
let currentRowIndex: number = 0;
|
|
264
|
+
let maxSpan: number = 0;
|
|
265
|
+
let rowCount: number = this.headers.count;
|
|
266
|
+
for (let i: number = 0; i < rowCount; i++) {
|
|
267
|
+
const row: PdfTreeGridRow = this.headers.getHeader(i);
|
|
268
|
+
maxSpan = 0;
|
|
269
|
+
const colCount: number = row.cells.count;
|
|
270
|
+
for (let j: number = 0; j < colCount; j++) {
|
|
271
|
+
const cell: PdfTreeGridCell = row.cells.getCell(j);
|
|
272
|
+
maxSpan = Math.max(maxSpan, cell.rowSpan);
|
|
273
|
+
//Skip setting span map for already coverted rows/columns.
|
|
274
|
+
if (!cell.isCellMergeContinue && !cell.isRowMergeContinue && (cell.columnSpan > 1 || cell.rowSpan > 1)) {
|
|
275
|
+
if (cell.columnSpan + j > row.cells.count) {
|
|
276
|
+
throw new Error('Invalid span specified at row ' + j.toString() + ' column ' + i.toString());
|
|
277
|
+
}
|
|
278
|
+
if (cell.rowSpan + i > this.headers.count) {
|
|
279
|
+
throw new Error('Invalid span specified at Header ' + j.toString() + ' column ' + i.toString());
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (cell.columnSpan > 1 && cell.rowSpan > 1) {
|
|
283
|
+
colSpan = cell.columnSpan;
|
|
284
|
+
rowSpan = cell.rowSpan;
|
|
285
|
+
currentCellIndex = j;
|
|
286
|
+
currentRowIndex = i;
|
|
287
|
+
cell.isCellMergeStart = true;
|
|
288
|
+
cell.isRowMergeStart = true;
|
|
289
|
+
//Set Column merges for first row
|
|
290
|
+
while (colSpan > 1) {
|
|
291
|
+
currentCellIndex++;
|
|
292
|
+
row.cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
293
|
+
row.cells.getCell(currentCellIndex).isRowMergeContinue = true;
|
|
294
|
+
row.cells.getCell(currentCellIndex).rowSpan = rowSpan;
|
|
295
|
+
colSpan--;
|
|
296
|
+
}
|
|
297
|
+
currentCellIndex = j;
|
|
298
|
+
colSpan = cell.columnSpan;
|
|
299
|
+
//Set Row Merges and column merges foreach subsequent rows.
|
|
300
|
+
while (rowSpan > 1) {
|
|
301
|
+
currentRowIndex++;
|
|
302
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(j).isRowMergeContinue = true;
|
|
303
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(currentCellIndex).isRowMergeContinue = true;
|
|
304
|
+
rowSpan--;
|
|
305
|
+
while (colSpan > 1) {
|
|
306
|
+
currentCellIndex++;
|
|
307
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
308
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(currentCellIndex).isRowMergeContinue = true;
|
|
309
|
+
colSpan--;
|
|
310
|
+
}
|
|
311
|
+
colSpan = cell.columnSpan;
|
|
312
|
+
currentCellIndex = j;
|
|
313
|
+
}
|
|
314
|
+
} else if (cell.columnSpan > 1 && cell.rowSpan === 1) {
|
|
315
|
+
colSpan = cell.columnSpan;
|
|
316
|
+
currentCellIndex = j;
|
|
317
|
+
cell.isCellMergeStart = true;
|
|
318
|
+
//Set Column merges.
|
|
319
|
+
while (colSpan > 1) {
|
|
320
|
+
currentCellIndex++;
|
|
321
|
+
row.cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
322
|
+
colSpan--;
|
|
323
|
+
}
|
|
324
|
+
} else if (cell.columnSpan === 1 && cell.rowSpan > 1) {
|
|
325
|
+
rowSpan = cell.rowSpan;
|
|
326
|
+
currentRowIndex = i;
|
|
327
|
+
//Set row Merges.
|
|
328
|
+
while (rowSpan > 1) {
|
|
329
|
+
currentRowIndex++;
|
|
330
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(j).isRowMergeContinue = true;
|
|
331
|
+
rowSpan--;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
row.maximumRowSpan = maxSpan;
|
|
337
|
+
}
|
|
338
|
+
colSpan = rowSpan = 1;
|
|
339
|
+
currentCellIndex = currentRowIndex = 0;
|
|
340
|
+
rowCount = this.rows.count;
|
|
341
|
+
for (let i: number = 0; i < rowCount; i++) {
|
|
342
|
+
const row: PdfTreeGridRow = this.rows.getRow(i);
|
|
343
|
+
const colcount: number = row.cells.count;
|
|
344
|
+
for (let j: number = 0; j < colcount; j++) {
|
|
345
|
+
const cell: PdfTreeGridCell = row.cells.getCell(j);
|
|
346
|
+
//Skip setting span map for already coverted rows/columns.
|
|
347
|
+
if (!cell.isCellMergeContinue && !cell.isRowMergeContinue && (cell.columnSpan > 1 || cell.rowSpan > 1)) {
|
|
348
|
+
if (cell.columnSpan + j > row.cells.count) {
|
|
349
|
+
throw new Error('Invalid span specified at row {0} column {1} ' + j.toString());
|
|
350
|
+
}
|
|
351
|
+
if (cell.rowSpan + i > this.rows.count) {
|
|
352
|
+
throw new Error('Invalid span specified at row {0} column {1} ' + j.toString());
|
|
353
|
+
}
|
|
354
|
+
if (cell.columnSpan > 1 && cell.rowSpan > 1) {
|
|
355
|
+
colSpan = cell.columnSpan;
|
|
356
|
+
rowSpan = cell.rowSpan;
|
|
357
|
+
currentCellIndex = j;
|
|
358
|
+
currentRowIndex = i;
|
|
359
|
+
cell.isCellMergeStart = true;
|
|
360
|
+
cell.isRowMergeStart = true;
|
|
361
|
+
//set Column merges for first row.
|
|
362
|
+
while (colSpan > 1) {
|
|
363
|
+
currentCellIndex++;
|
|
364
|
+
row.cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
365
|
+
colSpan--;
|
|
366
|
+
}
|
|
367
|
+
currentCellIndex = j;
|
|
368
|
+
colSpan = cell.columnSpan;
|
|
369
|
+
// Set row merges and column merges for each subsequentt rows.
|
|
370
|
+
while (rowSpan > 1) {
|
|
371
|
+
currentRowIndex++;
|
|
372
|
+
this.rows.getRow(currentRowIndex).cells.getCell(j).isRowMergeContinue = true;
|
|
373
|
+
rowSpan--;
|
|
374
|
+
while (colSpan > 1) {
|
|
375
|
+
currentCellIndex++;
|
|
376
|
+
this.rows.getRow(currentRowIndex).cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
377
|
+
colSpan--;
|
|
378
|
+
}
|
|
379
|
+
colSpan = cell.columnSpan;
|
|
380
|
+
currentCellIndex = j;
|
|
381
|
+
}
|
|
382
|
+
} else if (cell.columnSpan > 1 && cell.rowSpan === 1) {
|
|
383
|
+
colSpan = cell.columnSpan;
|
|
384
|
+
currentCellIndex = j;
|
|
385
|
+
cell.isCellMergeStart = true;
|
|
386
|
+
//set Column merges.
|
|
387
|
+
while (colSpan > 1) {
|
|
388
|
+
currentCellIndex++;
|
|
389
|
+
row.cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
390
|
+
colSpan--;
|
|
391
|
+
}
|
|
392
|
+
} else if (cell.columnSpan === 1 && cell.rowSpan > 1) {
|
|
393
|
+
rowSpan = cell.rowSpan;
|
|
394
|
+
currentRowIndex = i;
|
|
395
|
+
//set row merges.
|
|
396
|
+
while (rowSpan > 1) {
|
|
397
|
+
currentRowIndex++;
|
|
398
|
+
this.rows.getRow(currentRowIndex).cells.getCell(j).isRowMergeContinue = true;
|
|
399
|
+
rowSpan--;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Property, ChildProperty } from '@syncfusion/ej2-base';
|
|
2
|
+
import { DialogFieldType } from '../base/enum';
|
|
3
|
+
/**
|
|
4
|
+
* Defines dialog fields of add dialog.
|
|
5
|
+
*/
|
|
6
|
+
export class AddDialogFieldSettings extends ChildProperty<AddDialogFieldSettings> {
|
|
7
|
+
/**
|
|
8
|
+
* Defines types of tab which contains editor for columns.
|
|
9
|
+
* * `General` - Defines tab container type as general.
|
|
10
|
+
* * `Dependency` - Defines tab as dependency editor.
|
|
11
|
+
* * `Resources` - Defines tab as resources editor.
|
|
12
|
+
* * `Notes` - Defines tab as notes editor.
|
|
13
|
+
* * `Custom` - Defines tab as custom column editor.
|
|
14
|
+
*
|
|
15
|
+
* @default null
|
|
16
|
+
*/
|
|
17
|
+
@Property(null)
|
|
18
|
+
public type: DialogFieldType;
|
|
19
|
+
/**
|
|
20
|
+
* Defines header text of tab item.
|
|
21
|
+
*
|
|
22
|
+
* @default null
|
|
23
|
+
*/
|
|
24
|
+
@Property(null)
|
|
25
|
+
public headerText: string;
|
|
26
|
+
/**
|
|
27
|
+
* Defines edited column fields placed inside the tab.
|
|
28
|
+
*
|
|
29
|
+
* @default null
|
|
30
|
+
*/
|
|
31
|
+
@Property([])
|
|
32
|
+
public fields: string[];
|
|
33
|
+
}
|