ng-firebase-table-kxp 1.0.5 → 1.0.7

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.
@@ -1068,7 +1068,9 @@ class TableComponent {
1068
1068
  });
1069
1069
  }
1070
1070
  });
1071
- if (this.data.filterableOptions) {
1071
+ if (this.data.filterableOptions &&
1072
+ Array.isArray(this.data.filterableOptions) &&
1073
+ this.data.filterableOptions.length > 0) {
1072
1074
  this.data.filterableOptions.forEach((option) => this.dropdownItems.push({ ...option, arrange: 'equals' }));
1073
1075
  }
1074
1076
  }
@@ -1109,16 +1111,12 @@ class TableComponent {
1109
1111
  }
1110
1112
  getDisplayValue(col, row, withinLimit = false) {
1111
1113
  let value;
1112
- if (row[col.property] === null || row[col.property] === undefined) {
1113
- return '';
1114
- }
1115
1114
  if (col.calculateValue) {
1116
- value = String(col.calculateValue(row));
1115
+ value = col.calculateValue(row);
1117
1116
  }
1118
1117
  else {
1119
1118
  value = this.getNestedValue(row, col.property);
1120
1119
  }
1121
- // Verifica se é um array e tem arrayField definido
1122
1120
  if (Array.isArray(value) && col.arrayField) {
1123
1121
  value = this.formatArrayValue(value, col.arrayField);
1124
1122
  }
@@ -1126,7 +1124,19 @@ class TableComponent {
1126
1124
  value = row[col.property];
1127
1125
  }
1128
1126
  value = col.pipe ? col.pipe.transform(value) : value;
1129
- return withinLimit ? value : value.substring(0, col.charLimit) + '...';
1127
+ if (value === null || value === undefined) {
1128
+ value = '';
1129
+ }
1130
+ else {
1131
+ value = String(value);
1132
+ }
1133
+ if (typeof value !== 'string') {
1134
+ value = '';
1135
+ }
1136
+ if (withinLimit || !col.charLimit) {
1137
+ return value;
1138
+ }
1139
+ return value.substring(0, col.charLimit) + '...';
1130
1140
  }
1131
1141
  getNestedValue(obj, path) {
1132
1142
  if (!path)
@@ -1586,7 +1596,8 @@ class TableComponent {
1586
1596
  });
1587
1597
  }
1588
1598
  });
1589
- if (this.data.filterableOptions) {
1599
+ if (this.data.filterableOptions &&
1600
+ Array.isArray(this.data.filterableOptions)) {
1590
1601
  this.data.filterableOptions.forEach((option) => this.dropdownItems.push({ ...option, arrange: 'equals' }));
1591
1602
  }
1592
1603
  }