@syncfusion/ej2-gantt 23.2.5 → 24.1.41
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 +3 -0
- package/dist/ej2-gantt.min.js +2 -2
- package/dist/ej2-gantt.umd.min.js +2 -2
- package/dist/ej2-gantt.umd.min.js.map +1 -1
- package/dist/es6/ej2-gantt.es2015.js +2980 -336
- package/dist/es6/ej2-gantt.es2015.js.map +1 -1
- package/dist/es6/ej2-gantt.es5.js +3034 -370
- package/dist/es6/ej2-gantt.es5.js.map +1 -1
- package/dist/global/ej2-gantt.min.js +2 -2
- package/dist/global/ej2-gantt.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +21 -21
- package/src/gantt/actions/cell-edit.js +7 -3
- package/src/gantt/actions/chart-scroll.d.ts +9 -1
- package/src/gantt/actions/chart-scroll.js +111 -3
- package/src/gantt/actions/connector-line-edit.js +8 -1
- package/src/gantt/actions/context-menu.js +2 -2
- package/src/gantt/actions/day-markers.d.ts +2 -1
- package/src/gantt/actions/dependency.js +2 -2
- package/src/gantt/actions/dialog-edit.d.ts +24 -0
- package/src/gantt/actions/dialog-edit.js +383 -1
- package/src/gantt/actions/edit.js +104 -41
- package/src/gantt/actions/keyboard.js +5 -1
- package/src/gantt/actions/pdf-export.js +12 -4
- package/src/gantt/actions/rowdragdrop.js +24 -5
- package/src/gantt/actions/selection.js +6 -3
- package/src/gantt/actions/taskbar-edit.d.ts +14 -0
- package/src/gantt/actions/taskbar-edit.js +513 -78
- package/src/gantt/actions/toolbar.js +4 -1
- package/src/gantt/base/css-constants.d.ts +2 -0
- package/src/gantt/base/css-constants.js +2 -0
- package/src/gantt/base/enum.d.ts +22 -0
- package/src/gantt/base/gantt-chart.js +63 -21
- package/src/gantt/base/gantt-model.d.ts +9 -1
- package/src/gantt/base/gantt.d.ts +11 -1
- package/src/gantt/base/gantt.js +46 -18
- package/src/gantt/base/interface.d.ts +135 -3
- package/src/gantt/base/splitter.js +6 -0
- package/src/gantt/base/task-processor.d.ts +1 -1
- package/src/gantt/base/task-processor.js +37 -9
- package/src/gantt/base/tree-grid.js +1 -1
- package/src/gantt/export/export-helper.d.ts +12 -0
- package/src/gantt/export/export-helper.js +316 -9
- package/src/gantt/export/pdf-base/pdf-grid-table.js +14 -1
- package/src/gantt/export/pdf-base/pdf-style/gantt-theme.js +36 -0
- package/src/gantt/export/pdf-connector-line.js +137 -32
- package/src/gantt/export/pdf-event-marker.d.ts +10 -0
- package/src/gantt/export/pdf-event-marker.js +57 -0
- package/src/gantt/export/pdf-gantt.d.ts +2 -0
- package/src/gantt/export/pdf-gantt.js +30 -10
- package/src/gantt/export/pdf-taskbar.d.ts +23 -2
- package/src/gantt/export/pdf-taskbar.js +771 -43
- package/src/gantt/export/pdf-timeline.d.ts +9 -0
- package/src/gantt/export/pdf-timeline.js +98 -20
- package/src/gantt/models/column.d.ts +12 -0
- package/src/gantt/renderer/chart-rows.d.ts +1 -1
- package/src/gantt/renderer/chart-rows.js +29 -16
- package/src/gantt/renderer/connector-line.js +8 -5
- package/src/gantt/renderer/edit-tooltip.js +3 -0
- package/src/gantt/renderer/event-marker.js +4 -1
- package/src/gantt/renderer/nonworking-day.js +18 -5
- package/src/gantt/renderer/timeline.d.ts +9 -0
- package/src/gantt/renderer/timeline.js +169 -21
- package/styles/bootstrap-dark.css +77 -16
- package/styles/bootstrap.css +78 -17
- package/styles/bootstrap4.css +78 -17
- package/styles/bootstrap5-dark.css +78 -17
- package/styles/bootstrap5.css +78 -17
- package/styles/fabric-dark.css +78 -17
- package/styles/fabric.css +78 -17
- package/styles/fluent-dark.css +78 -17
- package/styles/fluent.css +78 -17
- package/styles/gantt/_bootstrap-dark-definition.scss +7 -2
- package/styles/gantt/_bootstrap-definition.scss +7 -2
- package/styles/gantt/_bootstrap4-definition.scss +7 -2
- package/styles/gantt/_bootstrap5-definition.scss +7 -2
- package/styles/gantt/_fabric-dark-definition.scss +7 -2
- package/styles/gantt/_fabric-definition.scss +7 -2
- package/styles/gantt/_fluent-definition.scss +7 -2
- package/styles/gantt/_fusionnew-definition.scss +6 -2
- package/styles/gantt/_highcontrast-definition.scss +7 -2
- package/styles/gantt/_highcontrast-light-definition.scss +7 -2
- package/styles/gantt/_layout.scss +92 -20
- package/styles/gantt/_material-dark-definition.scss +7 -2
- package/styles/gantt/_material-definition.scss +7 -2
- package/styles/gantt/_material3-definition.scss +7 -2
- package/styles/gantt/_tailwind-definition.scss +6 -1
- package/styles/gantt/_theme.scss +11 -0
- package/styles/gantt/bootstrap-dark.css +77 -16
- package/styles/gantt/bootstrap.css +78 -17
- package/styles/gantt/bootstrap4.css +78 -17
- package/styles/gantt/bootstrap5-dark.css +78 -17
- package/styles/gantt/bootstrap5.css +78 -17
- package/styles/gantt/fabric-dark.css +78 -17
- package/styles/gantt/fabric.css +78 -17
- package/styles/gantt/fluent-dark.css +78 -17
- package/styles/gantt/fluent.css +78 -17
- package/styles/gantt/highcontrast-light.css +78 -17
- package/styles/gantt/highcontrast.css +78 -17
- package/styles/gantt/material-dark.css +78 -17
- package/styles/gantt/material.css +78 -17
- package/styles/gantt/material3-dark.css +77 -16
- package/styles/gantt/material3.css +77 -16
- package/styles/gantt/tailwind-dark.css +78 -17
- package/styles/gantt/tailwind.css +78 -17
- package/styles/highcontrast-light.css +78 -17
- package/styles/highcontrast.css +78 -17
- package/styles/material-dark.css +78 -17
- package/styles/material.css +78 -17
- package/styles/material3-dark.css +77 -16
- package/styles/material3.css +77 -16
- package/styles/tailwind-dark.css +78 -17
- package/styles/tailwind.css +78 -17
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { PdfFontFamily, PdfTextWebLink } from '@syncfusion/ej2-pdf-export';
|
|
2
13
|
import { PdfStringFormat, PdfPageCountField, PdfPageNumberField } from '@syncfusion/ej2-pdf-export';
|
|
3
14
|
import { PdfPageTemplateElement, RectangleF, PdfCompositeField, PointF } from '@syncfusion/ej2-pdf-export';
|
|
4
15
|
import { PdfVerticalAlignment, PdfTextAlignment, PdfStandardFont } from '@syncfusion/ej2-pdf-export';
|
|
5
|
-
import { PdfFontStyle, PdfColor, PdfPen, PdfSolidBrush } from '@syncfusion/ej2-pdf-export';
|
|
16
|
+
import { PdfFontStyle, PdfColor, PdfPen, PdfSolidBrush, SizeF, PdfBitmap } from '@syncfusion/ej2-pdf-export';
|
|
6
17
|
import { PdfBorders, PdfPaddings } from './pdf-base/index';
|
|
7
18
|
import { isNullOrUndefined, Internationalization, getValue, extend } from '@syncfusion/ej2-base';
|
|
8
19
|
import { getForeignData, ValueFormatter } from '@syncfusion/ej2-grids';
|
|
@@ -185,8 +196,7 @@ var ExportHelper = /** @class */ (function () {
|
|
|
185
196
|
};
|
|
186
197
|
ExportHelper.prototype.isColumnVisible = function (column) {
|
|
187
198
|
var visibleColumn = column.visible || this.exportProps.includeHiddenColumn;
|
|
188
|
-
|
|
189
|
-
return (visibleColumn && templateColumn);
|
|
199
|
+
return (visibleColumn);
|
|
190
200
|
};
|
|
191
201
|
ExportHelper.prototype.processGanttContent = function () {
|
|
192
202
|
var _this = this;
|
|
@@ -218,14 +228,23 @@ var ExportHelper = /** @class */ (function () {
|
|
|
218
228
|
* @returns {void} .
|
|
219
229
|
*/
|
|
220
230
|
ExportHelper.prototype.processTimeline = function () {
|
|
231
|
+
if (this.parent.enableTimelineVirtualization) {
|
|
232
|
+
this.parent.timelineModule.createTimelineSeries();
|
|
233
|
+
}
|
|
221
234
|
var timelineSettings = this.parent.timelineModule;
|
|
222
235
|
this.gantt.chartHeader.topTierHeight = this.gantt.chartHeader.bottomTierHeight
|
|
223
236
|
= (this.parent.timelineModule.isSingleTier ? 45 : 60 / 2);
|
|
224
237
|
this.gantt.chartHeader.topTierCellWidth = timelineSettings.topTierCellWidth;
|
|
225
238
|
this.gantt.chartHeader.bottomTierCellWidth = timelineSettings.bottomTierCellWidth;
|
|
226
|
-
this.gantt.chartHeader.topTier = extend([], [], timelineSettings.topTierCollection, true);
|
|
227
|
-
this.gantt.chartHeader.bottomTier = extend([], [], timelineSettings.bottomTierCollection, true);
|
|
228
|
-
this.
|
|
239
|
+
this.gantt.chartHeader.topTier = extend([], [], this.parent.enableTimelineVirtualization ? timelineSettings.pdfExportTopTierCollection : timelineSettings.topTierCollection, true);
|
|
240
|
+
this.gantt.chartHeader.bottomTier = extend([], [], this.parent.enableTimelineVirtualization ? timelineSettings.pdfExportBottomTierCollection : timelineSettings.bottomTierCollection, true);
|
|
241
|
+
if (this.exportProps && this.exportProps.fitToWidthSettings && this.exportProps.fitToWidthSettings.isFitToWidth && this.parent.enableTimelineVirtualization) {
|
|
242
|
+
var tier = timelineSettings.topTier === 'None' ? 'bottomTier' : 'topTier';
|
|
243
|
+
this.gantt.chartHeader.width = timelineSettings['calculateWidthBetweenTwoDate'](tier, timelineSettings.timelineStartDate, timelineSettings.timelineEndDate);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
this.gantt.chartHeader.width = this.parent.enableTimelineVirtualization ? this.parent.timelineModule.wholeTimelineWidth : timelineSettings.totalTimelineWidth;
|
|
247
|
+
}
|
|
229
248
|
this.gantt.chartHeader.height = this.gantt.rows.getRow(0).height;
|
|
230
249
|
this.gantt.timelineStartDate = new Date(timelineSettings.timelineStartDate.getTime());
|
|
231
250
|
};
|
|
@@ -295,6 +314,9 @@ var ExportHelper = /** @class */ (function () {
|
|
|
295
314
|
else {
|
|
296
315
|
cell.value = !isNullOrUndefined(data[column.field]) ? data[column.field].toString() : '';
|
|
297
316
|
}
|
|
317
|
+
var cellValueString = !isNullOrUndefined(cell.value) ? cell.value.toString() : '';
|
|
318
|
+
var cellValue = cellValueString;
|
|
319
|
+
var value = !isNullOrUndefined(cellValue) ? cellValue : '';
|
|
298
320
|
cell.isHeaderCell = false;
|
|
299
321
|
cell.style.padding = new PdfPaddings();
|
|
300
322
|
this.copyStyles(this.ganttStyle.cell, cell, row.isParentRow);
|
|
@@ -306,7 +328,7 @@ var ExportHelper = /** @class */ (function () {
|
|
|
306
328
|
}
|
|
307
329
|
var args = {
|
|
308
330
|
data: data,
|
|
309
|
-
value:
|
|
331
|
+
value: value,
|
|
310
332
|
column: column,
|
|
311
333
|
style: cell.style,
|
|
312
334
|
cell: cell
|
|
@@ -315,7 +337,28 @@ var ExportHelper = /** @class */ (function () {
|
|
|
315
337
|
if (this.parent.pdfQueryCellInfo) {
|
|
316
338
|
this.parent.trigger('pdfQueryCellInfo', args);
|
|
317
339
|
}
|
|
340
|
+
if (!isNullOrUndefined(args.image) && !isNullOrUndefined(args.image.base64)) {
|
|
341
|
+
args.value = new PdfBitmap(args.image.base64);
|
|
342
|
+
args.value.height = args.image.height || args.value.height;
|
|
343
|
+
args.value.width = args.image.width || args.value.width;
|
|
344
|
+
}
|
|
318
345
|
cell.value = args.value;
|
|
346
|
+
if (!isNullOrUndefined(args.hyperLink) && !isNullOrUndefined(args.hyperLink.displayText)) {
|
|
347
|
+
cell.value = this.setHyperLink(args);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
ExportHelper.prototype.setHyperLink = function (args) {
|
|
351
|
+
// create the Text Web Link
|
|
352
|
+
var textLink = new PdfTextWebLink();
|
|
353
|
+
// set the hyperlink
|
|
354
|
+
textLink.url = args.hyperLink.target;
|
|
355
|
+
// set the link text
|
|
356
|
+
textLink.text = args.hyperLink.displayText || args.hyperLink.target;
|
|
357
|
+
// set the font
|
|
358
|
+
textLink.font = new PdfStandardFont(PdfFontFamily.Helvetica, 9.75);
|
|
359
|
+
// set the brush and pen for the text color
|
|
360
|
+
textLink.brush = new PdfSolidBrush(new PdfColor(51, 102, 187));
|
|
361
|
+
return textLink;
|
|
319
362
|
};
|
|
320
363
|
/**
|
|
321
364
|
* Method for create the taskbar collection for rendering
|
|
@@ -367,6 +410,17 @@ var ExportHelper = /** @class */ (function () {
|
|
|
367
410
|
}
|
|
368
411
|
taskbar.height = height;
|
|
369
412
|
}
|
|
413
|
+
taskbar.indicators = ganttProp.indicators;
|
|
414
|
+
taskbar.autoStartDate = ganttProp.autoStartDate;
|
|
415
|
+
taskbar.autoEndDate = ganttProp.autoEndDate;
|
|
416
|
+
taskbar.isAutoSchedule = ganttProp.isAutoSchedule;
|
|
417
|
+
taskbar.autoWidth = ganttProp.autoWidth;
|
|
418
|
+
taskbar.autoLeft = ganttProp.autoLeft;
|
|
419
|
+
taskbar.segment = ganttProp.segments;
|
|
420
|
+
taskbar.isSpliterTask = (isNullOrUndefined(ganttProp.segments) || ganttProp.segments.length === 0) ? false : true;
|
|
421
|
+
if (taskbar.isSpliterTask) {
|
|
422
|
+
taskbar.segmentCollection = taskbar.segment.map(function (obj) { return (__assign({}, obj)); });
|
|
423
|
+
}
|
|
370
424
|
taskbar.baselineTop = _this.parent.chartRowsModule.baselineTop;
|
|
371
425
|
taskbar.isMilestone = ganttProp.isMilestone;
|
|
372
426
|
taskbar.baselineStartDate = ganttProp.baselineStartDate;
|
|
@@ -411,6 +465,15 @@ var ExportHelper = /** @class */ (function () {
|
|
|
411
465
|
taskbar.taskBorderColor = new PdfColor(_this.ganttStyle.taskbar.taskBorderColor);
|
|
412
466
|
}
|
|
413
467
|
}
|
|
468
|
+
taskbar.manualParentBorder = new PdfColor(_this.ganttStyle.taskbar.manualParentBorder);
|
|
469
|
+
taskbar.manualChildBorder = new PdfColor(_this.ganttStyle.taskbar.manualChildBorder);
|
|
470
|
+
taskbar.manuallineColor = new PdfColor(_this.ganttStyle.taskbar.manualLineColor);
|
|
471
|
+
taskbar.unscheduledTaskBarColor = new PdfColor(_this.ganttStyle.taskbar.unscheduledTaskBarColor);
|
|
472
|
+
taskbar.manualParentBackground = new PdfColor(_this.ganttStyle.taskbar.manualParentBackground);
|
|
473
|
+
taskbar.manualParentProgress = new PdfColor(_this.ganttStyle.taskbar.manualParentProgress);
|
|
474
|
+
taskbar.manualChildBackground = new PdfColor(_this.ganttStyle.taskbar.manualChildBackground);
|
|
475
|
+
taskbar.manualChildProgress = new PdfColor(_this.ganttStyle.taskbar.manualChildProgress);
|
|
476
|
+
taskbar.splitLineBackground = new PdfColor(_this.ganttStyle.taskbar.splitLineBackground);
|
|
414
477
|
taskbar.baselineColor = new PdfColor(_this.ganttStyle.taskbar.baselineColor);
|
|
415
478
|
taskbar.baselineBorderColor = new PdfColor(_this.ganttStyle.taskbar.baselineBorderColor);
|
|
416
479
|
taskbar.gridLineColor = new PdfColor(_this.ganttStyle.chartGridLineColor);
|
|
@@ -425,7 +488,8 @@ var ExportHelper = /** @class */ (function () {
|
|
|
425
488
|
taskStyle.baselineBorderColor = taskbar.baselineBorderColor;
|
|
426
489
|
var args = {
|
|
427
490
|
taskbar: taskStyle,
|
|
428
|
-
data: data
|
|
491
|
+
data: data,
|
|
492
|
+
indicators: data.ganttProperties.indicators
|
|
429
493
|
};
|
|
430
494
|
if (_this.parent.pdfQueryTaskbarInfo) {
|
|
431
495
|
_this.parent.trigger('pdfQueryTaskbarInfo', args);
|
|
@@ -436,6 +500,7 @@ var ExportHelper = /** @class */ (function () {
|
|
|
436
500
|
taskbar.milestoneColor = args.taskbar.milestoneColor;
|
|
437
501
|
taskbar.baselineColor = args.taskbar.baselineColor;
|
|
438
502
|
taskbar.baselineBorderColor = args.taskbar.baselineBorderColor;
|
|
503
|
+
taskbar.indicators = args.indicators;
|
|
439
504
|
}
|
|
440
505
|
});
|
|
441
506
|
};
|
|
@@ -630,6 +695,248 @@ var ExportHelper = /** @class */ (function () {
|
|
|
630
695
|
compositeField.draw(footer.graphics, new PointF(0, 0));
|
|
631
696
|
pdfDoc.template.bottom = footer;
|
|
632
697
|
}
|
|
698
|
+
// code for draw header content
|
|
699
|
+
if (!isNullOrUndefined(this.exportProps.header)) {
|
|
700
|
+
var clientSize = this.pdfDoc.pageSettings.size;
|
|
701
|
+
var headerProp = this.exportProps.header;
|
|
702
|
+
var position = new PointF(0, headerProp.fromTop);
|
|
703
|
+
var size = new SizeF((clientSize.width * 1.1), ((headerProp && headerProp.height) ? headerProp.height * 0.75 : 50));
|
|
704
|
+
var bounds = new RectangleF(position, size);
|
|
705
|
+
pdfDoc.template.top = this.drawPageTemplate(new PdfPageTemplateElement(bounds), headerProp);
|
|
706
|
+
}
|
|
707
|
+
// code for customization of footer
|
|
708
|
+
if (!this.exportProps.enableFooter && !isNullOrUndefined(this.exportProps.footer)) {
|
|
709
|
+
var clientSize = this.pdfDoc.pageSettings.size;
|
|
710
|
+
var footer = this.exportProps.footer;
|
|
711
|
+
var position = new PointF(0, ((clientSize.width - 80) - ((footer && footer.fromBottom) ?
|
|
712
|
+
footer.fromBottom * 0.75 : 0)));
|
|
713
|
+
var size = new SizeF((clientSize.width * 1.1), ((footer && footer.height) ? footer.height * 0.75 : 50));
|
|
714
|
+
var bounds = new RectangleF(position, size);
|
|
715
|
+
this.pdfDoc.template.bottom = this.drawPageTemplate(new PdfPageTemplateElement(bounds), footer);
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
ExportHelper.prototype.drawPageTemplate = function (template, element) {
|
|
719
|
+
for (var _i = 0, _a = element.contents; _i < _a.length; _i++) {
|
|
720
|
+
var content = _a[_i];
|
|
721
|
+
switch (content.type) {
|
|
722
|
+
case 'Text':
|
|
723
|
+
if (content.value === '' || content.value === undefined || content.value === null || typeof content.value !== 'string') {
|
|
724
|
+
throw new Error('please enter the valid input value in text content...');
|
|
725
|
+
}
|
|
726
|
+
this.drawText(template, content);
|
|
727
|
+
break;
|
|
728
|
+
case 'PageNumber':
|
|
729
|
+
this.drawPageNumber(template, content);
|
|
730
|
+
break;
|
|
731
|
+
case 'Image':
|
|
732
|
+
if (content.src === undefined || content.src === null || content.src === '') {
|
|
733
|
+
throw new Error('please enter the valid base64 string in image content...');
|
|
734
|
+
}
|
|
735
|
+
this.drawImage(template, content);
|
|
736
|
+
break;
|
|
737
|
+
case 'Line':
|
|
738
|
+
this.drawLine(template, content);
|
|
739
|
+
break;
|
|
740
|
+
default:
|
|
741
|
+
throw new Error('Please set valid content type...');
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return template;
|
|
745
|
+
};
|
|
746
|
+
// code for draw text
|
|
747
|
+
ExportHelper.prototype.drawText = function (pageTemplate, content) {
|
|
748
|
+
var font = this.getFont(content);
|
|
749
|
+
var brush = this.getBrushFromContent(content);
|
|
750
|
+
var pen = null;
|
|
751
|
+
if (!isNullOrUndefined(content.style.textPenColor)) {
|
|
752
|
+
var penColor = this.hexToRgb(content.style.textPenColor);
|
|
753
|
+
pen = new PdfPen(new PdfColor(penColor.r, penColor.g, penColor.b));
|
|
754
|
+
}
|
|
755
|
+
if (brush == null && pen == null) {
|
|
756
|
+
brush = new PdfSolidBrush(new PdfColor(0, 0, 0));
|
|
757
|
+
}
|
|
758
|
+
var value = content.value.toString();
|
|
759
|
+
var x = content.position.x * 0.75;
|
|
760
|
+
var y = content.position.y * 0.75;
|
|
761
|
+
var format = new PdfStringFormat();
|
|
762
|
+
if (!isNullOrUndefined(content.style.stringFormat)) {
|
|
763
|
+
format.alignment = content.style.stringFormat.alignment;
|
|
764
|
+
}
|
|
765
|
+
var result = this.setContentFormat(content, format);
|
|
766
|
+
if (result !== null && !isNullOrUndefined(result.format) && !isNullOrUndefined(result.size)) {
|
|
767
|
+
pageTemplate.graphics.drawString(value, font, pen, brush, x, y, result.size.width, result.size.height, result.format);
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
pageTemplate.graphics.drawString(value, font, pen, brush, x, y, format);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
// code for draw pagenumber
|
|
774
|
+
ExportHelper.prototype.drawPageNumber = function (documentHeader, content) {
|
|
775
|
+
var font = this.getFont(content);
|
|
776
|
+
var brush = null;
|
|
777
|
+
if (!isNullOrUndefined(content.style.textBrushColor)) {
|
|
778
|
+
var brushColor = this.hexToRgb(content.style.textBrushColor);
|
|
779
|
+
brush = new PdfSolidBrush(new PdfColor(brushColor.r, brushColor.g, brushColor.b));
|
|
780
|
+
}
|
|
781
|
+
else {
|
|
782
|
+
brush = new PdfSolidBrush(new PdfColor(0, 0, 0));
|
|
783
|
+
}
|
|
784
|
+
var pageCounts = this.pdfDoc.pages.count;
|
|
785
|
+
var pageNumber = new PdfPageNumberField(font, brush);
|
|
786
|
+
pageNumber.numberStyle = this.getPageNumberStyle(content.pageNumberType);
|
|
787
|
+
var compositeField;
|
|
788
|
+
var format;
|
|
789
|
+
if (!isNullOrUndefined(content.format)) {
|
|
790
|
+
var total = '$total';
|
|
791
|
+
var current = '$current';
|
|
792
|
+
if (content.format.indexOf(total) !== -1 && content.format.indexOf(current) !== -1) {
|
|
793
|
+
var pageCount = new PdfPageCountField(font);
|
|
794
|
+
pageCount.numberStyle = this.getPageNumberStyle(content.pageNumberType);
|
|
795
|
+
if (content.format.indexOf(total) > content.format.indexOf(current)) {
|
|
796
|
+
format = content.format.replace(current, '0');
|
|
797
|
+
format = format.replace(total, '1');
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
format = content.format.replace(current, '1');
|
|
801
|
+
format = format.replace(total, '0');
|
|
802
|
+
}
|
|
803
|
+
compositeField = new PdfCompositeField(font, brush, format, pageNumber, pageCount);
|
|
804
|
+
}
|
|
805
|
+
else if (content.format.indexOf(current) !== -1 && content.format.indexOf(total) === -1) {
|
|
806
|
+
format = content.format.replace(current, '0');
|
|
807
|
+
compositeField = new PdfCompositeField(font, brush, format, pageNumber);
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
var pageCount = new PdfPageCountField(font);
|
|
811
|
+
format = content.format.replace(total, '0');
|
|
812
|
+
compositeField = new PdfCompositeField(font, brush, format, pageCount);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
else {
|
|
816
|
+
format = '{0}';
|
|
817
|
+
compositeField = new PdfCompositeField(font, brush, format, pageNumber);
|
|
818
|
+
}
|
|
819
|
+
var x = content.position.x * 0.75;
|
|
820
|
+
var y = content.position.y * 0.75;
|
|
821
|
+
var result = this.setContentFormat(content, compositeField.stringFormat);
|
|
822
|
+
if (result !== null && !isNullOrUndefined(result.format) && !isNullOrUndefined(result.size)) {
|
|
823
|
+
compositeField.stringFormat = result.format;
|
|
824
|
+
compositeField.bounds = new RectangleF(x, y, result.size.width, result.size.height);
|
|
825
|
+
}
|
|
826
|
+
compositeField.draw(documentHeader.graphics, x, y);
|
|
827
|
+
};
|
|
828
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
829
|
+
// code for draw image
|
|
830
|
+
ExportHelper.prototype.drawImage = function (documentHeader, content) {
|
|
831
|
+
var x = content.position.x * 0.75;
|
|
832
|
+
var y = content.position.y * 0.75;
|
|
833
|
+
var width = (!isNullOrUndefined(content.size) && !isNullOrUndefined(content.size.width)) ?
|
|
834
|
+
(content.size.width * 0.50) : undefined;
|
|
835
|
+
var height = (!isNullOrUndefined(content.size) && !isNullOrUndefined(content.size.height)) ?
|
|
836
|
+
(content.size.height * 0.75) : undefined;
|
|
837
|
+
var image = new PdfBitmap(content.src);
|
|
838
|
+
if (!isNullOrUndefined(width)) {
|
|
839
|
+
documentHeader.graphics.drawImage(image, x, y, width, height);
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
documentHeader.graphics.drawImage(image, x, y);
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
846
|
+
// code for draw line
|
|
847
|
+
ExportHelper.prototype.drawLine = function (documentHeader, content) {
|
|
848
|
+
var x1 = content.points.x1 * 0.75;
|
|
849
|
+
var y1 = content.points.y1 * 0.75;
|
|
850
|
+
var x2 = content.points.x2 * 0.75;
|
|
851
|
+
var y2 = content.points.y2 * 0.75;
|
|
852
|
+
var pen = this.getPenFromContent(content);
|
|
853
|
+
if (!isNullOrUndefined(content.style)) {
|
|
854
|
+
if (!isNullOrUndefined(content.style.penSize) && typeof content.style.penSize === 'number') {
|
|
855
|
+
pen.width = content.style.penSize * 0.75;
|
|
856
|
+
}
|
|
857
|
+
pen.dashStyle = this.getDashStyle(content.style.dashStyle);
|
|
858
|
+
}
|
|
859
|
+
documentHeader.graphics.drawLine(pen, x1, y1, x2, y2);
|
|
860
|
+
};
|
|
861
|
+
ExportHelper.prototype.getPenFromContent = function (content) {
|
|
862
|
+
var pen = new PdfPen(new PdfColor(0, 0, 0));
|
|
863
|
+
if (!isNullOrUndefined(content.style) && content.style !== null && !isNullOrUndefined(content.style.penColor)) {
|
|
864
|
+
var penColor = this.hexToRgb(content.style.penColor);
|
|
865
|
+
pen = new PdfPen(new PdfColor(penColor.r, penColor.g, penColor.b));
|
|
866
|
+
}
|
|
867
|
+
return pen;
|
|
868
|
+
};
|
|
869
|
+
ExportHelper.prototype.getDashStyle = function (dashStyle) {
|
|
870
|
+
switch (dashStyle) {
|
|
871
|
+
case 'Dash':
|
|
872
|
+
return 1;
|
|
873
|
+
case 'Dot':
|
|
874
|
+
return 2;
|
|
875
|
+
case 'DashDot':
|
|
876
|
+
return 3;
|
|
877
|
+
case 'DashDotDot':
|
|
878
|
+
return 4;
|
|
879
|
+
default:
|
|
880
|
+
return 0;
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
ExportHelper.prototype.getBrushFromContent = function (content) {
|
|
884
|
+
var brush = null;
|
|
885
|
+
if (!isNullOrUndefined(content.style.textBrushColor)) {
|
|
886
|
+
/* tslint:disable-next-line:max-line-length */
|
|
887
|
+
var brushColor = this.hexToRgb(content.style.textBrushColor);
|
|
888
|
+
brush = new PdfSolidBrush(new PdfColor(brushColor.r, brushColor.g, brushColor.b));
|
|
889
|
+
}
|
|
890
|
+
return brush;
|
|
891
|
+
};
|
|
892
|
+
ExportHelper.prototype.hexToRgb = function (hex) {
|
|
893
|
+
if (hex === null || hex === '' || hex.length !== 7) {
|
|
894
|
+
throw new Error('please set valid hex value for color...');
|
|
895
|
+
}
|
|
896
|
+
hex = hex.substring(1);
|
|
897
|
+
var bigint = parseInt(hex, 16);
|
|
898
|
+
var r = (bigint >> 16) & 255;
|
|
899
|
+
var g = (bigint >> 8) & 255;
|
|
900
|
+
var b = bigint & 255;
|
|
901
|
+
return { r: r, g: g, b: b };
|
|
902
|
+
};
|
|
903
|
+
ExportHelper.prototype.setContentFormat = function (content, format) {
|
|
904
|
+
var width = (content.size) ? content.size.width * 0.75 : this.pdfDoc.pageSettings.size.width;
|
|
905
|
+
var height = (content.size) ? content.size.height * 0.75 : this.exportProps.footer.height * 0.50;
|
|
906
|
+
format = new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Middle);
|
|
907
|
+
if (!isNullOrUndefined(content.style.hAlign)) {
|
|
908
|
+
switch (content.style.hAlign) {
|
|
909
|
+
case 'Right':
|
|
910
|
+
format.alignment = PdfTextAlignment.Right;
|
|
911
|
+
break;
|
|
912
|
+
case 'Center':
|
|
913
|
+
format.alignment = PdfTextAlignment.Center;
|
|
914
|
+
break;
|
|
915
|
+
case 'Justify':
|
|
916
|
+
format.alignment = PdfTextAlignment.Justify;
|
|
917
|
+
break;
|
|
918
|
+
default:
|
|
919
|
+
format.alignment = PdfTextAlignment.Left;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
if (!isNullOrUndefined(content.style.vAlign)) {
|
|
923
|
+
format = this.getVerticalAlignment(content.style.vAlign, format);
|
|
924
|
+
}
|
|
925
|
+
return { format: format, size: new SizeF(width, height) };
|
|
926
|
+
};
|
|
927
|
+
ExportHelper.prototype.getPageNumberStyle = function (pageNumberType) {
|
|
928
|
+
switch (pageNumberType) {
|
|
929
|
+
case 'LowerLatin':
|
|
930
|
+
return 2;
|
|
931
|
+
case 'LowerRoman':
|
|
932
|
+
return 3;
|
|
933
|
+
case 'UpperLatin':
|
|
934
|
+
return 4;
|
|
935
|
+
case 'UpperRoman':
|
|
936
|
+
return 5;
|
|
937
|
+
default:
|
|
938
|
+
return 1;
|
|
939
|
+
}
|
|
633
940
|
};
|
|
634
941
|
return ExportHelper;
|
|
635
942
|
}());
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PdfTreeGrid } from '../pdf-treegrid';
|
|
2
2
|
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
3
3
|
import { RectangleF, PdfTextAlignment, PdfBorderOverlapStyle, PointF, PdfDashStyle, PdfLineCap, PdfSolidBrush, PdfStandardFont } from '@syncfusion/ej2-pdf-export';
|
|
4
|
-
import { SizeF, PdfFontStyle } from '@syncfusion/ej2-pdf-export';
|
|
4
|
+
import { SizeF, PdfFontStyle, PdfBitmap, PdfImage, PdfTextWebLink } from '@syncfusion/ej2-pdf-export';
|
|
5
5
|
import { PdfStringFormat, PdfStringLayouter } from '@syncfusion/ej2-pdf-export';
|
|
6
6
|
/**@hidden*/
|
|
7
7
|
var PdfTreeGridCell = /** @class */ (function () {
|
|
@@ -204,6 +204,19 @@ var PdfTreeGridCell = /** @class */ (function () {
|
|
|
204
204
|
}
|
|
205
205
|
result = graphics.stringLayoutResult;
|
|
206
206
|
}
|
|
207
|
+
else if (this.value instanceof PdfImage || this.value instanceof PdfBitmap) {
|
|
208
|
+
var imageBounds = void 0;
|
|
209
|
+
if (this.value.width <= innerLayoutArea.width) {
|
|
210
|
+
imageBounds = new RectangleF(innerLayoutArea.x, innerLayoutArea.y, this.value.width, innerLayoutArea.height);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
imageBounds = innerLayoutArea;
|
|
214
|
+
}
|
|
215
|
+
graphics.drawImage(this.value, imageBounds.x, imageBounds.y - 10, imageBounds.width, imageBounds.height);
|
|
216
|
+
}
|
|
217
|
+
else if (this.value instanceof PdfTextWebLink) {
|
|
218
|
+
this.value.draw(graphics.currentPage, innerLayoutArea);
|
|
219
|
+
}
|
|
207
220
|
if (this.style.borders != null) {
|
|
208
221
|
this.drawCellBorder(graphics, bounds);
|
|
209
222
|
}
|
|
@@ -70,6 +70,15 @@ var PdfGanttTheme = /** @class */ (function () {
|
|
|
70
70
|
ganttStyle.footer.backgroundColor = new PdfColor(255, 255, 255);
|
|
71
71
|
ganttStyle.taskbar.progressFontColor = new PdfColor(255, 255, 255);
|
|
72
72
|
ganttStyle.label.fontColor = new PdfColor(0, 0, 0);
|
|
73
|
+
ganttStyle.taskbar.splitLineBackground = new PdfColor(51, 51, 51);
|
|
74
|
+
ganttStyle.taskbar.unscheduledTaskBarColor = new PdfColor(49, 122, 185);
|
|
75
|
+
ganttStyle.taskbar.manualParentBackground = new PdfColor(119, 119, 119);
|
|
76
|
+
ganttStyle.taskbar.manualParentProgress = new PdfColor(85, 85, 85);
|
|
77
|
+
ganttStyle.taskbar.manualChildBackground = new PdfColor(117, 56, 201);
|
|
78
|
+
ganttStyle.taskbar.manualChildProgress = new PdfColor(87, 42, 150);
|
|
79
|
+
ganttStyle.taskbar.manualLineColor = new PdfColor(152, 154, 156);
|
|
80
|
+
ganttStyle.taskbar.manualParentBorder = new PdfColor(85, 85, 85);
|
|
81
|
+
ganttStyle.taskbar.manualChildBorder = new PdfColor(87, 42, 150);
|
|
73
82
|
break;
|
|
74
83
|
case 'Bootstrap 4':
|
|
75
84
|
//chart side theme
|
|
@@ -92,6 +101,15 @@ var PdfGanttTheme = /** @class */ (function () {
|
|
|
92
101
|
ganttStyle.footer.backgroundColor = new PdfColor(255, 255, 255);
|
|
93
102
|
ganttStyle.taskbar.progressFontColor = new PdfColor(255, 255, 255);
|
|
94
103
|
ganttStyle.label.fontColor = new PdfColor(33, 37, 41);
|
|
104
|
+
ganttStyle.taskbar.splitLineBackground = new PdfColor(0, 0, 0);
|
|
105
|
+
ganttStyle.taskbar.unscheduledTaskBarColor = new PdfColor(0, 123, 255);
|
|
106
|
+
ganttStyle.taskbar.manualParentBackground = new PdfColor(108, 117, 125);
|
|
107
|
+
ganttStyle.taskbar.manualParentProgress = new PdfColor(73, 80, 87);
|
|
108
|
+
ganttStyle.taskbar.manualChildBackground = new PdfColor(133, 83, 241);
|
|
109
|
+
ganttStyle.taskbar.manualChildProgress = new PdfColor(102, 40, 238);
|
|
110
|
+
ganttStyle.taskbar.manualLineColor = new PdfColor(152, 154, 156);
|
|
111
|
+
ganttStyle.taskbar.manualParentBorder = new PdfColor(73, 80, 87);
|
|
112
|
+
ganttStyle.taskbar.manualChildBorder = new PdfColor(102, 40, 238);
|
|
95
113
|
break;
|
|
96
114
|
case 'Fabric':
|
|
97
115
|
ganttStyle.columnHeader.fontColor = new PdfColor(102, 102, 102);
|
|
@@ -116,6 +134,15 @@ var PdfGanttTheme = /** @class */ (function () {
|
|
|
116
134
|
ganttStyle.footer.backgroundColor = new PdfColor(255, 255, 255);
|
|
117
135
|
ganttStyle.taskbar.progressFontColor = new PdfColor(255, 255, 255);
|
|
118
136
|
ganttStyle.label.fontColor = new PdfColor(51, 51, 51);
|
|
137
|
+
ganttStyle.taskbar.splitLineBackground = new PdfColor(0, 0, 0);
|
|
138
|
+
ganttStyle.taskbar.unscheduledTaskBarColor = new PdfColor(0, 120, 214);
|
|
139
|
+
ganttStyle.taskbar.manualParentBackground = new PdfColor(118, 118, 118);
|
|
140
|
+
ganttStyle.taskbar.manualParentProgress = new PdfColor(80, 80, 80);
|
|
141
|
+
ganttStyle.taskbar.manualChildBackground = new PdfColor(154, 56, 186);
|
|
142
|
+
ganttStyle.taskbar.manualChildProgress = new PdfColor(109, 24, 136);
|
|
143
|
+
ganttStyle.taskbar.manualLineColor = new PdfColor(152, 154, 156);
|
|
144
|
+
ganttStyle.taskbar.manualParentBorder = new PdfColor(80, 80, 80);
|
|
145
|
+
ganttStyle.taskbar.manualChildBorder = new PdfColor(109, 24, 136);
|
|
119
146
|
break;
|
|
120
147
|
default:
|
|
121
148
|
//chart side theme
|
|
@@ -138,6 +165,15 @@ var PdfGanttTheme = /** @class */ (function () {
|
|
|
138
165
|
ganttStyle.footer.backgroundColor = new PdfColor(255, 255, 255);
|
|
139
166
|
ganttStyle.taskbar.progressFontColor = new PdfColor(255, 255, 255);
|
|
140
167
|
ganttStyle.label.fontColor = new PdfColor(51, 51, 51);
|
|
168
|
+
ganttStyle.taskbar.splitLineBackground = new PdfColor(0, 0, 0);
|
|
169
|
+
ganttStyle.taskbar.unscheduledTaskBarColor = new PdfColor(63, 81, 181);
|
|
170
|
+
ganttStyle.taskbar.manualParentBackground = new PdfColor(97, 97, 97);
|
|
171
|
+
ganttStyle.taskbar.manualParentProgress = new PdfColor(97, 97, 97);
|
|
172
|
+
ganttStyle.taskbar.manualChildBackground = new PdfColor(0, 135, 134);
|
|
173
|
+
ganttStyle.taskbar.manualChildProgress = new PdfColor(0, 135, 134);
|
|
174
|
+
ganttStyle.taskbar.manualLineColor = new PdfColor(152, 154, 156);
|
|
175
|
+
ganttStyle.taskbar.manualParentBorder = new PdfColor(97, 97, 97);
|
|
176
|
+
ganttStyle.taskbar.manualChildBorder = new PdfColor(0, 135, 134);
|
|
141
177
|
break;
|
|
142
178
|
}
|
|
143
179
|
};
|