@masterteam/components 0.0.197 → 0.0.198
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.
- package/fesm2022/masterteam-components-entities.mjs +2 -1
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-table.mjs +20 -7
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-entities.d.ts +6 -6
- package/types/masterteam-components-table.d.ts +20 -0
|
@@ -1226,7 +1226,24 @@ class TableExportService {
|
|
|
1226
1226
|
document.head.appendChild(style);
|
|
1227
1227
|
}
|
|
1228
1228
|
getExportableColumns(columns) {
|
|
1229
|
-
return columns.filter((column) => !column.filterOnly &&
|
|
1229
|
+
return columns.filter((column) => !column.filterOnly &&
|
|
1230
|
+
(column.type !== 'custom' ||
|
|
1231
|
+
column.exportable === true ||
|
|
1232
|
+
!!column.exportValue));
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Resolves a single cell's exported/printed scalar. A column-level
|
|
1236
|
+
* `exportValue` always wins; entity columns use the dedicated entity
|
|
1237
|
+
* resolver; everything else defers to the caller-supplied `resolveValue`.
|
|
1238
|
+
*/
|
|
1239
|
+
resolveCellValue(row, column, resolveValue) {
|
|
1240
|
+
if (column.exportValue) {
|
|
1241
|
+
return column.exportValue(row);
|
|
1242
|
+
}
|
|
1243
|
+
if (column.type === 'entity') {
|
|
1244
|
+
return TableValueResolver.getEntityValueByType(TableValueResolver.getProperty(row, column.key), 'export');
|
|
1245
|
+
}
|
|
1246
|
+
return resolveValue(row, column);
|
|
1230
1247
|
}
|
|
1231
1248
|
/**
|
|
1232
1249
|
* Produces rows keyed by column label (Excel header row).
|
|
@@ -1236,9 +1253,7 @@ class TableExportService {
|
|
|
1236
1253
|
return rows.map((row) => {
|
|
1237
1254
|
const labeledRow = {};
|
|
1238
1255
|
columns.forEach((column) => {
|
|
1239
|
-
const cellValue =
|
|
1240
|
-
? TableValueResolver.getEntityValueByType(TableValueResolver.getProperty(row, column.key), 'export')
|
|
1241
|
-
: resolveValue(row, column);
|
|
1256
|
+
const cellValue = this.resolveCellValue(row, column, resolveValue);
|
|
1242
1257
|
labeledRow[column.label] = cellValue ?? null;
|
|
1243
1258
|
});
|
|
1244
1259
|
return labeledRow;
|
|
@@ -1267,9 +1282,7 @@ class TableExportService {
|
|
|
1267
1282
|
const tr = document.createElement('tr');
|
|
1268
1283
|
columns.forEach((column) => {
|
|
1269
1284
|
const td = document.createElement('td');
|
|
1270
|
-
const cellValue =
|
|
1271
|
-
? TableValueResolver.getEntityValueByType(TableValueResolver.getProperty(row, column.key), 'export')
|
|
1272
|
-
: config.resolveValue(row, column);
|
|
1285
|
+
const cellValue = this.resolveCellValue(row, column, config.resolveValue);
|
|
1273
1286
|
td.textContent = cellValue === null ? '' : String(cellValue);
|
|
1274
1287
|
tr.appendChild(td);
|
|
1275
1288
|
});
|