@masterteam/components 0.0.197 → 0.0.199
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 +20 -5
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-table.mjs +29 -11
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-entities.d.ts +8 -6
- package/types/masterteam-components-table.d.ts +20 -0
|
@@ -339,7 +339,9 @@ class TableValueResolver {
|
|
|
339
339
|
const itemDateValue = filterType === 'date'
|
|
340
340
|
? typeof normalizedFilterValue === 'number'
|
|
341
341
|
? normalizedFilterValue
|
|
342
|
-
: null
|
|
342
|
+
: normalizedFilterValue != null && normalizedFilterValue !== ''
|
|
343
|
+
? new Date(String(normalizedFilterValue)).getTime()
|
|
344
|
+
: null
|
|
343
345
|
: itemValue instanceof Date
|
|
344
346
|
? itemValue.getTime()
|
|
345
347
|
: new Date(String(itemValue)).getTime();
|
|
@@ -352,9 +354,12 @@ class TableValueResolver {
|
|
|
352
354
|
itemDateValue < new Date(objectFilter.from).getTime()) {
|
|
353
355
|
return false;
|
|
354
356
|
}
|
|
355
|
-
if (objectFilter.to
|
|
356
|
-
|
|
357
|
-
|
|
357
|
+
if (objectFilter.to) {
|
|
358
|
+
const toDate = new Date(objectFilter.to);
|
|
359
|
+
toDate.setHours(23, 59, 59, 999);
|
|
360
|
+
if (itemDateValue > toDate.getTime()) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
358
363
|
}
|
|
359
364
|
return true;
|
|
360
365
|
}
|
|
@@ -1226,7 +1231,24 @@ class TableExportService {
|
|
|
1226
1231
|
document.head.appendChild(style);
|
|
1227
1232
|
}
|
|
1228
1233
|
getExportableColumns(columns) {
|
|
1229
|
-
return columns.filter((column) => !column.filterOnly &&
|
|
1234
|
+
return columns.filter((column) => !column.filterOnly &&
|
|
1235
|
+
(column.type !== 'custom' ||
|
|
1236
|
+
column.exportable === true ||
|
|
1237
|
+
!!column.exportValue));
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Resolves a single cell's exported/printed scalar. A column-level
|
|
1241
|
+
* `exportValue` always wins; entity columns use the dedicated entity
|
|
1242
|
+
* resolver; everything else defers to the caller-supplied `resolveValue`.
|
|
1243
|
+
*/
|
|
1244
|
+
resolveCellValue(row, column, resolveValue) {
|
|
1245
|
+
if (column.exportValue) {
|
|
1246
|
+
return column.exportValue(row);
|
|
1247
|
+
}
|
|
1248
|
+
if (column.type === 'entity') {
|
|
1249
|
+
return TableValueResolver.getEntityValueByType(TableValueResolver.getProperty(row, column.key), 'export');
|
|
1250
|
+
}
|
|
1251
|
+
return resolveValue(row, column);
|
|
1230
1252
|
}
|
|
1231
1253
|
/**
|
|
1232
1254
|
* Produces rows keyed by column label (Excel header row).
|
|
@@ -1236,9 +1258,7 @@ class TableExportService {
|
|
|
1236
1258
|
return rows.map((row) => {
|
|
1237
1259
|
const labeledRow = {};
|
|
1238
1260
|
columns.forEach((column) => {
|
|
1239
|
-
const cellValue =
|
|
1240
|
-
? TableValueResolver.getEntityValueByType(TableValueResolver.getProperty(row, column.key), 'export')
|
|
1241
|
-
: resolveValue(row, column);
|
|
1261
|
+
const cellValue = this.resolveCellValue(row, column, resolveValue);
|
|
1242
1262
|
labeledRow[column.label] = cellValue ?? null;
|
|
1243
1263
|
});
|
|
1244
1264
|
return labeledRow;
|
|
@@ -1267,9 +1287,7 @@ class TableExportService {
|
|
|
1267
1287
|
const tr = document.createElement('tr');
|
|
1268
1288
|
columns.forEach((column) => {
|
|
1269
1289
|
const td = document.createElement('td');
|
|
1270
|
-
const cellValue =
|
|
1271
|
-
? TableValueResolver.getEntityValueByType(TableValueResolver.getProperty(row, column.key), 'export')
|
|
1272
|
-
: config.resolveValue(row, column);
|
|
1290
|
+
const cellValue = this.resolveCellValue(row, column, config.resolveValue);
|
|
1273
1291
|
td.textContent = cellValue === null ? '' : String(cellValue);
|
|
1274
1292
|
tr.appendChild(td);
|
|
1275
1293
|
});
|