@syncfusion/ej2-pivotview 19.3.48 → 19.4.38

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 (136) 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 +29 -19
  4. package/dist/ej2-pivotview.umd.min.js +2 -2
  5. package/dist/ej2-pivotview.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-pivotview.es2015.js +2080 -1110
  7. package/dist/es6/ej2-pivotview.es2015.js.map +1 -1
  8. package/dist/es6/ej2-pivotview.es5.js +2096 -1120
  9. package/dist/es6/ej2-pivotview.es5.js.map +1 -1
  10. package/dist/global/ej2-pivotview.min.js +2 -2
  11. package/dist/global/ej2-pivotview.min.js.map +1 -1
  12. package/dist/global/index.d.ts +1 -1
  13. package/package.json +22 -22
  14. package/src/base/engine.d.ts +17 -1
  15. package/src/base/engine.js +74 -29
  16. package/src/base/export-util.d.ts +17 -0
  17. package/src/base/export-util.js +245 -0
  18. package/src/base/olap/engine.d.ts +7 -0
  19. package/src/base/olap/engine.js +138 -35
  20. package/src/base/util.d.ts +0 -9
  21. package/src/base/util.js +2 -215
  22. package/src/common/actions/field-list.js +1 -1
  23. package/src/common/actions/pivot-button.d.ts +5 -8
  24. package/src/common/actions/pivot-button.js +187 -171
  25. package/src/common/base/constant.d.ts +186 -0
  26. package/src/common/base/constant.js +186 -0
  27. package/src/common/base/css-constant.d.ts +2 -0
  28. package/src/common/base/css-constant.js +2 -0
  29. package/src/common/base/enum.d.ts +11 -0
  30. package/src/common/base/interface.d.ts +272 -2
  31. package/src/common/calculatedfield/calculated-field.js +108 -93
  32. package/src/common/conditionalformatting/conditional-formatting.js +8 -2
  33. package/src/common/grouping-bar/grouping-bar.js +1 -1
  34. package/src/common/popups/aggregate-menu.js +57 -35
  35. package/src/common/popups/drillthrough-dialog.js +187 -139
  36. package/src/common/popups/filter-dialog.d.ts +1 -0
  37. package/src/common/popups/filter-dialog.js +22 -1
  38. package/src/common/popups/formatting-dialog.js +4 -0
  39. package/src/common/popups/grouping.js +2 -1
  40. package/src/common/popups/toolbar.js +305 -203
  41. package/src/pivotchart/base/pivotchart.js +36 -15
  42. package/src/pivotfieldlist/base/field-list-model.d.ts +49 -1
  43. package/src/pivotfieldlist/base/field-list.d.ts +55 -1
  44. package/src/pivotfieldlist/base/field-list.js +68 -1
  45. package/src/pivotfieldlist/renderer/dialog-renderer.js +38 -15
  46. package/src/pivotfieldlist/renderer/tree-renderer.js +35 -22
  47. package/src/pivotview/actions/drill-through.js +1 -1
  48. package/src/pivotview/actions/excel-export.js +9 -7
  49. package/src/pivotview/actions/pdf-export.js +3 -3
  50. package/src/pivotview/base/pivotview-model.d.ts +46 -1
  51. package/src/pivotview/base/pivotview.d.ts +56 -2
  52. package/src/pivotview/base/pivotview.js +313 -109
  53. package/src/pivotview/model/chartsettings-model.d.ts +1 -1
  54. package/src/pivotview/model/chartsettings.d.ts +1 -1
  55. package/src/pivotview/model/chartsettings.js +1 -1
  56. package/src/pivotview/model/datasourcesettings-model.d.ts +8 -1
  57. package/src/pivotview/model/datasourcesettings.d.ts +7 -0
  58. package/src/pivotview/model/datasourcesettings.js +3 -0
  59. package/src/pivotview/renderer/render.d.ts +2 -1
  60. package/src/pivotview/renderer/render.js +64 -20
  61. package/styles/bootstrap-dark.css +115 -104
  62. package/styles/bootstrap.css +115 -104
  63. package/styles/bootstrap4.css +114 -81
  64. package/styles/bootstrap5-dark.css +220 -168
  65. package/styles/bootstrap5.css +215 -161
  66. package/styles/fabric-dark.css +117 -103
  67. package/styles/fabric.css +115 -102
  68. package/styles/highcontrast-light.css +116 -102
  69. package/styles/highcontrast.css +118 -104
  70. package/styles/material-dark.css +108 -97
  71. package/styles/material.css +108 -97
  72. package/styles/pivotfieldlist/_bootstrap-dark-definition.scss +1 -4
  73. package/styles/pivotfieldlist/_bootstrap-definition.scss +1 -4
  74. package/styles/pivotfieldlist/_bootstrap4-definition.scss +1 -4
  75. package/styles/pivotfieldlist/_bootstrap5-definition.scss +8 -11
  76. package/styles/pivotfieldlist/_fabric-dark-definition.scss +1 -4
  77. package/styles/pivotfieldlist/_fabric-definition.scss +1 -4
  78. package/styles/pivotfieldlist/_fluent-definition.scss +177 -0
  79. package/styles/pivotfieldlist/_highcontrast-definition.scss +1 -4
  80. package/styles/pivotfieldlist/_highcontrast-light-definition.scss +1 -4
  81. package/styles/pivotfieldlist/_layout.scss +199 -109
  82. package/styles/pivotfieldlist/_material-dark-definition.scss +1 -4
  83. package/styles/pivotfieldlist/_material-definition.scss +1 -4
  84. package/styles/pivotfieldlist/_tailwind-definition.scss +6 -9
  85. package/styles/pivotfieldlist/_theme.scss +185 -35
  86. package/styles/pivotfieldlist/bootstrap-dark.css +49 -58
  87. package/styles/pivotfieldlist/bootstrap.css +49 -58
  88. package/styles/pivotfieldlist/bootstrap4.css +44 -39
  89. package/styles/pivotfieldlist/bootstrap5-dark.css +115 -89
  90. package/styles/pivotfieldlist/bootstrap5.css +115 -89
  91. package/styles/pivotfieldlist/fabric-dark.css +49 -58
  92. package/styles/pivotfieldlist/fabric.css +49 -58
  93. package/styles/pivotfieldlist/highcontrast-light.css +49 -58
  94. package/styles/pivotfieldlist/highcontrast.css +49 -58
  95. package/styles/pivotfieldlist/icons/_bootstrap5.scss +2 -2
  96. package/styles/pivotfieldlist/icons/_fluent.scss +352 -0
  97. package/styles/pivotfieldlist/icons/_tailwind.scss +2 -2
  98. package/styles/pivotfieldlist/material-dark.css +44 -53
  99. package/styles/pivotfieldlist/material.css +44 -53
  100. package/styles/pivotfieldlist/tailwind-dark.css +138 -81
  101. package/styles/pivotfieldlist/tailwind.css +140 -83
  102. package/styles/pivotview/_bootstrap-dark-definition.scss +9 -6
  103. package/styles/pivotview/_bootstrap-definition.scss +9 -6
  104. package/styles/pivotview/_bootstrap4-definition.scss +10 -7
  105. package/styles/pivotview/_bootstrap5-definition.scss +12 -9
  106. package/styles/pivotview/_fabric-dark-definition.scss +8 -5
  107. package/styles/pivotview/_fabric-definition.scss +7 -4
  108. package/styles/pivotview/_fluent-definition.scss +126 -0
  109. package/styles/pivotview/_highcontrast-definition.scss +8 -5
  110. package/styles/pivotview/_highcontrast-light-definition.scss +7 -4
  111. package/styles/pivotview/_layout.scss +119 -64
  112. package/styles/pivotview/_material-dark-definition.scss +7 -4
  113. package/styles/pivotview/_material-definition.scss +8 -4
  114. package/styles/pivotview/_tailwind-definition.scss +8 -5
  115. package/styles/pivotview/_theme.scss +124 -70
  116. package/styles/pivotview/bootstrap-dark.css +66 -46
  117. package/styles/pivotview/bootstrap.css +66 -46
  118. package/styles/pivotview/bootstrap4.css +70 -42
  119. package/styles/pivotview/bootstrap5-dark.css +99 -73
  120. package/styles/pivotview/bootstrap5-dark.scss +0 -1
  121. package/styles/pivotview/bootstrap5.css +100 -72
  122. package/styles/pivotview/fabric-dark.css +68 -45
  123. package/styles/pivotview/fabric.css +66 -44
  124. package/styles/pivotview/highcontrast-light.css +67 -44
  125. package/styles/pivotview/highcontrast.css +69 -46
  126. package/styles/pivotview/icons/_bootstrap4.scss +1 -1
  127. package/styles/pivotview/icons/_bootstrap5.scss +1 -1
  128. package/styles/pivotview/icons/_fluent.scss +183 -0
  129. package/styles/pivotview/icons/_tailwind.scss +1 -1
  130. package/styles/pivotview/material-dark.css +64 -44
  131. package/styles/pivotview/material.css +64 -44
  132. package/styles/pivotview/tailwind-dark.css +106 -58
  133. package/styles/pivotview/tailwind-dark.scss +0 -1
  134. package/styles/pivotview/tailwind.css +107 -57
  135. package/styles/tailwind-dark.css +250 -145
  136. package/styles/tailwind.css +247 -140
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 19.3.48
3
+ * version : 19.4.38
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.47",
3
+ "_id": "@syncfusion/ej2-pivotview@18.25.2",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-QQ2EsAps5ihvb8r/LnIRKagB9bxlvStzANMQxaAHNmagCyivhZCuVRckVi6dJTosc5SOSraGgdhiONORu9uFag==",
5
+ "_integrity": "sha512-1Ji0/7L8nd8Q+wqGe37tPt3HnC0LfASDwqfZeXU/ooY65c4fZS3W4k5qlRX4/VPQiVZM+eG4ED55DHq2WXFngw==",
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.47.tgz",
27
- "_shasum": "2c273275b3fbd7410fc90f7ac1df1729501e927f",
26
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-pivotview/-/ej2-pivotview-18.25.2.tgz",
27
+ "_shasum": "615a4e05a02dc4aa92fa9307f0fa174688ffff56",
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.47",
39
- "@syncfusion/ej2-buttons": "~19.3.44",
40
- "@syncfusion/ej2-calendars": "~19.3.46",
41
- "@syncfusion/ej2-charts": "~19.3.48",
42
- "@syncfusion/ej2-compression": "~19.3.43",
43
- "@syncfusion/ej2-data": "~19.3.47",
44
- "@syncfusion/ej2-dropdowns": "~19.3.48",
45
- "@syncfusion/ej2-excel-export": "~19.3.48",
46
- "@syncfusion/ej2-file-utils": "~19.3.43",
47
- "@syncfusion/ej2-grids": "~19.3.48",
48
- "@syncfusion/ej2-inputs": "~19.3.48",
49
- "@syncfusion/ej2-lists": "~19.3.48",
50
- "@syncfusion/ej2-navigations": "~19.3.46",
51
- "@syncfusion/ej2-pdf-export": "~19.3.43",
52
- "@syncfusion/ej2-popups": "~19.3.47",
53
- "@syncfusion/ej2-splitbuttons": "~19.3.48",
54
- "@syncfusion/ej2-svg-base": "~19.3.45"
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.38",
42
+ "@syncfusion/ej2-compression": "~19.4.38",
43
+ "@syncfusion/ej2-data": "~19.4.38",
44
+ "@syncfusion/ej2-dropdowns": "~19.4.38",
45
+ "@syncfusion/ej2-excel-export": "~19.4.38",
46
+ "@syncfusion/ej2-file-utils": "~19.4.38",
47
+ "@syncfusion/ej2-grids": "~19.4.38",
48
+ "@syncfusion/ej2-inputs": "~19.4.38",
49
+ "@syncfusion/ej2-lists": "~19.4.38",
50
+ "@syncfusion/ej2-navigations": "~19.4.38",
51
+ "@syncfusion/ej2-pdf-export": "~19.4.38",
52
+ "@syncfusion/ej2-popups": "~19.4.38",
53
+ "@syncfusion/ej2-splitbuttons": "~19.4.38",
54
+ "@syncfusion/ej2-svg-base": "~19.4.38"
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.48",
81
+ "version": "19.4.38",
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) {
@@ -2512,8 +2545,8 @@ var PivotEngine = /** @class */ (function () {
2512
2545
  }
2513
2546
  }
2514
2547
  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;
2548
+ 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)); })) :
2549
+ 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
2550
  }
2518
2551
  if (alphaNumbervalue.length > 0) {
2519
2552
  alphaNumbervalue = childrens.sort === 'Ascending' ?
@@ -2526,9 +2559,9 @@ var PivotEngine = /** @class */ (function () {
2526
2559
  }
2527
2560
  else {
2528
2561
  return sortOrder === 'Ascending' ?
2529
- (headers.sort(function (a, b) { return (a.actualText > b.actualText) ? 1 : ((b.actualText > a.actualText) ? -1 : 0); })) :
2562
+ (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
2563
  sortOrder === 'Descending' ?
2531
- (headers.sort(function (a, b) { return (a.actualText < b.actualText) ? 1 : ((b.actualText < a.actualText) ? -1 : 0); })) :
2564
+ (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
2565
  headers;
2533
2566
  }
2534
2567
  }
@@ -2548,7 +2581,8 @@ var PivotEngine = /** @class */ (function () {
2548
2581
  this.valueSortHeaderText = undefined;
2549
2582
  if (this.enableValueSorting && this.valueSortSettings.headerText && !this.valueSortHeaderText &&
2550
2583
  this.valueSortSettings.headerText !== '' && this.values.length > 0) {
2551
- var textArray = this.valueSortSettings.headerText.split(this.valueSortSettings.headerDelimiter);
2584
+ this.valueSortHeaderText = this.valueSortSettings.headerText;
2585
+ var textArray = this.valueSortHeaderText.split(this.valueSortSettings.headerDelimiter);
2552
2586
  for (var _i = 0, _a = this.values; _i < _a.length; _i++) {
2553
2587
  var field = _a[_i];
2554
2588
  var name_1 = field.caption ? field.caption : field.name;
@@ -3197,6 +3231,7 @@ var PivotEngine = /** @class */ (function () {
3197
3231
  var summCell = headers[headers.length - 1];
3198
3232
  if (summCell && summCell.type === 'grand sum') {
3199
3233
  summCell.index = this.filterMembers;
3234
+ summCell.indexObject = {};
3200
3235
  /* eslint-disable */
3201
3236
  var lt = void 0;
3202
3237
  for (var ln = 0, lt_1 = this.filterMembers.length; ln < lt_1; ln++) {
@@ -3339,7 +3374,7 @@ var PivotEngine = /** @class */ (function () {
3339
3374
  PivotEngine.prototype.insertAllMember = function (set, filter, customText, axis) {
3340
3375
  var len = set.length;
3341
3376
  customText = ' Total';
3342
- set[len] = {
3377
+ var grandTotalSet = {
3343
3378
  hasChild: false,
3344
3379
  index: filter,
3345
3380
  level: 0,
@@ -3353,13 +3388,14 @@ var PivotEngine = /** @class */ (function () {
3353
3388
  type: 'grand sum',
3354
3389
  valueSort: {}
3355
3390
  };
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;
3391
+ grandTotalSet.valueSort[grandTotalSet.formattedText] = 1;
3392
+ grandTotalSet.valueSort.levelName = grandTotalSet.formattedText;
3393
+ grandTotalSet.valueSort[grandTotalSet.actualText] = 1;
3394
+ grandTotalSet.valueSort.uniqueName = grandTotalSet.actualText;
3360
3395
  for (var ln = 0, lt = filter.length; ln < lt; ln++) {
3361
- set[len].indexObject[filter[ln]] = filter[ln];
3396
+ grandTotalSet.indexObject[filter[ln]] = filter[ln];
3362
3397
  }
3398
+ (this.dataSourceSettings.grandTotalsPosition === 'Top' && this.dataSourceSettings.showGrandTotals) ? set.unshift(grandTotalSet) : set.push(grandTotalSet);
3363
3399
  // if (axis === 'row') {
3364
3400
  // this.rowCount += this.rowValuesLength;
3365
3401
  // } else {
@@ -3378,10 +3414,11 @@ var PivotEngine = /** @class */ (function () {
3378
3414
  row.colIndex = 0;
3379
3415
  row.rowIndex = tnum;
3380
3416
  var isRowFieldsAvail = false;
3417
+ var delimiter = this.dataSourceSettings.valueSortSettings.headerDelimiter;
3381
3418
  if (this.valueAxis && this.dataSourceSettings.rows.length === 0 && this.dataSourceSettings.values.length > 1) {
3382
3419
  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) {
3420
+ isRowFieldsAvail = (this.valueAxis && this.dataSourceSettings.rows.length === 0 && row.valueSort.levelName && row.valueSort.levelName.toString().indexOf('Grand Total' + delimiter) !== 0);
3421
+ if (this.valueAxis && this.dataSourceSettings.rows.length === 0 && row.valueSort.levelName.toString().indexOf('Grand Total' + delimiter) === 0) {
3385
3422
  row.index = this.rowIndex;
3386
3423
  }
3387
3424
  }
@@ -3406,7 +3443,7 @@ var PivotEngine = /** @class */ (function () {
3406
3443
  for (var cln = 0, dln = 1, clt = columns.length; cln < clt; ++cln) {
3407
3444
  if (!isValueIndexFound) {
3408
3445
  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) {
3446
+ if (row.valueSort.uniqueName && row.valueSort.uniqueName.toString().indexOf(this.values[vln].name) > -1) {
3410
3447
  isValueIndexFound = true;
3411
3448
  isValueCellUpdated = true;
3412
3449
  break;
@@ -3441,7 +3478,7 @@ var PivotEngine = /** @class */ (function () {
3441
3478
  for (var cln = 0, dln = 1, clt = columns.length; cln < clt; ++cln) {
3442
3479
  for (var vln = 0; vln < vlt; vln++) {
3443
3480
  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) {
3481
+ if (columns[cln].valueSort.uniqueName && columns[cln].valueSort.uniqueName.toString().indexOf(this.values[vln].name) > -1) {
3445
3482
  this.updateRowData(rows, columns, tnum, data, vln, rln, cln, dln, actCnt, rTotal, cTotal);
3446
3483
  dln = data[tnum].length;
3447
3484
  }
@@ -4398,6 +4435,10 @@ var PivotEngine = /** @class */ (function () {
4398
4435
  this.updateValueMembers(this.measureIndex === 0 && axis.length > 1, null, null, columnHeaders, axis.slice(0, axis.length - 1), vcnt, 0);
4399
4436
  this.updateValueMembers(false, null, null, columnHeaders, axis.slice(axis.length - 1, axis.length), vcnt, -1);
4400
4437
  }
4438
+ else if (this.grandTotalsPosition === 'Top' && this.showGrandTotals && this.measureIndex === 0) {
4439
+ this.updateValueMembers(false, null, null, columnHeaders, axis.slice(0, 1), vcnt, -1);
4440
+ this.updateValueMembers(this.measureIndex === 0 && axis.length > 1, null, null, columnHeaders, axis.slice(1, axis.length), vcnt, 0);
4441
+ }
4401
4442
  else {
4402
4443
  var hasColumnTotal = columns.length === 0 && axis.length === 1 && axis[0].type == 'grand sum';
4403
4444
  this.updateValueMembers(!hasColumnTotal && this.measureIndex === 0, null, null, columnHeaders, axis, vcnt, hasColumnTotal ? -1 : 0);
@@ -4438,6 +4479,10 @@ var PivotEngine = /** @class */ (function () {
4438
4479
  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
4480
  this.updateValueMembers(false, null, null, rowAxis, this.rMembers.slice(this.rMembers.length - 1, this.rMembers.length), this.values.length, -1);
4440
4481
  }
4482
+ else if (this.grandTotalsPosition === 'Top' && this.showGrandTotals && this.measureIndex === 0) {
4483
+ this.updateValueMembers(false, null, null, rowAxis, this.rMembers.slice(0, 1), this.values.length, -1);
4484
+ this.updateValueMembers(this.measureIndex == 0 && this.rMembers.length > 1, null, null, rowAxis, this.rMembers.slice(1, this.rMembers.length), this.values.length, 0);
4485
+ }
4441
4486
  else {
4442
4487
  var hasRowTotal = rows.length === 0 && this.rMembers.length === 1 && this.rMembers[0].type == 'grand sum';
4443
4488
  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
+ }