@zeedhi/common 1.112.0 → 1.113.0

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.
@@ -2831,7 +2831,7 @@ class TextInput extends Input {
2831
2831
  return mask;
2832
2832
  }
2833
2833
  }
2834
- FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, } = {}) => {
2834
+ FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, eagerMask, } = {}) => {
2835
2835
  let formatted = value;
2836
2836
  if (formatted) {
2837
2837
  formatted = valueWithPrefix ? formatted.substring(prefix.length) : formatted;
@@ -2842,7 +2842,10 @@ FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPref
2842
2842
  maskDef = Loader.getInstance(controller)[accessor];
2843
2843
  }
2844
2844
  const maskValue = typeof (maskDef) === 'function' ? maskDef(Mask.getValueWithoutMask(formatted)) : maskDef;
2845
- formatted = maskValue ? Mask.getValueWithMask(Mask.getValueWithoutMask(formatted), maskValue) : formatted;
2845
+ if (maskValue) {
2846
+ const valueWithoutMask = Mask.getValueWithoutMask(formatted);
2847
+ formatted = Mask.getValueWithMask(valueWithoutMask, maskValue, false, eagerMask);
2848
+ }
2846
2849
  }
2847
2850
  return formatted;
2848
2851
  });
@@ -3138,8 +3141,10 @@ class AlertService {
3138
3141
  * Hides alert by index. Default index is 0
3139
3142
  */
3140
3143
  static hide(index = 0) {
3141
- this.alertsManager.visibleInstances[index].hide();
3142
- this.remove(index);
3144
+ if (this.alertsManager.visibleInstances[index]) {
3145
+ this.alertsManager.visibleInstances[index].hide();
3146
+ this.remove(index);
3147
+ }
3143
3148
  }
3144
3149
  /**
3145
3150
  * Hides alert by alert id (returned by the `show` method)
@@ -8527,18 +8532,26 @@ class BaseReport {
8527
8532
  SUM: 'SUM',
8528
8533
  };
8529
8534
  this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
8535
+ this.labelFormatter = labelFormatter;
8530
8536
  this.reportColumnTransformer = this.getReportColumnTransformer(labelFormatter);
8531
8537
  }
8532
8538
  getReportColumnTransformer(labelFormatter) {
8533
8539
  return new ReportColumnTransformer({ labelFormatter, fileType: this.getFileType() });
8534
8540
  }
8541
+ getColumnLabel(key, column) {
8542
+ if (!column)
8543
+ return key;
8544
+ if (!this.labelFormatter)
8545
+ return column.label || key;
8546
+ return this.labelFormatter({ column, fileType: this.getFileType() });
8547
+ }
8535
8548
  buildFilter(filter, columns) {
8536
8549
  return Object.keys(filter).map((key) => {
8537
- var _a;
8538
- return ({
8539
- label: ((_a = columns.find((col) => col.name === key)) === null || _a === void 0 ? void 0 : _a.label) || key,
8550
+ const column = columns.find((col) => col.name === key);
8551
+ return {
8552
+ label: this.getColumnLabel(key, column),
8540
8553
  value: I18n.translate('IS_EQUAL', { value: filter[key] }),
8541
- });
8554
+ };
8542
8555
  });
8543
8556
  }
8544
8557
  formatLangCode(lang) {
@@ -8547,6 +8560,12 @@ class BaseReport {
8547
8560
  }
8548
8561
  return lang.toLowerCase().replace('-', '_');
8549
8562
  }
8563
+ filterColumns(columns) {
8564
+ return columns.filter((item) => (item.type !== 'action' && item.isVisible !== false));
8565
+ }
8566
+ buildCols(columns) {
8567
+ return this.reportColumnTransformer.transform(this.filterColumns(columns));
8568
+ }
8550
8569
  }
8551
8570
 
8552
8571
  class CSVReport extends BaseReport {
@@ -8557,8 +8576,9 @@ class CSVReport extends BaseReport {
8557
8576
  getFileType() {
8558
8577
  return 'csv';
8559
8578
  }
8560
- buildDataset(data, columns) {
8561
- const columnNames = columns.map((col) => col.name);
8579
+ buildDataset({ data, columns }) {
8580
+ const filteredColumns = this.filterColumns(columns);
8581
+ const columnNames = filteredColumns.map((col) => col.name);
8562
8582
  const result = data.reduce((reduced, row) => {
8563
8583
  const values = columnNames.map((col) => row[col] || '');
8564
8584
  return [...reduced, values];
@@ -8566,7 +8586,7 @@ class CSVReport extends BaseReport {
8566
8586
  return JSON.stringify(result);
8567
8587
  }
8568
8588
  buildMetadata(name, title, columns, filter) {
8569
- const builtCols = this.reportColumnTransformer.transform(columns);
8589
+ const builtCols = this.buildCols(columns);
8570
8590
  const builtFilters = this.buildFilter(filter || {}, columns);
8571
8591
  const lang = this.formatLangCode(I18n.instance.language);
8572
8592
  const clientLogo = '';
@@ -8610,7 +8630,7 @@ class PDFReport extends BaseReport {
8610
8630
  const fileType = this.getFileType();
8611
8631
  return new ReportColumnTransformer({ getFormatFn, labelFormatter, fileType });
8612
8632
  }
8613
- buildDataset(data) {
8633
+ buildDataset({ data }) {
8614
8634
  return JSON.stringify(data);
8615
8635
  }
8616
8636
  getFormatOfColumn(column) {
@@ -8660,7 +8680,7 @@ class PDFReport extends BaseReport {
8660
8680
  }
8661
8681
  buildMetadata(name, title, columns, filter, portrait = true) {
8662
8682
  return __awaiter(this, void 0, void 0, function* () {
8663
- const builtCols = this.reportColumnTransformer.transform(columns);
8683
+ const builtCols = this.buildCols(columns);
8664
8684
  const builtFilters = this.buildFilter(filter || {}, columns);
8665
8685
  const lang = this.formatLangCode(I18n.instance.language);
8666
8686
  let clientLogo = '';
@@ -8748,8 +8768,8 @@ class XLSReport extends BaseReport {
8748
8768
  getFileType() {
8749
8769
  return 'xls';
8750
8770
  }
8751
- buildDataset(data, columns) {
8752
- const result = this.formatRawDataSet(data, columns);
8771
+ buildDataset({ data, columns }) {
8772
+ const result = this.formatRawDataSet(data, this.filterColumns(columns));
8753
8773
  return JSON.stringify(result);
8754
8774
  }
8755
8775
  // formata o dataset para o formato "cru" xls
@@ -8762,7 +8782,7 @@ class XLSReport extends BaseReport {
8762
8782
  return result;
8763
8783
  }
8764
8784
  buildMetadata(name, title, columns, filter) {
8765
- const builtCols = this.reportColumnTransformer.transform(columns);
8785
+ const builtCols = this.buildCols(columns);
8766
8786
  const builtFilters = this.buildFilter(filter || {}, columns);
8767
8787
  const lang = this.formatLangCode(I18n.instance.language);
8768
8788
  const clientLogo = '';
@@ -8805,12 +8825,12 @@ class XLS2Report extends BaseReport {
8805
8825
  getFileType() {
8806
8826
  return 'xls';
8807
8827
  }
8808
- buildDataset(data, metadata) {
8828
+ buildDataset({ data, metadata }) {
8809
8829
  const result = this.formatDataSet(metadata, data);
8810
8830
  return JSON.stringify(result);
8811
8831
  }
8812
8832
  buildMetadata(name, title, columns, filter) {
8813
- const builtCols = this.reportColumnTransformer.transform(columns);
8833
+ const builtCols = this.buildCols(columns);
8814
8834
  const builtFilters = this.buildFilter(filter || {}, columns);
8815
8835
  const lang = this.formatLangCode(I18n.instance.language);
8816
8836
  const clientLogo = '';
@@ -9005,12 +9025,12 @@ class XLS3Report extends BaseReport {
9005
9025
  getFileType() {
9006
9026
  return 'xls';
9007
9027
  }
9008
- buildDataset(data, metadata) {
9028
+ buildDataset({ data, metadata }) {
9009
9029
  const result = this.formatDataSet(metadata, data);
9010
9030
  return JSON.stringify(result);
9011
9031
  }
9012
9032
  buildMetadata(name, title, columns, filter) {
9013
- const builtCols = this.reportColumnTransformer.transform(columns);
9033
+ const builtCols = this.buildCols(columns);
9014
9034
  const builtFilters = this.buildFilter(filter || {}, columns);
9015
9035
  const lang = this.formatLangCode(I18n.instance.language);
9016
9036
  const clientLogo = '';
@@ -9330,21 +9350,20 @@ class Report {
9330
9350
  const { route } = reportType;
9331
9351
  const { name, columns, datasource } = this.iterable;
9332
9352
  const { groupedData } = Object.assign({}, this.iterable);
9333
- const formattedColumns = this.filterColumns(columns);
9334
- const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
9353
+ const metadataObj = yield reportType.buildMetadata(name, this.title, columns, datasource.filter, portrait);
9335
9354
  let dataset;
9336
9355
  if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
9337
9356
  const rowMetadata = rowObj.metaData;
9338
9357
  const metadataObjClone = merge(rowMetadata, JSON.parse(metadataObj));
9339
- dataset = reportType.buildDataset(groupedData, metadataObjClone);
9358
+ dataset = reportType.buildDataset({ data: groupedData, metadata: metadataObjClone });
9340
9359
  }
9341
9360
  else if (reportType instanceof PDFReport && groupedData && groupedData.length > 0) {
9342
9361
  const formatter = new GroupedPDFFormatter();
9343
9362
  const pdfGroupedData = formatter.format(groupedData);
9344
- dataset = reportType.buildDataset(pdfGroupedData);
9363
+ dataset = reportType.buildDataset({ data: pdfGroupedData });
9345
9364
  }
9346
9365
  else {
9347
- dataset = reportType.buildDataset(data, formattedColumns);
9366
+ dataset = reportType.buildDataset({ data, metadata: metadataObj, columns });
9348
9367
  }
9349
9368
  const filter = '[]';
9350
9369
  let row = {
@@ -9373,9 +9392,6 @@ class Report {
9373
9392
  return new URL(reportFile, this.fileEndPoint).href;
9374
9393
  });
9375
9394
  }
9376
- filterColumns(columns) {
9377
- return columns.filter((item) => (item.type !== 'action' && item.isVisible));
9378
- }
9379
9395
  }
9380
9396
 
9381
9397
  class TreeDataStructure {
@@ -10535,7 +10551,7 @@ class Select extends TextInput {
10535
10551
  });
10536
10552
  }
10537
10553
  }
10538
- FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
10554
+ FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', eagerMask, }) => {
10539
10555
  if (value === null || value === undefined) {
10540
10556
  return null;
10541
10557
  }
@@ -10567,7 +10583,7 @@ FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTe
10567
10583
  let masked = value[column];
10568
10584
  if (masks[index]) {
10569
10585
  const maskValue = typeof masks[index] === 'function' ? masks[index](value[column]) : masks[index];
10570
- masked = Mask.getValueWithMask(value[column], maskValue);
10586
+ masked = Mask.getValueWithMask(value[column], maskValue, false, eagerMask);
10571
10587
  }
10572
10588
  return result + separator + masked;
10573
10589
  }
@@ -12178,7 +12194,8 @@ FormatterParserProvider.registerParser('ZdMonth', (value, { dateFormat = Config.
12178
12194
  }
12179
12195
  }
12180
12196
  return value;
12181
- });
12197
+ });
12198
+ InputFactory.register('ZdMonth', Month);
12182
12199
 
12183
12200
  /**
12184
12201
  * Base class for Password component.
@@ -12968,7 +12985,8 @@ FormatterParserProvider.registerFormatter('ZdSelectMultiple', (value, props) =>
12968
12985
  return formattedRow;
12969
12986
  });
12970
12987
  return formattedValue;
12971
- });
12988
+ });
12989
+ InputFactory.register('ZdSelectMultiple', SelectMultiple);
12972
12990
 
12973
12991
  /**
12974
12992
  * Base class for Select Tree component.
@@ -13562,7 +13580,8 @@ class SelectTreeMultiple extends SelectTree {
13562
13580
  }
13563
13581
  }
13564
13582
  const selectFormatterFn = FormatterParserProvider.getFormatter('ZdSelectMultiple');
13565
- FormatterParserProvider.registerFormatter('ZdSelectTreeMultiple', selectFormatterFn);
13583
+ FormatterParserProvider.registerFormatter('ZdSelectTreeMultiple', selectFormatterFn);
13584
+ InputFactory.register('ZdSelectTreeMultiple', SelectTreeMultiple);
13566
13585
 
13567
13586
  /**
13568
13587
  * Base class for SelectableList component.
@@ -15987,7 +16006,7 @@ const storeOrRetrieveLookup = (column, row, value, dataValue, componentProps) =>
15987
16006
  }
15988
16007
  return row;
15989
16008
  };
15990
- const formatter$1 = ({ column, value, row, componentProps, }) => {
16009
+ const formatter$2 = ({ column, value, row, componentProps, }) => {
15991
16010
  if (value === null || value === undefined)
15992
16011
  return '';
15993
16012
  const { dataText, formatterDataText, dataTextSeparator, dataValue, dataTextDiscrete, foreignColumns, } = componentProps;
@@ -16018,12 +16037,12 @@ const formatter$1 = ({ column, value, row, componentProps, }) => {
16018
16037
  return currentRow[textColumn] || value;
16019
16038
  }
16020
16039
  const formatterFn = FormatterParserProvider.getFormatter('ZdSelect');
16021
- return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator });
16040
+ return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator, eagerMask: false });
16022
16041
  };
16023
- FormatterParserProvider.registerFormatter('column_ZdSelect', formatter$1);
16024
- FormatterParserProvider.registerFormatter('column_ZdSelectTree', formatter$1);
16042
+ FormatterParserProvider.registerFormatter('column_ZdSelect', formatter$2);
16043
+ FormatterParserProvider.registerFormatter('column_ZdSelectTree', formatter$2);
16025
16044
 
16026
- const formatter = ({ column, value, row, componentProps, }) => {
16045
+ const formatter$1 = ({ column, value, row, componentProps, }) => {
16027
16046
  if (!value || !Array.isArray(value) || value.length === 0)
16028
16047
  return '';
16029
16048
  const { formatterDataText, foreignColumns, dataText } = componentProps;
@@ -16061,8 +16080,12 @@ const formatter = ({ column, value, row, componentProps, }) => {
16061
16080
  });
16062
16081
  return result.join(', ');
16063
16082
  };
16064
- FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', formatter);
16065
- FormatterParserProvider.registerFormatter('column_ZdSelectTreeMultiple', formatter);
16083
+ FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', formatter$1);
16084
+ FormatterParserProvider.registerFormatter('column_ZdSelectTreeMultiple', formatter$1);
16085
+
16086
+ const defaultFormatter = FormatterParserProvider.getFormatter('ZdTextInput');
16087
+ const formatter = ({ value, componentProps, }) => defaultFormatter(value, Object.assign(Object.assign({}, componentProps), { eagerMask: false }));
16088
+ FormatterParserProvider.registerFormatter('column_ZdTextInput', formatter);
16066
16089
 
16067
16090
  const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
16068
16091
  const packageContent = require('../package.json');
@@ -2838,7 +2838,7 @@
2838
2838
  return mask;
2839
2839
  }
2840
2840
  }
2841
- core.FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, } = {}) => {
2841
+ core.FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, eagerMask, } = {}) => {
2842
2842
  let formatted = value;
2843
2843
  if (formatted) {
2844
2844
  formatted = valueWithPrefix ? formatted.substring(prefix.length) : formatted;
@@ -2849,7 +2849,10 @@
2849
2849
  maskDef = core.Loader.getInstance(controller)[accessor];
2850
2850
  }
2851
2851
  const maskValue = typeof (maskDef) === 'function' ? maskDef(core.Mask.getValueWithoutMask(formatted)) : maskDef;
2852
- formatted = maskValue ? core.Mask.getValueWithMask(core.Mask.getValueWithoutMask(formatted), maskValue) : formatted;
2852
+ if (maskValue) {
2853
+ const valueWithoutMask = core.Mask.getValueWithoutMask(formatted);
2854
+ formatted = core.Mask.getValueWithMask(valueWithoutMask, maskValue, false, eagerMask);
2855
+ }
2853
2856
  }
2854
2857
  return formatted;
2855
2858
  });
@@ -3145,8 +3148,10 @@
3145
3148
  * Hides alert by index. Default index is 0
3146
3149
  */
3147
3150
  static hide(index = 0) {
3148
- this.alertsManager.visibleInstances[index].hide();
3149
- this.remove(index);
3151
+ if (this.alertsManager.visibleInstances[index]) {
3152
+ this.alertsManager.visibleInstances[index].hide();
3153
+ this.remove(index);
3154
+ }
3150
3155
  }
3151
3156
  /**
3152
3157
  * Hides alert by alert id (returned by the `show` method)
@@ -8534,18 +8539,26 @@
8534
8539
  SUM: 'SUM',
8535
8540
  };
8536
8541
  this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
8542
+ this.labelFormatter = labelFormatter;
8537
8543
  this.reportColumnTransformer = this.getReportColumnTransformer(labelFormatter);
8538
8544
  }
8539
8545
  getReportColumnTransformer(labelFormatter) {
8540
8546
  return new ReportColumnTransformer({ labelFormatter, fileType: this.getFileType() });
8541
8547
  }
8548
+ getColumnLabel(key, column) {
8549
+ if (!column)
8550
+ return key;
8551
+ if (!this.labelFormatter)
8552
+ return column.label || key;
8553
+ return this.labelFormatter({ column, fileType: this.getFileType() });
8554
+ }
8542
8555
  buildFilter(filter, columns) {
8543
8556
  return Object.keys(filter).map((key) => {
8544
- var _a;
8545
- return ({
8546
- label: ((_a = columns.find((col) => col.name === key)) === null || _a === void 0 ? void 0 : _a.label) || key,
8557
+ const column = columns.find((col) => col.name === key);
8558
+ return {
8559
+ label: this.getColumnLabel(key, column),
8547
8560
  value: core.I18n.translate('IS_EQUAL', { value: filter[key] }),
8548
- });
8561
+ };
8549
8562
  });
8550
8563
  }
8551
8564
  formatLangCode(lang) {
@@ -8554,6 +8567,12 @@
8554
8567
  }
8555
8568
  return lang.toLowerCase().replace('-', '_');
8556
8569
  }
8570
+ filterColumns(columns) {
8571
+ return columns.filter((item) => (item.type !== 'action' && item.isVisible !== false));
8572
+ }
8573
+ buildCols(columns) {
8574
+ return this.reportColumnTransformer.transform(this.filterColumns(columns));
8575
+ }
8557
8576
  }
8558
8577
 
8559
8578
  class CSVReport extends BaseReport {
@@ -8564,8 +8583,9 @@
8564
8583
  getFileType() {
8565
8584
  return 'csv';
8566
8585
  }
8567
- buildDataset(data, columns) {
8568
- const columnNames = columns.map((col) => col.name);
8586
+ buildDataset({ data, columns }) {
8587
+ const filteredColumns = this.filterColumns(columns);
8588
+ const columnNames = filteredColumns.map((col) => col.name);
8569
8589
  const result = data.reduce((reduced, row) => {
8570
8590
  const values = columnNames.map((col) => row[col] || '');
8571
8591
  return [...reduced, values];
@@ -8573,7 +8593,7 @@
8573
8593
  return JSON.stringify(result);
8574
8594
  }
8575
8595
  buildMetadata(name, title, columns, filter) {
8576
- const builtCols = this.reportColumnTransformer.transform(columns);
8596
+ const builtCols = this.buildCols(columns);
8577
8597
  const builtFilters = this.buildFilter(filter || {}, columns);
8578
8598
  const lang = this.formatLangCode(core.I18n.instance.language);
8579
8599
  const clientLogo = '';
@@ -8617,7 +8637,7 @@
8617
8637
  const fileType = this.getFileType();
8618
8638
  return new ReportColumnTransformer({ getFormatFn, labelFormatter, fileType });
8619
8639
  }
8620
- buildDataset(data) {
8640
+ buildDataset({ data }) {
8621
8641
  return JSON.stringify(data);
8622
8642
  }
8623
8643
  getFormatOfColumn(column) {
@@ -8667,7 +8687,7 @@
8667
8687
  }
8668
8688
  buildMetadata(name, title, columns, filter, portrait = true) {
8669
8689
  return __awaiter(this, void 0, void 0, function* () {
8670
- const builtCols = this.reportColumnTransformer.transform(columns);
8690
+ const builtCols = this.buildCols(columns);
8671
8691
  const builtFilters = this.buildFilter(filter || {}, columns);
8672
8692
  const lang = this.formatLangCode(core.I18n.instance.language);
8673
8693
  let clientLogo = '';
@@ -8755,8 +8775,8 @@
8755
8775
  getFileType() {
8756
8776
  return 'xls';
8757
8777
  }
8758
- buildDataset(data, columns) {
8759
- const result = this.formatRawDataSet(data, columns);
8778
+ buildDataset({ data, columns }) {
8779
+ const result = this.formatRawDataSet(data, this.filterColumns(columns));
8760
8780
  return JSON.stringify(result);
8761
8781
  }
8762
8782
  // formata o dataset para o formato "cru" xls
@@ -8769,7 +8789,7 @@
8769
8789
  return result;
8770
8790
  }
8771
8791
  buildMetadata(name, title, columns, filter) {
8772
- const builtCols = this.reportColumnTransformer.transform(columns);
8792
+ const builtCols = this.buildCols(columns);
8773
8793
  const builtFilters = this.buildFilter(filter || {}, columns);
8774
8794
  const lang = this.formatLangCode(core.I18n.instance.language);
8775
8795
  const clientLogo = '';
@@ -8812,12 +8832,12 @@
8812
8832
  getFileType() {
8813
8833
  return 'xls';
8814
8834
  }
8815
- buildDataset(data, metadata) {
8835
+ buildDataset({ data, metadata }) {
8816
8836
  const result = this.formatDataSet(metadata, data);
8817
8837
  return JSON.stringify(result);
8818
8838
  }
8819
8839
  buildMetadata(name, title, columns, filter) {
8820
- const builtCols = this.reportColumnTransformer.transform(columns);
8840
+ const builtCols = this.buildCols(columns);
8821
8841
  const builtFilters = this.buildFilter(filter || {}, columns);
8822
8842
  const lang = this.formatLangCode(core.I18n.instance.language);
8823
8843
  const clientLogo = '';
@@ -9012,12 +9032,12 @@
9012
9032
  getFileType() {
9013
9033
  return 'xls';
9014
9034
  }
9015
- buildDataset(data, metadata) {
9035
+ buildDataset({ data, metadata }) {
9016
9036
  const result = this.formatDataSet(metadata, data);
9017
9037
  return JSON.stringify(result);
9018
9038
  }
9019
9039
  buildMetadata(name, title, columns, filter) {
9020
- const builtCols = this.reportColumnTransformer.transform(columns);
9040
+ const builtCols = this.buildCols(columns);
9021
9041
  const builtFilters = this.buildFilter(filter || {}, columns);
9022
9042
  const lang = this.formatLangCode(core.I18n.instance.language);
9023
9043
  const clientLogo = '';
@@ -9337,21 +9357,20 @@
9337
9357
  const { route } = reportType;
9338
9358
  const { name, columns, datasource } = this.iterable;
9339
9359
  const { groupedData } = Object.assign({}, this.iterable);
9340
- const formattedColumns = this.filterColumns(columns);
9341
- const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
9360
+ const metadataObj = yield reportType.buildMetadata(name, this.title, columns, datasource.filter, portrait);
9342
9361
  let dataset;
9343
9362
  if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
9344
9363
  const rowMetadata = rowObj.metaData;
9345
9364
  const metadataObjClone = merge__default["default"](rowMetadata, JSON.parse(metadataObj));
9346
- dataset = reportType.buildDataset(groupedData, metadataObjClone);
9365
+ dataset = reportType.buildDataset({ data: groupedData, metadata: metadataObjClone });
9347
9366
  }
9348
9367
  else if (reportType instanceof PDFReport && groupedData && groupedData.length > 0) {
9349
9368
  const formatter = new GroupedPDFFormatter();
9350
9369
  const pdfGroupedData = formatter.format(groupedData);
9351
- dataset = reportType.buildDataset(pdfGroupedData);
9370
+ dataset = reportType.buildDataset({ data: pdfGroupedData });
9352
9371
  }
9353
9372
  else {
9354
- dataset = reportType.buildDataset(data, formattedColumns);
9373
+ dataset = reportType.buildDataset({ data, metadata: metadataObj, columns });
9355
9374
  }
9356
9375
  const filter = '[]';
9357
9376
  let row = {
@@ -9380,9 +9399,6 @@
9380
9399
  return new URL(reportFile, this.fileEndPoint).href;
9381
9400
  });
9382
9401
  }
9383
- filterColumns(columns) {
9384
- return columns.filter((item) => (item.type !== 'action' && item.isVisible));
9385
- }
9386
9402
  }
9387
9403
 
9388
9404
  class TreeDataStructure {
@@ -10542,7 +10558,7 @@
10542
10558
  });
10543
10559
  }
10544
10560
  }
10545
- core.FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
10561
+ core.FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', eagerMask, }) => {
10546
10562
  if (value === null || value === undefined) {
10547
10563
  return null;
10548
10564
  }
@@ -10574,7 +10590,7 @@
10574
10590
  let masked = value[column];
10575
10591
  if (masks[index]) {
10576
10592
  const maskValue = typeof masks[index] === 'function' ? masks[index](value[column]) : masks[index];
10577
- masked = core.Mask.getValueWithMask(value[column], maskValue);
10593
+ masked = core.Mask.getValueWithMask(value[column], maskValue, false, eagerMask);
10578
10594
  }
10579
10595
  return result + separator + masked;
10580
10596
  }
@@ -12185,7 +12201,8 @@
12185
12201
  }
12186
12202
  }
12187
12203
  return value;
12188
- });
12204
+ });
12205
+ InputFactory.register('ZdMonth', Month);
12189
12206
 
12190
12207
  /**
12191
12208
  * Base class for Password component.
@@ -12975,7 +12992,8 @@
12975
12992
  return formattedRow;
12976
12993
  });
12977
12994
  return formattedValue;
12978
- });
12995
+ });
12996
+ InputFactory.register('ZdSelectMultiple', SelectMultiple);
12979
12997
 
12980
12998
  /**
12981
12999
  * Base class for Select Tree component.
@@ -13569,7 +13587,8 @@
13569
13587
  }
13570
13588
  }
13571
13589
  const selectFormatterFn = core.FormatterParserProvider.getFormatter('ZdSelectMultiple');
13572
- core.FormatterParserProvider.registerFormatter('ZdSelectTreeMultiple', selectFormatterFn);
13590
+ core.FormatterParserProvider.registerFormatter('ZdSelectTreeMultiple', selectFormatterFn);
13591
+ InputFactory.register('ZdSelectTreeMultiple', SelectTreeMultiple);
13573
13592
 
13574
13593
  /**
13575
13594
  * Base class for SelectableList component.
@@ -15994,7 +16013,7 @@
15994
16013
  }
15995
16014
  return row;
15996
16015
  };
15997
- const formatter$1 = ({ column, value, row, componentProps, }) => {
16016
+ const formatter$2 = ({ column, value, row, componentProps, }) => {
15998
16017
  if (value === null || value === undefined)
15999
16018
  return '';
16000
16019
  const { dataText, formatterDataText, dataTextSeparator, dataValue, dataTextDiscrete, foreignColumns, } = componentProps;
@@ -16025,12 +16044,12 @@
16025
16044
  return currentRow[textColumn] || value;
16026
16045
  }
16027
16046
  const formatterFn = core.FormatterParserProvider.getFormatter('ZdSelect');
16028
- return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator });
16047
+ return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator, eagerMask: false });
16029
16048
  };
16030
- core.FormatterParserProvider.registerFormatter('column_ZdSelect', formatter$1);
16031
- core.FormatterParserProvider.registerFormatter('column_ZdSelectTree', formatter$1);
16049
+ core.FormatterParserProvider.registerFormatter('column_ZdSelect', formatter$2);
16050
+ core.FormatterParserProvider.registerFormatter('column_ZdSelectTree', formatter$2);
16032
16051
 
16033
- const formatter = ({ column, value, row, componentProps, }) => {
16052
+ const formatter$1 = ({ column, value, row, componentProps, }) => {
16034
16053
  if (!value || !Array.isArray(value) || value.length === 0)
16035
16054
  return '';
16036
16055
  const { formatterDataText, foreignColumns, dataText } = componentProps;
@@ -16068,8 +16087,12 @@
16068
16087
  });
16069
16088
  return result.join(', ');
16070
16089
  };
16071
- core.FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', formatter);
16072
- core.FormatterParserProvider.registerFormatter('column_ZdSelectTreeMultiple', formatter);
16090
+ core.FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', formatter$1);
16091
+ core.FormatterParserProvider.registerFormatter('column_ZdSelectTreeMultiple', formatter$1);
16092
+
16093
+ const defaultFormatter = core.FormatterParserProvider.getFormatter('ZdTextInput');
16094
+ const formatter = ({ value, componentProps, }) => defaultFormatter(value, Object.assign(Object.assign({}, componentProps), { eagerMask: false }));
16095
+ core.FormatterParserProvider.registerFormatter('column_ZdTextInput', formatter);
16073
16096
 
16074
16097
  const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
16075
16098
  const packageContent = require('../package.json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.112.0",
3
+ "version": "1.113.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -43,5 +43,5 @@
43
43
  "lodash.times": "4.3.*",
44
44
  "mockdate": "3.0.*"
45
45
  },
46
- "gitHead": "bcf25802928f8264bc7810b19a903364f3e371c9"
46
+ "gitHead": "09c421e9201842e6426485730c44dc9a817b9698"
47
47
  }
@@ -132,7 +132,7 @@ export declare class Input extends ComponentRender implements IInput {
132
132
  /**
133
133
  * Sets view validation method.
134
134
  */
135
- setViewValidate(viewValidate: () => boolean | string): void;
135
+ setViewValidate(viewValidate: (force: boolean) => boolean | string): void;
136
136
  /**
137
137
  * Sets view reset validation method.
138
138
  */
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,3 @@
1
1
  import './column-zdselect';
2
2
  import './column-zdselectmultiple';
3
+ import './column-zdtextinput';
@@ -1,17 +1,21 @@
1
1
  import { IDictionary } from '@zeedhi/core';
2
2
  import { IColumn } from '../../../components';
3
- import { IReportType, MetadataFilter, LabelFormatter } from './interfaces';
3
+ import { IReportType, MetadataFilter, LabelFormatter, BuildDatasetParams } from './interfaces';
4
4
  import { ReportColumnTransformer } from './report-column-transformer';
5
5
  export declare abstract class BaseReport implements IReportType {
6
6
  reportColumnTransformer: ReportColumnTransformer;
7
+ labelFormatter?: LabelFormatter;
7
8
  constructor(labelFormatter?: LabelFormatter);
8
9
  protected getReportColumnTransformer(labelFormatter?: LabelFormatter): ReportColumnTransformer;
9
10
  abstract getFileType(): string;
10
11
  abstract route: string;
11
- abstract buildDataset(data: IDictionary<any>[], metadata?: any): any;
12
+ abstract buildDataset(params: BuildDatasetParams): any;
12
13
  abstract buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>, portrait?: boolean): Promise<any>;
14
+ private getColumnLabel;
13
15
  protected buildFilter(filter: IDictionary, columns: IColumn[]): MetadataFilter;
14
16
  protected formatLangCode(lang?: string): string;
15
17
  protected expressionZeedhiToXls: any;
16
18
  protected colunmXLS: string;
19
+ protected filterColumns(columns: IColumn[]): IColumn[];
20
+ protected buildCols(columns: IColumn[]): import("./interfaces").MetadataColumn;
17
21
  }
@@ -1,9 +1,10 @@
1
1
  import { IDictionary } from '@zeedhi/core';
2
2
  import { IColumn } from '../../../components';
3
3
  import { BaseReport } from './base-report';
4
+ import { BuildDatasetParams } from './interfaces';
4
5
  export declare class CSVReport extends BaseReport {
5
6
  getFileType(): string;
6
7
  readonly route: string;
7
- buildDataset(data: IDictionary<any>[], columns: IColumn[]): string;
8
+ buildDataset({ data, columns }: Omit<BuildDatasetParams, 'metadata'>): string;
8
9
  buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>): Promise<string>;
9
10
  }
@@ -1,10 +1,14 @@
1
1
  import { IDictionary } from '@zeedhi/core';
2
2
  import { IColumn } from '../../../components';
3
+ export declare type BuildDatasetParams = {
4
+ data: IDictionary[];
5
+ columns: IColumn[];
6
+ metadata: IMetadataObj;
7
+ };
3
8
  export interface IReportType {
4
9
  readonly route: string;
5
10
  type?: string;
6
- buildDataset(data: IDictionary[], metadata: any): any;
7
- buildDataset(data: IDictionary[], metadata?: any, columns?: IColumn[]): any;
11
+ buildDataset(params: BuildDatasetParams): any;
8
12
  buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary, portrait?: boolean): Promise<any>;
9
13
  }
10
14
  export declare type MetadataColumn = IDictionary<{
@@ -7,7 +7,9 @@ export declare class PDFReport extends BaseReport {
7
7
  getFileType(): string;
8
8
  readonly route: string;
9
9
  protected getReportColumnTransformer(labelFormatter?: LabelFormatter): ReportColumnTransformer;
10
- buildDataset(data: IDictionary<any>[]): string;
10
+ buildDataset({ data }: {
11
+ data: IDictionary[];
12
+ }): string;
11
13
  private getFormatOfColumn;
12
14
  private isNumberComponent;
13
15
  private checkAccessor;
@@ -1,10 +1,11 @@
1
1
  import { IDictionary } from '@zeedhi/core';
2
2
  import { IColumn } from '../../../components';
3
3
  import { BaseReport } from './base-report';
4
+ import { BuildDatasetParams } from './interfaces';
4
5
  export declare class XLSReport extends BaseReport {
5
6
  getFileType(): string;
6
7
  readonly route: string;
7
- buildDataset(data: IDictionary<any>[], columns: IColumn[]): string;
8
+ buildDataset({ data, columns }: Omit<BuildDatasetParams, 'metadata'>): string;
8
9
  private formatRawDataSet;
9
10
  buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>): Promise<string>;
10
11
  }
@@ -1,11 +1,11 @@
1
1
  import { IDictionary } from '@zeedhi/core';
2
2
  import { IColumn } from '../../../components';
3
3
  import { BaseReport } from './base-report';
4
- import { IMetadataObj } from './interfaces';
4
+ import { BuildDatasetParams, IMetadataObj } from './interfaces';
5
5
  export declare class XLS2Report extends BaseReport {
6
6
  getFileType(): string;
7
7
  readonly route: string;
8
- buildDataset(data: IDictionary<any>[], metadata: IMetadataObj): string;
8
+ buildDataset({ data, metadata }: Omit<BuildDatasetParams, 'columns'>): string;
9
9
  buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>): Promise<string>;
10
10
  private getColumnsName;
11
11
  private initVars;
@@ -1,11 +1,11 @@
1
1
  import { IDictionary } from '@zeedhi/core';
2
2
  import { IColumn } from '../../../components';
3
3
  import { BaseReport } from './base-report';
4
- import { IMetadataObj } from './interfaces';
4
+ import { BuildDatasetParams, IMetadataObj } from './interfaces';
5
5
  export declare class XLS3Report extends BaseReport {
6
6
  getFileType(): string;
7
7
  readonly route: string;
8
- buildDataset(data: IDictionary<any>[], metadata: IMetadataObj): string;
8
+ buildDataset({ data, metadata }: Omit<BuildDatasetParams, 'columns'>): string;
9
9
  buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>): Promise<string>;
10
10
  private getColumnsNameFormat3;
11
11
  private initVars;
@@ -14,5 +14,4 @@ export declare class Report implements IReport {
14
14
  private getData;
15
15
  private getReportType;
16
16
  getReport(type: string, portrait?: boolean, rowObj?: any, beforeReportEvent?: IBeforeReportEvent, labelFormatter?: LabelFormatter): Promise<string>;
17
- private filterColumns;
18
17
  }