igniteui-angular 14.2.34 → 14.2.36

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.
@@ -3973,30 +3973,29 @@ class CharSeparatedValueData {
3973
3973
  }
3974
3974
  this._isSpecialData = ExportUtilities.isSpecialData(this._data[0]);
3975
3975
  this._escapeCharacters.push(this._delimiter);
3976
- this._headerRecord = this.processHeaderRecord(keys);
3976
+ this._headerRecord = this.processHeaderRecord(keys, this._data.length);
3977
3977
  this._dataRecords = this.processDataRecords(this._data, keys);
3978
3978
  return this._headerRecord + this._dataRecords;
3979
3979
  }
3980
3980
  prepareDataAsync(done) {
3981
- if (!this._data || this._data.length === 0) {
3982
- done('');
3983
- }
3984
3981
  const columns = this.columns?.filter(c => !c.skip)
3985
3982
  .sort((a, b) => a.startIndex - b.startIndex)
3986
3983
  .sort((a, b) => a.pinnedIndex - b.pinnedIndex);
3987
3984
  const keys = columns && columns.length ? columns.map(c => c.field) : ExportUtilities.getKeysFromData(this._data);
3988
- if (keys.length === 0) {
3989
- done('');
3990
- }
3991
3985
  this._isSpecialData = ExportUtilities.isSpecialData(this._data[0]);
3992
3986
  this._escapeCharacters.push(this._delimiter);
3993
3987
  const headers = columns && columns.length ?
3994
3988
  columns.map(c => c.header ?? c.field) :
3995
3989
  keys;
3996
- this._headerRecord = this.processHeaderRecord(headers);
3997
- this.processDataRecordsAsync(this._data, keys, (dr) => {
3998
- done(this._headerRecord + dr);
3999
- });
3990
+ this._headerRecord = this.processHeaderRecord(headers, this._data.length);
3991
+ if (keys.length === 0 || ((!this._data || this._data.length === 0) && keys.length === 0)) {
3992
+ done('');
3993
+ }
3994
+ else {
3995
+ this.processDataRecordsAsync(this._data, keys, (dr) => {
3996
+ done(this._headerRecord + dr);
3997
+ });
3998
+ }
4000
3999
  }
4001
4000
  processField(value, escapeChars) {
4002
4001
  let safeValue = ExportUtilities.hasValue(value) ? String(value) : '';
@@ -4005,12 +4004,13 @@ class CharSeparatedValueData {
4005
4004
  }
4006
4005
  return safeValue + this._delimiter;
4007
4006
  }
4008
- processHeaderRecord(keys) {
4007
+ processHeaderRecord(keys, dataLength) {
4009
4008
  let recordData = '';
4010
4009
  for (const keyName of keys) {
4011
4010
  recordData += this.processField(keyName, this._escapeCharacters);
4012
4011
  }
4013
- return recordData.slice(0, -this._delimiterLength) + this._eor;
4012
+ const result = recordData.slice(0, -this._delimiterLength);
4013
+ return dataLength > 0 ? result + this._eor : result;
4014
4014
  }
4015
4015
  processRecord(record, keys) {
4016
4016
  const recordData = new Array(keys.length);
@@ -4336,7 +4336,7 @@ class IgxCsvExporterService extends IgxBaseExporter {
4336
4336
  }
4337
4337
  }
4338
4338
  exportFile(data, fileName, fileType) {
4339
- const blob = new Blob(['\ufeff', data], { type: fileType });
4339
+ const blob = new Blob([data ? '\ufeff' : '', data], { type: fileType });
4340
4340
  ExportUtilities.saveBlobToFile(blob, fileName);
4341
4341
  }
4342
4342
  }
@@ -78718,12 +78718,12 @@ class IgxTreeGridNormalizeRecordsPipe {
78718
78718
  const primaryKey = this.grid.primaryKey;
78719
78719
  // using flattened data because origin data may be hierarchical.
78720
78720
  const flatData = this.grid.flatData;
78721
- const res = flatData.map(rec => ({
78721
+ const res = flatData ? flatData.map(rec => ({
78722
78722
  rowID: this.grid.primaryKey ? rec[primaryKey] : rec,
78723
78723
  data: rec,
78724
78724
  level: 0,
78725
78725
  children: []
78726
- }));
78726
+ })) : [];
78727
78727
  return res;
78728
78728
  }
78729
78729
  }