@syncfusion/ej2-pivotview 19.3.53 → 19.4.40

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 (137) hide show
  1. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +76 -0
  2. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +56 -0
  3. package/CHANGELOG.md +31 -25
  4. package/README.md +1 -1
  5. package/dist/ej2-pivotview.umd.min.js +2 -2
  6. package/dist/ej2-pivotview.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-pivotview.es2015.js +2076 -1100
  8. package/dist/es6/ej2-pivotview.es2015.js.map +1 -1
  9. package/dist/es6/ej2-pivotview.es5.js +2092 -1110
  10. package/dist/es6/ej2-pivotview.es5.js.map +1 -1
  11. package/dist/global/ej2-pivotview.min.js +2 -2
  12. package/dist/global/ej2-pivotview.min.js.map +1 -1
  13. package/dist/global/index.d.ts +1 -1
  14. package/package.json +22 -22
  15. package/src/base/engine.d.ts +17 -1
  16. package/src/base/engine.js +82 -29
  17. package/src/base/export-util.d.ts +17 -0
  18. package/src/base/export-util.js +245 -0
  19. package/src/base/olap/engine.d.ts +7 -0
  20. package/src/base/olap/engine.js +138 -35
  21. package/src/base/util.d.ts +0 -9
  22. package/src/base/util.js +2 -215
  23. package/src/common/actions/field-list.js +1 -1
  24. package/src/common/actions/pivot-button.d.ts +5 -8
  25. package/src/common/actions/pivot-button.js +188 -171
  26. package/src/common/base/constant.d.ts +186 -0
  27. package/src/common/base/constant.js +186 -0
  28. package/src/common/base/css-constant.d.ts +2 -0
  29. package/src/common/base/css-constant.js +2 -0
  30. package/src/common/base/enum.d.ts +11 -0
  31. package/src/common/base/interface.d.ts +272 -2
  32. package/src/common/calculatedfield/calculated-field.js +108 -93
  33. package/src/common/conditionalformatting/conditional-formatting.js +8 -2
  34. package/src/common/grouping-bar/grouping-bar.js +1 -1
  35. package/src/common/popups/aggregate-menu.js +57 -35
  36. package/src/common/popups/drillthrough-dialog.js +187 -139
  37. package/src/common/popups/filter-dialog.d.ts +1 -0
  38. package/src/common/popups/filter-dialog.js +22 -1
  39. package/src/common/popups/formatting-dialog.js +4 -0
  40. package/src/common/popups/grouping.js +2 -1
  41. package/src/common/popups/toolbar.js +305 -203
  42. package/src/pivotchart/base/pivotchart.js +36 -15
  43. package/src/pivotfieldlist/base/field-list-model.d.ts +49 -1
  44. package/src/pivotfieldlist/base/field-list.d.ts +55 -1
  45. package/src/pivotfieldlist/base/field-list.js +68 -1
  46. package/src/pivotfieldlist/renderer/dialog-renderer.js +38 -15
  47. package/src/pivotfieldlist/renderer/tree-renderer.js +35 -22
  48. package/src/pivotview/actions/drill-through.js +1 -1
  49. package/src/pivotview/actions/excel-export.js +9 -7
  50. package/src/pivotview/actions/pdf-export.js +3 -3
  51. package/src/pivotview/base/pivotview-model.d.ts +46 -1
  52. package/src/pivotview/base/pivotview.d.ts +56 -2
  53. package/src/pivotview/base/pivotview.js +311 -107
  54. package/src/pivotview/model/chartsettings-model.d.ts +2 -2
  55. package/src/pivotview/model/chartsettings.d.ts +2 -2
  56. package/src/pivotview/model/chartsettings.js +2 -2
  57. package/src/pivotview/model/datasourcesettings-model.d.ts +8 -1
  58. package/src/pivotview/model/datasourcesettings.d.ts +7 -0
  59. package/src/pivotview/model/datasourcesettings.js +3 -0
  60. package/src/pivotview/renderer/render.d.ts +2 -1
  61. package/src/pivotview/renderer/render.js +52 -11
  62. package/styles/bootstrap-dark.css +115 -104
  63. package/styles/bootstrap.css +115 -104
  64. package/styles/bootstrap4.css +114 -81
  65. package/styles/bootstrap5-dark.css +220 -168
  66. package/styles/bootstrap5.css +215 -161
  67. package/styles/fabric-dark.css +117 -103
  68. package/styles/fabric.css +115 -102
  69. package/styles/highcontrast-light.css +116 -102
  70. package/styles/highcontrast.css +118 -104
  71. package/styles/material-dark.css +108 -97
  72. package/styles/material.css +108 -97
  73. package/styles/pivotfieldlist/_bootstrap-dark-definition.scss +1 -4
  74. package/styles/pivotfieldlist/_bootstrap-definition.scss +1 -4
  75. package/styles/pivotfieldlist/_bootstrap4-definition.scss +1 -4
  76. package/styles/pivotfieldlist/_bootstrap5-definition.scss +8 -11
  77. package/styles/pivotfieldlist/_fabric-dark-definition.scss +1 -4
  78. package/styles/pivotfieldlist/_fabric-definition.scss +1 -4
  79. package/styles/pivotfieldlist/_fluent-definition.scss +177 -0
  80. package/styles/pivotfieldlist/_highcontrast-definition.scss +1 -4
  81. package/styles/pivotfieldlist/_highcontrast-light-definition.scss +1 -4
  82. package/styles/pivotfieldlist/_layout.scss +199 -109
  83. package/styles/pivotfieldlist/_material-dark-definition.scss +1 -4
  84. package/styles/pivotfieldlist/_material-definition.scss +1 -4
  85. package/styles/pivotfieldlist/_tailwind-definition.scss +6 -9
  86. package/styles/pivotfieldlist/_theme.scss +185 -35
  87. package/styles/pivotfieldlist/bootstrap-dark.css +49 -58
  88. package/styles/pivotfieldlist/bootstrap.css +49 -58
  89. package/styles/pivotfieldlist/bootstrap4.css +44 -39
  90. package/styles/pivotfieldlist/bootstrap5-dark.css +115 -89
  91. package/styles/pivotfieldlist/bootstrap5.css +115 -89
  92. package/styles/pivotfieldlist/fabric-dark.css +49 -58
  93. package/styles/pivotfieldlist/fabric.css +49 -58
  94. package/styles/pivotfieldlist/highcontrast-light.css +49 -58
  95. package/styles/pivotfieldlist/highcontrast.css +49 -58
  96. package/styles/pivotfieldlist/icons/_bootstrap5.scss +2 -2
  97. package/styles/pivotfieldlist/icons/_fluent.scss +352 -0
  98. package/styles/pivotfieldlist/icons/_tailwind.scss +2 -2
  99. package/styles/pivotfieldlist/material-dark.css +44 -53
  100. package/styles/pivotfieldlist/material.css +44 -53
  101. package/styles/pivotfieldlist/tailwind-dark.css +138 -81
  102. package/styles/pivotfieldlist/tailwind.css +140 -83
  103. package/styles/pivotview/_bootstrap-dark-definition.scss +9 -6
  104. package/styles/pivotview/_bootstrap-definition.scss +9 -6
  105. package/styles/pivotview/_bootstrap4-definition.scss +10 -7
  106. package/styles/pivotview/_bootstrap5-definition.scss +12 -9
  107. package/styles/pivotview/_fabric-dark-definition.scss +8 -5
  108. package/styles/pivotview/_fabric-definition.scss +7 -4
  109. package/styles/pivotview/_fluent-definition.scss +126 -0
  110. package/styles/pivotview/_highcontrast-definition.scss +8 -5
  111. package/styles/pivotview/_highcontrast-light-definition.scss +7 -4
  112. package/styles/pivotview/_layout.scss +119 -64
  113. package/styles/pivotview/_material-dark-definition.scss +7 -4
  114. package/styles/pivotview/_material-definition.scss +8 -4
  115. package/styles/pivotview/_tailwind-definition.scss +8 -5
  116. package/styles/pivotview/_theme.scss +124 -70
  117. package/styles/pivotview/bootstrap-dark.css +66 -46
  118. package/styles/pivotview/bootstrap.css +66 -46
  119. package/styles/pivotview/bootstrap4.css +70 -42
  120. package/styles/pivotview/bootstrap5-dark.css +99 -73
  121. package/styles/pivotview/bootstrap5-dark.scss +0 -1
  122. package/styles/pivotview/bootstrap5.css +100 -72
  123. package/styles/pivotview/fabric-dark.css +68 -45
  124. package/styles/pivotview/fabric.css +66 -44
  125. package/styles/pivotview/highcontrast-light.css +67 -44
  126. package/styles/pivotview/highcontrast.css +69 -46
  127. package/styles/pivotview/icons/_bootstrap4.scss +1 -1
  128. package/styles/pivotview/icons/_bootstrap5.scss +1 -1
  129. package/styles/pivotview/icons/_fluent.scss +183 -0
  130. package/styles/pivotview/icons/_tailwind.scss +1 -1
  131. package/styles/pivotview/material-dark.css +64 -44
  132. package/styles/pivotview/material.css +64 -44
  133. package/styles/pivotview/tailwind-dark.css +106 -58
  134. package/styles/pivotview/tailwind-dark.scss +0 -1
  135. package/styles/pivotview/tailwind.css +107 -57
  136. package/styles/tailwind-dark.css +250 -145
  137. package/styles/tailwind.css +247 -140
@@ -0,0 +1,245 @@
1
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
2
+ /**
3
+ * This is a file to perform common utility for OLAP and Relational datasource
4
+ * @hidden
5
+ */
6
+ var PivotExportUtil = /** @class */ (function () {
7
+ function PivotExportUtil() {
8
+ }
9
+ /* eslint-disable @typescript-eslint/no-explicit-any */
10
+ PivotExportUtil.getDefinedObj = function (data) {
11
+ var keyPos = 0;
12
+ var framedSet = {};
13
+ /* eslint-enable @typescript-eslint/no-explicit-any */
14
+ if (!(data === null || data === undefined)) {
15
+ var fields = Object.keys(data);
16
+ while (keyPos < fields.length) {
17
+ if (!(data[fields[keyPos]] === null || data[fields[keyPos]] === undefined)) {
18
+ framedSet[fields[keyPos]] = data[fields[keyPos]];
19
+ }
20
+ keyPos++;
21
+ }
22
+ }
23
+ else {
24
+ framedSet = data;
25
+ }
26
+ return framedSet;
27
+ };
28
+ PivotExportUtil.getClonedPivotValues = function (pivotValues) {
29
+ var clonedSets = [];
30
+ for (var i = 0; i < pivotValues.length; i++) {
31
+ if (pivotValues[i]) {
32
+ clonedSets[i] = [];
33
+ for (var j = 0; j < pivotValues[i].length; j++) {
34
+ if (pivotValues[i][j]) {
35
+ /* eslint-disable */
36
+ clonedSets[i][j] = this.getClonedPivotValueObj(pivotValues[i][j]);
37
+ /* eslint-enable */
38
+ }
39
+ }
40
+ }
41
+ }
42
+ return clonedSets;
43
+ };
44
+ /* eslint-disable */
45
+ PivotExportUtil.getClonedPivotValueObj = function (data) {
46
+ /* eslint-enable */
47
+ var keyPos = 0;
48
+ /* eslint-disable @typescript-eslint/no-explicit-any */
49
+ var framedSet = {};
50
+ /* eslint-enable @typescript-eslint/no-explicit-any */
51
+ if (!(data === null || data === undefined)) {
52
+ var fields = Object.keys(data);
53
+ while (keyPos < fields.length) {
54
+ framedSet[fields[keyPos]] = data[fields[keyPos]];
55
+ keyPos++;
56
+ }
57
+ }
58
+ else {
59
+ framedSet = data;
60
+ }
61
+ return framedSet;
62
+ };
63
+ /* eslint-disable */
64
+ PivotExportUtil.isContainCommonElements = function (collection1, collection2) {
65
+ /* eslint-enable */
66
+ for (var i = 0, cnt = collection1.length; i < cnt; i++) {
67
+ for (var j = 0, lnt = collection2.length; j < lnt; j++) {
68
+ if (collection2[j] === collection1[i]) {
69
+ return true;
70
+ }
71
+ }
72
+ }
73
+ return false;
74
+ };
75
+ /* eslint-disable */
76
+ PivotExportUtil.formatPdfHeaderFooter = function (pdf) {
77
+ var contents = [];
78
+ if (!isNullOrUndefined(pdf)) {
79
+ for (var i = 0; i < pdf.length; i++) {
80
+ var a = pdf[i];
81
+ var content = {
82
+ /* eslint-enable */
83
+ type: a.Type,
84
+ pageNumberType: a.PageNumberType,
85
+ style: a.Style ? {
86
+ penColor: a.Style.PenColor,
87
+ penSize: a.Style.PenSize,
88
+ dashStyle: a.Style.DashStyle,
89
+ textBrushColor: a.Style.TextBrushColor,
90
+ textPenColor: a.Style.TextPenColor,
91
+ fontSize: a.Style.FontSize,
92
+ hAlign: a.Style.HAlign,
93
+ vAlign: a.Style.VAlign
94
+ } : a.Style,
95
+ points: a.Points !== null ? {
96
+ x1: a.Points.X1,
97
+ y1: a.Points.Y1,
98
+ x2: a.Points.X2,
99
+ y2: a.Points.Y2
100
+ } : null,
101
+ format: a.Format,
102
+ position: a.Position !== null ? {
103
+ x: a.Position.X,
104
+ y: a.Position.Y
105
+ } : null,
106
+ size: a.Size !== null ? {
107
+ height: a.Size.Height,
108
+ width: a.Size.Width
109
+ } : null,
110
+ src: a.Src,
111
+ value: a.Value,
112
+ font: a.Font
113
+ };
114
+ contents.push(content);
115
+ }
116
+ }
117
+ return contents;
118
+ };
119
+ /* eslint-disable */
120
+ PivotExportUtil.formatPdfExportProperties = function (pdf) {
121
+ var values;
122
+ /* eslint-enable */
123
+ values = this.getDefinedObj({
124
+ pageOrientation: typeof pdf.PageOrientation === 'string' ? pdf.PageOrientation : null,
125
+ pageSize: typeof pdf.PageSize === 'string' ? pdf.PageSize : null,
126
+ header: !isNullOrUndefined(pdf.Header) ? {
127
+ fromTop: pdf.Header.FromTop,
128
+ height: pdf.Header.Height,
129
+ contents: this.formatPdfHeaderFooter(pdf.Header.Contents)
130
+ } : null,
131
+ columns: pdf.Columns,
132
+ footer: !isNullOrUndefined(pdf.Footer) ? {
133
+ fromTop: pdf.Footer.FromBottom,
134
+ height: pdf.Footer.Height,
135
+ contents: this.formatPdfHeaderFooter(pdf.Footer.Contents)
136
+ } : null,
137
+ includeHiddenColumn: pdf.IncludeHiddenColumn,
138
+ dataSource: pdf.DataSource,
139
+ exportType: typeof pdf.ExportType === 'string' ? pdf.ExportType : null,
140
+ theme: !isNullOrUndefined(pdf.Theme) ? {
141
+ header: pdf.Theme.Header,
142
+ record: pdf.Theme.Record,
143
+ caption: pdf.Theme.Caption
144
+ } : null,
145
+ fileName: pdf.FileName,
146
+ hierarchyExportMode: typeof pdf.HierarchyExportMode === 'string' ? pdf.HierarchyExportMode : null,
147
+ allowHorizontalOverflow: pdf.AllowHorizontalOverflow
148
+ });
149
+ return values;
150
+ };
151
+ /* eslint-disable */
152
+ PivotExportUtil.formatExcelStyle = function (style) {
153
+ var prop;
154
+ /* eslint-enable */
155
+ if (!isNullOrUndefined(style)) {
156
+ prop = this.getDefinedObj({
157
+ fontColor: style.FontColor,
158
+ fontName: style.FontName,
159
+ fontSize: style.FontSize,
160
+ hAlign: style.HAlign === String ? style.HAlign : null,
161
+ vAlign: style.VAlign === String ? style.VAlign : null,
162
+ bold: style.Bold,
163
+ indent: style.Indent,
164
+ italic: style.Italic,
165
+ underline: style.Underline,
166
+ backColor: style.BackColor,
167
+ wrapText: style.WrapText,
168
+ borders: style.Borders,
169
+ numberFormat: style.NumberFormat,
170
+ type: style.Type
171
+ });
172
+ }
173
+ return prop;
174
+ };
175
+ /* eslint-disable */
176
+ PivotExportUtil.formatExcelCell = function (cell) {
177
+ var cells = [];
178
+ if (!isNullOrUndefined(cell)) {
179
+ for (var i = 0; i < cell.length; i++) {
180
+ this.getDefinedObj({
181
+ index: !isNullOrUndefined(cell[i].Index) ? cell[i].Index : null,
182
+ colSpan: !isNullOrUndefined(cell[i].ColSpan) ? cell[i].ColSpan : null,
183
+ value: !isNullOrUndefined(cell[i].Value) ? cell[i].Value : null,
184
+ hyperlink: {
185
+ target: !isNullOrUndefined(cell[i].Hyperlink) ? cell[i].Hyperlink.Target : null,
186
+ displayText: !isNullOrUndefined(cell[i].Hyperlink) ? cell[i].Hyperlink.DisplayText : null
187
+ },
188
+ styles: this.formatExcelStyle(cell[i].Style),
189
+ rowSpan: !isNullOrUndefined(cell[i].RowSpan) ? cell[i].RowSpan : null
190
+ });
191
+ /* eslint-enable */
192
+ }
193
+ }
194
+ return cells;
195
+ };
196
+ /* eslint-disable */
197
+ PivotExportUtil.formatExcelHeaderFooter = function (excel) {
198
+ var rows = [];
199
+ if (!isNullOrUndefined(excel)) {
200
+ for (var i = 0; i < excel.Rows.length; i++) {
201
+ var row = excel.Rows[i];
202
+ var prop = this.getDefinedObj({
203
+ index: !isNullOrUndefined(row.Index) ? row.Index : null,
204
+ cells: this.formatExcelCell(row.Cells),
205
+ grouping: !isNullOrUndefined(row.Grouping) ? row.Grouping : null
206
+ });
207
+ rows.push(prop);
208
+ }
209
+ }
210
+ return rows;
211
+ };
212
+ PivotExportUtil.formatExcelExportProperties = function (excel) {
213
+ /* eslint-enable */
214
+ var prop;
215
+ prop = this.getDefinedObj({
216
+ dataSource: excel.DataSource,
217
+ query: excel.Query,
218
+ multipleExport: this.getDefinedObj({
219
+ type: !isNullOrUndefined(excel.MultipleExport) ? excel.MultipleExport.Type : null,
220
+ blankRows: !isNullOrUndefined(excel.MultipleExport) ? excel.MultipleExport.BlankRows : null
221
+ }),
222
+ header: this.getDefinedObj({
223
+ headerRows: !isNullOrUndefined(excel.Header) ? excel.Header.HeaderRows : null,
224
+ rows: this.formatExcelHeaderFooter(excel.Header)
225
+ }),
226
+ footer: this.getDefinedObj({
227
+ footerRows: !isNullOrUndefined(excel.Footer) ? excel.Footer.FooterRows : null,
228
+ rows: this.formatExcelHeaderFooter(excel.Footer)
229
+ }),
230
+ columns: excel.Columns,
231
+ exportType: typeof excel.ExportType === 'string' ? excel.ExportType : undefined,
232
+ includeHiddenColumn: excel.IncludeHiddenColumn,
233
+ theme: !isNullOrUndefined(excel.Theme) ? {
234
+ header: this.formatExcelStyle(excel.Theme.Header),
235
+ record: this.formatExcelStyle(excel.Theme.Record),
236
+ caption: this.formatExcelStyle(excel.Theme.Caption)
237
+ } : undefined,
238
+ fileName: excel.FileName,
239
+ hierarchyExportMode: typeof excel.HierarchyExportMode === 'string' ? excel.HierarchyExportMode : undefined
240
+ });
241
+ return prop;
242
+ };
243
+ return PivotExportUtil;
244
+ }());
245
+ export { PivotExportUtil };
@@ -74,6 +74,8 @@ export declare class OlapEngine {
74
74
  /** @hidden */
75
75
  isMondrian: boolean;
76
76
  /** @hidden */
77
+ olapValueAxis: string;
78
+ /** @hidden */
77
79
  isMeasureAvail: boolean;
78
80
  /** @hidden */
79
81
  selectedItems: string[];
@@ -108,6 +110,7 @@ export declare class OlapEngine {
108
110
  private localeObj;
109
111
  private measureReportItems;
110
112
  private locale;
113
+ private olapRowValueIndex;
111
114
  private mappingFields;
112
115
  private customRegex;
113
116
  private formatRegex;
@@ -165,6 +168,9 @@ export declare class OlapEngine {
165
168
  generateEngine(xmlDoc: Document, request: Ajax, customArgs: FieldData): void;
166
169
  private getSubTotalsVisibility;
167
170
  private frameRowHeader;
171
+ private insertRowGrandTotal;
172
+ private getValueAxis;
173
+ private frameGrandTotalAxisSet;
168
174
  private getDepth;
169
175
  private checkAttributeDrill;
170
176
  private frameTupCollection;
@@ -173,6 +179,7 @@ export declare class OlapEngine {
173
179
  setNamedSetsPosition(): void;
174
180
  private updateRowEngine;
175
181
  private updateTupCollection;
182
+ private frameGrandTotalValues;
176
183
  private frameColumnHeader;
177
184
  private orderTotals;
178
185
  private setParentCollection;
@@ -219,6 +219,7 @@ var OlapEngine = /** @class */ (function () {
219
219
  this.updateTupCollection(customArgs.drillInfo.axis === 'row' ? rowTuples.length : columnTuples.length);
220
220
  }
221
221
  if (customArgs.action === 'down' ? customArgs.drillInfo.axis === 'column' : true) {
222
+ this.olapValueAxis = isNullOrUndefined(this.getValueAxis(undefined, undefined)) ? 'column' : 'row';
222
223
  this.frameColumnHeader(columnTuples);
223
224
  if (!this.isPaging) {
224
225
  this.performColumnSorting();
@@ -273,6 +274,7 @@ var OlapEngine = /** @class */ (function () {
273
274
  OlapEngine.prototype.frameRowHeader = function (tuples) {
274
275
  this.headerGrouping = {};
275
276
  this.lastLevel = [];
277
+ var isGrandTotalAdd = true;
276
278
  var position = this.pivotValues.length;
277
279
  var pivotValues = [];
278
280
  var valueContent = [];
@@ -333,6 +335,7 @@ var OlapEngine = /** @class */ (function () {
333
335
  var startTupPos = tupPos;
334
336
  var pagingAllowFlag = true;
335
337
  var lastMesPos = 0;
338
+ var isGrandTotalTop = false;
336
339
  while (tupPos < tuplesLength && pagingAllowFlag) {
337
340
  var members = tuples[this.customArgs.action === 'down' ?
338
341
  (tupPos - (this.customArgs.drillInfo.currentCell.ordinal + 1)) : tupPos].querySelectorAll('Member');
@@ -387,35 +390,25 @@ var OlapEngine = /** @class */ (function () {
387
390
  (allStartPos === (drillStartPos + 1) || this.tupRowInfo[tupPos].measurePosition === (drillStartPos + 1))))
388
391
  : drillAllow;
389
392
  var withoutAllAllow = (withoutAllStartPos > -1 && allCount > 0) ? (attrDrill || allStartPos > withoutAllEndPos) : true;
390
- if (members.length === allCount + (measure ? 1 : 0) && measure) {
393
+ isGrandTotalTop = this.dataSourceSettings.grandTotalsPosition === 'Top' && this.olapRowValueIndex === 0 && this.olapValueAxis === 'row'
394
+ && this.dataSourceSettings.showGrandTotals && this.dataSourceSettings.showRowGrandTotals && (this.olapValueAxis === 'row' ? this.dataSourceSettings.rows.length > 1 : true);
395
+ if (isGrandTotalTop && gTotals.length === 1) {
396
+ gTotals = this.frameGrandTotalValues(tuples, gTotals, typeColl, measurePos);
397
+ }
398
+ if (members.length === allCount + (measure ? 1 : 0) && measure && !isGrandTotalTop) {
391
399
  var levelName = 'Grand Total.' + members[measurePos].querySelector('Caption').textContent;
392
- gTotals.push({
393
- axis: 'row',
394
- actualText: this.getUniqueName(members[measurePos].querySelector('UName').textContent),
395
- colIndex: 0,
396
- formattedText: (typeColl[measurePos] === '3' &&
397
- this.dataFields[this.getUniqueName(members[measurePos].querySelector('UName').textContent)] &&
398
- this.dataFields[this.getUniqueName(members[measurePos].querySelector('UName').textContent)].caption) ?
399
- this.dataFields[this.getUniqueName(members[measurePos].querySelector('UName').textContent)].caption :
400
- members[measurePos].querySelector('Caption').textContent,
401
- hasChild: false,
402
- level: -1,
403
- rowIndex: position,
404
- index: [],
405
- ordinal: tupPos,
406
- colSpan: 1,
407
- rowSpan: 1,
408
- memberType: Number(typeColl[measurePos]),
409
- isDrilled: false,
410
- parentUniqueName: members[measurePos].querySelector('PARENT_UNIQUE_NAME') ?
411
- members[measurePos].querySelector('PARENT_UNIQUE_NAME').textContent : undefined,
412
- levelUniqueName: members[measurePos].querySelector('LName').textContent,
413
- hierarchy: members[measurePos].getAttribute('Hierarchy'),
414
- valueSort: { levelName: levelName, axis: members[measurePos].getAttribute('Hierarchy') }
415
- });
400
+ var formattedText = (typeColl[measurePos] === '3' && this.dataFields[this.getUniqueName(members[measurePos].querySelector('UName').textContent)] &&
401
+ this.dataFields[this.getUniqueName(members[measurePos].querySelector('UName').textContent)].caption) ? this.dataFields[this.getUniqueName(members[measurePos].querySelector('UName').textContent)].caption :
402
+ members[measurePos].querySelector('Caption').textContent;
403
+ gTotals = this.frameGrandTotalAxisSet(gTotals, this.getUniqueName(members[measurePos].querySelector('UName').textContent), formattedText, position, tupPos, Number(typeColl[measurePos]), members[measurePos].querySelector('PARENT_UNIQUE_NAME') ? members[measurePos].querySelector('PARENT_UNIQUE_NAME').textContent : undefined, members[measurePos].querySelector('LName').textContent, members[measurePos].getAttribute('Hierarchy'), { levelName: levelName, axis: members[measurePos].getAttribute('Hierarchy') });
416
404
  gTotals[gTotals.length - 1].valueSort['Grand Total.' + members[measurePos].querySelector('Caption').textContent] = 1;
417
405
  }
418
406
  else if (!(allStartPos === 0 || (measurePos === 0 && allStartPos === 1)) && drillAllow && withoutAllAllow) {
407
+ if (this.dataSourceSettings.grandTotalsPosition === 'Top' && isGrandTotalAdd && this.dataSourceSettings.showGrandTotals && (this.olapValueAxis === 'row' ? this.dataSourceSettings.rows.length > 1 : true)) {
408
+ this.insertRowGrandTotal(gTotals, valueContent, pivotValues, tuples, position);
409
+ position = this.pivotValues.length;
410
+ isGrandTotalAdd = false;
411
+ }
419
412
  prevTupInfo = this.tupRowInfo[tupPos];
420
413
  var lastPos = position;
421
414
  var lastMemPos = memPos;
@@ -506,6 +499,11 @@ var OlapEngine = /** @class */ (function () {
506
499
  }
507
500
  tupPos++;
508
501
  }
502
+ if (!(this.dataSourceSettings.grandTotalsPosition === 'Top') || (this.olapValueAxis === 'row' && this.dataSourceSettings.rows.length === 1 && this.dataSourceSettings.grandTotalsPosition === 'Top') || this.dataSourceSettings.rows.length === 0) {
503
+ this.insertRowGrandTotal(gTotals, valueContent, pivotValues, tuples, position);
504
+ }
505
+ };
506
+ OlapEngine.prototype.insertRowGrandTotal = function (gTotals, valueContent, pivotValues, tuples, position) {
509
507
  if (gTotals.length > 1 && gTotals[0].memberType !== 3) {
510
508
  gTotals[0].ordinal = -1;
511
509
  }
@@ -531,6 +529,41 @@ var OlapEngine = /** @class */ (function () {
531
529
  this.updateRowEngine(pivotValues, valueContent, tuples.length);
532
530
  this.onDemandDrillEngine = pivotValues;
533
531
  }
532
+ return gTotals;
533
+ };
534
+ OlapEngine.prototype.getValueAxis = function (valueAxis, valueIndex) {
535
+ this.olapValueAxis = valueAxis;
536
+ this.olapRowValueIndex = valueIndex;
537
+ for (var i = 0; i < this.dataSourceSettings.rows.length; i++) {
538
+ if (this.dataSourceSettings.rows[i].name === '[Measures]') {
539
+ this.olapValueAxis = 'row';
540
+ this.olapRowValueIndex = i;
541
+ break;
542
+ }
543
+ }
544
+ return this.olapValueAxis;
545
+ };
546
+ OlapEngine.prototype.frameGrandTotalAxisSet = function (gTotals, actualText, formattedText, rowIndex, ordinal, memberType, parentUniqueName, levelUniqueName, hierarchy, valueSort) {
547
+ gTotals.push({
548
+ axis: 'row',
549
+ actualText: actualText,
550
+ colIndex: 0,
551
+ formattedText: formattedText,
552
+ hasChild: false,
553
+ level: -1,
554
+ rowIndex: rowIndex,
555
+ index: [],
556
+ ordinal: ordinal,
557
+ colSpan: 1,
558
+ rowSpan: 1,
559
+ memberType: memberType,
560
+ isDrilled: false,
561
+ parentUniqueName: parentUniqueName,
562
+ levelUniqueName: levelUniqueName,
563
+ hierarchy: hierarchy,
564
+ valueSort: valueSort
565
+ });
566
+ return gTotals;
534
567
  };
535
568
  OlapEngine.prototype.getDepth = function (tupInfo, uniqueName, memberType) {
536
569
  var memberPosition = tupInfo.uNameCollection.indexOf(uniqueName);
@@ -771,6 +804,55 @@ var OlapEngine = /** @class */ (function () {
771
804
  currTupCount--;
772
805
  }
773
806
  };
807
+ OlapEngine.prototype.frameGrandTotalValues = function (tuples, gTotals, typeColl, measurePos) {
808
+ var tupPos = 0;
809
+ var lastAllStartPos;
810
+ var lastAllCount;
811
+ var availAllMember = false;
812
+ var withoutAllEndPos = -1;
813
+ var isGrandtoalDataAdd = false;
814
+ var prevTupInfo;
815
+ var isGrandTotalTop = false;
816
+ while (tupPos < tuples.length && !isGrandtoalDataAdd) {
817
+ var members = tuples[this.customArgs.action === 'down' ?
818
+ (tupPos - (this.customArgs.drillInfo.currentCell.ordinal + 1)) : tupPos].querySelectorAll('Member');
819
+ var memPos = 0;
820
+ var allCount = this.tupRowInfo[tupPos].allCount;
821
+ var allStartPos = this.tupRowInfo[tupPos].allStartPos;
822
+ var measure = this.tupRowInfo[tupPos].measure;
823
+ var typeColl_1 = this.tupRowInfo[tupPos].typeCollection;
824
+ var drillStartPos = this.tupRowInfo[tupPos].drillStartPos;
825
+ var startDrillUniquename = this.tupRowInfo[tupPos].startDrillUniquename;
826
+ memPos = 0;
827
+ if (tupPos === 0 && (members.length > (allCount + (measure ? 1 : 0)) || (members.length === 1 && measure))) {
828
+ gTotals.pop();
829
+ }
830
+ if ((tupPos === 0 && this.isPaging) ? gTotals.length === 0 :
831
+ (!availAllMember || allCount === lastAllCount || allStartPos !== lastAllStartPos || (members.length === 1 && measure))) {
832
+ var attrDrill = this.checkAttributeDrill(this.tupRowInfo[tupPos].drillInfo, 'rows');
833
+ var drillAllow = drillStartPos > -1 ? (allCount > 0 ? (attrDrill || allStartPos > drillStartPos) : true) : true;
834
+ drillAllow = (prevTupInfo && drillAllow && drillStartPos > -1) ?
835
+ (prevTupInfo.startDrillUniquename !== startDrillUniquename ? true :
836
+ ((withoutAllEndPos > prevTupInfo.measurePosition ? false :
837
+ prevTupInfo.measureName !== this.tupRowInfo[tupPos].measureName) &&
838
+ (allStartPos === (drillStartPos + 1) || this.tupRowInfo[tupPos].measurePosition === (drillStartPos + 1))))
839
+ : drillAllow;
840
+ if (members.length === allCount + (measure ? 1 : 0) && measure && !isGrandTotalTop) {
841
+ var levelName = 'Grand Total.' + members[measurePos].querySelector('Caption').textContent;
842
+ var formattedText = (typeColl_1[measurePos] === '3' && this.dataFields[this.getUniqueName(members[measurePos].querySelector('UName').textContent)] &&
843
+ this.dataFields[this.getUniqueName(members[measurePos].querySelector('UName').textContent)].caption) ? this.dataFields[this.getUniqueName(members[measurePos].querySelector('UName').textContent)].caption :
844
+ members[measurePos].querySelector('Caption').textContent;
845
+ gTotals = this.frameGrandTotalAxisSet(gTotals, this.getUniqueName(members[measurePos].querySelector('UName').textContent), formattedText, this.pivotValues.length, tupPos, Number(typeColl_1[measurePos]), members[measurePos].querySelector('PARENT_UNIQUE_NAME') ? members[measurePos].querySelector('PARENT_UNIQUE_NAME').textContent : undefined, members[measurePos].querySelector('LName').textContent, members[measurePos].getAttribute('Hierarchy'), { levelName: levelName, axis: members[measurePos].getAttribute('Hierarchy') });
846
+ gTotals[gTotals.length - 1].valueSort['Grand Total.' + members[measurePos].querySelector('Caption').textContent] = 1;
847
+ }
848
+ lastAllCount = allCount;
849
+ lastAllStartPos = allStartPos;
850
+ }
851
+ isGrandtoalDataAdd = this.dataSourceSettings.values.length + 1 === gTotals.length ? true : false;
852
+ tupPos++;
853
+ }
854
+ return gTotals;
855
+ };
774
856
  OlapEngine.prototype.frameColumnHeader = function (tuples) {
775
857
  var _this = this;
776
858
  this.headerGrouping = {};
@@ -835,8 +917,18 @@ var OlapEngine = /** @class */ (function () {
835
917
  withoutAllAvail = true;
836
918
  isStartCol = (allCount > 0 && isStartCol) ? (allStartPos > withoutAllStartPos) : isStartCol;
837
919
  }
838
- if (isStartCol) {
839
- if (allCount === 0) {
920
+ var isGrandTotalTop = false;
921
+ if (this_1.dataSourceSettings.grandTotalsPosition === 'Top' && this_1.dataSourceSettings.showGrandTotals && this_1.dataSourceSettings.showColumnGrandTotals) {
922
+ var count = 0;
923
+ for (var i = 0; i < members.length; i++) {
924
+ if ((members[i].querySelector('Caption').textContent).indexOf('All') === 0) {
925
+ count++;
926
+ }
927
+ }
928
+ isGrandTotalTop = count === (this_1.olapValueAxis === 'column' ? this_1.dataSourceSettings.columns.length - 1 : this_1.dataSourceSettings.columns.length);
929
+ }
930
+ if (isStartCol || isGrandTotalTop) {
931
+ if (allCount === 0 || isGrandTotalTop) {
840
932
  var levelComp = [-1, -1, -1];
841
933
  if (this_1.tupColumnInfo[tupPos - 1] && this_1.tupColumnInfo[tupPos - 1].allCount === 0) {
842
934
  levelComp = this_1.levelCompare(levelColl, this_1.tupColumnInfo[tupPos - 1].levelCollection);
@@ -873,8 +965,10 @@ var OlapEngine = /** @class */ (function () {
873
965
  }
874
966
  this_1.setParentCollection(members);
875
967
  if (withoutAllAvail ? (withoutAllEndPos <= drillStartPos) : true) {
876
- this_1.totalCollection[this_1.totalCollection.length] =
877
- ({ allCount: allCount, ordinal: tupPos, members: members, drillInfo: drillInfo });
968
+ if (!isGrandTotalTop) {
969
+ this_1.totalCollection[this_1.totalCollection.length] =
970
+ ({ allCount: allCount, ordinal: tupPos, members: members, drillInfo: drillInfo });
971
+ }
878
972
  lastSavedInfo.allCount = allCount;
879
973
  lastSavedInfo.allStartPos = allStartPos;
880
974
  lastSavedInfo.drillStartPos = drillStartPos;
@@ -899,10 +993,12 @@ var OlapEngine = /** @class */ (function () {
899
993
  }
900
994
  this_1.setParentCollection(members);
901
995
  if ((withoutAllAvail && drillStartPos > -1) ? (withoutAllEndPos <= drillStartPos) : true) {
902
- this_1.totalCollection[this_1.totalCollection.length] =
903
- ({
904
- allCount: allCount, ordinal: tupPos, members: members, allStartPos: allStartPos, drillInfo: drillInfo
905
- });
996
+ if (!isGrandTotalTop) {
997
+ this_1.totalCollection[this_1.totalCollection.length] =
998
+ ({
999
+ allCount: allCount, ordinal: tupPos, members: members, allStartPos: allStartPos, drillInfo: drillInfo
1000
+ });
1001
+ }
906
1002
  lastSavedInfo.allCount = allCount;
907
1003
  lastSavedInfo.allStartPos = allStartPos;
908
1004
  lastSavedInfo.drillStartPos = drillStartPos;
@@ -1406,19 +1502,26 @@ var OlapEngine = /** @class */ (function () {
1406
1502
  }
1407
1503
  var newPos = 0;
1408
1504
  var totPos = 0;
1505
+ var valuePos = 0;
1409
1506
  gSumFlag = false;
1410
1507
  gSumGrouping = this.sortRowHeaders(gSumGrouping);
1411
1508
  for (var rPos = this.colDepth; rPos < rowCount; rPos++) {
1412
1509
  /* eslint-disable @typescript-eslint/dot-notation */
1510
+ if (this.dataSourceSettings.grandTotalsPosition === 'Top' && (this.dataSourceSettings.showGrandTotals && this.dataSourceSettings.showRowGrandTotals) &&
1511
+ ((this.olapValueAxis === 'column' && this.colDepth + 1 === rPos) || (this.olapValueAxis === 'row' && this.colDepth + this.dataSourceSettings.values.length + 1 === rPos))) {
1512
+ newPos = 0;
1513
+ gSumFlag = false;
1514
+ }
1413
1515
  var cell = gSumFlag ? gSumGrouping : sortLvlGrouping[levels[0]]['parent'];
1414
1516
  /* eslint-enable @typescript-eslint/dot-notation */
1415
- var currPos = gSumFlag ? (newPos - totPos) : newPos;
1517
+ var currPos = (this.dataSourceSettings.grandTotalsPosition === 'Top' && (this.dataSourceSettings.showGrandTotals && this.dataSourceSettings.showRowGrandTotals) && this.colDepth === rPos) ? cell.length : gSumFlag ? (newPos - totPos) : newPos;
1416
1518
  if (cell[currPos]) {
1417
1519
  this.pivotValues[rPos] = [cell[currPos]];
1418
1520
  this.pivotValues[rPos][0].rowIndex = rPos;
1419
- this.valueContent[newPos][0] = this.pivotValues[rPos][0];
1521
+ this.valueContent[valuePos][0] = this.pivotValues[rPos][0];
1420
1522
  }
1421
1523
  newPos++;
1524
+ valuePos++;
1422
1525
  if (this.pivotValues[rPos][0].type === 'grand sum') {
1423
1526
  gSumFlag = true;
1424
1527
  totPos = newPos;
@@ -15,11 +15,8 @@ export declare class PivotUtil {
15
15
  }[]): {
16
16
  [key: string]: Object;
17
17
  }[];
18
- static getClonedPivotValues(pivotValues: IPivotValues): IPivotValues;
19
- private static getClonedPivotValueObj;
20
18
  private static getDefinedObj;
21
19
  static inArray(value: Object, collection: Object[]): number;
22
- static isContainCommonElements(collection1: Object[], collection2: Object[]): boolean;
23
20
  static setPivotProperties(control: any, properties: any): void;
24
21
  static getClonedDataSourceSettings(dataSourceSettings: IDataOptions): IDataOptions;
25
22
  static updateDataSourceSettings(control: PivotView | PivotFieldList, dataSourceSettings: IDataOptions): void;
@@ -39,12 +36,6 @@ export declare class PivotUtil {
39
36
  static getFieldInfo(fieldName: string, control: PivotView | PivotFieldList, hasAllField?: boolean): FieldItemInfo;
40
37
  static isButtonIconRefesh(prop: string, oldProp: PivotViewModel | PivotFieldListModel, newProp: PivotViewModel | PivotFieldListModel): boolean;
41
38
  static formatPivotValues(pivotValues: any): any;
42
- static formatPdfHeaderFooter(pdf: any): any;
43
- static formatPdfExportProperties(pdf: any): any;
44
- static formatExcelStyle(style: any): any;
45
- static formatExcelCell(cell: any): any;
46
- static formatExcelHeaderFooter(excel: any): any;
47
- static formatExcelExportProperties(excel: any): any;
48
39
  static formatFieldList(fieldList: any): any;
49
40
  static frameContent(pivotValues: IPivotValues, type: string, rowPosition: number, control: PivotView | PivotFieldList): IGridValues;
50
41
  static getLocalizedObject(control: PivotView | PivotFieldList): Object;