@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.
Files changed (211) hide show
  1. package/CHANGELOG.md +1072 -1060
  2. package/README.md +75 -75
  3. package/dist/ej2-gantt.umd.min.js +1 -10
  4. package/dist/ej2-gantt.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-gantt.es2015.js +274 -176
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +642 -534
  8. package/dist/es6/ej2-gantt.es5.js.map +1 -1
  9. package/dist/global/ej2-gantt.min.js +1 -10
  10. package/dist/global/ej2-gantt.min.js.map +1 -1
  11. package/dist/global/index.d.ts +0 -9
  12. package/dist/ts/components.ts +4 -0
  13. package/dist/ts/gantt/actions/actions.ts +18 -0
  14. package/dist/ts/gantt/actions/cell-edit.ts +606 -0
  15. package/dist/ts/gantt/actions/chart-scroll.ts +167 -0
  16. package/dist/ts/gantt/actions/column-menu.ts +35 -0
  17. package/dist/ts/gantt/actions/column-reorder.ts +52 -0
  18. package/dist/ts/gantt/actions/column-resize.ts +52 -0
  19. package/dist/ts/gantt/actions/connector-line-edit.ts +829 -0
  20. package/dist/ts/gantt/actions/context-menu.ts +754 -0
  21. package/dist/ts/gantt/actions/day-markers.ts +80 -0
  22. package/dist/ts/gantt/actions/dependency.ts +692 -0
  23. package/dist/ts/gantt/actions/dialog-edit.ts +2208 -0
  24. package/dist/ts/gantt/actions/edit.ts +3499 -0
  25. package/dist/ts/gantt/actions/excel-export.ts +61 -0
  26. package/dist/ts/gantt/actions/filter.ts +302 -0
  27. package/dist/ts/gantt/actions/keyboard.ts +306 -0
  28. package/dist/ts/gantt/actions/pdf-export.ts +214 -0
  29. package/dist/ts/gantt/actions/rowdragdrop.ts +839 -0
  30. package/dist/ts/gantt/actions/selection.ts +536 -0
  31. package/dist/ts/gantt/actions/sort.ts +98 -0
  32. package/dist/ts/gantt/actions/taskbar-edit.ts +1940 -0
  33. package/dist/ts/gantt/actions/toolbar.ts +489 -0
  34. package/dist/ts/gantt/actions/virtual-scroll.ts +60 -0
  35. package/dist/ts/gantt/base/common.ts +9 -0
  36. package/dist/ts/gantt/base/constant.ts +13 -0
  37. package/dist/ts/gantt/base/css-constants.ts +148 -0
  38. package/dist/ts/gantt/base/date-processor.ts +1257 -0
  39. package/dist/ts/gantt/base/enum.ts +372 -0
  40. package/dist/ts/gantt/base/gantt-chart.ts +1248 -0
  41. package/dist/ts/gantt/base/gantt.ts +4069 -0
  42. package/dist/ts/gantt/base/interface.ts +955 -0
  43. package/dist/ts/gantt/base/splitter.ts +174 -0
  44. package/dist/ts/gantt/base/task-processor.ts +2217 -0
  45. package/dist/ts/gantt/base/tree-grid.ts +694 -0
  46. package/dist/ts/gantt/base/utils.ts +208 -0
  47. package/dist/ts/gantt/export/export-helper.ts +552 -0
  48. package/dist/ts/gantt/export/pdf-base/dictionary.ts +152 -0
  49. package/dist/ts/gantt/export/pdf-base/pdf-borders.ts +277 -0
  50. package/dist/ts/gantt/export/pdf-base/pdf-grid-table.ts +901 -0
  51. package/dist/ts/gantt/export/pdf-base/pdf-style/gantt-theme.ts +131 -0
  52. package/dist/ts/gantt/export/pdf-base/pdf-style/style.ts +91 -0
  53. package/dist/ts/gantt/export/pdf-base/treegrid-layouter.ts +414 -0
  54. package/dist/ts/gantt/export/pdf-connector-line.ts +422 -0
  55. package/dist/ts/gantt/export/pdf-gantt.ts +282 -0
  56. package/dist/ts/gantt/export/pdf-taskbar.ts +395 -0
  57. package/dist/ts/gantt/export/pdf-timeline.ts +202 -0
  58. package/dist/ts/gantt/export/pdf-treegrid.ts +406 -0
  59. package/dist/ts/gantt/models/add-dialog-field-settings.ts +33 -0
  60. package/dist/ts/gantt/models/column.ts +464 -0
  61. package/dist/ts/gantt/models/day-working-time.ts +22 -0
  62. package/dist/ts/gantt/models/edit-dialog-field-settings.ts +33 -0
  63. package/dist/ts/gantt/models/edit-settings.ts +79 -0
  64. package/dist/ts/gantt/models/event-marker.ts +27 -0
  65. package/dist/ts/gantt/models/filter-settings.ts +53 -0
  66. package/dist/ts/gantt/models/holiday.ts +34 -0
  67. package/dist/ts/gantt/models/label-settings.ts +30 -0
  68. package/dist/ts/gantt/models/models.ts +36 -0
  69. package/dist/ts/gantt/models/resource-fields.ts +38 -0
  70. package/dist/ts/gantt/models/search-settings.ts +77 -0
  71. package/dist/ts/gantt/models/selection-settings.ts +56 -0
  72. package/dist/ts/gantt/models/sort-settings.ts +50 -0
  73. package/dist/ts/gantt/models/splitter-settings.ts +47 -0
  74. package/dist/ts/gantt/models/task-fields.ts +171 -0
  75. package/dist/ts/gantt/models/timeline-settings.ts +112 -0
  76. package/dist/ts/gantt/models/tooltip-settings.ts +46 -0
  77. package/dist/ts/gantt/renderer/chart-rows.ts +1838 -0
  78. package/dist/ts/gantt/renderer/connector-line.ts +1025 -0
  79. package/dist/ts/gantt/renderer/edit-tooltip.ts +228 -0
  80. package/dist/ts/gantt/renderer/event-marker.ts +96 -0
  81. package/dist/ts/gantt/renderer/nonworking-day.ts +205 -0
  82. package/dist/ts/gantt/renderer/render.ts +5 -0
  83. package/dist/ts/gantt/renderer/timeline.ts +1397 -0
  84. package/dist/ts/gantt/renderer/tooltip.ts +450 -0
  85. package/dist/ts/gantt/renderer/virtual-content-render.ts +50 -0
  86. package/license +9 -9
  87. package/package.json +80 -80
  88. package/src/gantt/actions/cell-edit.js +2 -1
  89. package/src/gantt/actions/dialog-edit.js +2 -1
  90. package/src/gantt/actions/edit.js +11 -2
  91. package/src/gantt/actions/rowdragdrop.js +37 -15
  92. package/src/gantt/actions/taskbar-edit.js +24 -24
  93. package/src/gantt/base/date-processor.js +0 -1
  94. package/src/gantt/base/gantt-chart.js +9 -4
  95. package/src/gantt/base/gantt-model.d.ts +779 -779
  96. package/src/gantt/base/gantt.d.ts +27 -27
  97. package/src/gantt/base/gantt.js +22 -22
  98. package/src/gantt/base/splitter.js +1 -0
  99. package/src/gantt/base/task-processor.js +13 -13
  100. package/src/gantt/base/tree-grid.js +3 -1
  101. package/src/gantt/export/pdf-base/treegrid-layouter.js +13 -13
  102. package/src/gantt/export/pdf-connector-line.js +11 -11
  103. package/src/gantt/export/pdf-gantt.js +24 -24
  104. package/src/gantt/export/pdf-taskbar.js +11 -11
  105. package/src/gantt/export/pdf-treegrid.js +13 -13
  106. package/src/gantt/models/add-dialog-field-settings-model.d.ts +21 -21
  107. package/src/gantt/models/add-dialog-field-settings.js +19 -19
  108. package/src/gantt/models/day-working-time-model.d.ts +11 -11
  109. package/src/gantt/models/day-working-time.js +19 -19
  110. package/src/gantt/models/edit-dialog-field-settings-model.d.ts +21 -21
  111. package/src/gantt/models/edit-dialog-field-settings.js +19 -19
  112. package/src/gantt/models/edit-settings-model.d.ts +50 -50
  113. package/src/gantt/models/edit-settings.js +19 -19
  114. package/src/gantt/models/event-marker-model.d.ts +16 -16
  115. package/src/gantt/models/event-marker.js +19 -19
  116. package/src/gantt/models/filter-settings-model.d.ts +34 -34
  117. package/src/gantt/models/filter-settings.js +19 -19
  118. package/src/gantt/models/holiday-model.d.ts +21 -21
  119. package/src/gantt/models/holiday.js +19 -19
  120. package/src/gantt/models/label-settings-model.d.ts +16 -16
  121. package/src/gantt/models/label-settings.js +19 -19
  122. package/src/gantt/models/resource-fields-model.d.ts +21 -21
  123. package/src/gantt/models/resource-fields.js +19 -19
  124. package/src/gantt/models/search-settings-model.d.ts +56 -56
  125. package/src/gantt/models/search-settings.js +19 -19
  126. package/src/gantt/models/selection-settings-model.d.ts +35 -35
  127. package/src/gantt/models/selection-settings.js +19 -19
  128. package/src/gantt/models/sort-settings-model.d.ts +24 -24
  129. package/src/gantt/models/sort-settings.js +19 -19
  130. package/src/gantt/models/splitter-settings-model.d.ts +30 -30
  131. package/src/gantt/models/splitter-settings.js +19 -19
  132. package/src/gantt/models/task-fields-model.d.ts +110 -110
  133. package/src/gantt/models/task-fields.js +19 -19
  134. package/src/gantt/models/timeline-settings-model.d.ts +71 -71
  135. package/src/gantt/models/timeline-settings.js +19 -19
  136. package/src/gantt/models/tooltip-settings-model.d.ts +26 -26
  137. package/src/gantt/models/tooltip-settings.js +19 -19
  138. package/src/gantt/renderer/chart-rows.js +49 -37
  139. package/src/gantt/renderer/connector-line.js +22 -18
  140. package/src/gantt/renderer/event-marker.js +1 -0
  141. package/src/gantt/renderer/nonworking-day.js +13 -6
  142. package/src/gantt/renderer/timeline.d.ts +1 -0
  143. package/src/gantt/renderer/timeline.js +48 -12
  144. package/src/gantt/renderer/tooltip.js +11 -3
  145. package/styles/bootstrap-dark.css +442 -427
  146. package/styles/bootstrap.css +442 -433
  147. package/styles/bootstrap4.css +454 -479
  148. package/styles/bootstrap5-dark.css +457 -433
  149. package/styles/bootstrap5.css +457 -433
  150. package/styles/fabric-dark.css +438 -421
  151. package/styles/fabric.css +445 -428
  152. package/styles/fluent-dark.css +1938 -0
  153. package/styles/fluent-dark.scss +1 -0
  154. package/styles/fluent.css +1938 -0
  155. package/styles/fluent.scss +1 -0
  156. package/styles/gantt/_all.scss +2 -2
  157. package/styles/gantt/_bootstrap-dark-definition.scss +210 -156
  158. package/styles/gantt/_bootstrap-definition.scss +211 -157
  159. package/styles/gantt/_bootstrap4-definition.scss +213 -158
  160. package/styles/gantt/_bootstrap5-definition.scss +215 -162
  161. package/styles/gantt/_fabric-dark-definition.scss +211 -157
  162. package/styles/gantt/_fabric-definition.scss +211 -157
  163. package/styles/gantt/_fluent-dark-definition.scss +1 -0
  164. package/styles/gantt/_fluent-definition.scss +215 -162
  165. package/styles/gantt/_fusionnew-definition.scss +214 -0
  166. package/styles/gantt/_highcontrast-definition.scss +211 -157
  167. package/styles/gantt/_highcontrast-light-definition.scss +211 -157
  168. package/styles/gantt/_layout.scss +1446 -1027
  169. package/styles/gantt/_material-dark-definition.scss +212 -157
  170. package/styles/gantt/_material-definition.scss +212 -157
  171. package/styles/gantt/_material3-definition.scss +215 -0
  172. package/styles/gantt/_tailwind-definition.scss +215 -161
  173. package/styles/gantt/_theme.scss +702 -668
  174. package/styles/gantt/bootstrap-dark.css +442 -427
  175. package/styles/gantt/bootstrap.css +442 -433
  176. package/styles/gantt/bootstrap4.css +454 -479
  177. package/styles/gantt/bootstrap5-dark.css +457 -433
  178. package/styles/gantt/bootstrap5.css +457 -433
  179. package/styles/gantt/fabric-dark.css +438 -421
  180. package/styles/gantt/fabric.css +445 -428
  181. package/styles/gantt/fluent-dark.css +1938 -0
  182. package/styles/gantt/fluent-dark.scss +22 -0
  183. package/styles/gantt/fluent.css +1938 -0
  184. package/styles/gantt/fluent.scss +22 -0
  185. package/styles/gantt/highcontrast-light.css +405 -405
  186. package/styles/gantt/highcontrast.css +444 -456
  187. package/styles/gantt/icons/_bootstrap-dark.scss +124 -113
  188. package/styles/gantt/icons/_bootstrap.scss +124 -113
  189. package/styles/gantt/icons/_bootstrap4.scss +124 -113
  190. package/styles/gantt/icons/_bootstrap5.scss +124 -112
  191. package/styles/gantt/icons/_fabric-dark.scss +124 -112
  192. package/styles/gantt/icons/_fabric.scss +124 -112
  193. package/styles/gantt/icons/_fluent-dark.scss +1 -0
  194. package/styles/gantt/icons/_fluent.scss +124 -112
  195. package/styles/gantt/icons/_fusionnew.scss +120 -0
  196. package/styles/gantt/icons/_highcontrast.scss +124 -112
  197. package/styles/gantt/icons/_material-dark.scss +124 -112
  198. package/styles/gantt/icons/_material.scss +124 -112
  199. package/styles/gantt/icons/_material3.scss +124 -0
  200. package/styles/gantt/icons/_tailwind-dark.scss +124 -113
  201. package/styles/gantt/icons/_tailwind.scss +124 -113
  202. package/styles/gantt/material-dark.css +446 -417
  203. package/styles/gantt/material.css +445 -419
  204. package/styles/gantt/tailwind-dark.css +452 -482
  205. package/styles/gantt/tailwind.css +449 -479
  206. package/styles/highcontrast-light.css +405 -405
  207. package/styles/highcontrast.css +444 -456
  208. package/styles/material-dark.css +446 -417
  209. package/styles/material.css +445 -419
  210. package/styles/tailwind-dark.css +452 -482
  211. package/styles/tailwind.css +449 -479
@@ -0,0 +1,901 @@
1
+ import { PdfGanttCellStyle } from './../../base/interface';
2
+ import { PdfTreeGrid } from '../pdf-treegrid';
3
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
4
+ import { PdfPaddings } from './index';
5
+ import {
6
+ RectangleF, PdfTextAlignment, PdfBorderOverlapStyle, PointF, PdfDashStyle,
7
+ PdfLineCap, PdfSolidBrush, PdfStandardFont
8
+ } from '@syncfusion/ej2-pdf-export';
9
+ import { SizeF, PdfBrush, PdfPen, PdfFontStyle, PdfFont, PdfGraphics } from '@syncfusion/ej2-pdf-export';
10
+ import { PdfStringFormat, PdfStringLayouter, PdfStringLayoutResult } from '@syncfusion/ej2-pdf-export';
11
+
12
+ /**
13
+ *
14
+ */
15
+ export class PdfTreeGridCell {
16
+ /**
17
+ * Gets or sets the parent `row`.
18
+ *
19
+ * @private
20
+ */
21
+ public row: PdfTreeGridRow;
22
+ /**
23
+ * Gets or sets the cell `style`.
24
+ *
25
+ * @private
26
+ */
27
+ public style: PdfGanttCellStyle;
28
+ private cellWidth: number = 0;
29
+ private cellHeight: number = 0;
30
+ /**
31
+ * Gets or sets a value that indicates the total number of rows that cell `spans` within a PdfGrid.
32
+ *
33
+ * @private
34
+ */
35
+ public rowSpan: number;
36
+ /**
37
+ * Gets or sets a value that indicates the total number of columns that cell `spans` within a PdfGrid.
38
+ *
39
+ * @private
40
+ */
41
+ public columnSpan: number;
42
+ public value: Object;
43
+ /** @private */
44
+ public remainingString: string;
45
+ /** @private */
46
+ public finishedDrawingCell: boolean = true;
47
+ /** @private */
48
+ public isCellMergeContinue: boolean;
49
+ /** @private */
50
+ public isRowMergeContinue: boolean;
51
+ /** @private */
52
+ public isCellMergeStart: boolean;
53
+ /** @private */
54
+ public isRowMergeStart: boolean;
55
+ /** @private */
56
+ public isHeaderCell: boolean;
57
+
58
+ constructor(row?: PdfTreeGridRow) {
59
+ if (isNullOrUndefined(row)) {
60
+ this.rowSpan = 1;
61
+ this.columnSpan = 1;
62
+ } else {
63
+ this.row = row;
64
+ }
65
+ this.style = {};
66
+ }
67
+ /**
68
+ * Gets the `height` of the PdfTreeGrid cell.[Read-Only].
69
+ *
70
+ * @returns {number} .
71
+ * @private
72
+ */
73
+ public get height(): number {
74
+ if (this.cellHeight === 0) {
75
+ this.cellHeight = this.measureHeight();
76
+ }
77
+ return this.cellHeight;
78
+ }
79
+ public set height(value: number) {
80
+ this.cellHeight = value;
81
+ }
82
+ /**
83
+ * Gets the `width` of the PdfTreeGrid cell.[Read-Only].
84
+ *
85
+ * @returns {number} .
86
+ * @private
87
+ */
88
+ public get width(): number {
89
+ if (this.cellWidth === 0) {
90
+ this.cellWidth = this.measureWidth();
91
+ }
92
+ return Math.round(this.cellWidth);
93
+ }
94
+ public set width(value: number) {
95
+ this.cellWidth = value;
96
+ }
97
+
98
+ private measureWidth(): number {
99
+ let width: number = 0;
100
+ const layouter: PdfStringLayouter = new PdfStringLayouter();
101
+ if (typeof this.value === 'string') {
102
+ /* eslint-disable-next-line */
103
+ const font: PdfStandardFont = new PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily, this.style.fontSize, this.style.fontStyle);
104
+ /* eslint-disable-next-line */
105
+ const slr: PdfStringLayoutResult = layouter.layout((this.value as string), font, this.style.format, new SizeF(Number.MAX_VALUE, Number.MAX_VALUE), false, new SizeF(0, 0));
106
+ width += slr.actualSize.width;
107
+ width += (this.style.borders.left.width + this.style.borders.right.width) * 2;
108
+ }
109
+ if (typeof this.row.treegrid.style.cellPadding.left !== 'undefined' && this.row.treegrid.style.cellPadding.hasLeftPad) {
110
+ width += this.row.treegrid.style.cellPadding.left;
111
+ }
112
+ if (typeof this.row.treegrid.style.cellPadding.right !== 'undefined' && this.row.treegrid.style.cellPadding.hasRightPad) {
113
+ width += this.row.treegrid.style.cellPadding.right;
114
+ }
115
+ width += this.row.treegrid.style.cellSpacing;
116
+ return width;
117
+ }
118
+ /**
119
+ * @returns {number} .
120
+ * @private
121
+ */
122
+ /* eslint-disable */
123
+ public measureHeight(): number {
124
+ const rowHeight: number = this.row.treegrid.rowHeight;
125
+ let height = 0;
126
+ let width: number = this.calculateWidth();
127
+ width -= this.row.treegrid.style.cellPadding.right + this.row.treegrid.style.cellPadding.left;
128
+ width -= this.style.borders.left.width + this.style.borders.right.width;
129
+ const layouter: PdfStringLayouter = new PdfStringLayouter();
130
+ if (typeof this.value === 'string' || typeof this.remainingString === 'string') {
131
+ let currentValue: string = this.value as string;
132
+ if (!this.finishedDrawingCell) {
133
+ currentValue = !(isNullOrUndefined(this.remainingString) || this.remainingString === '') ? this.remainingString : (this.value as string);
134
+ }
135
+ /* eslint-disable */
136
+ const font: PdfStandardFont = new PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily, this.style.fontSize, this.style.fontStyle);
137
+ /* eslint-disable */
138
+ const slr: PdfStringLayoutResult = layouter.layout(currentValue, font, this.style.format, new SizeF(width, 0), false, new SizeF(0, 0));
139
+ height += slr.actualSize.height;
140
+ height += (this.style.borders.top.width + this.style.borders.bottom.width) * 2;
141
+ }
142
+ height += this.row.treegrid.style.cellPadding.top + this.row.treegrid.style.cellPadding.bottom;
143
+ height += this.row.treegrid.style.cellSpacing;
144
+ return height > rowHeight ? height : rowHeight;
145
+ }
146
+ /* eslint-enable */
147
+
148
+ private calculateWidth(): number {
149
+ const cellIndex: number = this.row.cells.indexOf(this);
150
+ const columnSpan: number = this.columnSpan;
151
+ let width: number = 0;
152
+ for (let i: number = 0; i < columnSpan; i++) {
153
+ width += this.row.treegrid.columns.getColumn(cellIndex + i).width;
154
+ }
155
+ if (this.row.treegrid.columns.getColumn(cellIndex).isTreeColumn) {
156
+ width -= (this.row.level * 10);
157
+ }
158
+ return width;
159
+ }
160
+ /**
161
+ * `Draws` the specified graphics.
162
+ *
163
+ * @param {PdfGraphics} graphics .
164
+ * @param {RectangleF} bounds .
165
+ * @param {boolean} cancelSubsequentSpans .
166
+ * @param {number} leftAdjustment .
167
+ * @returns {PdfStringLayoutResult} .
168
+ * @private
169
+ */
170
+ public draw(graphics: PdfGraphics, bounds: RectangleF, cancelSubsequentSpans: boolean, leftAdjustment: number): PdfStringLayoutResult {
171
+ let result: PdfStringLayoutResult = null; const padding: number = 10;
172
+ if (cancelSubsequentSpans) {
173
+ // Cancel all subsequent cell spans, if no space exists.
174
+ const currentCellIndex: number = this.row.cells.indexOf(this);
175
+ for (let i: number = currentCellIndex + 1; i <= currentCellIndex + this.columnSpan; i++) {
176
+ this.row.cells.getCell(i).isCellMergeContinue = false;
177
+ this.row.cells.getCell(i).isRowMergeContinue = false;
178
+ }
179
+ this.columnSpan = 1;
180
+ }
181
+ // Skip cells which were already covered by span map.
182
+ if (this.isCellMergeContinue || this.isRowMergeContinue) {
183
+ if (this.isCellMergeContinue && this.row.treegrid.style.allowHorizontalOverflow) {
184
+ if ((this.row.rowOverflowIndex > 0 && (this.row.cells.indexOf(this) !== this.row.rowOverflowIndex + 1)) ||
185
+ (this.row.rowOverflowIndex === 0 && this.isCellMergeContinue)) {
186
+ return result;
187
+ } else {
188
+ return result;
189
+ }
190
+ }
191
+ }
192
+ //bounds = this.adjustContentLayoutArea(bounds);
193
+ this.drawCellBackground(graphics, bounds);
194
+ const textPen: PdfPen = null;
195
+ const textBrush: PdfBrush = new PdfSolidBrush(this.style.fontColor);
196
+ let font: PdfFont = null;
197
+ if (this.row.isParentRow) {
198
+ font = new PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily, this.style.fontSize, PdfFontStyle.Bold);
199
+ } else {
200
+ font = new PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily, this.style.fontSize, this.style.fontStyle);
201
+ }
202
+ let innerLayoutArea: RectangleF = bounds;
203
+ if (!this.isHeaderCell) {
204
+ /* eslint-disable-next-line */
205
+ innerLayoutArea.x = innerLayoutArea.x;
206
+ /* eslint-disable-next-line */
207
+ innerLayoutArea.width = innerLayoutArea.width;
208
+ }
209
+ if (innerLayoutArea.height >= graphics.clientSize.height) {
210
+ // To break row to next page
211
+ if (this.row.treegrid.allowRowBreakAcrossPages) {
212
+ innerLayoutArea.height -= innerLayoutArea.y;
213
+ bounds.height -= bounds.y;
214
+ } else {
215
+ innerLayoutArea.height = graphics.clientSize.height;
216
+ bounds.height = graphics.clientSize.height;
217
+ }
218
+ }
219
+ innerLayoutArea = this.adjustContentLayoutArea(innerLayoutArea);
220
+ if (typeof this.value === 'string' || typeof this.remainingString === 'string') {
221
+ let temp: string = null;
222
+ if (this.finishedDrawingCell) {
223
+ temp = (this.remainingString === '') ? this.remainingString : this.value as string;
224
+ /* eslint-disable-next-line */
225
+ graphics.drawString(temp, font, textPen, textBrush, (innerLayoutArea.x + leftAdjustment), innerLayoutArea.y, (innerLayoutArea.width - leftAdjustment - padding), (innerLayoutArea.height - padding), this.style.format);
226
+ } else {
227
+ /* eslint-disable-next-line */
228
+ graphics.drawString(this.remainingString, font, textPen, textBrush, (innerLayoutArea.x + leftAdjustment), innerLayoutArea.y, this.style.format);
229
+ }
230
+ result = graphics.stringLayoutResult;
231
+ }
232
+ if (this.style.borders != null) {
233
+ this.drawCellBorder(graphics, bounds);
234
+ }
235
+ return result;
236
+ }
237
+
238
+ /**
239
+ * Draw the `cell background`.
240
+ *
241
+ * @param {PdfGraphics} graphics .
242
+ * @param {RectangleF} bounds .
243
+ * @returns {void} .
244
+ * @private
245
+ */
246
+ public drawCellBackground(graphics: PdfGraphics, bounds: RectangleF): void {
247
+ const backgroundBrush: PdfBrush = new PdfSolidBrush(this.style.backgroundColor);
248
+ if (backgroundBrush != null) {
249
+ graphics.save();
250
+ graphics.drawRectangle(backgroundBrush, bounds.x, bounds.y, bounds.width, bounds.height);
251
+ graphics.restore();
252
+ }
253
+ // if (this.style.backgroundImage != null) {
254
+ // let image: PdfImage = this.getBackgroundImage();
255
+ // graphics.drawImage(this.style.backgroundImage, bounds.x, bounds.y, bounds.width, bounds.height);
256
+ // }
257
+ }
258
+
259
+ /**
260
+ * `Adjusts the text layout area`.
261
+ *
262
+ * @param {RectangleF} bounds .
263
+ * @returns {RectangleF} .
264
+ * @private
265
+ */
266
+ private adjustContentLayoutArea(bounds: RectangleF): RectangleF {
267
+ //Add Padding value to its Cell Bounds
268
+ const returnBounds: RectangleF = new RectangleF(new PointF(bounds.x, bounds.y), new SizeF(bounds.width, bounds.height));
269
+ const cellPadding: PdfPaddings = this.style.padding;
270
+ if (this.value instanceof PdfTreeGrid) {
271
+ const size: SizeF = (this.value as PdfTreeGrid).size;
272
+ if (this.style.format.alignment === PdfTextAlignment.Center) {
273
+ returnBounds.x += cellPadding.left + (returnBounds.width - size.width) / 2;
274
+ returnBounds.y += cellPadding.top + (returnBounds.height - size.height) / 2;
275
+ } else if (this.style.format.alignment === PdfTextAlignment.Left) {
276
+ returnBounds.x += cellPadding.left;
277
+ returnBounds.y += cellPadding.top;
278
+ } else if (this.style.format.alignment === PdfTextAlignment.Right) {
279
+ returnBounds.x += cellPadding.left + (returnBounds.width - size.width);
280
+ returnBounds.y += cellPadding.top;
281
+ }
282
+ } else {
283
+ returnBounds.x += cellPadding.left;
284
+ returnBounds.y += cellPadding.top;
285
+ }
286
+ return returnBounds;
287
+ }
288
+
289
+ /**
290
+ * @param {PdfGraphics} graphics .
291
+ * @param {RectangleF} bounds .
292
+ * @returns {void} .
293
+ * @private
294
+ */
295
+ private drawCellBorder(graphics: PdfGraphics, bounds: RectangleF): void {
296
+ if (this.row.treegrid.style.borderOverlapStyle === PdfBorderOverlapStyle.Inside) {
297
+ bounds.x += this.style.borders.left.width;
298
+ bounds.y += this.style.borders.top.width;
299
+ bounds.width -= this.style.borders.right.width;
300
+ bounds.height -= this.style.borders.bottom.width;
301
+ }
302
+ if (this.style.borders.isAll && this.isHeaderCell) {
303
+ graphics.drawRectangle(this.style.borders.left, bounds.x, bounds.y, bounds.width, bounds.height);
304
+ graphics.restore();
305
+ return;
306
+ } else {
307
+ let p1: PointF = new PointF(bounds.x, bounds.y + bounds.height);
308
+ let p2: PointF = new PointF(bounds.x, bounds.y);
309
+ let pen: PdfPen = this.style.borders.left;
310
+ if (this.style.borders.left.dashStyle === PdfDashStyle.Solid) {
311
+ pen.lineCap = PdfLineCap.Square;
312
+ }
313
+ graphics.drawLine(pen, p1, p2);
314
+ graphics.restore();
315
+ p1 = new PointF(bounds.x + bounds.width, bounds.y);
316
+ p2 = new PointF(bounds.x + bounds.width, bounds.y + bounds.height);
317
+ pen = this.style.borders.right;
318
+ if ((bounds.x + bounds.width) > (graphics.clientSize.width - (pen.width / 2))) {
319
+ p1 = new PointF(graphics.clientSize.width - (pen.width / 2), bounds.y);
320
+ p2 = new PointF(graphics.clientSize.width - (pen.width / 2), bounds.y + bounds.height);
321
+ }
322
+ if (this.style.borders.right.dashStyle === PdfDashStyle.Solid) {
323
+ pen.lineCap = PdfLineCap.Square;
324
+ }
325
+ graphics.drawLine(pen, p1, p2);
326
+ graphics.restore();
327
+ p1 = new PointF(bounds.x, bounds.y);
328
+ p2 = new PointF(bounds.x + bounds.width, bounds.y);
329
+ pen = this.style.borders.top;
330
+ if (this.style.borders.top.dashStyle === PdfDashStyle.Solid) {
331
+ pen.lineCap = PdfLineCap.Square;
332
+ }
333
+ graphics.drawLine(pen, p1, p2);
334
+ graphics.restore();
335
+ p1 = new PointF(bounds.x + bounds.width, bounds.y + bounds.height);
336
+ p2 = new PointF(bounds.x, bounds.y + bounds.height);
337
+ pen = this.style.borders.bottom;
338
+ if (bounds.y + bounds.height > graphics.clientSize.height - pen.width / 2) {
339
+ p1 = new PointF(bounds.x + bounds.width, graphics.clientSize.height - pen.width / 2);
340
+ p2 = new PointF(bounds.x, graphics.clientSize.height - pen.width / 2);
341
+ }
342
+ if (this.style.borders.bottom.dashStyle === PdfDashStyle.Solid) {
343
+ pen.lineCap = PdfLineCap.Square;
344
+ }
345
+ graphics.drawLine(pen, p1, p2);
346
+ graphics.restore();
347
+ }
348
+ }
349
+ }
350
+ /**
351
+ * `PdfTreeGridCellCollection` class provides access to an ordered,
352
+ * strongly typed collection of 'PdfTreeGridCell' objects.
353
+ *
354
+ * @private
355
+ */
356
+ export class PdfTreeGridCellCollection {
357
+ //Fields
358
+ /**
359
+ * @private
360
+ */
361
+ private treegridRow: PdfTreeGridRow;
362
+ /**
363
+ * @private
364
+ */
365
+ private cells: PdfTreeGridCell[];
366
+ //Constructor
367
+ /**
368
+ * Initializes a new instance of the `PdfGridCellCollection` class with the row.
369
+ *
370
+ * @param { PdfTreeGridRow} row .
371
+ * @private
372
+ */
373
+ public constructor(row: PdfTreeGridRow) {
374
+ this.treegridRow = row;
375
+ this.cells = [];
376
+ }
377
+ //Properties
378
+ /**
379
+ * Gets the current `cell`.
380
+ *
381
+ * @param {number} index .
382
+ * @returns {PdfTreeGridCell} .
383
+ * @private
384
+ */
385
+ public getCell(index: number): PdfTreeGridCell {
386
+ if (index < 0 || index >= this.count) {
387
+ throw new Error('IndexOutOfRangeException');
388
+ }
389
+ return this.cells[index];
390
+ }
391
+ /**
392
+ * Gets the cells `count`.[Read-Only].
393
+ *
394
+ * @returns {number} .
395
+ * @private
396
+ */
397
+ public get count(): number {
398
+ return this.cells.length;
399
+ }
400
+ //Implementation
401
+ /**
402
+ * `Adds` this instance.
403
+ *
404
+ * @param {PdfTreeGridCell} cell .
405
+ * @returns {PdfTreeGridCell | void} .
406
+ * @private
407
+ */
408
+ public add(cell?: PdfTreeGridCell): PdfTreeGridCell | void {
409
+ if (typeof cell === 'undefined') {
410
+ const tempcell: PdfTreeGridCell = new PdfTreeGridCell();
411
+ this.add(tempcell);
412
+ return cell;
413
+ } else {
414
+ cell.row = this.treegridRow;
415
+ this.cells.push(cell);
416
+ }
417
+ }
418
+ /**
419
+ * Returns the `index of` a particular cell in the collection.
420
+ *
421
+ * @param {PdfTreeGridCell} cell .
422
+ * @returns {number} .
423
+ * @private
424
+ */
425
+ public indexOf(cell: PdfTreeGridCell): number {
426
+ return this.cells.indexOf(cell);
427
+ }
428
+ }
429
+ /**
430
+ *
431
+ */
432
+ export class PdfTreeGridRow {
433
+ private treegridCells: PdfTreeGridCellCollection;
434
+ private pdfTreeGrid: PdfTreeGrid;
435
+ private treegridRowOverflowIndex: number = 0;
436
+ private treegridRowBreakHeight: number;
437
+ private rowHeight: number = 0;
438
+ private rowWidth: number = 0;
439
+ /* eslint-disable-next-line */
440
+ private _isParentRow = false;
441
+ private intendLevel: number = 0;
442
+ /**
443
+ * The `Maximum span` of the row.
444
+ *
445
+ * @public
446
+ */
447
+ public maximumRowSpan: number;
448
+
449
+ constructor(treegrid: PdfTreeGrid) {
450
+ this.pdfTreeGrid = treegrid;
451
+ }
452
+
453
+ public get cells(): PdfTreeGridCellCollection {
454
+ if (isNullOrUndefined(this.treegridCells)) {
455
+ this.treegridCells = new PdfTreeGridCellCollection(this);
456
+ }
457
+ return this.treegridCells;
458
+ }
459
+
460
+ public get isParentRow(): boolean {
461
+ return this._isParentRow;
462
+ }
463
+
464
+ public set isParentRow(value: boolean) {
465
+ this._isParentRow = value;
466
+ }
467
+
468
+ public get treegrid(): PdfTreeGrid {
469
+ return this.pdfTreeGrid;
470
+ }
471
+ public set treegrid(value: PdfTreeGrid) {
472
+ this.pdfTreeGrid = value;
473
+ }
474
+
475
+ /**
476
+ * `Height` of the row yet to be drawn after split.
477
+ *
478
+ * @returns {number} .
479
+ * @private
480
+ */
481
+ public get rowBreakHeight(): number {
482
+ if (typeof this.treegridRowBreakHeight === 'undefined') {
483
+ this.treegridRowBreakHeight = 0;
484
+ }
485
+ return this.treegridRowBreakHeight;
486
+ }
487
+ public set rowBreakHeight(value: number) {
488
+ this.treegridRowBreakHeight = value;
489
+ }
490
+ /**
491
+ * `over flow index` of the row.
492
+ *
493
+ * @returns {number} .
494
+ * @private
495
+ */
496
+ public get rowOverflowIndex(): number {
497
+ return this.treegridRowOverflowIndex;
498
+ }
499
+ public set rowOverflowIndex(value: number) {
500
+ this.treegridRowOverflowIndex = value;
501
+ }
502
+ public get level(): number {
503
+ return this.intendLevel;
504
+ }
505
+ public set level(value: number) {
506
+ this.intendLevel = value;
507
+ }
508
+
509
+ /**
510
+ * Gets or sets the `height` of the row.
511
+ *
512
+ * @returns {number} .
513
+ * @private
514
+ */
515
+ public get height(): number {
516
+ if (this.rowHeight === 0) {
517
+ this.rowHeight = this.measureHeight();
518
+ }
519
+ return this.rowHeight;
520
+ }
521
+ public set height(value: number) {
522
+ this.rowHeight = value;
523
+ }
524
+ /**
525
+ * Gets or sets the `width` of the row.
526
+ *
527
+ * @returns {number} .
528
+ * @private
529
+ */
530
+ public get width(): number {
531
+ if (this.rowWidth === 0) {
532
+ this.rowWidth = this.measureWidth();
533
+ }
534
+ return this.rowWidth;
535
+ }
536
+ public get rowIndex(): number {
537
+ return this.treegrid.rows.rowCollection.indexOf(this);
538
+ }
539
+
540
+ private measureWidth(): number {
541
+ const columns: PdfTreeGridColumn[] = this.treegrid.columns.columns;
542
+ let totalWidth: number = 0;
543
+ for (let i: number = 0; i < columns.length; i++) {
544
+ const column: PdfTreeGridColumn = columns[i];
545
+ totalWidth += column.width;
546
+ }
547
+ return totalWidth;
548
+ }
549
+
550
+ private measureHeight(): number {
551
+ let rowHeight: number = this.cells.getCell(0).height;
552
+ for (let i: number = 0; i < this.cells.count; i++) {
553
+ const cell: PdfTreeGridCell = this.cells.getCell(i);
554
+ if (cell.columnSpan === 1 || cell.rowSpan === 1) {
555
+ rowHeight = Math.max(rowHeight, cell.height);
556
+ } else {
557
+ rowHeight = Math.min(rowHeight, cell.height);
558
+ }
559
+ cell.height = rowHeight;
560
+ }
561
+ return rowHeight;
562
+ }
563
+ }
564
+ /**
565
+ * `PdfTreeGridRowCollection` class provides access to an ordered, strongly typed collection of 'PdfTreeGridRow' objects.
566
+ *
567
+ * @private
568
+ */
569
+ export class PdfTreeGridRowCollection {
570
+ // Fields
571
+ /**
572
+ * @private
573
+ */
574
+ private treegrid: PdfTreeGrid;
575
+ /**
576
+ * The row collection of the `treegrid`.
577
+ *
578
+ * @private
579
+ */
580
+ private rows: PdfTreeGridRow[];
581
+ // Constructor
582
+ /**
583
+ * Initializes a new instance of the `PdfTreeGridRowCollection` class with the parent grid.
584
+ *
585
+ * @param {PdfTreeGrid} treegrid .
586
+ * @private
587
+ */
588
+ public constructor(treegrid: PdfTreeGrid) {
589
+ this.rows = [];
590
+ this.treegrid = treegrid;
591
+ }
592
+ //Properties
593
+ /**
594
+ * Gets the number of header in the `PdfTreeGrid`.[Read-Only].
595
+ *
596
+ * @returns {number} .
597
+ * @private
598
+ */
599
+ public get count(): number {
600
+ return this.rows.length;
601
+ }
602
+ //Implementation
603
+ /**
604
+ * Return the row collection of the `treegrid`.
605
+ *
606
+ * @returns {PdfTreeGridRow[]} .
607
+ * @private
608
+ */
609
+ public get rowCollection(): PdfTreeGridRow[] {
610
+ return this.rows;
611
+ }
612
+ public addRow(): PdfTreeGridRow;
613
+ public addRow(row: PdfTreeGridRow): void;
614
+ public addRow(row?: PdfTreeGridRow): void | PdfTreeGridRow {
615
+ if (typeof row === 'undefined') {
616
+ const row: PdfTreeGridRow = new PdfTreeGridRow(this.treegrid);
617
+ this.addRow(row);
618
+ return row;
619
+ } else {
620
+ if (row.cells.count === 0) {
621
+ for (let i: number = 0; i < this.treegrid.columns.count; i++) {
622
+ row.cells.add(new PdfTreeGridCell());
623
+ }
624
+ }
625
+ this.rows.push(row);
626
+ }
627
+ }
628
+ /**
629
+ * Return the row by index.
630
+ *
631
+ * @param {number} index .
632
+ * @returns {PdfTreeGridRow} .
633
+ * @private
634
+ */
635
+ public getRow(index: number): PdfTreeGridRow {
636
+ return this.rows[index];
637
+ }
638
+ }
639
+ /**
640
+ * `PdfTreeGridHeaderCollection` class provides customization of the settings for the header.
641
+ *
642
+ * @private
643
+ */
644
+ export class PdfTreeGridHeaderCollection {
645
+ /**
646
+ * The `treegrid`.
647
+ *
648
+ * @returns {PdfTreeGrid} .
649
+ * @private
650
+ */
651
+ private treegrid: PdfTreeGrid;
652
+ /**
653
+ * The array to store the `rows` of the grid header.
654
+ *
655
+ * @returns {PdfTreeGridRow[]} .
656
+ * @private
657
+ */
658
+ private rows: PdfTreeGridRow[] = [];
659
+ //constructor
660
+ /**
661
+ * Initializes a new instance of the `PdfTreeGridHeaderCollection` class with the parent grid.
662
+ *
663
+ * @param {PdfTreeGrid} treegrid .
664
+ * @private
665
+ */
666
+ public constructor(treegrid: PdfTreeGrid) {
667
+ this.treegrid = treegrid;
668
+ this.rows = [];
669
+ }
670
+ //Properties
671
+ /**
672
+ * Gets a 'PdfTreeGridRow' object that represents the `header` row in a 'PdfGridHeaderCollection' control.[Read-Only].
673
+ *
674
+ * @param {number} index .
675
+ * @returns {PdfTreeGridRow} .
676
+ * @private
677
+ */
678
+ public getHeader(index: number): PdfTreeGridRow {
679
+ return (this.rows[index]);
680
+ }
681
+ /**
682
+ * Gets the `number of header` in the 'PdfGrid'.[Read-Only]
683
+ *
684
+ * @returns {number} .
685
+ * @private
686
+ */
687
+ public get count(): number {
688
+ return this.rows.length;
689
+ }
690
+ //Implementation
691
+ /**
692
+ * `Adds` the specified row.
693
+ *
694
+ * @param {PdfTreeGridRow} row .
695
+ * @returns {void} .
696
+ * @private
697
+ */
698
+ public add(row: PdfTreeGridRow): void {
699
+ this.rows.push(row);
700
+ }
701
+ public indexOf(row: PdfTreeGridRow): number {
702
+ return this.rows.indexOf(row);
703
+ }
704
+ }
705
+
706
+ export class PdfTreeGridColumn {
707
+ private treegrid: PdfTreeGrid;
708
+ private columnWidth: number = 0;
709
+ private stringFormat: PdfStringFormat;
710
+ private treeColumnIndex: boolean = false;
711
+ private _headerText: string = '';
712
+ private _field: string = '';
713
+ constructor(treegrid: PdfTreeGrid) {
714
+ this.treegrid = treegrid;
715
+ }
716
+ public get headerText(): string {
717
+ return this._headerText;
718
+ }
719
+ public set headerText(value: string) {
720
+ this._headerText = value;
721
+ }
722
+ public get field(): string {
723
+ return this._field;
724
+ }
725
+ public set field(value: string) {
726
+ this._field = value;
727
+ }
728
+ public get width(): number {
729
+ return this.columnWidth;
730
+ }
731
+ public set width(value: number) {
732
+ this.columnWidth = value;
733
+ }
734
+ public get isTreeColumn(): boolean {
735
+ return this.treeColumnIndex;
736
+ }
737
+ public set isTreeColumn(value: boolean) {
738
+ this.treeColumnIndex = value;
739
+ }
740
+ /**
741
+ * Gets or sets the information about the text `formatting`.
742
+ *
743
+ * @returns {PdfStringFormat} .
744
+ * @private
745
+ */
746
+ public get format(): PdfStringFormat {
747
+ if (this.stringFormat == null) {
748
+ this.stringFormat = new PdfStringFormat(); //GetDefaultFormat();
749
+ }
750
+ return this.stringFormat;
751
+ }
752
+ public set format(value: PdfStringFormat) {
753
+ this.stringFormat = value;
754
+ }
755
+ }
756
+ /**
757
+ * `PdfTreeGridColumnCollection` class provides access to an ordered,
758
+ * strongly typed collection of 'PdfTreeGridColumn' objects.
759
+ *
760
+ * @private
761
+ */
762
+ export class PdfTreeGridColumnCollection {
763
+ //Fields
764
+ /**
765
+ * @private
766
+ */
767
+ private treegrid: PdfTreeGrid;
768
+ /**
769
+ * @private
770
+ */
771
+ private internalColumns: PdfTreeGridColumn[] = [];
772
+ /**
773
+ * @private
774
+ */
775
+ public columnWidth: number = 0;
776
+ //properties
777
+ //Constructors
778
+ /**
779
+ * Initializes a new instance of the `PdfTreeGridColumnCollection` class with the parent grid.
780
+ *
781
+ * @param { PdfTreeGrid} treegrid .
782
+ * @private
783
+ */
784
+ public constructor(treegrid: PdfTreeGrid) {
785
+ this.treegrid = treegrid;
786
+ this.internalColumns = [];
787
+ }
788
+ //Implementation
789
+ /**
790
+ * `Add` a new column to the 'PdfGrid'.
791
+ *
792
+ * @param {number} count .
793
+ * @returns {void} .
794
+ * @private
795
+ */
796
+ public add(count: number): void {
797
+ // public add(column : PdfGridColumn) : void
798
+ // public add(arg : number|PdfGridColumn) : void {
799
+ // if (typeof arg === 'number') {
800
+ for (let i: number = 0; i < count; i++) {
801
+ this.internalColumns.push(new PdfTreeGridColumn(this.treegrid));
802
+ for (let index: number = 0; index < this.treegrid.rows.count; index++) {
803
+ const row: PdfTreeGridRow = this.treegrid.rows.getRow(index);
804
+ const cell: PdfTreeGridCell = new PdfTreeGridCell();
805
+ cell.value = '';
806
+ row.cells.add(cell);
807
+ }
808
+ }
809
+ // } else {
810
+ // let column : PdfGridColumn = new PdfGridColumn(this.grid);
811
+ // this.columns.push(column);
812
+ // return column;
813
+ // }
814
+ }
815
+ /**
816
+ * Gets the `number of columns` in the 'PdfGrid'.[Read-Only].
817
+ *
818
+ * @returns {number} .
819
+ * @private
820
+ */
821
+ public get count(): number {
822
+ return this.internalColumns.length;
823
+ }
824
+ /**
825
+ * Gets the `widths`.
826
+ *
827
+ * @returns {number} .
828
+ * @private
829
+ */
830
+ public get width(): number {
831
+ if (this.columnWidth === 0) {
832
+ this.columnWidth = this.measureColumnsWidth();
833
+ }
834
+ return this.columnWidth;
835
+ }
836
+ /**
837
+ * Gets the `array of PdfGridColumn`.[Read-Only]
838
+ *
839
+ * @returns {PdfTreeGridColumn[]} .
840
+ * @private
841
+ */
842
+ public get columns(): PdfTreeGridColumn[] {
843
+ return this.internalColumns;
844
+ }
845
+ /**
846
+ * Gets the `PdfTreeGridColumn` from the specified index.[Read-Only]
847
+ *
848
+ * @param {number} index .
849
+ * @returns {PdfTreeGridColumn} .
850
+ * @private
851
+ */
852
+ public getColumn(index: number): PdfTreeGridColumn {
853
+ if (index >= 0 && index <= this.columns.length) {
854
+ return this.columns[index];
855
+ } else {
856
+ throw Error('can not get the column from the index: ' + index);
857
+ }
858
+ }
859
+ //Implementation
860
+ /**
861
+ * `Calculates the column widths`.
862
+ *
863
+ * @returns {number} .
864
+ * @private
865
+ */
866
+ public measureColumnsWidth(): number {
867
+ let totalWidth: number = 0;
868
+ this.treegrid.measureColumnsWidth();
869
+ for (let i: number = 0, count: number = this.internalColumns.length; i < count; i++) {
870
+ totalWidth += this.internalColumns[i].width;
871
+ }
872
+ return totalWidth;
873
+ }
874
+ /**
875
+ * Gets the `widths of the columns`.
876
+ *
877
+ * @param {number} totalWidth .
878
+ * @returns {number} .
879
+ * @private
880
+ */
881
+ public getDefaultWidths(totalWidth: number): number[] {
882
+ const widths: number[] = [];
883
+ let subFactor: number = this.count;
884
+ for (let i: number = 0; i < this.count; i++) {
885
+ widths[i] = this.internalColumns[i].width;
886
+ if (this.internalColumns[i].width > 0) {
887
+ totalWidth -= this.internalColumns[i].width;
888
+ subFactor--;
889
+ } else {
890
+ widths[i] = 0;
891
+ }
892
+ }
893
+ for (let i: number = 0; i < this.count; i++) {
894
+ const width: number = totalWidth / subFactor;
895
+ if (widths[i] <= 0) {
896
+ widths[i] = width;
897
+ }
898
+ }
899
+ return widths;
900
+ }
901
+ }