blixify-ui-web 1.2.162 → 1.2.165

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.
Files changed (32) hide show
  1. package/lib/components/data/dataTemplate/activityChanges.d.ts +12 -4
  2. package/lib/components/data/dataTemplate/activityChanges.d.ts.map +1 -1
  3. package/lib/components/data/dataTemplate/activityChanges.js +256 -53
  4. package/lib/components/data/dataTemplate/activityChanges.js.map +1 -1
  5. package/lib/components/data/dataTemplate/activityModal.d.ts +3 -1
  6. package/lib/components/data/dataTemplate/activityModal.d.ts.map +1 -1
  7. package/lib/components/data/dataTemplate/activityModal.js +45 -28
  8. package/lib/components/data/dataTemplate/activityModal.js.map +1 -1
  9. package/lib/components/data/dataTemplate/dataStateModel.d.ts +1 -0
  10. package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
  11. package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
  12. package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
  13. package/lib/components/data/dataTemplate/index.js +398 -61
  14. package/lib/components/data/dataTemplate/index.js.map +1 -1
  15. package/lib/components/data/dataTemplate/viewStatePersistence.d.ts +1 -0
  16. package/lib/components/data/dataTemplate/viewStatePersistence.d.ts.map +1 -1
  17. package/lib/components/data/dataTemplate/viewStatePersistence.js +2 -1
  18. package/lib/components/data/dataTemplate/viewStatePersistence.js.map +1 -1
  19. package/lib/components/data/utils.d.ts +1 -0
  20. package/lib/components/data/utils.d.ts.map +1 -1
  21. package/lib/components/data/utils.js +20 -8
  22. package/lib/components/data/utils.js.map +1 -1
  23. package/lib/components/display/newTable/index.d.ts +13 -1
  24. package/lib/components/display/newTable/index.d.ts.map +1 -1
  25. package/lib/components/display/newTable/index.js +292 -54
  26. package/lib/components/display/newTable/index.js.map +1 -1
  27. package/lib/components/navigation/leftNav/index.d.ts +25 -0
  28. package/lib/components/navigation/leftNav/index.d.ts.map +1 -1
  29. package/lib/components/navigation/leftNav/index.js +62 -0
  30. package/lib/components/navigation/leftNav/index.js.map +1 -1
  31. package/lib/tail.css +2 -2
  32. package/package.json +1 -1
@@ -477,59 +477,73 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
477
477
  var _162 = (0, react_1.useState)(undefined), allQueryList = _162[0], setAllQueryList = _162[1];
478
478
  var _163 = (0, react_1.useState)(-1), queryIndex = _163[0], setQueryIndex = _163[1];
479
479
  var _164 = (0, react_1.useState)((_y = props.organise) === null || _y === void 0 ? void 0 : _y.groupBy), groupId = _164[0], setGroupId = _164[1];
480
- var _165 = (0, react_1.useState)(""), readTabSection = _165[0], setReadTabSection = _165[1];
481
- var _166 = (0, react_1.useState)(false), readFloatingNav = _166[0], setReadFloatingNav = _166[1];
480
+ // INFO: Monday-board per-group paging. Keyed by the group key that
481
+ // handleBuildNewTableGroups() produces (a list option or "Unknown/No Value").
482
+ // Each group tracks its own loaded cursor + total so it can lazily load its
483
+ // next page as the user scrolls inside that band, independent of every other
484
+ // group. Only used when renderCheckGroupPaging() is true.
485
+ var _165 = (0, react_1.useState)({}), groupPageState = _165[0], setGroupPageState = _165[1];
486
+ // INFO: read fresh inside the async per-group fetch so chained scroll fires
487
+ // in one tick do not re-fetch an already in-flight page.
488
+ var groupPageStateRef = (0, react_1.useRef)({});
489
+ groupPageStateRef.current = groupPageState;
490
+ // INFO: bumped on every fresh read, so a group page requested before the
491
+ // list was re-read (new search, filter, sort or grouping) is dropped on
492
+ // arrival instead of appending rows that belong to the old list
493
+ var groupPagingGenRef = (0, react_1.useRef)(0);
494
+ var _166 = (0, react_1.useState)(""), readTabSection = _166[0], setReadTabSection = _166[1];
495
+ var _167 = (0, react_1.useState)(false), readFloatingNav = _167[0], setReadFloatingNav = _167[1];
482
496
  var readTabSectionRefs = (0, react_1.useRef)({});
483
497
  //INFO : Used by Read
484
498
  //INFO : Used by Update
485
- var _167 = (0, react_1.useState)(false), modalVisible = _167[0], setModalVisible = _167[1];
486
- var _168 = (0, react_1.useState)(false), deleteModal = _168[0], setDeleteModal = _168[1];
487
- var _169 = (0, react_1.useState)(false), excelModal = _169[0], setExcelModal = _169[1];
488
- var _170 = (0, react_1.useState)(false), exportExcel = _170[0], setExportExcel = _170[1];
489
- var _171 = (0, react_1.useState)(""), exportType = _171[0], setExportType = _171[1];
490
- var _172 = (0, react_1.useState)(false), exportQR = _172[0], setExportQR = _172[1];
491
- var _173 = (0, react_1.useState)(function () {
499
+ var _168 = (0, react_1.useState)(false), modalVisible = _168[0], setModalVisible = _168[1];
500
+ var _169 = (0, react_1.useState)(false), deleteModal = _169[0], setDeleteModal = _169[1];
501
+ var _170 = (0, react_1.useState)(false), excelModal = _170[0], setExcelModal = _170[1];
502
+ var _171 = (0, react_1.useState)(false), exportExcel = _171[0], setExportExcel = _171[1];
503
+ var _172 = (0, react_1.useState)(""), exportType = _172[0], setExportType = _172[1];
504
+ var _173 = (0, react_1.useState)(false), exportQR = _173[0], setExportQR = _173[1];
505
+ var _174 = (0, react_1.useState)(function () {
492
506
  var _a, _b;
493
507
  var firstTabId = (_b = (_a = structure.find(function (item) { return item.tabId; })) === null || _a === void 0 ? void 0 : _a.tabId) !== null && _b !== void 0 ? _b : "";
494
508
  return firstTabId;
495
- }), activeTab = _173[0], setActiveTab = _173[1];
496
- var _174 = (0, react_1.useState)(false), signatureSigning = _174[0], setSignatureSigning = _174[1];
497
- var _175 = (0, react_1.useState)({}), selectedData = _175[0], setSelectedData = _175[1];
498
- var _176 = (0, react_1.useState)(""), selectedObjectStructureId = _176[0], setSelectedObjectStructureId = _176[1];
499
- var _177 = (0, react_1.useState)(""), selectedObjectId = _177[0], setSelectedObjectId = _177[1];
500
- var _178 = (0, react_1.useState)(""), selectedListAddressId = _178[0], setSelectedListAddressId = _178[1];
501
- var _179 = (0, react_1.useState)(-1), selectedListAddressIndex = _179[0], setSelectedListAddressIndex = _179[1];
502
- var _180 = (0, react_1.useState)({
509
+ }), activeTab = _174[0], setActiveTab = _174[1];
510
+ var _175 = (0, react_1.useState)(false), signatureSigning = _175[0], setSignatureSigning = _175[1];
511
+ var _176 = (0, react_1.useState)({}), selectedData = _176[0], setSelectedData = _176[1];
512
+ var _177 = (0, react_1.useState)(""), selectedObjectStructureId = _177[0], setSelectedObjectStructureId = _177[1];
513
+ var _178 = (0, react_1.useState)(""), selectedObjectId = _178[0], setSelectedObjectId = _178[1];
514
+ var _179 = (0, react_1.useState)(""), selectedListAddressId = _179[0], setSelectedListAddressId = _179[1];
515
+ var _180 = (0, react_1.useState)(-1), selectedListAddressIndex = _180[0], setSelectedListAddressIndex = _180[1];
516
+ var _181 = (0, react_1.useState)({
503
517
  lat: 0,
504
518
  lng: 0,
505
519
  name: "",
506
- }), selectedListAddress = _180[0], setSelectedListAddress = _180[1];
507
- var _181 = (0, react_1.useState)({}), selectedObjectData = _181[0], setSelectedObjectData = _181[1];
508
- var _182 = (0, react_1.useState)(null), objectCellEdit = _182[0], setObjectCellEdit = _182[1];
509
- var _183 = (0, react_1.useState)(false), referenceLoading = _183[0], setReferenceLoading = _183[1];
510
- var _184 = (0, react_1.useState)({}), referencesOptions = _184[0], setReferencesOptions = _184[1];
511
- var _185 = (0, react_1.useState)({}), referencesDetails = _185[0], setReferencesDetails = _185[1];
512
- var _186 = (0, react_1.useState)({}), listReferencesOptions = _186[0], setListReferencesOptions = _186[1];
513
- var _187 = (0, react_1.useState)({}), referenceDeleteTableData = _187[0], setReferenceDeleteTableData = _187[1];
514
- var _188 = (0, react_1.useState)([]), relatedSections = _188[0], setRelatedSections = _188[1];
515
- var _189 = (0, react_1.useState)(0), referenceDeleteIndex = _189[0], setReferenceDeleteIndex = _189[1];
516
- var _190 = (0, react_1.useState)({
520
+ }), selectedListAddress = _181[0], setSelectedListAddress = _181[1];
521
+ var _182 = (0, react_1.useState)({}), selectedObjectData = _182[0], setSelectedObjectData = _182[1];
522
+ var _183 = (0, react_1.useState)(null), objectCellEdit = _183[0], setObjectCellEdit = _183[1];
523
+ var _184 = (0, react_1.useState)(false), referenceLoading = _184[0], setReferenceLoading = _184[1];
524
+ var _185 = (0, react_1.useState)({}), referencesOptions = _185[0], setReferencesOptions = _185[1];
525
+ var _186 = (0, react_1.useState)({}), referencesDetails = _186[0], setReferencesDetails = _186[1];
526
+ var _187 = (0, react_1.useState)({}), listReferencesOptions = _187[0], setListReferencesOptions = _187[1];
527
+ var _188 = (0, react_1.useState)({}), referenceDeleteTableData = _188[0], setReferenceDeleteTableData = _188[1];
528
+ var _189 = (0, react_1.useState)([]), relatedSections = _189[0], setRelatedSections = _189[1];
529
+ var _190 = (0, react_1.useState)(0), referenceDeleteIndex = _190[0], setReferenceDeleteIndex = _190[1];
530
+ var _191 = (0, react_1.useState)({
517
531
  id: "",
518
532
  name: "",
519
533
  type: "string",
520
- }), referenceCreationModal = _190[0], setReferenceCreationModal = _190[1];
521
- var _191 = (0, react_1.useState)({}), referenceModelSchema = _191[0], setReferenceSchema = _191[1];
522
- var _192 = (0, react_1.useState)([]), kanbanChecked = _192[0], setKanbanChecked = _192[1];
534
+ }), referenceCreationModal = _191[0], setReferenceCreationModal = _191[1];
535
+ var _192 = (0, react_1.useState)({}), referenceModelSchema = _192[0], setReferenceSchema = _192[1];
536
+ var _193 = (0, react_1.useState)([]), kanbanChecked = _193[0], setKanbanChecked = _193[1];
523
537
  //INFO : Offline
524
- var _193 = (0, react_1.useState)(0), offlineDataLength = _193[0], setOfflineDataLength = _193[1];
525
- var _194 = (0, react_1.useState)(false), offlineModal = _194[0], setOfflineModal = _194[1];
538
+ var _194 = (0, react_1.useState)(0), offlineDataLength = _194[0], setOfflineDataLength = _194[1];
539
+ var _195 = (0, react_1.useState)(false), offlineModal = _195[0], setOfflineModal = _195[1];
526
540
  // INFO: live-stream state — driven by socket connection and navigator.onLine
527
- var _195 = (0, react_1.useState)(false), isLive = _195[0], setIsLive = _195[1];
528
- var _196 = (0, react_1.useState)(false), isLiveOffline = _196[0], setIsLiveOffline = _196[1];
541
+ var _196 = (0, react_1.useState)(false), isLive = _196[0], setIsLive = _196[1];
542
+ var _197 = (0, react_1.useState)(false), isLiveOffline = _197[0], setIsLiveOffline = _197[1];
529
543
  // INFO: true when navigator is offline — used to switch ReadQueryHoc between
530
544
  // server reads (online, full pagination) and IndexedDB reads (offline, cached data).
531
545
  // Independent of SSE status so it works even when bareSocketName is not set.
532
- var _197 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _197[0], setIsNetworkOffline = _197[1];
546
+ var _198 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _198[0], setIsNetworkOffline = _198[1];
533
547
  var previousType = (0, react_1.useRef)(null);
534
548
  var previousSelectedData = (0, react_1.useRef)(null);
535
549
  var scrollSentinelRef = (0, react_1.useRef)(null);
@@ -746,7 +760,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
746
760
  var isSchemaHideMode = ((_10 = props.organise) === null || _10 === void 0 ? void 0 : _10.onChangeHide) ? true : false;
747
761
  // INFO: rows per page is a view setting the user can change, so it starts from
748
762
  // the persisted value and falls back to the consumer's limit
749
- var _198 = (0, react_1.useState)((_12 = (_11 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _11 !== void 0 ? _11 : props.limit) !== null && _12 !== void 0 ? _12 : 10), pageLimit = _198[0], setPageLimit = _198[1];
763
+ var _199 = (0, react_1.useState)((_12 = (_11 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _11 !== void 0 ? _11 : props.limit) !== null && _12 !== void 0 ? _12 : 10), pageLimit = _199[0], setPageLimit = _199[1];
750
764
  var limit = pageLimit;
751
765
  var isSavedViewsEnabled = !!((_13 = props.organise) === null || _13 === void 0 ? void 0 : _13.savedViews) && resolvedType === "list";
752
766
  // INFO: an app that stores views takes over from this browser's storage, so
@@ -771,7 +785,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
771
785
  setCursor("");
772
786
  setLastCursor("");
773
787
  };
774
- var _199 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _199.canUpdateRecord, canInlineUpdate = _199.canInlineUpdate, canBatchUpdate = _199.canBatchUpdate, canDeleteRecord = _199.canDeleteRecord;
788
+ var _200 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _200.canUpdateRecord, canInlineUpdate = _200.canInlineUpdate, canBatchUpdate = _200.canBatchUpdate, canDeleteRecord = _200.canDeleteRecord;
775
789
  var isEditor = ((_17 = props.edit) === null || _17 === void 0 ? void 0 : _17.allEditable) ? true : false;
776
790
  var isOffline = (_18 = props.bareSettings) === null || _18 === void 0 ? void 0 : _18.bareOffline;
777
791
  // INFO: when bareOfflineNetworkAware is true, the save path is also gated on
@@ -1213,7 +1227,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1213
1227
  // INFO: scroll mode reloads from page 0; the anchor restores the position
1214
1228
  pageIndex: renderCheckScrollMode() ? 0 : pageIndex, hiddenColumnIds: structure.filter(function (col) { return col.hide; }).map(function (col) { return col.id; }),
1215
1229
  // INFO: raw, so switching bareViewSettings off does not wipe the user's choice
1216
- userHiddenColumnIds: userHiddenColumnIds, columnOrder: structure.map(function (col) { return col.id; }) }, scrollCaptureRef.current));
1230
+ userHiddenColumnIds: userHiddenColumnIds, columnOrder: structure.map(function (col) { return col.id; }), groupBy: groupId !== null && groupId !== void 0 ? groupId : "" }, scrollCaptureRef.current));
1217
1231
  };
1218
1232
  handleRegisterViewSnapshot(handleBuildViewSnapshot);
1219
1233
  //=====================================================================================
@@ -1330,11 +1344,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1330
1344
  // INFO: a view is the defaults overridden by its own fields, so a field it
1331
1345
  // leaves out is reset rather than carried over from whatever was on screen
1332
1346
  var handleResolveViewState = function (state) {
1333
- var _a, _b, _c, _d;
1347
+ var _a, _b, _c, _d, _e, _f;
1334
1348
  var model = (_a = props.model) !== null && _a !== void 0 ? _a : [];
1335
- return ((_d = (0, viewStatePersistence_1.handlePruneStaleColumns)(__assign({ filterSearchParams: initialFilterSearchParams, filterSelection: initialFilterSelection, filterReference: initialFilterReference, filterReferenceDate: (0, viewStatePersistence_1.serializeDateFilterState)(initialFilterReferenceDate), sort: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.sort, pageLimit: (_c = props.limit) !== null && _c !== void 0 ? _c : 10, userHiddenColumnIds: [], hiddenColumnIds: model
1349
+ return ((_f = (0, viewStatePersistence_1.handlePruneStaleColumns)(__assign({ filterSearchParams: initialFilterSearchParams, filterSelection: initialFilterSelection, filterReference: initialFilterReference, filterReferenceDate: (0, viewStatePersistence_1.serializeDateFilterState)(initialFilterReferenceDate), sort: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.sort, pageLimit: (_c = props.limit) !== null && _c !== void 0 ? _c : 10, userHiddenColumnIds: [], hiddenColumnIds: model
1336
1350
  .filter(function (eachColumn) { return eachColumn.hide; })
1337
- .map(function (eachColumn) { return eachColumn.id; }), columnOrder: model.map(function (eachColumn) { return eachColumn.id; }) }, (state !== null && state !== void 0 ? state : {})), model)) !== null && _d !== void 0 ? _d : {});
1351
+ .map(function (eachColumn) { return eachColumn.id; }), columnOrder: model.map(function (eachColumn) { return eachColumn.id; }), groupBy: (_e = (_d = props.organise) === null || _d === void 0 ? void 0 : _d.groupBy) !== null && _e !== void 0 ? _e : "" }, (state !== null && state !== void 0 ? state : {})), model)) !== null && _f !== void 0 ? _f : {});
1338
1352
  };
1339
1353
  var handleApplyViewColumns = function (columns, state) {
1340
1354
  var _a;
@@ -1349,11 +1363,21 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1349
1363
  return (__assign(__assign({}, eachColumn), { hide: (_b = (_a = state.hiddenColumnIds) === null || _a === void 0 ? void 0 : _a.includes(eachColumn.id)) !== null && _b !== void 0 ? _b : false }));
1350
1364
  });
1351
1365
  };
1366
+ // INFO: notify — only a user's choice is handed back; a list opening on a
1367
+ // view or syncing the host's own groupBy tells the host nothing new
1368
+ var handleChangeGroupBy = function (value, notify) {
1369
+ var _a, _b;
1370
+ if (value === (groupId !== null && groupId !== void 0 ? groupId : ""))
1371
+ return;
1372
+ setGroupId(value);
1373
+ if (notify)
1374
+ (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeGroupBy) === null || _b === void 0 ? void 0 : _b.call(_a, value);
1375
+ };
1352
1376
  // INFO: isOpening — the list opening on a view tells the host nothing new,
1353
1377
  // so its sort is not handed back (a host saving sort would write it on
1354
1378
  // every open)
1355
1379
  var handleApplySavedView = function (view, isOpening) {
1356
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
1380
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1357
1381
  var next = handleResolveViewState((_a = view === null || view === void 0 ? void 0 : view.state) !== null && _a !== void 0 ? _a : null);
1358
1382
  var isQueryChanged = !(0, viewStatePersistence_1.handleIsSameViewState)((0, viewStatePersistence_1.handlePickQueryState)(handleBuildViewSnapshot()), (0, viewStatePersistence_1.handlePickQueryState)(next));
1359
1383
  handleClearFlexFilterTypingTimeout();
@@ -1376,7 +1400,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1376
1400
  (_h = (_g = props.organise) === null || _g === void 0 ? void 0 : _g.onChangeSort) === null || _h === void 0 ? void 0 : _h.call(_g, next.sort);
1377
1401
  if (next.pageLimit)
1378
1402
  setPageLimit(next.pageLimit);
1379
- setUserHiddenColumnIds((_j = next.userHiddenColumnIds) !== null && _j !== void 0 ? _j : []);
1403
+ handleChangeGroupBy((_j = next.groupBy) !== null && _j !== void 0 ? _j : "", !isOpening);
1404
+ setUserHiddenColumnIds((_k = next.userHiddenColumnIds) !== null && _k !== void 0 ? _k : []);
1380
1405
  if (view) {
1381
1406
  if (!schemaStructureRef.current)
1382
1407
  schemaStructureRef.current = structure;
@@ -1391,12 +1416,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1391
1416
  pendingViewCondKeyRef.current = JSON.stringify(handleReadQueryHocCond());
1392
1417
  handleClearDataByFilter();
1393
1418
  if (pageIndex !== 0)
1394
- (_l = (_k = props.organise) === null || _k === void 0 ? void 0 : _k.onChangePagination) === null || _l === void 0 ? void 0 : _l.call(_k, 0);
1395
- (_o = (_m = props.bareSettings) === null || _m === void 0 ? void 0 : _m.bareListHandleFilter) === null || _o === void 0 ? void 0 : _o.call(_m, (_p = next.filterSearchParams) !== null && _p !== void 0 ? _p : {}, (_q = next.filterSelection) !== null && _q !== void 0 ? _q : {}, next.filterReferenceDate
1419
+ (_m = (_l = props.organise) === null || _l === void 0 ? void 0 : _l.onChangePagination) === null || _m === void 0 ? void 0 : _m.call(_l, 0);
1420
+ (_p = (_o = props.bareSettings) === null || _o === void 0 ? void 0 : _o.bareListHandleFilter) === null || _p === void 0 ? void 0 : _p.call(_o, (_q = next.filterSearchParams) !== null && _q !== void 0 ? _q : {}, (_r = next.filterSelection) !== null && _r !== void 0 ? _r : {}, next.filterReferenceDate
1396
1421
  ? (0, viewStatePersistence_1.parseDateFilterState)(next.filterReferenceDate)
1397
- : initialFilterReferenceDate, (_r = next.filterReference) !== null && _r !== void 0 ? _r : {});
1422
+ : initialFilterReferenceDate, (_s = next.filterReference) !== null && _s !== void 0 ? _s : {});
1398
1423
  }
1399
- setActiveSavedViewId((_s = view === null || view === void 0 ? void 0 : view.id) !== null && _s !== void 0 ? _s : null);
1424
+ setActiveSavedViewId((_t = view === null || view === void 0 ? void 0 : view.id) !== null && _t !== void 0 ? _t : null);
1400
1425
  setDeletingSavedViewId(null);
1401
1426
  };
1402
1427
  // INFO: re-read storage before each write so a change made in another browser
@@ -2556,7 +2581,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2556
2581
  return sort;
2557
2582
  };
2558
2583
  var handleReadQueryHocCond = function () {
2559
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2584
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
2560
2585
  var query = (_a = renderImpSearchFilterConditions()) !== null && _a !== void 0 ? _a : [];
2561
2586
  var calendarSettings = false;
2562
2587
  if (selectedTab && selectedTab.viewType === "calendar") {
@@ -2577,7 +2602,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2577
2602
  startDate = (0, dayjs_1.default)(calendarTabMonth).startOf("isoWeek").toDate();
2578
2603
  endDate = (0, dayjs_1.default)(calendarTabMonth).endOf("isoWeek").toDate();
2579
2604
  if ((_d = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.calendarSettings) === null || _d === void 0 ? void 0 : _d.customView) {
2580
- var _v = (_e = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.calendarSettings) === null || _e === void 0 ? void 0 : _e.customView, view = _v.view, duration = _v.duration;
2605
+ var _w = (_e = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.calendarSettings) === null || _e === void 0 ? void 0 : _e.customView, view = _w.view, duration = _w.duration;
2581
2606
  if (view &&
2582
2607
  duration &&
2583
2608
  view === "week" &&
@@ -2694,13 +2719,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2694
2719
  (selectedTab &&
2695
2720
  (selectedTab.viewType === "map" ||
2696
2721
  selectedTab.viewType === "timeline")) ||
2697
- groupId) {
2722
+ // INFO: the legacy grouped list renders one table per group and needs
2723
+ // every row. NewTable bands are built from whatever rows are loaded, so
2724
+ // it keeps normal page reads: page mode groups the rows of the current
2725
+ // page, and scroll mode pages each band (handleFetchGroupNextPage). A
2726
+ // full read there also broke the pager — page 2 skipped the first page
2727
+ // of a list that was already complete.
2728
+ (groupId && !((_t = props.bareSettings) === null || _t === void 0 ? void 0 : _t.bareNewDTW))) {
2698
2729
  // INFO: a Gantt needs every bar at once — a page of rows would hide
2699
2730
  // spans that fall outside it, so fetch the full set like map/calendar
2700
2731
  cond.limit = undefined;
2701
2732
  cond.stopLimit = true;
2702
2733
  }
2703
- else if ((_u = (_t = props.organise) === null || _t === void 0 ? void 0 : _t.unionCollections) === null || _u === void 0 ? void 0 : _u.length) {
2734
+ else if ((_v = (_u = props.organise) === null || _u === void 0 ? void 0 : _u.unionCollections) === null || _v === void 0 ? void 0 : _v.length) {
2704
2735
  // INFO: a union request only carries `skip`, so the page offset goes there, and
2705
2736
  // `_id` keeps the order stable between page requests
2706
2737
  cond.skip = (0, unionPagination_1.handleGetUnionPageSkip)(pageIndex, limit);
@@ -2929,6 +2960,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2929
2960
  if (!isScrollMode && !isFirebase) {
2930
2961
  handleSetListData(dataList, prettierDataList);
2931
2962
  setSize((_j = responseData.count) !== null && _j !== void 0 ? _j : 0);
2963
+ if (renderCheckGroupPaging())
2964
+ handleLoadGroupFirstPages();
2932
2965
  }
2933
2966
  else {
2934
2967
  newTableData = [];
@@ -2936,6 +2969,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2936
2969
  if (!isFirebase && requestCond) {
2937
2970
  isFirstPage = !requestCond.cursor && !requestCond.skip;
2938
2971
  if (isFirstPage) {
2972
+ // INFO: per-group cursors and "exhausted" flags describe the old
2973
+ // list; keeping them would skip rows or stop a group early
2974
+ groupPagingGenRef.current += 1;
2975
+ groupPageStateRef.current = {};
2976
+ setGroupPageState({});
2939
2977
  newTableData = dataList;
2940
2978
  newPrettierTableData = prettierDataList;
2941
2979
  }
@@ -3019,6 +3057,28 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3019
3057
  // INFO: keep polling ref current so the setInterval always fires the latest
3020
3058
  // handleRefresh closure (captures current filters, pagination, etc.)
3021
3059
  handleRefreshRef.current = handleRefresh;
3060
+ // INFO: scroll mode keeps every loaded row, and bands seed their cursor from
3061
+ // the rows they already hold — rows loaded for the old grouping are not the
3062
+ // first rows of the new groups, so a regroup starts the list over
3063
+ var previousGroupIdRef = (0, react_1.useRef)(groupId !== null && groupId !== void 0 ? groupId : "");
3064
+ (0, react_1.useEffect)(function () {
3065
+ var _a, _b;
3066
+ // INFO: undefined and "" are both ungrouped, as the host sync sets on mount
3067
+ if ((groupId !== null && groupId !== void 0 ? groupId : "") === previousGroupIdRef.current)
3068
+ return;
3069
+ previousGroupIdRef.current = groupId !== null && groupId !== void 0 ? groupId : "";
3070
+ if (!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW) || isFirebase)
3071
+ return;
3072
+ if (renderResolvedPaginationType() === "cursor")
3073
+ return;
3074
+ var isFirstPage = pageIndex === 0;
3075
+ handleClearDataByFilter();
3076
+ // INFO: from page 0 the request does not change, so ask for the read
3077
+ if (isFirstPage)
3078
+ (_b = listRQueryHocRef.current) === null || _b === void 0 ? void 0 : _b.handleRefresh();
3079
+ /* eslint-disable */
3080
+ }, [groupId]);
3081
+ /* eslint-enable */
3022
3082
  var handleObjectReferenceOptions = function () { return __awaiter(void 0, void 0, void 0, function () {
3023
3083
  var clonedOptions_1, clonedDetails_1, model, err_2;
3024
3084
  var _a;
@@ -3093,6 +3153,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3093
3153
  setCursor("");
3094
3154
  setLastCursor("");
3095
3155
  setTableLoading(true);
3156
+ // INFO: band totals, cursors and "exhausted" flags describe the list being
3157
+ // cleared; dropping them now keeps a stale total off an emptied band and
3158
+ // any band page still in flight off the new list
3159
+ groupPagingGenRef.current += 1;
3160
+ groupPageStateRef.current = {};
3161
+ setGroupPageState({});
3096
3162
  // INFO: In scroll mode, accumulated rows must be cleared on refresh/filter change
3097
3163
  // so the fresh response replaces stale data instead of being deduped away.
3098
3164
  if (renderCheckScrollMode()) {
@@ -8054,7 +8120,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8054
8120
  var filterElementList = [];
8055
8121
  if (!((_f = props.organise) === null || _f === void 0 ? void 0 : _f.filterComponentNewRow)) {
8056
8122
  if ((_g = props.organise) === null || _g === void 0 ? void 0 : _g.showGroupByFeature) {
8057
- filterElementList.push(react_1.default.createElement(select_1.Select, { portalDropdown: true, label: "Group", options: (_o = (_k = (_j = (_h = props === null || props === void 0 ? void 0 : props.organise) === null || _h === void 0 ? void 0 : _h.renderGroupByOptions) === null || _j === void 0 ? void 0 : _j.call(_h)) !== null && _k !== void 0 ? _k : (_m = (_l = props === null || props === void 0 ? void 0 : props.organise) === null || _l === void 0 ? void 0 : _l.renderReferenceLabelOptions) === null || _m === void 0 ? void 0 : _m.call(_l, props.collectionId, true)) !== null && _o !== void 0 ? _o : [], value: groupId !== null && groupId !== void 0 ? groupId : "", onChange: function (value) { return setGroupId(value); } }));
8123
+ filterElementList.push(react_1.default.createElement(select_1.Select, { portalDropdown: true, label: "Group", options: (_o = (_k = (_j = (_h = props === null || props === void 0 ? void 0 : props.organise) === null || _h === void 0 ? void 0 : _h.renderGroupByOptions) === null || _j === void 0 ? void 0 : _j.call(_h)) !== null && _k !== void 0 ? _k : (_m = (_l = props === null || props === void 0 ? void 0 : props.organise) === null || _l === void 0 ? void 0 : _l.renderReferenceLabelOptions) === null || _m === void 0 ? void 0 : _m.call(_l, props.collectionId, true)) !== null && _o !== void 0 ? _o : [], value: groupId !== null && groupId !== void 0 ? groupId : "", onChange: function (value) { return handleChangeGroupBy(value !== null && value !== void 0 ? value : "", true); } }));
8058
8124
  }
8059
8125
  if (filterComponent_1 &&
8060
8126
  Array.isArray(filterComponent_1) &&
@@ -8213,7 +8279,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8213
8279
  }
8214
8280
  if ((_d = props.organise) === null || _d === void 0 ? void 0 : _d.filterComponentNewRow) {
8215
8281
  if (props.organise.showGroupByFeature) {
8216
- filterElementList.push(react_1.default.createElement(select_1.Select, { portalDropdown: true, label: "Group", options: (_k = (_g = (_f = (_e = props === null || props === void 0 ? void 0 : props.organise) === null || _e === void 0 ? void 0 : _e.renderGroupByOptions) === null || _f === void 0 ? void 0 : _f.call(_e)) !== null && _g !== void 0 ? _g : (_j = (_h = props === null || props === void 0 ? void 0 : props.organise) === null || _h === void 0 ? void 0 : _h.renderReferenceLabelOptions) === null || _j === void 0 ? void 0 : _j.call(_h, props.collectionId, true)) !== null && _k !== void 0 ? _k : [], value: groupId !== null && groupId !== void 0 ? groupId : "", onChange: function (value) { return setGroupId(value); } }));
8282
+ filterElementList.push(react_1.default.createElement(select_1.Select, { portalDropdown: true, label: "Group", options: (_k = (_g = (_f = (_e = props === null || props === void 0 ? void 0 : props.organise) === null || _e === void 0 ? void 0 : _e.renderGroupByOptions) === null || _f === void 0 ? void 0 : _f.call(_e)) !== null && _g !== void 0 ? _g : (_j = (_h = props === null || props === void 0 ? void 0 : props.organise) === null || _h === void 0 ? void 0 : _h.renderReferenceLabelOptions) === null || _j === void 0 ? void 0 : _j.call(_h, props.collectionId, true)) !== null && _k !== void 0 ? _k : [], value: groupId !== null && groupId !== void 0 ? groupId : "", onChange: function (value) { return handleChangeGroupBy(value !== null && value !== void 0 ? value : "", true); } }));
8217
8283
  }
8218
8284
  if (filterComponent_1 &&
8219
8285
  Array.isArray(filterComponent_1) &&
@@ -8538,6 +8604,26 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8538
8604
  var _a;
8539
8605
  return ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.paginationType) === "scroll";
8540
8606
  };
8607
+ // INFO: groups page themselves only when every group is known before its
8608
+ // rows load — a list column's options plus "Unknown/No Value" for any other
8609
+ // value. Grouping by a free-form column builds groups from loaded rows, so a
8610
+ // group absent from the first page would never appear; those keep the
8611
+ // global scroll instead. Firebase pages by document cursor, not by count.
8612
+ var renderCheckGroupPaging = function () {
8613
+ var _a, _b, _c, _d;
8614
+ var paginationType = renderResolvedPaginationType();
8615
+ if (paginationType !== "scroll" && paginationType !== "page")
8616
+ return false;
8617
+ if (!groupId || isFirebase)
8618
+ return false;
8619
+ // INFO: the mobile list draws no bands, so it keeps the normal pagination
8620
+ if (!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW) ||
8621
+ ((_b = props.bareSettings) === null || _b === void 0 ? void 0 : _b.bareListMobileView))
8622
+ return false;
8623
+ var groupAttributeDS = structure.find(function (eachDS) { return eachDS.id === groupId; });
8624
+ return ((groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.type) === "list" &&
8625
+ ((_d = (_c = groupAttributeDS.listSelection) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0);
8626
+ };
8541
8627
  var renderResolvedPaginationType = function () {
8542
8628
  var _a;
8543
8629
  if ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.paginationType)
@@ -8564,6 +8650,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8564
8650
  var renderScrollSentinel = function () {
8565
8651
  if (!renderCheckScrollMode())
8566
8652
  return null;
8653
+ // INFO: when every group pages itself, the single global bottom sentinel is
8654
+ // suppressed to avoid a competing "load the whole list" fire. Any other
8655
+ // grouping keeps it, so rows of groups not loaded yet stay reachable.
8656
+ if (renderCheckGroupPaging())
8657
+ return null;
8567
8658
  if (renderCheckScrollExhausted())
8568
8659
  return null;
8569
8660
  // INFO: only show the append spinner once we already have rows. On the
@@ -8750,11 +8841,29 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8750
8841
  // INFO: for NewTable, groupBy stays inside one table — rows are handed over
8751
8842
  // as coloured, collapsible bands keyed the same way the legacy split is
8752
8843
  var handleBuildNewTableGroups = function () {
8753
- var _a;
8844
+ var _a, _b;
8754
8845
  if (!groupId || !((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW))
8755
8846
  return undefined;
8756
8847
  var groupAttributeDS = structure.find(function (eachDS) { return eachDS.id === groupId; });
8848
+ var isGroupPaging = renderCheckGroupPaging();
8849
+ var listSelection = (_b = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelection) !== null && _b !== void 0 ? _b : [];
8757
8850
  var groups = [];
8851
+ // INFO: with per-group paging every option is a band from the start, even
8852
+ // with no row loaded yet, so its sentinel can load it; "Unknown/No Value"
8853
+ // holds every value outside the options, matching its "!in" query
8854
+ if (isGroupPaging)
8855
+ __spreadArray(__spreadArray([], listSelection, true), ["Unknown/No Value"], false).forEach(function (key, optionIndex) {
8856
+ var _a, _b;
8857
+ return groups.push({
8858
+ id: key,
8859
+ title: key,
8860
+ colour: (_a = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelectionColour) === null || _a === void 0 ? void 0 : _a[optionIndex],
8861
+ rowIds: [],
8862
+ count: ((_b = groupPageState[key]) === null || _b === void 0 ? void 0 : _b.fetched)
8863
+ ? groupPageState[key].size
8864
+ : undefined,
8865
+ });
8866
+ });
8758
8867
  (spaceTableData !== null && spaceTableData !== void 0 ? spaceTableData : []).forEach(function (eachData, index) {
8759
8868
  var _a, _b, _c, _d, _e, _f, _g, _h;
8760
8869
  // INFO: key off the raw row — the display row holds a Tag element for a
@@ -8771,6 +8880,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8771
8880
  rawValue && rawValue !== " - " && typeof rawValue !== "object"
8772
8881
  ? String(rawValue)
8773
8882
  : "Unknown/No Value";
8883
+ if (isGroupPaging && !listSelection.includes(key))
8884
+ key = "Unknown/No Value";
8774
8885
  }
8775
8886
  var rowId = (_d = (_c = tableData === null || tableData === void 0 ? void 0 : tableData[index]) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : (_e = tableData === null || tableData === void 0 ? void 0 : tableData[index]) === null || _e === void 0 ? void 0 : _e._id;
8776
8887
  if (!rowId)
@@ -8790,8 +8901,212 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8790
8901
  }
8791
8902
  group.rowIds.push(rowId);
8792
8903
  });
8904
+ // INFO: a group whose own query came back empty has nothing to show
8905
+ if (isGroupPaging)
8906
+ return groups.filter(function (eachGroup) {
8907
+ var _a, _b;
8908
+ return eachGroup.rowIds.length > 0 ||
8909
+ !(((_a = groupPageState[eachGroup.id]) === null || _a === void 0 ? void 0 : _a.fetched) &&
8910
+ ((_b = groupPageState[eachGroup.id]) === null || _b === void 0 ? void 0 : _b.size) === 0);
8911
+ });
8793
8912
  return groups;
8794
8913
  };
8914
+ // INFO: a row's band under per-group paging — its option, or
8915
+ // "Unknown/No Value" for any value outside the options (the "!in" query)
8916
+ var handleResolveGroupKey = function (row) {
8917
+ var _a, _b;
8918
+ var listSelection = (_b = (_a = structure.find(function (eachDS) { return eachDS.id === groupId; })) === null || _a === void 0 ? void 0 : _a.listSelection) !== null && _b !== void 0 ? _b : [];
8919
+ var value = groupId ? row === null || row === void 0 ? void 0 : row[groupId] : undefined;
8920
+ return typeof value === "string" && listSelection.includes(value)
8921
+ ? value
8922
+ : "Unknown/No Value";
8923
+ };
8924
+ var handleSetGroupPageState = function (groupKey, state) {
8925
+ return setGroupPageState(function (previous) {
8926
+ var _a;
8927
+ var _b;
8928
+ var next = __assign(__assign({}, previous), (_a = {}, _a[groupKey] = __assign(__assign({}, ((_b = previous[groupKey]) !== null && _b !== void 0 ? _b : {
8929
+ cursor: 0,
8930
+ size: 0,
8931
+ loadingMore: false,
8932
+ exhausted: false,
8933
+ })), state), _a));
8934
+ groupPageStateRef.current = next;
8935
+ return next;
8936
+ });
8937
+ };
8938
+ // INFO: reads one page of ONE group from the same list endpoint, filters and
8939
+ // sort the main read uses, scoped to that group, and runs it through the
8940
+ // same prettifier so its rows carry the shape of every other row. Returns
8941
+ // undefined when the list was re-read while the page was in flight.
8942
+ var handleReadGroupPage = function (groupKey, cursor) { return __awaiter(void 0, void 0, void 0, function () {
8943
+ var generation, groupAttributeDS, groupQuery, baseQuery, responseData, rawRows, count, prettierRows;
8944
+ var _a, _b, _c, _d, _e, _f, _g, _h;
8945
+ return __generator(this, function (_j) {
8946
+ switch (_j.label) {
8947
+ case 0:
8948
+ generation = groupPagingGenRef.current;
8949
+ groupAttributeDS = structure.find(function (eachDS) { return eachDS.id === groupId; });
8950
+ groupQuery = groupKey === "Unknown/No Value"
8951
+ ? [
8952
+ {
8953
+ type: "!in",
8954
+ queryId: groupId !== null && groupId !== void 0 ? groupId : "",
8955
+ value: (_a = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelection) !== null && _a !== void 0 ? _a : [],
8956
+ },
8957
+ ]
8958
+ : [{ type: "=", queryId: groupId !== null && groupId !== void 0 ? groupId : "", value: groupKey }];
8959
+ baseQuery = (_b = renderImpSearchFilterConditions()) !== null && _b !== void 0 ? _b : [];
8960
+ return [4 /*yield*/, readServerQuery.call({
8961
+ type: "list",
8962
+ query: __spreadArray(__spreadArray([], baseQuery, true), groupQuery, true),
8963
+ cursor: cursor,
8964
+ limit: limit,
8965
+ sort: handleReadQueryHocSort(baseQuery),
8966
+ })];
8967
+ case 1:
8968
+ responseData = _j.sent();
8969
+ if (generation !== groupPagingGenRef.current)
8970
+ return [2 /*return*/, undefined];
8971
+ rawRows = (_c = responseData === null || responseData === void 0 ? void 0 : responseData.data) !== null && _c !== void 0 ? _c : [];
8972
+ count = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.count) !== null && _d !== void 0 ? _d : 0;
8973
+ prettierRows = [];
8974
+ if (!(rawRows.length > 0)) return [3 /*break*/, 3];
8975
+ return [4 /*yield*/, (0, listModule_1.handleListDataBasedOnModel)(rawRows, props.devSettings, (_e = props.lib) === null || _e === void 0 ? void 0 : _e.axios, structure, (_f = props.organise) === null || _f === void 0 ? void 0 : _f.handleNavigate, setActivityModal, setActivityId, isActivityLog ? (_g = props.edit) === null || _g === void 0 ? void 0 : _g.activityLog : undefined, (_h = props.bareSettings) === null || _h === void 0 ? void 0 : _h.bareListActionBtns, !canUpdateRecord, undefined, handleSeedListReferenceOptions)];
8976
+ case 2:
8977
+ prettierRows = _j.sent();
8978
+ rawRows.forEach(function (eachData) {
8979
+ // INFO: normalise _id -> id to match the shape the main list carries
8980
+ if (eachData["_id"]) {
8981
+ eachData["id"] = eachData["_id"];
8982
+ delete eachData["_id"];
8983
+ }
8984
+ });
8985
+ _j.label = 3;
8986
+ case 3:
8987
+ if (generation !== groupPagingGenRef.current)
8988
+ return [2 /*return*/, undefined];
8989
+ return [2 /*return*/, { rawRows: rawRows, prettierRows: prettierRows, count: count }];
8990
+ }
8991
+ });
8992
+ }); };
8993
+ // INFO: scroll mode — appends the NEXT page of ONE group to the shared flat
8994
+ // tableData / spaceTableData, so handleBuildNewTableGroups() keeps building
8995
+ // bands from one source; each group advances its own cursor
8996
+ var handleFetchGroupNextPage = function (groupKey) { return __awaiter(void 0, void 0, void 0, function () {
8997
+ var current, cursor, generation, page_1, existingIds_1, appendRaw_1, appendPretty_1, nextCursor, err_30;
8998
+ var _a, _b, _c, _d;
8999
+ return __generator(this, function (_e) {
9000
+ switch (_e.label) {
9001
+ case 0:
9002
+ if (!renderCheckGroupPaging() || !renderCheckScrollMode())
9003
+ return [2 /*return*/];
9004
+ current = groupPageStateRef.current[groupKey];
9005
+ if ((current === null || current === void 0 ? void 0 : current.loadingMore) || (current === null || current === void 0 ? void 0 : current.exhausted))
9006
+ return [2 /*return*/];
9007
+ cursor = (_d = (_a = current === null || current === void 0 ? void 0 : current.cursor) !== null && _a !== void 0 ? _a : (_c = ((_b = handleBuildNewTableGroups()) !== null && _b !== void 0 ? _b : []).find(function (eachGroup) { return eachGroup.id === groupKey; })) === null || _c === void 0 ? void 0 : _c.rowIds.length) !== null && _d !== void 0 ? _d : 0;
9008
+ generation = groupPagingGenRef.current;
9009
+ handleSetGroupPageState(groupKey, { cursor: cursor, loadingMore: true });
9010
+ _e.label = 1;
9011
+ case 1:
9012
+ _e.trys.push([1, 3, , 4]);
9013
+ return [4 /*yield*/, handleReadGroupPage(groupKey, cursor)];
9014
+ case 2:
9015
+ page_1 = _e.sent();
9016
+ if (!page_1)
9017
+ return [2 /*return*/];
9018
+ existingIds_1 = new Set(tableDataRef.current.map(function (eachRow) { var _a; return (_a = eachRow.id) !== null && _a !== void 0 ? _a : eachRow._id; }));
9019
+ appendRaw_1 = [];
9020
+ appendPretty_1 = [];
9021
+ page_1.rawRows.forEach(function (eachRow, eachIndex) {
9022
+ var _a;
9023
+ if (existingIds_1.has((_a = eachRow.id) !== null && _a !== void 0 ? _a : eachRow._id))
9024
+ return;
9025
+ appendRaw_1.push(eachRow);
9026
+ appendPretty_1.push(page_1.prettierRows[eachIndex]);
9027
+ });
9028
+ handleSetListData(tableDataRef.current.concat(appendRaw_1), spaceTableDataRef.current.concat(appendPretty_1));
9029
+ nextCursor = cursor + page_1.rawRows.length;
9030
+ handleSetGroupPageState(groupKey, {
9031
+ cursor: nextCursor,
9032
+ size: page_1.count,
9033
+ loadingMore: false,
9034
+ fetched: true,
9035
+ exhausted: page_1.rawRows.length === 0 || nextCursor >= page_1.count,
9036
+ });
9037
+ return [3 /*break*/, 4];
9038
+ case 3:
9039
+ err_30 = _e.sent();
9040
+ if (generation !== groupPagingGenRef.current)
9041
+ return [2 /*return*/];
9042
+ // INFO: clear the in-flight flag so a failed page can be retried on the
9043
+ // next scroll rather than wedging the band in a loading state
9044
+ handleSetGroupPageState(groupKey, { loadingMore: false });
9045
+ return [3 /*break*/, 4];
9046
+ case 4: return [2 /*return*/];
9047
+ }
9048
+ });
9049
+ }); };
9050
+ // INFO: page mode — swaps ONE group's rows for its page `page`; every other
9051
+ // group keeps the page it is on
9052
+ var handleFetchGroupPage = function (groupKey, page) { return __awaiter(void 0, void 0, void 0, function () {
9053
+ var generation, result, keptRaw_1, keptPretty_1, loaded, err_31;
9054
+ return __generator(this, function (_a) {
9055
+ switch (_a.label) {
9056
+ case 0:
9057
+ if (!renderCheckGroupPaging() || renderCheckScrollMode())
9058
+ return [2 /*return*/];
9059
+ generation = groupPagingGenRef.current;
9060
+ handleSetGroupPageState(groupKey, { loadingMore: true });
9061
+ _a.label = 1;
9062
+ case 1:
9063
+ _a.trys.push([1, 3, , 4]);
9064
+ return [4 /*yield*/, handleReadGroupPage(groupKey, page * limit)];
9065
+ case 2:
9066
+ result = _a.sent();
9067
+ if (!result)
9068
+ return [2 /*return*/];
9069
+ keptRaw_1 = [];
9070
+ keptPretty_1 = [];
9071
+ tableDataRef.current.forEach(function (eachRow, eachIndex) {
9072
+ if (handleResolveGroupKey(eachRow) === groupKey)
9073
+ return;
9074
+ keptRaw_1.push(eachRow);
9075
+ keptPretty_1.push(spaceTableDataRef.current[eachIndex]);
9076
+ });
9077
+ handleSetListData(keptRaw_1.concat(result.rawRows), keptPretty_1.concat(result.prettierRows));
9078
+ loaded = page * limit + result.rawRows.length;
9079
+ handleSetGroupPageState(groupKey, {
9080
+ page: page,
9081
+ cursor: loaded,
9082
+ size: result.count,
9083
+ loadingMore: false,
9084
+ fetched: true,
9085
+ exhausted: loaded >= result.count,
9086
+ });
9087
+ return [3 /*break*/, 4];
9088
+ case 3:
9089
+ err_31 = _a.sent();
9090
+ if (generation !== groupPagingGenRef.current)
9091
+ return [2 /*return*/];
9092
+ handleSetGroupPageState(groupKey, { loadingMore: false });
9093
+ return [3 /*break*/, 4];
9094
+ case 4: return [2 /*return*/];
9095
+ }
9096
+ });
9097
+ }); };
9098
+ // INFO: page mode — after each fresh read every band reads its own first
9099
+ // page, so each shows its real total and pages on its own
9100
+ var handleLoadGroupFirstPages = function () {
9101
+ var _a, _b;
9102
+ groupPagingGenRef.current += 1;
9103
+ groupPageStateRef.current = {};
9104
+ setGroupPageState({});
9105
+ var listSelection = (_b = (_a = structure.find(function (eachDS) { return eachDS.id === groupId; })) === null || _a === void 0 ? void 0 : _a.listSelection) !== null && _b !== void 0 ? _b : [];
9106
+ __spreadArray(__spreadArray([], listSelection, true), ["Unknown/No Value"], false).forEach(function (groupKey) {
9107
+ return handleFetchGroupPage(groupKey, 0);
9108
+ });
9109
+ };
8795
9110
  var renderGroupTable = function (multipleSelect) {
8796
9111
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29;
8797
9112
  if (groupId && !((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW)) {
@@ -8915,11 +9230,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8915
9230
  }, onObjectEdit: handleObjectCellEdit, addable: {
8916
9231
  active: ((_u = props.edit) === null || _u === void 0 ? void 0 : _u.listAddable) ? true : false,
8917
9232
  onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
9233
+ var createdId;
8918
9234
  return __generator(this, function (_a) {
8919
9235
  switch (_a.label) {
8920
9236
  case 0: return [4 /*yield*/, handleSubmitData("create", "", "", data)];
8921
9237
  case 1:
8922
- _a.sent();
9238
+ createdId = _a.sent();
9239
+ if (!createdId)
9240
+ throw new Error("Create failed");
8923
9241
  return [2 /*return*/];
8924
9242
  }
8925
9243
  });
@@ -8931,7 +9249,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8931
9249
  else {
8932
9250
  // INFO: when bareNewDTW is enabled, render NewTable instead of legacy Table
8933
9251
  if ((_b = props.bareSettings) === null || _b === void 0 ? void 0 : _b.bareNewDTW) {
8934
- return (react_1.default.createElement(newTable_1.NewTable, { darkModeBg: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.darkModeBg, showId: showId, paginationType: renderResolvedPaginationType(), data: tableData, spaceData: spaceTableData !== null && spaceTableData !== void 0 ? spaceTableData : [], referencesOptions: listReferencesOptions, groups: handleBuildNewTableGroups(), size: size !== null && size !== void 0 ? size : 0, limit: limit, cursor: cursor !== null && cursor !== void 0 ? cursor : "", loading: tableLoading !== null && tableLoading !== void 0 ? tableLoading : true, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, selectAllText: selectAll ? "from filter" : "", disableSelectFullData: (_e = (_d = props.organise) === null || _d === void 0 ? void 0 : _d.disableSelectFullData) === null || _e === void 0 ? void 0 : _e.table, maxSelectedCount: (_f = props.bareSettings) === null || _f === void 0 ? void 0 : _f.bareListMaxSelectedCount, mobileView: (_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareListMobileView, mobileTooltip: (_h = props.bareSettings) === null || _h === void 0 ? void 0 : _h.bareMobileTooltip, multiActionFloatingBtns: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], (canBatchUpdate &&
9252
+ return (react_1.default.createElement(newTable_1.NewTable, { darkModeBg: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.darkModeBg, showId: showId, paginationType: renderResolvedPaginationType(), data: tableData, spaceData: spaceTableData !== null && spaceTableData !== void 0 ? spaceTableData : [], referencesOptions: listReferencesOptions, groups: handleBuildNewTableGroups(),
9253
+ // INFO: per-group paging — scroll appends inside a band, page
9254
+ // mode gives each band its own pager; undefined = bands as before
9255
+ onGroupLoadMore: renderCheckGroupPaging() && renderCheckScrollMode()
9256
+ ? function (groupKey) { return handleFetchGroupNextPage(groupKey); }
9257
+ : undefined, onGroupPageChange: renderCheckGroupPaging() && !renderCheckScrollMode()
9258
+ ? function (groupKey, page) {
9259
+ return handleFetchGroupPage(groupKey, page);
9260
+ }
9261
+ : undefined, groupLoadingStatus: renderCheckGroupPaging() ? groupPageState : undefined, size: size !== null && size !== void 0 ? size : 0, limit: limit, cursor: cursor !== null && cursor !== void 0 ? cursor : "", loading: tableLoading !== null && tableLoading !== void 0 ? tableLoading : true, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, selectAllText: selectAll ? "from filter" : "", disableSelectFullData: (_e = (_d = props.organise) === null || _d === void 0 ? void 0 : _d.disableSelectFullData) === null || _e === void 0 ? void 0 : _e.table, maxSelectedCount: (_f = props.bareSettings) === null || _f === void 0 ? void 0 : _f.bareListMaxSelectedCount, mobileView: (_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareListMobileView, mobileTooltip: (_h = props.bareSettings) === null || _h === void 0 ? void 0 : _h.bareMobileTooltip, multiActionFloatingBtns: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], (canBatchUpdate &&
8935
9262
  !((_j = props.bareSettings) === null || _j === void 0 ? void 0 : _j.bareHideTableExtraMultipleAction)
8936
9263
  ? [
8937
9264
  {
@@ -9063,16 +9390,23 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9063
9390
  }, onObjectEdit: handleObjectCellEdit, addable: {
9064
9391
  active: ((_5 = props.edit) === null || _5 === void 0 ? void 0 : _5.listAddable) ? true : false,
9065
9392
  onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
9393
+ var createdId;
9066
9394
  return __generator(this, function (_a) {
9067
9395
  switch (_a.label) {
9068
9396
  case 0: return [4 /*yield*/, handleSubmitData("create", "", "", data)];
9069
9397
  case 1:
9070
- _a.sent();
9398
+ createdId = _a.sent();
9399
+ if (!createdId)
9400
+ throw new Error("Create failed");
9071
9401
  return [2 /*return*/];
9072
9402
  }
9073
9403
  });
9074
9404
  }); },
9075
- }, darkMode: (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.darkMode, hidePagination: (_7 = props.organise) === null || _7 === void 0 ? void 0 : _7.hidePagination, customPaginationSize: customPaginationSize, disableEllipsisOnLongWord: (_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.disableEllipsisOnLongWord, pinColumns: (_9 = props.bareSettings) === null || _9 === void 0 ? void 0 : _9.bareListTablePinColumns }));
9405
+ }, darkMode: (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.darkMode,
9406
+ // INFO: each band pages itself, so the list-wide pager would only
9407
+ // page the read that seeded them
9408
+ hidePagination: ((_7 = props.organise) === null || _7 === void 0 ? void 0 : _7.hidePagination) ||
9409
+ (renderCheckGroupPaging() && !renderCheckScrollMode()), customPaginationSize: customPaginationSize, disableEllipsisOnLongWord: (_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.disableEllipsisOnLongWord, pinColumns: (_9 = props.bareSettings) === null || _9 === void 0 ? void 0 : _9.bareListTablePinColumns }));
9076
9410
  }
9077
9411
  return (react_1.default.createElement(table_1.Table, { showId: showId, paginationType: renderResolvedPaginationType(), data: tableData, spaceData: spaceTableData !== null && spaceTableData !== void 0 ? spaceTableData : [], referencesOptions: listReferencesOptions, size: size !== null && size !== void 0 ? size : 0, limit: limit, cursor: cursor !== null && cursor !== void 0 ? cursor : "", loading: tableLoading !== null && tableLoading !== void 0 ? tableLoading : true, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, selectAllText: selectAll ? "from filter" : "", disableSelectFullData: (_11 = (_10 = props.organise) === null || _10 === void 0 ? void 0 : _10.disableSelectFullData) === null || _11 === void 0 ? void 0 : _11.table, multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
9078
9412
  selectedIds.length > 0 &&
@@ -9157,11 +9491,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9157
9491
  }, onObjectEdit: handleObjectCellEdit, addable: {
9158
9492
  active: ((_26 = props.edit) === null || _26 === void 0 ? void 0 : _26.listAddable) ? true : false,
9159
9493
  onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
9494
+ var createdId;
9160
9495
  return __generator(this, function (_a) {
9161
9496
  switch (_a.label) {
9162
9497
  case 0: return [4 /*yield*/, handleSubmitData("create", "", "", data)];
9163
9498
  case 1:
9164
- _a.sent();
9499
+ createdId = _a.sent();
9500
+ if (!createdId)
9501
+ throw new Error("Create failed");
9165
9502
  return [2 /*return*/];
9166
9503
  }
9167
9504
  });
@@ -10719,7 +11056,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
10719
11056
  var _a, _b;
10720
11057
  return (react_1.default.createElement(activityModal_1.ActivityModal, { title: props.title && typeof props.title === "string"
10721
11058
  ? props.title
10722
- : "this collection", devSettings: props.devSettings, collectionId: props.collectionId, dataId: resolvedType === "read" ? ((_a = props.id) !== null && _a !== void 0 ? _a : "") : activityId, activityLog: (_b = props.edit) === null || _b === void 0 ? void 0 : _b.activityLog }));
11059
+ : "this collection", devSettings: props.devSettings, collectionId: props.collectionId, dataId: resolvedType === "read" ? ((_a = props.id) !== null && _a !== void 0 ? _a : "") : activityId, activityLog: (_b = props.edit) === null || _b === void 0 ? void 0 : _b.activityLog, model: structure }));
10723
11060
  }, maxWidth: "4xl", onClose: function () {
10724
11061
  setActivityModal(false);
10725
11062
  setActivityId("");