@zeedhi/common 1.96.0 → 1.96.1

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.
@@ -1,4 +1,4 @@
1
- import { AccessorManager, Event, KeyMap, Metadata, Accessor, I18n, FormatterParserProvider, Validation, Mask, DatasourceFactory, MethodNotAssignedError, Loader, Config, dayjs, Utils, DateHelper, Router, InstanceNotFoundError, MemoryDatasource, Cookie, Http, URL as URL$1, VersionService } from '@zeedhi/core';
1
+ import { AccessorManager, Event, KeyMap, Metadata, Accessor, I18n, FormatterParserProvider, Validation, Mask, DatasourceFactory, MethodNotAssignedError, Loader, Config, dayjs, Utils, DateHelper, Router, InstanceNotFoundError, ViewService, MemoryDatasource, Cookie, Http, URL as URL$1, VersionService } from '@zeedhi/core';
2
2
  import merge from 'lodash.merge';
3
3
  import cloneDeep from 'lodash.clonedeep';
4
4
  import debounce from 'lodash.debounce';
@@ -2003,7 +2003,10 @@ class Input extends ComponentRender {
2003
2003
  */
2004
2004
  updateRules() {
2005
2005
  this.rules = Object.values(this.parsedValidations)
2006
- .map((validation) => () => validation(this.value));
2006
+ .map((validation) => (value) => {
2007
+ const testValue = value !== undefined ? value : this.value;
2008
+ return validation(testValue);
2009
+ });
2007
2010
  }
2008
2011
  /**
2009
2012
  * Input value.
@@ -2056,8 +2059,11 @@ class Input extends ComponentRender {
2056
2059
  * Checks the input value are valid to all applied rules.
2057
2060
  * @returns Input is valid
2058
2061
  */
2059
- isValid() {
2060
- return this.rules.every((rule) => typeof rule(this.value) !== 'string');
2062
+ isValid(value) {
2063
+ return this.rules.every((rule) => {
2064
+ const testValue = value !== undefined ? value : this.value;
2065
+ return typeof rule(testValue) !== 'string';
2066
+ });
2061
2067
  }
2062
2068
  /**
2063
2069
  * Triggered when the input value changes.
@@ -2142,6 +2148,19 @@ class Toggleable extends Input {
2142
2148
  }
2143
2149
  }
2144
2150
 
2151
+ class InputFactory {
2152
+ static register(className, inputClass) {
2153
+ if (!this.inputClasses[className])
2154
+ this.inputClasses[className] = inputClass;
2155
+ }
2156
+ static factory(props) {
2157
+ if (!this.inputClasses[props.component])
2158
+ return undefined;
2159
+ return new this.inputClasses[props.component](props);
2160
+ }
2161
+ }
2162
+ InputFactory.inputClasses = {};
2163
+
2145
2164
  /**
2146
2165
  * Base class for Checkbox component.
2147
2166
  */
@@ -2156,7 +2175,8 @@ class Checkbox extends Toggleable {
2156
2175
  this.showHelper = false;
2157
2176
  this.createAccessors();
2158
2177
  }
2159
- }
2178
+ }
2179
+ InputFactory.register('ZdCheckbox', Checkbox);
2160
2180
 
2161
2181
  /**
2162
2182
  * Base class for Checkbox multiple component.
@@ -2209,7 +2229,8 @@ class CheckboxMultiple extends Input {
2209
2229
  super.onBeforeDestroy();
2210
2230
  this.datasource.destroy();
2211
2231
  }
2212
- }
2232
+ }
2233
+ InputFactory.register('ZdCheckboxMultiple', CheckboxMultiple);
2213
2234
 
2214
2235
  /**
2215
2236
  * Base class for Chip component.
@@ -2696,10 +2717,15 @@ class TextInput extends Input {
2696
2717
  * Defines text input value should concat the suffix text.
2697
2718
  */
2698
2719
  this.valueWithSuffix = textInputDefaults.valueWithSuffix;
2720
+ /**
2721
+ * Defines clicks on outer icon should focus the component.
2722
+ */
2723
+ this.focusOnOuterIconClick = true;
2699
2724
  this.formatterFn = FormatterParserProvider.getFormatter('ZdTextInput');
2700
2725
  this.parserFn = FormatterParserProvider.getParser('ZdTextInput');
2701
2726
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, this.appendIcon);
2702
2727
  this.appendOuterIcon = this.getInitValue('appendOuterIcon', props.appendOuterIcon, this.appendOuterIcon);
2728
+ this.focusOnOuterIconClick = this.getInitValue('focusOnOuterIconClick', props.focusOnOuterIconClick, this.focusOnOuterIconClick);
2703
2729
  this.prefix = this.getInitValue('prefix', props.prefix, this.prefix);
2704
2730
  this.prependIcon = this.getInitValue('prependIcon', props.prependIcon, this.prependIcon);
2705
2731
  this.prependOuterIcon = this.getInitValue('prependOuterIcon', props.prependOuterIcon, this.prependOuterIcon);
@@ -2805,7 +2831,8 @@ FormatterParserProvider.registerParser('ZdTextInput', (value, { valueWithPrefix
2805
2831
  formatted = prefixValue + formatted + suffixValue;
2806
2832
  }
2807
2833
  return formatted;
2808
- });
2834
+ });
2835
+ InputFactory.register('ZdTextInput', TextInput);
2809
2836
 
2810
2837
  /**
2811
2838
  * Base class for Number component
@@ -2915,7 +2942,8 @@ FormatterParserProvider.registerParser('ZdNumber', (value, { mask = {}, } = {})
2915
2942
  let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2916
2943
  maskValue = Object.assign(Object.assign({}, Config.masks.numberMask), maskValue);
2917
2944
  return value === '' ? null : AutoNumeric.unformat(value, maskValue);
2918
- });
2945
+ });
2946
+ InputFactory.register('ZdNumber', Number$1);
2919
2947
 
2920
2948
  /**
2921
2949
  * Base class for Currency component
@@ -2951,7 +2979,8 @@ FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = {}, } = {}
2951
2979
  let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2952
2980
  maskValue = Object.assign(Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask), maskValue);
2953
2981
  return value === '' ? null : AutoNumeric.unformat(value, maskValue);
2954
- });
2982
+ });
2983
+ InputFactory.register('ZdCurrency', Currency);
2955
2984
 
2956
2985
  class AlertQueue {
2957
2986
  constructor() {
@@ -4209,7 +4238,8 @@ FormatterParserProvider.registerParser('ZdDateTime', (value, { dateTimeFormat =
4209
4238
  return dayjs(value, displayFormat).format(dateTimeFormat);
4210
4239
  }
4211
4240
  return value;
4212
- });
4241
+ });
4242
+ InputFactory.register('ZdDate', Date$1);
4213
4243
 
4214
4244
  class DateRange extends TextInput {
4215
4245
  /* istanbul ignore next */
@@ -4673,7 +4703,8 @@ FormatterParserProvider.registerParser('ZdDateRange', (value, { dateFormat = Con
4673
4703
  }
4674
4704
  });
4675
4705
  return formattedValue;
4676
- });
4706
+ });
4707
+ InputFactory.register('ZdDateRange', DateRange);
4677
4708
 
4678
4709
  /**
4679
4710
  * Base class for Divider component.
@@ -4943,7 +4974,10 @@ class FileInput extends TextInput {
4943
4974
  .map((key) => {
4944
4975
  const validation = this.parsedValidations[key];
4945
4976
  if (key !== 'maxFileSize')
4946
- return () => validation(this.value);
4977
+ return (value) => {
4978
+ const testValue = value !== undefined ? value : this.value;
4979
+ return validation(testValue);
4980
+ };
4947
4981
  return () => {
4948
4982
  if (this.viewGetFileSizes) {
4949
4983
  const fileSizes = this.viewGetFileSizes();
@@ -4965,7 +4999,8 @@ Validation.register('maxFileSize', (config) => (fileSizes) => {
4965
4999
  });
4966
5000
  const message = I18n.translate((config.message || 'VALIDATION_FILE_SIZE'), { fileError });
4967
5001
  return (fileError === '') || message;
4968
- });
5002
+ });
5003
+ InputFactory.register('ZdFileInput', FileInput);
4969
5004
 
4970
5005
  /**
4971
5006
  * Base class for Footer component.
@@ -6008,7 +6043,7 @@ class Grid extends Iterable {
6008
6043
  },
6009
6044
  tab: {
6010
6045
  event: this.navigateRight.bind(this),
6011
- prevent: true,
6046
+ prevent: false,
6012
6047
  active: true,
6013
6048
  index: 99,
6014
6049
  input: true,
@@ -6016,7 +6051,7 @@ class Grid extends Iterable {
6016
6051
  },
6017
6052
  'shift+tab': {
6018
6053
  event: this.navigateLeft.bind(this),
6019
- prevent: true,
6054
+ prevent: false,
6020
6055
  active: true,
6021
6056
  index: 99,
6022
6057
  input: true,
@@ -6267,51 +6302,58 @@ class Grid extends Iterable {
6267
6302
  arrSelection.splice(index, 1);
6268
6303
  }
6269
6304
  }
6270
- navigateLeft() {
6305
+ navigateLeft({ event }) {
6271
6306
  if (!this.viewNavigate)
6272
6307
  return;
6273
- this.viewNavigate('left');
6308
+ this.viewNavigate('left', event);
6274
6309
  }
6275
- navigateRight() {
6310
+ navigateRight({ event }) {
6276
6311
  if (!this.viewNavigate)
6277
6312
  return;
6278
- this.viewNavigate('right');
6313
+ this.viewNavigate('right', event);
6279
6314
  }
6280
6315
  navigateUp() {
6281
- if (this.cellSelection && this.viewNavigate) {
6282
- this.viewNavigate('up');
6283
- return;
6284
- }
6285
- const { uniqueKey, currentRow } = this.datasource;
6286
- const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
6287
- if (rowIndex === -1) {
6288
- this.datasource.currentRow = this.datasource.data[this.datasource.data.length - 1];
6289
- [this.currentColumn] = this.columns;
6290
- return;
6291
- }
6292
- if (rowIndex === 0) {
6293
- this.navigatePageDown();
6316
+ if (!this.viewNavigate)
6294
6317
  return;
6295
- }
6296
- this.datasource.currentRow = this.datasource.data[rowIndex - 1];
6318
+ this.viewNavigate('up');
6297
6319
  }
6298
6320
  navigateDown() {
6299
- if (this.cellSelection && this.viewNavigate) {
6300
- this.viewNavigate('down');
6321
+ if (!this.viewNavigate)
6301
6322
  return;
6302
- }
6323
+ this.viewNavigate('down');
6324
+ }
6325
+ navigateDatasource(up) {
6303
6326
  const { uniqueKey, currentRow } = this.datasource;
6304
6327
  const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
6305
6328
  if (rowIndex === -1) {
6306
- [this.datasource.currentRow] = this.datasource.data;
6307
- [this.currentColumn] = this.columns;
6308
- return;
6329
+ return this.navigateInitial(up);
6309
6330
  }
6310
- if (rowIndex === this.datasource.data.length - 1) {
6311
- this.navigatePageUp();
6331
+ if (up && rowIndex === 0) {
6332
+ return this.navigatePageDown();
6333
+ }
6334
+ if (!up && rowIndex === this.datasource.data.length - 1) {
6335
+ return this.navigatePageUp();
6336
+ }
6337
+ return this.navigateCurrentRow(up, rowIndex);
6338
+ }
6339
+ navigateCurrentRow(up, rowIndex) {
6340
+ const addIndex = up ? -1 : 1;
6341
+ this.datasource.currentRow = this.datasource.data[rowIndex + addIndex];
6342
+ }
6343
+ navigateInitial(up) {
6344
+ if (up) {
6345
+ this.navigateLast();
6312
6346
  return;
6313
6347
  }
6314
- this.datasource.currentRow = this.datasource.data[rowIndex + 1];
6348
+ this.navigateFirst();
6349
+ }
6350
+ navigateFirst() {
6351
+ [this.datasource.currentRow] = this.datasource.data;
6352
+ [this.currentColumn] = this.columns;
6353
+ }
6354
+ navigateLast() {
6355
+ this.datasource.currentRow = this.datasource.data[this.datasource.data.length - 1];
6356
+ [this.currentColumn] = this.columns;
6315
6357
  }
6316
6358
  navigatePageUp() {
6317
6359
  if (this.datasource.page < Math.ceil(this.datasource.total / this.datasource.limit)) {
@@ -6846,6 +6888,9 @@ class GridEditable extends Grid {
6846
6888
  if (!revalidate) {
6847
6889
  return Object.keys(this.invalidComponents).length === 0;
6848
6890
  }
6891
+ if (!this.editing) {
6892
+ return this.isViewGridValid();
6893
+ }
6849
6894
  let allValid = true;
6850
6895
  this.datasource.data.forEach((row) => this.columns.forEach((column) => {
6851
6896
  if (!column.isVisible || !column.editable)
@@ -6855,6 +6900,38 @@ class GridEditable extends Grid {
6855
6900
  }));
6856
6901
  return allValid;
6857
6902
  }
6903
+ /**
6904
+ * Checks whether the grid is valid while not in editing mode
6905
+ */
6906
+ isViewGridValid(forceEditing = true) {
6907
+ const invalidCompNames = [];
6908
+ const componentInstances = {};
6909
+ const editableColumns = this.columns.filter((column) => column.editable && column.isVisible);
6910
+ editableColumns.forEach((column) => {
6911
+ const compName = this.getCompName('temp', column.name);
6912
+ const componentProps = Object.assign(Object.assign({}, column.componentProps), { name: compName });
6913
+ componentInstances[column.name] = InputFactory.factory(componentProps);
6914
+ });
6915
+ this.datasource.data.forEach((row) => {
6916
+ const key = row[this.datasource.uniqueKey];
6917
+ editableColumns.forEach((column) => {
6918
+ const instance = componentInstances[column.name];
6919
+ if (!instance.isValid(row[column.name])) {
6920
+ invalidCompNames.push(this.getCompName(key, column.name));
6921
+ }
6922
+ });
6923
+ });
6924
+ if (invalidCompNames.length > 0 && forceEditing) {
6925
+ this.editing = true;
6926
+ ViewService.nextTick(() => {
6927
+ invalidCompNames.forEach((compName) => {
6928
+ const invalidComponent = Metadata.getInstance(compName);
6929
+ invalidComponent.validate();
6930
+ });
6931
+ });
6932
+ }
6933
+ return invalidCompNames.length === 0;
6934
+ }
6858
6935
  /**
6859
6936
  * Adds new row to the datasource data and pushes it to the editedRows
6860
6937
  * @param row Row
@@ -7340,7 +7417,8 @@ class Increment extends Number$1 {
7340
7417
  this.value -= this.step;
7341
7418
  }
7342
7419
  }
7343
- }
7420
+ }
7421
+ InputFactory.register('ZdIncrement', Increment);
7344
7422
 
7345
7423
  class IterableColumnsButtonController {
7346
7424
  constructor(iterableComponent) {
@@ -8025,7 +8103,8 @@ FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTe
8025
8103
  }
8026
8104
  return result;
8027
8105
  }, '');
8028
- });
8106
+ });
8107
+ InputFactory.register('ZdSelect', Select);
8029
8108
 
8030
8109
  /**
8031
8110
  * Base class for Iterable Page Size component
@@ -8192,7 +8271,8 @@ class Search extends TextInput {
8192
8271
  yield this.iterableComponent.setSearch(search);
8193
8272
  });
8194
8273
  }
8195
- }
8274
+ }
8275
+ InputFactory.register('ZdSearch', Search);
8196
8276
 
8197
8277
  /**
8198
8278
  * Base class for IterableComponentRender component.
@@ -9450,12 +9530,14 @@ class Modal extends Component {
9450
9530
  */
9451
9531
  show() {
9452
9532
  this.isVisible = true;
9533
+ ViewService.nextTick(() => this.callEvent('onShow', { component: this }));
9453
9534
  }
9454
9535
  /**
9455
9536
  * Closes modal
9456
9537
  */
9457
9538
  hide() {
9458
9539
  this.isVisible = false;
9540
+ ViewService.nextTick(() => this.callEvent('onHide', { component: this }));
9459
9541
  }
9460
9542
  }
9461
9543
 
@@ -9626,7 +9708,8 @@ class Password extends TextInput {
9626
9708
  }
9627
9709
  }
9628
9710
  }
9629
- FormatterParserProvider.registerFormatter('ZdPassword', (value) => (value || '').replace(/./g, '*'));
9711
+ FormatterParserProvider.registerFormatter('ZdPassword', (value) => (value || '').replace(/./g, '*'));
9712
+ InputFactory.register('ZdPassword', Password);
9630
9713
 
9631
9714
  /**
9632
9715
  * Base class for Progress component
@@ -9721,7 +9804,8 @@ class Radio extends Input {
9721
9804
  super.onBeforeDestroy();
9722
9805
  this.datasource.destroy();
9723
9806
  }
9724
- }
9807
+ }
9808
+ InputFactory.register('ZdRadio', Radio);
9725
9809
 
9726
9810
  /**
9727
9811
  * Base class for Range Slider component
@@ -9818,7 +9902,8 @@ class RangeSlider extends Input {
9818
9902
  set value(value) {
9819
9903
  this.rangeSliderValue = value;
9820
9904
  }
9821
- }
9905
+ }
9906
+ InputFactory.register('ZdRangeSlider', RangeSlider);
9822
9907
 
9823
9908
  /**
9824
9909
  * Base class for Row component.
@@ -10245,11 +10330,12 @@ class SelectMultiple extends Select {
10245
10330
  */
10246
10331
  updateRules() {
10247
10332
  this.rules = Object.keys(this.parsedValidations)
10248
- .map((key) => () => {
10333
+ .map((key) => (value) => {
10334
+ const testValue = value !== undefined ? value : this.value;
10249
10335
  const validation = this.parsedValidations[key];
10250
10336
  if (key !== 'required')
10251
- return validation(this.value);
10252
- return validation((this.checkboxAll && 'all') || this.value);
10337
+ return validation(testValue);
10338
+ return validation((this.checkboxAll && 'all') || testValue);
10253
10339
  });
10254
10340
  }
10255
10341
  }
@@ -11079,7 +11165,8 @@ class SelectTree extends TextInput {
11079
11165
  this.setValue(filteredNode.id);
11080
11166
  }
11081
11167
  }
11082
- }
11168
+ }
11169
+ InputFactory.register('ZdSelectTree', SelectTree);
11083
11170
 
11084
11171
  /**
11085
11172
  * Base class for Select Tree Multiple component.
@@ -11529,7 +11616,8 @@ class Switch extends Toggleable {
11529
11616
  this.inset = this.getInitValue('inset', props.inset, this.inset);
11530
11617
  this.createAccessors();
11531
11618
  }
11532
- }
11619
+ }
11620
+ InputFactory.register('ZdSwitch', Switch);
11533
11621
 
11534
11622
  /**
11535
11623
  * Base class for Table component.
@@ -11867,7 +11955,8 @@ class Textarea extends TextInput {
11867
11955
  this.addValidation('maxLength', { limit: parseInt(this.counter.toString(), 10) });
11868
11956
  }
11869
11957
  }
11870
- }
11958
+ }
11959
+ InputFactory.register('ZdTextarea', Textarea);
11871
11960
 
11872
11961
  /**
11873
11962
  * Selects the time format by the rule:
@@ -12255,7 +12344,8 @@ FormatterParserProvider.registerParser('ZdTime', (value, { displayFormat = Confi
12255
12344
  }
12256
12345
  }
12257
12346
  return value;
12258
- });
12347
+ });
12348
+ InputFactory.register('ZdTime', Time);
12259
12349
 
12260
12350
  /**
12261
12351
  * Base class for Tooltip component.
@@ -12900,45 +12990,28 @@ class TreeGrid extends Grid {
12900
12990
  navigateToggle(collapse) {
12901
12991
  this.treeDataStructure.navigateToggle(collapse);
12902
12992
  }
12903
- /**
12904
- * Navigate upwards
12905
- */
12906
- navigateUp() {
12907
- if (this.cellSelection && this.viewNavigate) {
12908
- this.viewNavigate('up');
12909
- return;
12910
- }
12993
+ navigateDatasource(up) {
12911
12994
  const { uniqueKey, currentRow } = this.datasource;
12912
12995
  const rowIndex = this.treeDataStructure.findDataIndex(this.datasource.data, currentRow[uniqueKey]);
12913
- if (rowIndex === -1) {
12914
- const lastOpenedRowIdx = this.treeDataStructure.previousOpenedRow(this.datasource.data.length);
12915
- this.datasource.currentRow = this.datasource.data[lastOpenedRowIdx];
12916
- }
12917
- else {
12996
+ if (up) {
12997
+ if (rowIndex === -1) {
12998
+ const lastOpenedRowIdx = this.treeDataStructure.previousOpenedRow(this.datasource.data.length);
12999
+ this.datasource.currentRow = this.datasource.data[lastOpenedRowIdx];
13000
+ return;
13001
+ }
12918
13002
  const previousRowIdx = this.treeDataStructure.previousOpenedRow(rowIndex);
12919
13003
  if (previousRowIdx > -1) {
12920
13004
  this.datasource.currentRow = this.datasource.data[previousRowIdx];
12921
13005
  }
12922
- }
12923
- }
12924
- /**
12925
- * Navigate downwards
12926
- */
12927
- navigateDown() {
12928
- if (this.cellSelection && this.viewNavigate) {
12929
- this.viewNavigate('down');
12930
13006
  return;
12931
13007
  }
12932
- const { uniqueKey, currentRow } = this.datasource;
12933
- const rowIndex = this.treeDataStructure.findDataIndex(this.datasource.data, currentRow[uniqueKey]);
12934
13008
  if (rowIndex === -1) {
12935
13009
  [this.datasource.currentRow] = this.datasource.data;
13010
+ return;
12936
13011
  }
12937
- else {
12938
- const nextRowIdx = this.treeDataStructure.nextOpenedRow(rowIndex);
12939
- if (nextRowIdx > -1) {
12940
- this.datasource.currentRow = this.datasource.data[nextRowIdx];
12941
- }
13012
+ const nextRowIdx = this.treeDataStructure.nextOpenedRow(rowIndex);
13013
+ if (nextRowIdx > -1) {
13014
+ this.datasource.currentRow = this.datasource.data[nextRowIdx];
12942
13015
  }
12943
13016
  }
12944
13017
  removeDuplicates(arr, key) {
@@ -14665,6 +14738,52 @@ class XLS3Report extends BaseReport {
14665
14738
  }
14666
14739
  }
14667
14740
 
14741
+ /**
14742
+ * Class used to format grouped data into the ZhReports format
14743
+ */
14744
+ class GroupedPDFFormatter {
14745
+ format(data) {
14746
+ return data.map((item) => {
14747
+ if (this.isGroupHeader(item)) {
14748
+ return {
14749
+ __group: item.group,
14750
+ __groupHeader: item.groupHeader,
14751
+ __groupFooter: false,
14752
+ __groupIndex: item.groupIndex,
14753
+ __groupLabel: item.groupLabel,
14754
+ __groupValue: item.groupValue,
14755
+ __groupOpened: item.groupOpened,
14756
+ };
14757
+ }
14758
+ if (this.isGroupFooter(item)) {
14759
+ const groupKeys = ['groupFooter', 'groupIndex', 'groupHeaders', 'groupLabel', 'groupValue', 'groupSummary'];
14760
+ const totalColumnNames = Object.keys(item).filter((key) => !groupKeys.includes(key));
14761
+ const result = {
14762
+ __group: true,
14763
+ __groupFooter: item.groupFooter,
14764
+ __groupIndex: item.groupIndex,
14765
+ __groupLabel: item.groupLabel,
14766
+ __groupValue: item.groupValue,
14767
+ __groupSummary: !!item.groupSummary,
14768
+ };
14769
+ totalColumnNames.forEach((name) => {
14770
+ result[name] = item[name];
14771
+ });
14772
+ return result;
14773
+ }
14774
+ const dataItem = Object.assign({}, item);
14775
+ delete dataItem.groupHeaders;
14776
+ return dataItem;
14777
+ });
14778
+ }
14779
+ isGroupHeader(entry) {
14780
+ return entry.groupHeader === true;
14781
+ }
14782
+ isGroupFooter(entry) {
14783
+ return entry.groupFooter === true;
14784
+ }
14785
+ }
14786
+
14668
14787
  class Report {
14669
14788
  constructor(iterable, title) {
14670
14789
  this.endPoint = Config.reportsEndPoint;
@@ -14721,7 +14840,7 @@ class Report {
14721
14840
  const { route } = reportType;
14722
14841
  const { name, columns, datasource } = this.iterable;
14723
14842
  const { groupedData } = Object.assign({}, this.iterable);
14724
- const formattedColumns = this.removeColumns(columns);
14843
+ const formattedColumns = this.filterColumns(columns);
14725
14844
  const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
14726
14845
  let dataset;
14727
14846
  if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
@@ -14729,6 +14848,11 @@ class Report {
14729
14848
  const metadataObjClone = merge(rowMetadata, JSON.parse(metadataObj));
14730
14849
  dataset = reportType.buildDataset(groupedData, metadataObjClone);
14731
14850
  }
14851
+ else if (reportType instanceof PDFReport && groupedData && groupedData.length > 0) {
14852
+ const formatter = new GroupedPDFFormatter();
14853
+ const pdfGroupedData = formatter.format(groupedData);
14854
+ dataset = reportType.buildDataset(pdfGroupedData);
14855
+ }
14732
14856
  else {
14733
14857
  dataset = reportType.buildDataset(data, formattedColumns);
14734
14858
  }
@@ -14759,7 +14883,7 @@ class Report {
14759
14883
  return new URL(reportFile, this.fileEndPoint).href;
14760
14884
  });
14761
14885
  }
14762
- removeColumns(columns) {
14886
+ filterColumns(columns) {
14763
14887
  return columns.filter((item) => (item.type !== 'action' && item.isVisible));
14764
14888
  }
14765
14889
  }
@@ -14768,4 +14892,4 @@ const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
14768
14892
  const packageContent = require('../package.json');
14769
14893
  VersionService.addPackageVersion(packageContent.name, packageContent.version);
14770
14894
 
14771
- export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
14895
+ export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, GroupedPDFFormatter, Header, Icon, Icons, Image, Increment, Input, InputFactory, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };