@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
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 19.3.53
3
+ * version : 19.4.40
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-pivotview@*",
3
- "_id": "@syncfusion/ej2-pivotview@19.3.48",
3
+ "_id": "@syncfusion/ej2-pivotview@19.4.38",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-gKbPG1m+Pr8ZncxXlxagHrMfQvl0t8I+91cq4oLlFyr7vWVrnTMub+7zJcAEpB1rezSLad/khDI+mybuaAzIOA==",
5
+ "_integrity": "sha512-+fFwkKf9f7dvy1yimYl177BDSWAFQ5OgMMZQhRr4uzC63qedgNfM4WsA+j3CSXAodlDsH69Wk0RLYrbxYJbo7g==",
6
6
  "_location": "/@syncfusion/ej2-pivotview",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -23,8 +23,8 @@
23
23
  "/@syncfusion/ej2-react-pivotview",
24
24
  "/@syncfusion/ej2-vue-pivotview"
25
25
  ],
26
- "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-pivotview/-/ej2-pivotview-19.3.48.tgz",
27
- "_shasum": "18edeff7aed76eee560dfb774f256ad06621a733",
26
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-pivotview/-/ej2-pivotview-19.4.38.tgz",
27
+ "_shasum": "295cfc89df3f91c8f3f63e12169f1da81d58097b",
28
28
  "_spec": "@syncfusion/ej2-pivotview@*",
29
29
  "_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
30
30
  "author": {
@@ -35,23 +35,23 @@
35
35
  },
36
36
  "bundleDependencies": false,
37
37
  "dependencies": {
38
- "@syncfusion/ej2-base": "~19.3.53",
39
- "@syncfusion/ej2-buttons": "~19.3.53",
40
- "@syncfusion/ej2-calendars": "~19.3.53",
41
- "@syncfusion/ej2-charts": "~19.3.53",
42
- "@syncfusion/ej2-compression": "~19.3.53",
43
- "@syncfusion/ej2-data": "~19.3.53",
44
- "@syncfusion/ej2-dropdowns": "~19.3.53",
45
- "@syncfusion/ej2-excel-export": "~19.3.53",
46
- "@syncfusion/ej2-file-utils": "~19.3.53",
47
- "@syncfusion/ej2-grids": "~19.3.53",
48
- "@syncfusion/ej2-inputs": "~19.3.53",
49
- "@syncfusion/ej2-lists": "~19.3.53",
50
- "@syncfusion/ej2-navigations": "~19.3.53",
51
- "@syncfusion/ej2-pdf-export": "~19.3.53",
52
- "@syncfusion/ej2-popups": "~19.3.53",
53
- "@syncfusion/ej2-splitbuttons": "~19.3.53",
54
- "@syncfusion/ej2-svg-base": "~19.3.53"
38
+ "@syncfusion/ej2-base": "~19.4.38",
39
+ "@syncfusion/ej2-buttons": "~19.4.38",
40
+ "@syncfusion/ej2-calendars": "~19.4.38",
41
+ "@syncfusion/ej2-charts": "~19.4.40",
42
+ "@syncfusion/ej2-compression": "~19.4.38",
43
+ "@syncfusion/ej2-data": "~19.4.38",
44
+ "@syncfusion/ej2-dropdowns": "~19.4.40",
45
+ "@syncfusion/ej2-excel-export": "~19.4.38",
46
+ "@syncfusion/ej2-file-utils": "~19.4.38",
47
+ "@syncfusion/ej2-grids": "~19.4.40",
48
+ "@syncfusion/ej2-inputs": "~19.4.38",
49
+ "@syncfusion/ej2-lists": "~19.4.38",
50
+ "@syncfusion/ej2-navigations": "~19.4.40",
51
+ "@syncfusion/ej2-pdf-export": "~19.4.38",
52
+ "@syncfusion/ej2-popups": "~19.4.38",
53
+ "@syncfusion/ej2-splitbuttons": "~19.4.40",
54
+ "@syncfusion/ej2-svg-base": "~19.4.40"
55
55
  },
56
56
  "deprecated": false,
57
57
  "description": "The pivot grid, or pivot table, is used to visualize large sets of relational data in a cross-tabular format, similar to an Excel pivot table.",
@@ -78,6 +78,6 @@
78
78
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
79
79
  },
80
80
  "typings": "index.d.ts",
81
- "version": "19.3.53",
81
+ "version": "19.4.40",
82
82
  "sideEffects": false
83
83
  }
@@ -3,7 +3,7 @@ import { L10n } from '@syncfusion/ej2-base';
3
3
  import { DataManager } from '@syncfusion/ej2-data';
4
4
  import { Sorting, SummaryTypes, FilterType, Operators, Condition } from './types';
5
5
  import { DateGroup, GroupType, ProviderType, DataSourceType } from './types';
6
- import { HeaderCollection } from '../common';
6
+ import { HeaderCollection, GrandTotalsPosition } from '../common';
7
7
  /**
8
8
  * PivotEngine is used to manipulate the relational or Multi-Dimensional data as pivoting values.
9
9
  */
@@ -56,6 +56,8 @@ export declare class PivotEngine {
56
56
  /** @hidden */
57
57
  showGrandTotals: boolean;
58
58
  /** @hidden */
59
+ grandTotalsPosition: GrandTotalsPosition;
60
+ /** @hidden */
59
61
  showRowGrandTotals: boolean;
60
62
  /** @hidden */
61
63
  showHeaderWhenEmpty: boolean;
@@ -189,6 +191,7 @@ export declare class PivotEngine {
189
191
  private formatRegex;
190
192
  private clonedReport;
191
193
  private measureNames;
194
+ private currencyCode;
192
195
  renderEngine(dataSource?: IDataOptions, customProperties?: ICustomProperties, fn?: Function): void;
193
196
  private removeIrrelevantFields;
194
197
  private updateDataSourceSettings;
@@ -325,6 +328,7 @@ export declare class PivotEngine {
325
328
  * * `showRowSubTotals`: Allows to show or hide sub-totals in row axis of the pivot table.
326
329
  * * `showColumnSubTotals`: Allows to show or hide sub-totals in column axis of the pivot table.
327
330
  * * `showGrandTotals`: Allows to show or hide grand totals in both rows and columns axis of the pivot table.
331
+ * * `grandTotalsPosition`: Allows the grand totals to be position at first position in the row and column axis of the pivot table.
328
332
  * * `showRowGrandTotals`: Allows to show or hide grand totals in row axis of the pivot table.
329
333
  * * `showColumnGrandTotals`: Allows to show or hide grand totals in column axis of the pivot table.
330
334
  * * `showHeaderWhenEmpty`: Allows the undefined headers to be displayed in the pivot table, when the specific field(s) are not defined in the raw data.
@@ -538,6 +542,10 @@ export interface IDataOptions {
538
542
  * Allows to show or hide grand totals in both rows and columns axis of the pivot table.
539
543
  */
540
544
  showGrandTotals?: boolean;
545
+ /**
546
+ * Allows the grand totals to be position at first position in the row and column axis of the pivot table.
547
+ */
548
+ grandTotalsPosition?: GrandTotalsPosition;
541
549
  /**
542
550
  * Allows to show or hide grand totals in row axis of the pivot table.
543
551
  */
@@ -1420,6 +1428,14 @@ export interface ICustomProperties {
1420
1428
  * Specifies the current locale information of the component.
1421
1429
  */
1422
1430
  localeObj?: L10n;
1431
+ /**
1432
+ * Specifies the current culture information of the component.
1433
+ */
1434
+ globalize?: Internationalization;
1435
+ /**
1436
+ * Specifies the current currency code of the component.
1437
+ */
1438
+ currenyCode?: string;
1423
1439
  /**
1424
1440
  * Specifies the customized field type information.
1425
1441
  */
@@ -148,7 +148,8 @@ var PivotEngine = /** @class */ (function () {
148
148
  this.isLastHeaderHasMeasures = true;
149
149
  this.isEditing = false;
150
150
  var fields;
151
- this.globalize = new Internationalization();
151
+ this.globalize = (customProperties && customProperties.globalize) ? customProperties.globalize : new Internationalization();
152
+ this.currencyCode = (customProperties && customProperties.currenyCode) ? customProperties.currenyCode : undefined;
152
153
  this.localeObj = customProperties ? customProperties.localeObj : undefined;
153
154
  this.fieldsType = customProperties ? customProperties.fieldsType : {};
154
155
  this.clonedReport = customProperties ? (customProperties.clonedReport &&
@@ -162,6 +163,7 @@ var PivotEngine = /** @class */ (function () {
162
163
  this.showRowSubTotals = isNullOrUndefined(dataSource.showRowSubTotals) ? true : dataSource.showRowSubTotals;
163
164
  this.showColumnSubTotals = isNullOrUndefined(dataSource.showColumnSubTotals) ? true : dataSource.showColumnSubTotals;
164
165
  this.showGrandTotals = isNullOrUndefined(dataSource.showGrandTotals) ? true : dataSource.showGrandTotals;
166
+ this.grandTotalsPosition = isNullOrUndefined(dataSource.grandTotalsPosition) ? 'Bottom' : dataSource.grandTotalsPosition;
165
167
  this.showRowGrandTotals = isNullOrUndefined(dataSource.showRowGrandTotals) ? true : dataSource.showRowGrandTotals;
166
168
  this.showColumnGrandTotals = isNullOrUndefined(dataSource.showColumnGrandTotals) ? true : dataSource.showColumnGrandTotals;
167
169
  this.allowValueFilter = dataSource.allowValueFilter;
@@ -275,6 +277,7 @@ var PivotEngine = /** @class */ (function () {
275
277
  this.showRowSubTotals = isNullOrUndefined(dataSource.showRowSubTotals) ? true : dataSource.showRowSubTotals;
276
278
  this.showColumnSubTotals = isNullOrUndefined(dataSource.showColumnSubTotals) ? true : dataSource.showColumnSubTotals;
277
279
  this.showGrandTotals = isNullOrUndefined(dataSource.showGrandTotals) ? true : dataSource.showGrandTotals;
280
+ this.grandTotalsPosition = isNullOrUndefined(dataSource.grandTotalsPosition) ? 'Bottom' : dataSource.grandTotalsPosition;
278
281
  this.showRowGrandTotals = isNullOrUndefined(dataSource.showRowGrandTotals) ? true : dataSource.showRowGrandTotals;
279
282
  this.showColumnGrandTotals = isNullOrUndefined(dataSource.showColumnGrandTotals) ? true : dataSource.showColumnGrandTotals;
280
283
  this.allowValueFilter = dataSource.allowValueFilter;
@@ -577,6 +580,7 @@ var PivotEngine = /** @class */ (function () {
577
580
  }
578
581
  if (!PivotUtil.getFieldByName(groupKeys[gCnt], dataFields)) {
579
582
  groupField = groupFields[groupKeys[gCnt]];
583
+ caption_1 = (caption_1.indexOf(' (') !== -1 && caption_1.indexOf(')') !== -1) ? caption_1.slice(caption_1.indexOf('(') + 1, caption_1.length - 1) : caption_1;
580
584
  var newField = {
581
585
  name: groupKeys[gCnt],
582
586
  caption: (this_1.localeObj ? this_1.localeObj.getConstant(groupField) : groupField) + ' (' + caption_1 + ')',
@@ -604,6 +608,8 @@ var PivotEngine = /** @class */ (function () {
604
608
  }
605
609
  }
606
610
  gCnt = Object.keys(groupKeys).length;
611
+ var field = this_1.getMappingField(fieldName, this_1.clonedReport ? this_1.clonedReport.fieldMapping : this_1.fieldMapping);
612
+ var caption_2 = field.caption ? field.caption : fieldName;
607
613
  while (gCnt--) {
608
614
  groupField = groupFields[groupKeys[gCnt]];
609
615
  for (var i = 0, len_3 = this_1.formats.length; i < len_3; i++) {
@@ -622,6 +628,33 @@ var PivotEngine = /** @class */ (function () {
622
628
  };
623
629
  this_1.formats.push(formatSettings);
624
630
  }
631
+ if (!isDataSource) {
632
+ var mappingField = this_1.getMappingField(groupKeys[gCnt], this_1.fieldMapping);
633
+ if (groupKeys[gCnt] !== fieldName && isNullOrUndefined(mappingField.name)) {
634
+ var newField = {
635
+ name: groupKeys[gCnt],
636
+ caption: (this_1.localeObj ? this_1.localeObj.getConstant(groupField) : groupField) + ' (' + caption_2 + ')'
637
+ };
638
+ this_1.fieldMapping.push(newField);
639
+ }
640
+ else if (groupKeys[gCnt] !== fieldName) {
641
+ mappingField.caption = (this_1.localeObj ? this_1.localeObj.getConstant(groupField) : groupField) + ' (' + caption_2 + ')';
642
+ }
643
+ }
644
+ }
645
+ if (!isDataSource) {
646
+ var mappingField = this_1.getMappingField(fieldName, this_1.fieldMapping);
647
+ groupField = groupFields[fieldName];
648
+ if (groupKeys[gCnt] !== fieldName && isNullOrUndefined(mappingField.name)) {
649
+ var newField = {
650
+ name: fieldName,
651
+ caption: (this_1.localeObj ? this_1.localeObj.getConstant(groupField) : groupField) + ' (' + caption_2 + ')'
652
+ };
653
+ this_1.fieldMapping.push(newField);
654
+ }
655
+ else {
656
+ mappingField.caption = (this_1.localeObj ? this_1.localeObj.getConstant(groupField) : groupField) + ' (' + caption_2 + ')';
657
+ }
625
658
  }
626
659
  }
627
660
  else if (group.type === 'Number' && group.rangeInterval) {
@@ -870,7 +903,7 @@ var PivotEngine = /** @class */ (function () {
870
903
  this.fieldList = this.savedFieldList;
871
904
  while (len--) { /** while is used for better performance than for */
872
905
  var key = keys[len];
873
- var field = this.getMappingField(key);
906
+ var field = this.getMappingField(key, this.fieldMapping);
874
907
  if (this.fieldList[key]) {
875
908
  this.fieldList[key].isSelected = false;
876
909
  this.fieldList[key].index = len;
@@ -949,7 +982,7 @@ var PivotEngine = /** @class */ (function () {
949
982
  this.fieldList = {};
950
983
  while (len--) { /** while is used for better performance than for */
951
984
  var key = keys[len];
952
- var field = this.getMappingField(key);
985
+ var field = this.getMappingField(key, this.fieldMapping);
953
986
  type = (field && 'dataType' in field && field.dataType && dataTypes.indexOf(field.dataType.toLowerCase()) > -1) ?
954
987
  field.dataType.toLowerCase() : PivotUtil.getType(fields[this.fieldKeys[key]]);
955
988
  this.fieldList[key] = {
@@ -993,12 +1026,12 @@ var PivotEngine = /** @class */ (function () {
993
1026
  }
994
1027
  this.updateTreeViewData(dataFields);
995
1028
  };
996
- PivotEngine.prototype.getMappingField = function (key) {
1029
+ PivotEngine.prototype.getMappingField = function (key, fieldMapping) {
997
1030
  var field = {};
998
- if (this.fieldMapping.length > 0) {
999
- for (var index = 0, cnt = this.fieldMapping.length; index < cnt; index++) {
1000
- if (this.fieldMapping[index].name === key) {
1001
- field = this.fieldMapping[index];
1031
+ if (fieldMapping.length > 0) {
1032
+ for (var index = 0, cnt = fieldMapping.length; index < cnt; index++) {
1033
+ if (fieldMapping[index].name === key) {
1034
+ field = fieldMapping[index];
1002
1035
  break;
1003
1036
  }
1004
1037
  }
@@ -1572,8 +1605,8 @@ var PivotEngine = /** @class */ (function () {
1572
1605
  field.filter = filter;
1573
1606
  field.filterType = type;
1574
1607
  field.isExcelFilter = isLabelFilter;
1575
- var members = (this.formatFields[name] &&
1576
- (['date', 'dateTime', 'time'].indexOf(this.formatFields[name].type) > -1)) ?
1608
+ var members = ((this.formatFields[name] &&
1609
+ (['date', 'dateTime', 'time'].indexOf(this.formatFields[name].type) > -1)) || (name in this.groupingFields)) ?
1577
1610
  field.formattedMembers : field.members;
1578
1611
  var allowFil = isInclude;
1579
1612
  var final = {};
@@ -1620,7 +1653,7 @@ var PivotEngine = /** @class */ (function () {
1620
1653
  };
1621
1654
  PivotEngine.prototype.applyValueFiltering = function (rowData, level, rows, columns, valueFilter, rowFilterData, type) {
1622
1655
  this.isValueFiltered = false;
1623
- var allMember = extend({}, (type === 'row' && this.rowGrandTotal ? this.rowGrandTotal : type === 'column' && this.columnGrandTotal ? this.columnGrandTotal : rows[rows.length - 1]), null, true);
1656
+ var allMember = extend({}, (type === 'row' && this.rowGrandTotal ? this.rowGrandTotal : type === 'column' && this.columnGrandTotal ? this.columnGrandTotal : (!(this.grandTotalsPosition === 'Top') ? rows[rows.length - 1] : rows[0])), null, true);
1624
1657
  this.getFilteredData(rows, columns, valueFilter, rowFilterData, level, rowData.name, allMember, type);
1625
1658
  if (this.isValueFiltered) {
1626
1659
  if ((type === 'row' && this.rowGrandTotal === null) || (type === 'column' && this.columnGrandTotal === null)) {
@@ -1967,14 +2000,14 @@ var PivotEngine = /** @class */ (function () {
1967
2000
  for (var i = 0; i < rLen; i++) {
1968
2001
  if (filterElement.name === rows[i].name && valueFields[filterElement.measure] && !isAvail) {
1969
2002
  isAvail = true;
1970
- rowFilteredData = this.applyValueFiltering(rows[i], i, rowHeaders, (this.columnGrandTotal ? this.columnGrandTotal : columnHeaders[columnHeaders.length - 1]), valueFilters, this.valueFilteredData, 'row');
2003
+ rowFilteredData = this.applyValueFiltering(rows[i], i, rowHeaders, (this.columnGrandTotal ? this.columnGrandTotal : (this.grandTotalsPosition === 'Top' && this.showGrandTotals) ? columnHeaders[0] : columnHeaders[columnHeaders.length - 1]), valueFilters, this.valueFilteredData, 'row');
1971
2004
  break;
1972
2005
  }
1973
2006
  }
1974
2007
  for (var j = 0; j < cLen; j++) {
1975
2008
  if (filterElement.name === columns[j].name && valueFields[filterElement.measure] && !isAvail) {
1976
2009
  isAvail = true;
1977
- columnFilteredData = this.applyValueFiltering(columns[j], j, columnHeaders, (this.rowGrandTotal ? this.rowGrandTotal : rowHeaders[rowHeaders.length - 1]), valueFilters, this.valueFilteredData, 'column');
2010
+ columnFilteredData = this.applyValueFiltering(columns[j], j, columnHeaders, (this.rowGrandTotal ? this.rowGrandTotal : (this.grandTotalsPosition === 'Top' && this.showGrandTotals) ? rowHeaders[0] : rowHeaders[rowHeaders.length - 1]), valueFilters, this.valueFilteredData, 'column');
1978
2011
  break;
1979
2012
  }
1980
2013
  }
@@ -2286,7 +2319,7 @@ var PivotEngine = /** @class */ (function () {
2286
2319
  }
2287
2320
  var engine = this;
2288
2321
  return headers.filter(function (item) {
2289
- return item.members.length > 0 ? item.members.length > 0 : engine.matchIndexes(item.indexObject, filterObjects);
2322
+ return (item.members.length > 0 || item.type === 'grand sum') ? true : engine.matchIndexes(item.indexObject, filterObjects);
2290
2323
  });
2291
2324
  };
2292
2325
  PivotEngine.prototype.matchIndexes = function (index, filterObjects) {
@@ -2366,6 +2399,14 @@ var PivotEngine = /** @class */ (function () {
2366
2399
  }
2367
2400
  /* eslint-enable */
2368
2401
  rawHeaders = this.getSortedHeaders(rawHeaders.concat(excessHeaders), this.fieldList[headersInfo.fields[0].name].sort).concat(grandHeader);
2402
+ if (headersInfo.axis === 'row') {
2403
+ this.cMembers = this.getIndexedHeaders(this.columns, this.data, 0, this.filterMembers, 'column', '');
2404
+ this.insertAllMember(this.cMembers, this.filterMembers, '', 'column');
2405
+ }
2406
+ else {
2407
+ this.rMembers = this.getIndexedHeaders(this.rows, this.data, 0, this.filterMembers, 'row', '');
2408
+ this.insertAllMember(this.rMembers, this.filterMembers, '', 'row');
2409
+ }
2369
2410
  }
2370
2411
  if (headersInfo.axis === 'row') {
2371
2412
  this.rowCount = 0;
@@ -2512,8 +2553,8 @@ var PivotEngine = /** @class */ (function () {
2512
2553
  }
2513
2554
  }
2514
2555
  if (stringValue.length > 0) {
2515
- stringValue = childrens.sort === 'Ascending' ? (stringValue.sort(function (a, b) { return (a.actualText > b.actualText) ? 1 : ((b.actualText > a.actualText) ? -1 : 0); })) :
2516
- childrens.sort === 'Descending' ? (stringValue.sort(function (a, b) { return (a.actualText < b.actualText) ? 1 : ((b.actualText < a.actualText) ? -1 : 0); })) : stringValue;
2556
+ stringValue = childrens.sort === 'Ascending' ? (stringValue.sort(function (a, b) { return (a.actualText === 'Grand Total' || b.actualText === 'Grand Total') ? 0 : ((a.actualText > b.actualText) ? 1 : ((b.actualText > a.actualText) ? -1 : 0)); })) :
2557
+ childrens.sort === 'Descending' ? (stringValue.sort(function (a, b) { return (a.actualText === 'Grand Total' || b.actualText === 'Grand Total') ? 0 : ((a.actualText < b.actualText) ? 1 : ((b.actualText < a.actualText) ? -1 : 0)); })) : stringValue;
2517
2558
  }
2518
2559
  if (alphaNumbervalue.length > 0) {
2519
2560
  alphaNumbervalue = childrens.sort === 'Ascending' ?
@@ -2526,9 +2567,9 @@ var PivotEngine = /** @class */ (function () {
2526
2567
  }
2527
2568
  else {
2528
2569
  return sortOrder === 'Ascending' ?
2529
- (headers.sort(function (a, b) { return (a.actualText > b.actualText) ? 1 : ((b.actualText > a.actualText) ? -1 : 0); })) :
2570
+ (headers.sort(function (a, b) { return (a.actualText === 'Grand Total' || b.actualText === 'Grand Total') ? 0 : ((a.actualText > b.actualText) ? 1 : ((b.actualText > a.actualText) ? -1 : 0)); })) :
2530
2571
  sortOrder === 'Descending' ?
2531
- (headers.sort(function (a, b) { return (a.actualText < b.actualText) ? 1 : ((b.actualText < a.actualText) ? -1 : 0); })) :
2572
+ (headers.sort(function (a, b) { return (a.actualText === 'Grand Total' || b.actualText === 'Grand Total') ? 0 : ((a.actualText < b.actualText) ? 1 : ((b.actualText < a.actualText) ? -1 : 0)); })) :
2532
2573
  headers;
2533
2574
  }
2534
2575
  }
@@ -2548,7 +2589,8 @@ var PivotEngine = /** @class */ (function () {
2548
2589
  this.valueSortHeaderText = undefined;
2549
2590
  if (this.enableValueSorting && this.valueSortSettings.headerText && !this.valueSortHeaderText &&
2550
2591
  this.valueSortSettings.headerText !== '' && this.values.length > 0) {
2551
- var textArray = this.valueSortSettings.headerText.split(this.valueSortSettings.headerDelimiter);
2592
+ this.valueSortHeaderText = this.valueSortSettings.headerText;
2593
+ var textArray = this.valueSortHeaderText.split(this.valueSortSettings.headerDelimiter);
2552
2594
  for (var _i = 0, _a = this.values; _i < _a.length; _i++) {
2553
2595
  var field = _a[_i];
2554
2596
  var name_1 = field.caption ? field.caption : field.name;
@@ -3197,6 +3239,7 @@ var PivotEngine = /** @class */ (function () {
3197
3239
  var summCell = headers[headers.length - 1];
3198
3240
  if (summCell && summCell.type === 'grand sum') {
3199
3241
  summCell.index = this.filterMembers;
3242
+ summCell.indexObject = {};
3200
3243
  /* eslint-disable */
3201
3244
  var lt = void 0;
3202
3245
  for (var ln = 0, lt_1 = this.filterMembers.length; ln < lt_1; ln++) {
@@ -3339,7 +3382,7 @@ var PivotEngine = /** @class */ (function () {
3339
3382
  PivotEngine.prototype.insertAllMember = function (set, filter, customText, axis) {
3340
3383
  var len = set.length;
3341
3384
  customText = ' Total';
3342
- set[len] = {
3385
+ var grandTotalSet = {
3343
3386
  hasChild: false,
3344
3387
  index: filter,
3345
3388
  level: 0,
@@ -3353,13 +3396,14 @@ var PivotEngine = /** @class */ (function () {
3353
3396
  type: 'grand sum',
3354
3397
  valueSort: {}
3355
3398
  };
3356
- set[len].valueSort[set[len].formattedText] = 1;
3357
- set[len].valueSort.levelName = set[len].formattedText;
3358
- set[len].valueSort[set[len].actualText] = 1;
3359
- set[len].valueSort.uniqueName = set[len].actualText;
3399
+ grandTotalSet.valueSort[grandTotalSet.formattedText] = 1;
3400
+ grandTotalSet.valueSort.levelName = grandTotalSet.formattedText;
3401
+ grandTotalSet.valueSort[grandTotalSet.actualText] = 1;
3402
+ grandTotalSet.valueSort.uniqueName = grandTotalSet.actualText;
3360
3403
  for (var ln = 0, lt = filter.length; ln < lt; ln++) {
3361
- set[len].indexObject[filter[ln]] = filter[ln];
3404
+ grandTotalSet.indexObject[filter[ln]] = filter[ln];
3362
3405
  }
3406
+ (this.dataSourceSettings.grandTotalsPosition === 'Top' && this.dataSourceSettings.showGrandTotals) ? set.unshift(grandTotalSet) : set.push(grandTotalSet);
3363
3407
  // if (axis === 'row') {
3364
3408
  // this.rowCount += this.rowValuesLength;
3365
3409
  // } else {
@@ -3378,10 +3422,11 @@ var PivotEngine = /** @class */ (function () {
3378
3422
  row.colIndex = 0;
3379
3423
  row.rowIndex = tnum;
3380
3424
  var isRowFieldsAvail = false;
3425
+ var delimiter = this.dataSourceSettings.valueSortSettings.headerDelimiter;
3381
3426
  if (this.valueAxis && this.dataSourceSettings.rows.length === 0 && this.dataSourceSettings.values.length > 1) {
3382
3427
  this.rowIndex = (isNullOrUndefined(this.rowIndex) && !isLeastNode && this.dataSourceSettings.rows.length === 0) ? row.index : this.rowIndex;
3383
- isRowFieldsAvail = (this.valueAxis && this.dataSourceSettings.rows.length === 0 && row.valueSort.levelName.toString().indexOf('Grand Total.') !== 0);
3384
- if (this.valueAxis && this.dataSourceSettings.rows.length === 0 && row.valueSort.levelName.toString().indexOf('Grand Total.') === 0) {
3428
+ isRowFieldsAvail = (this.valueAxis && this.dataSourceSettings.rows.length === 0 && row.valueSort.levelName && row.valueSort.levelName.toString().indexOf('Grand Total' + delimiter) !== 0);
3429
+ if (this.valueAxis && this.dataSourceSettings.rows.length === 0 && row.valueSort.levelName.toString().indexOf('Grand Total' + delimiter) === 0) {
3385
3430
  row.index = this.rowIndex;
3386
3431
  }
3387
3432
  }
@@ -3406,7 +3451,7 @@ var PivotEngine = /** @class */ (function () {
3406
3451
  for (var cln = 0, dln = 1, clt = columns.length; cln < clt; ++cln) {
3407
3452
  if (!isValueIndexFound) {
3408
3453
  for (vln = 0; vln < vlt; vln++) {
3409
- if (row.valueSort.uniqueName && row.valueSort.uniqueName.toString().split(this.valueSortSettings.headerDelimiter).indexOf(this.values[vln].name) > -1) {
3454
+ if (row.valueSort.uniqueName && row.valueSort.uniqueName.toString().indexOf(this.values[vln].name) > -1) {
3410
3455
  isValueIndexFound = true;
3411
3456
  isValueCellUpdated = true;
3412
3457
  break;
@@ -3441,7 +3486,7 @@ var PivotEngine = /** @class */ (function () {
3441
3486
  for (var cln = 0, dln = 1, clt = columns.length; cln < clt; ++cln) {
3442
3487
  for (var vln = 0; vln < vlt; vln++) {
3443
3488
  if (!this.valueAxis && !this.isLastHeaderHasMeasures) {
3444
- if (columns[cln].valueSort.uniqueName && columns[cln].valueSort.uniqueName.toString().split(this.valueSortSettings.headerDelimiter).indexOf(this.values[vln].name) > -1) {
3489
+ if (columns[cln].valueSort.uniqueName && columns[cln].valueSort.uniqueName.toString().indexOf(this.values[vln].name) > -1) {
3445
3490
  this.updateRowData(rows, columns, tnum, data, vln, rln, cln, dln, actCnt, rTotal, cTotal);
3446
3491
  dln = data[tnum].length;
3447
3492
  }
@@ -4398,6 +4443,10 @@ var PivotEngine = /** @class */ (function () {
4398
4443
  this.updateValueMembers(this.measureIndex === 0 && axis.length > 1, null, null, columnHeaders, axis.slice(0, axis.length - 1), vcnt, 0);
4399
4444
  this.updateValueMembers(false, null, null, columnHeaders, axis.slice(axis.length - 1, axis.length), vcnt, -1);
4400
4445
  }
4446
+ else if (this.grandTotalsPosition === 'Top' && this.showGrandTotals && this.measureIndex === 0) {
4447
+ this.updateValueMembers(false, null, null, columnHeaders, axis.slice(0, 1), vcnt, -1);
4448
+ this.updateValueMembers(this.measureIndex === 0 && axis.length > 1, null, null, columnHeaders, axis.slice(1, axis.length), vcnt, 0);
4449
+ }
4401
4450
  else {
4402
4451
  var hasColumnTotal = columns.length === 0 && axis.length === 1 && axis[0].type == 'grand sum';
4403
4452
  this.updateValueMembers(!hasColumnTotal && this.measureIndex === 0, null, null, columnHeaders, axis, vcnt, hasColumnTotal ? -1 : 0);
@@ -4438,6 +4487,10 @@ var PivotEngine = /** @class */ (function () {
4438
4487
  this.updateValueMembers(this.measureIndex == 0 && this.rMembers.length > 1, null, null, rowAxis, this.rMembers.slice(0, this.rMembers.length - 1), this.values.length, 0);
4439
4488
  this.updateValueMembers(false, null, null, rowAxis, this.rMembers.slice(this.rMembers.length - 1, this.rMembers.length), this.values.length, -1);
4440
4489
  }
4490
+ else if (this.grandTotalsPosition === 'Top' && this.showGrandTotals && this.measureIndex === 0) {
4491
+ this.updateValueMembers(false, null, null, rowAxis, this.rMembers.slice(0, 1), this.values.length, -1);
4492
+ this.updateValueMembers(this.measureIndex == 0 && this.rMembers.length > 1, null, null, rowAxis, this.rMembers.slice(1, this.rMembers.length), this.values.length, 0);
4493
+ }
4441
4494
  else {
4442
4495
  var hasRowTotal = rows.length === 0 && this.rMembers.length === 1 && this.rMembers[0].type == 'grand sum';
4443
4496
  this.updateValueMembers(!hasRowTotal && this.measureIndex == 0, null, null, rowAxis, this.rMembers, this.values.length, hasRowTotal ? -1 : 0);
@@ -0,0 +1,17 @@
1
+ import { IPivotValues } from './engine';
2
+ /**
3
+ * This is a file to perform common utility for OLAP and Relational datasource
4
+ * @hidden
5
+ */
6
+ export declare class PivotExportUtil {
7
+ private static getDefinedObj;
8
+ static getClonedPivotValues(pivotValues: IPivotValues): IPivotValues;
9
+ private static getClonedPivotValueObj;
10
+ static isContainCommonElements(collection1: Object[], collection2: Object[]): boolean;
11
+ static formatPdfHeaderFooter(pdf: any): any;
12
+ static formatPdfExportProperties(pdf: any): any;
13
+ static formatExcelStyle(style: any): any;
14
+ static formatExcelCell(cell: any): any;
15
+ static formatExcelHeaderFooter(excel: any): any;
16
+ static formatExcelExportProperties(excel: any): any;
17
+ }