max-agent-ui 0.0.28 → 0.0.29

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.
@@ -1287,18 +1287,29 @@ class MaxAssistantComponent {
1287
1287
  }
1288
1288
  tablePageStatus(table) {
1289
1289
  const pagination = table.pagination;
1290
- return pagination
1291
- ? `${Math.min(table.rows.length, pagination.totalRecords).toLocaleString()} of ${pagination.totalRecords.toLocaleString()} records retrieved`
1292
- : '';
1290
+ if (!pagination) {
1291
+ return '';
1292
+ }
1293
+ const retrieved = table.rows.length;
1294
+ return pagination.totalRecordsExact === false
1295
+ ? `${retrieved.toLocaleString()} ${retrieved === 1 ? 'record' : 'records'} retrieved`
1296
+ : `${Math.min(retrieved, pagination.totalRecords).toLocaleString()} of ${pagination.totalRecords.toLocaleString()} records retrieved`;
1293
1297
  }
1294
1298
  hasNextTablePage(table) {
1295
1299
  const pagination = table.pagination;
1296
- return Boolean(pagination &&
1297
- pagination.remainingRecords > 0 &&
1298
- pagination.nextOffset !== undefined &&
1300
+ if (!pagination || pagination.nextOffset === undefined) {
1301
+ return false;
1302
+ }
1303
+ if (pagination.hasMore !== undefined) {
1304
+ return pagination.hasMore;
1305
+ }
1306
+ return Boolean(pagination.remainingRecords > 0 &&
1299
1307
  table.rows.length < pagination.totalRecords);
1300
1308
  }
1301
1309
  nextTablePageLabel(pagination) {
1310
+ if (pagination.totalRecordsExact === false) {
1311
+ return `Retrieve next ${pagination.pageSize.toLocaleString()} records`;
1312
+ }
1302
1313
  return `Retrieve next ${Math.min(pagination.pageSize, pagination.remainingRecords).toLocaleString()} records`;
1303
1314
  }
1304
1315
  isTablePageLoading(messageId, tableIndex) {
@@ -1515,18 +1526,29 @@ class MaxAssistantComponent {
1515
1526
  }));
1516
1527
  return { ...message, developerTrace };
1517
1528
  }
1518
- const totalRecords = nextTable.pagination?.totalRecords ?? rowOffset + nextTable.rows.length;
1519
- const rows = [...currentTable.rows, ...nextTable.rows].slice(0, totalRecords);
1520
- const remainingRecords = Math.max(totalRecords - rows.length, 0);
1529
+ const nextPagination = nextTable.pagination;
1530
+ const totalRecords = nextPagination?.totalRecords ?? rowOffset + nextTable.rows.length;
1531
+ const totalRecordsExact = nextPagination?.totalRecordsExact !== false;
1532
+ const combinedRows = [...currentTable.rows, ...nextTable.rows];
1533
+ const rows = totalRecordsExact
1534
+ ? combinedRows.slice(0, totalRecords)
1535
+ : combinedRows;
1536
+ const hasMore = nextPagination?.hasMore ??
1537
+ ((nextPagination?.remainingRecords ?? 0) > 0);
1538
+ const remainingRecords = totalRecordsExact
1539
+ ? Math.max(totalRecords - rows.length, 0)
1540
+ : (nextPagination?.remainingRecords ?? 0);
1521
1541
  const pagination = nextTable.pagination
1522
1542
  ? {
1523
1543
  query: nextTable.pagination.query,
1524
1544
  offset: 0,
1525
1545
  pageSize: nextTable.pagination.pageSize,
1526
1546
  totalRecords,
1547
+ totalRecordsExact,
1527
1548
  returnedRecords: rows.length,
1528
1549
  remainingRecords,
1529
- ...(remainingRecords > 0 ? { nextOffset: rows.length } : {})
1550
+ hasMore,
1551
+ ...(hasMore ? { nextOffset: rows.length } : {})
1530
1552
  }
1531
1553
  : currentTable.pagination;
1532
1554
  tables[tableIndex] = {