blixify-ui-web 1.2.163 → 1.2.166
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/lib/components/data/dataTemplate/activityChanges.d.ts +12 -4
- package/lib/components/data/dataTemplate/activityChanges.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/activityChanges.js +256 -53
- package/lib/components/data/dataTemplate/activityChanges.js.map +1 -1
- package/lib/components/data/dataTemplate/activityModal.d.ts +3 -1
- package/lib/components/data/dataTemplate/activityModal.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/activityModal.js +45 -28
- package/lib/components/data/dataTemplate/activityModal.js.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.d.ts +1 -0
- package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
- package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +413 -64
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts +1 -0
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.js +2 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.js.map +1 -1
- package/lib/components/data/utils.d.ts +1 -0
- package/lib/components/data/utils.d.ts.map +1 -1
- package/lib/components/data/utils.js +20 -8
- package/lib/components/data/utils.js.map +1 -1
- package/lib/components/display/newTable/index.d.ts +13 -1
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +292 -54
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/tail.css +2 -2
- 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
|
-
|
|
481
|
-
|
|
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
|
|
486
|
-
var
|
|
487
|
-
var
|
|
488
|
-
var
|
|
489
|
-
var
|
|
490
|
-
var
|
|
491
|
-
var
|
|
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 =
|
|
496
|
-
var
|
|
497
|
-
var
|
|
498
|
-
var
|
|
499
|
-
var
|
|
500
|
-
var
|
|
501
|
-
var
|
|
502
|
-
var
|
|
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 =
|
|
507
|
-
var
|
|
508
|
-
var
|
|
509
|
-
var
|
|
510
|
-
var
|
|
511
|
-
var
|
|
512
|
-
var
|
|
513
|
-
var
|
|
514
|
-
var
|
|
515
|
-
var
|
|
516
|
-
var
|
|
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 =
|
|
521
|
-
var
|
|
522
|
-
var
|
|
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
|
|
525
|
-
var
|
|
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
|
|
528
|
-
var
|
|
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
|
|
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
|
|
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
|
|
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 ((
|
|
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 &&
|
|
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,27 @@ 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: the columns a list can be grouped by — the app's own list, else
|
|
1367
|
+
// every column the reference picker offers
|
|
1368
|
+
var handleGetGroupByOptions = function () {
|
|
1369
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1370
|
+
return (_f = (_c = (_b = (_a = props === null || props === void 0 ? void 0 : props.organise) === null || _a === void 0 ? void 0 : _a.renderGroupByOptions) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : (_e = (_d = props === null || props === void 0 ? void 0 : props.organise) === null || _d === void 0 ? void 0 : _d.renderReferenceLabelOptions) === null || _e === void 0 ? void 0 : _e.call(_d, props.collectionId, true)) !== null && _f !== void 0 ? _f : [];
|
|
1371
|
+
};
|
|
1372
|
+
// INFO: notify — only a user's choice is handed back; a list opening on a
|
|
1373
|
+
// view or syncing the host's own groupBy tells the host nothing new
|
|
1374
|
+
var handleChangeGroupBy = function (value, notify) {
|
|
1375
|
+
var _a, _b;
|
|
1376
|
+
if (value === (groupId !== null && groupId !== void 0 ? groupId : ""))
|
|
1377
|
+
return;
|
|
1378
|
+
setGroupId(value);
|
|
1379
|
+
if (notify)
|
|
1380
|
+
(_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeGroupBy) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
1381
|
+
};
|
|
1352
1382
|
// INFO: isOpening — the list opening on a view tells the host nothing new,
|
|
1353
1383
|
// so its sort is not handed back (a host saving sort would write it on
|
|
1354
1384
|
// every open)
|
|
1355
1385
|
var handleApplySavedView = function (view, isOpening) {
|
|
1356
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
1386
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
1357
1387
|
var next = handleResolveViewState((_a = view === null || view === void 0 ? void 0 : view.state) !== null && _a !== void 0 ? _a : null);
|
|
1358
1388
|
var isQueryChanged = !(0, viewStatePersistence_1.handleIsSameViewState)((0, viewStatePersistence_1.handlePickQueryState)(handleBuildViewSnapshot()), (0, viewStatePersistence_1.handlePickQueryState)(next));
|
|
1359
1389
|
handleClearFlexFilterTypingTimeout();
|
|
@@ -1376,7 +1406,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
1376
1406
|
(_h = (_g = props.organise) === null || _g === void 0 ? void 0 : _g.onChangeSort) === null || _h === void 0 ? void 0 : _h.call(_g, next.sort);
|
|
1377
1407
|
if (next.pageLimit)
|
|
1378
1408
|
setPageLimit(next.pageLimit);
|
|
1379
|
-
|
|
1409
|
+
handleChangeGroupBy((_j = next.groupBy) !== null && _j !== void 0 ? _j : "", !isOpening);
|
|
1410
|
+
setUserHiddenColumnIds((_k = next.userHiddenColumnIds) !== null && _k !== void 0 ? _k : []);
|
|
1380
1411
|
if (view) {
|
|
1381
1412
|
if (!schemaStructureRef.current)
|
|
1382
1413
|
schemaStructureRef.current = structure;
|
|
@@ -1391,12 +1422,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
1391
1422
|
pendingViewCondKeyRef.current = JSON.stringify(handleReadQueryHocCond());
|
|
1392
1423
|
handleClearDataByFilter();
|
|
1393
1424
|
if (pageIndex !== 0)
|
|
1394
|
-
(
|
|
1395
|
-
(
|
|
1425
|
+
(_m = (_l = props.organise) === null || _l === void 0 ? void 0 : _l.onChangePagination) === null || _m === void 0 ? void 0 : _m.call(_l, 0);
|
|
1426
|
+
(_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
1427
|
? (0, viewStatePersistence_1.parseDateFilterState)(next.filterReferenceDate)
|
|
1397
|
-
: initialFilterReferenceDate, (
|
|
1428
|
+
: initialFilterReferenceDate, (_s = next.filterReference) !== null && _s !== void 0 ? _s : {});
|
|
1398
1429
|
}
|
|
1399
|
-
setActiveSavedViewId((
|
|
1430
|
+
setActiveSavedViewId((_t = view === null || view === void 0 ? void 0 : view.id) !== null && _t !== void 0 ? _t : null);
|
|
1400
1431
|
setDeletingSavedViewId(null);
|
|
1401
1432
|
};
|
|
1402
1433
|
// INFO: re-read storage before each write so a change made in another browser
|
|
@@ -2556,7 +2587,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2556
2587
|
return sort;
|
|
2557
2588
|
};
|
|
2558
2589
|
var handleReadQueryHocCond = function () {
|
|
2559
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
2590
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2560
2591
|
var query = (_a = renderImpSearchFilterConditions()) !== null && _a !== void 0 ? _a : [];
|
|
2561
2592
|
var calendarSettings = false;
|
|
2562
2593
|
if (selectedTab && selectedTab.viewType === "calendar") {
|
|
@@ -2577,7 +2608,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2577
2608
|
startDate = (0, dayjs_1.default)(calendarTabMonth).startOf("isoWeek").toDate();
|
|
2578
2609
|
endDate = (0, dayjs_1.default)(calendarTabMonth).endOf("isoWeek").toDate();
|
|
2579
2610
|
if ((_d = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.calendarSettings) === null || _d === void 0 ? void 0 : _d.customView) {
|
|
2580
|
-
var
|
|
2611
|
+
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
2612
|
if (view &&
|
|
2582
2613
|
duration &&
|
|
2583
2614
|
view === "week" &&
|
|
@@ -2694,13 +2725,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2694
2725
|
(selectedTab &&
|
|
2695
2726
|
(selectedTab.viewType === "map" ||
|
|
2696
2727
|
selectedTab.viewType === "timeline")) ||
|
|
2697
|
-
|
|
2728
|
+
// INFO: the legacy grouped list renders one table per group and needs
|
|
2729
|
+
// every row. NewTable bands are built from whatever rows are loaded, so
|
|
2730
|
+
// it keeps normal page reads: page mode groups the rows of the current
|
|
2731
|
+
// page, and scroll mode pages each band (handleFetchGroupNextPage). A
|
|
2732
|
+
// full read there also broke the pager — page 2 skipped the first page
|
|
2733
|
+
// of a list that was already complete.
|
|
2734
|
+
(groupId && !((_t = props.bareSettings) === null || _t === void 0 ? void 0 : _t.bareNewDTW))) {
|
|
2698
2735
|
// INFO: a Gantt needs every bar at once — a page of rows would hide
|
|
2699
2736
|
// spans that fall outside it, so fetch the full set like map/calendar
|
|
2700
2737
|
cond.limit = undefined;
|
|
2701
2738
|
cond.stopLimit = true;
|
|
2702
2739
|
}
|
|
2703
|
-
else if ((
|
|
2740
|
+
else if ((_v = (_u = props.organise) === null || _u === void 0 ? void 0 : _u.unionCollections) === null || _v === void 0 ? void 0 : _v.length) {
|
|
2704
2741
|
// INFO: a union request only carries `skip`, so the page offset goes there, and
|
|
2705
2742
|
// `_id` keeps the order stable between page requests
|
|
2706
2743
|
cond.skip = (0, unionPagination_1.handleGetUnionPageSkip)(pageIndex, limit);
|
|
@@ -2929,6 +2966,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2929
2966
|
if (!isScrollMode && !isFirebase) {
|
|
2930
2967
|
handleSetListData(dataList, prettierDataList);
|
|
2931
2968
|
setSize((_j = responseData.count) !== null && _j !== void 0 ? _j : 0);
|
|
2969
|
+
if (renderCheckGroupPaging())
|
|
2970
|
+
handleLoadGroupFirstPages();
|
|
2932
2971
|
}
|
|
2933
2972
|
else {
|
|
2934
2973
|
newTableData = [];
|
|
@@ -2936,6 +2975,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2936
2975
|
if (!isFirebase && requestCond) {
|
|
2937
2976
|
isFirstPage = !requestCond.cursor && !requestCond.skip;
|
|
2938
2977
|
if (isFirstPage) {
|
|
2978
|
+
// INFO: per-group cursors and "exhausted" flags describe the old
|
|
2979
|
+
// list; keeping them would skip rows or stop a group early
|
|
2980
|
+
groupPagingGenRef.current += 1;
|
|
2981
|
+
groupPageStateRef.current = {};
|
|
2982
|
+
setGroupPageState({});
|
|
2939
2983
|
newTableData = dataList;
|
|
2940
2984
|
newPrettierTableData = prettierDataList;
|
|
2941
2985
|
}
|
|
@@ -3019,6 +3063,28 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3019
3063
|
// INFO: keep polling ref current so the setInterval always fires the latest
|
|
3020
3064
|
// handleRefresh closure (captures current filters, pagination, etc.)
|
|
3021
3065
|
handleRefreshRef.current = handleRefresh;
|
|
3066
|
+
// INFO: scroll mode keeps every loaded row, and bands seed their cursor from
|
|
3067
|
+
// the rows they already hold — rows loaded for the old grouping are not the
|
|
3068
|
+
// first rows of the new groups, so a regroup starts the list over
|
|
3069
|
+
var previousGroupIdRef = (0, react_1.useRef)(groupId !== null && groupId !== void 0 ? groupId : "");
|
|
3070
|
+
(0, react_1.useEffect)(function () {
|
|
3071
|
+
var _a, _b;
|
|
3072
|
+
// INFO: undefined and "" are both ungrouped, as the host sync sets on mount
|
|
3073
|
+
if ((groupId !== null && groupId !== void 0 ? groupId : "") === previousGroupIdRef.current)
|
|
3074
|
+
return;
|
|
3075
|
+
previousGroupIdRef.current = groupId !== null && groupId !== void 0 ? groupId : "";
|
|
3076
|
+
if (!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW) || isFirebase)
|
|
3077
|
+
return;
|
|
3078
|
+
if (renderResolvedPaginationType() === "cursor")
|
|
3079
|
+
return;
|
|
3080
|
+
var isFirstPage = pageIndex === 0;
|
|
3081
|
+
handleClearDataByFilter();
|
|
3082
|
+
// INFO: from page 0 the request does not change, so ask for the read
|
|
3083
|
+
if (isFirstPage)
|
|
3084
|
+
(_b = listRQueryHocRef.current) === null || _b === void 0 ? void 0 : _b.handleRefresh();
|
|
3085
|
+
/* eslint-disable */
|
|
3086
|
+
}, [groupId]);
|
|
3087
|
+
/* eslint-enable */
|
|
3022
3088
|
var handleObjectReferenceOptions = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3023
3089
|
var clonedOptions_1, clonedDetails_1, model, err_2;
|
|
3024
3090
|
var _a;
|
|
@@ -3093,6 +3159,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3093
3159
|
setCursor("");
|
|
3094
3160
|
setLastCursor("");
|
|
3095
3161
|
setTableLoading(true);
|
|
3162
|
+
// INFO: band totals, cursors and "exhausted" flags describe the list being
|
|
3163
|
+
// cleared; dropping them now keeps a stale total off an emptied band and
|
|
3164
|
+
// any band page still in flight off the new list
|
|
3165
|
+
groupPagingGenRef.current += 1;
|
|
3166
|
+
groupPageStateRef.current = {};
|
|
3167
|
+
setGroupPageState({});
|
|
3096
3168
|
// INFO: In scroll mode, accumulated rows must be cleared on refresh/filter change
|
|
3097
3169
|
// so the fresh response replaces stale data instead of being deduped away.
|
|
3098
3170
|
if (renderCheckScrollMode()) {
|
|
@@ -6887,7 +6959,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
6887
6959
|
: getActiveUserHiddenColumnIds().includes(column.id);
|
|
6888
6960
|
};
|
|
6889
6961
|
var renderViewSettingsContent = function () {
|
|
6890
|
-
var _a, _b, _c, _d, _e;
|
|
6962
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6891
6963
|
var viewColumns = getViewSettingsColumns();
|
|
6892
6964
|
var hiddenCount = viewColumns.filter(getIsColumnHidden).length;
|
|
6893
6965
|
var visibleCount = viewColumns.length - hiddenCount;
|
|
@@ -6961,6 +7033,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
6961
7033
|
type: value,
|
|
6962
7034
|
});
|
|
6963
7035
|
} })))),
|
|
7036
|
+
((_f = props.organise) === null || _f === void 0 ? void 0 : _f.showGroupByFeature) && (react_1.default.createElement("div", { className: "mt-3 border-t pt-3 ".concat(dividerColor) },
|
|
7037
|
+
react_1.default.createElement("p", { className: "text-sm font-medium ".concat(labelColor) }, "Group"),
|
|
7038
|
+
react_1.default.createElement("div", { className: "mt-1" },
|
|
7039
|
+
react_1.default.createElement(select_1.Select, { id: "dtw-view-group-by", portalDropdown: true, label: "", placeholder: "Column", value: groupId !== null && groupId !== void 0 ? groupId : "", darkMode: (_g = props.organise) === null || _g === void 0 ? void 0 : _g.darkMode, options: handleGetGroupByOptions(), onChange: function (value) {
|
|
7040
|
+
return handleChangeGroupBy(value !== null && value !== void 0 ? value : "", true);
|
|
7041
|
+
} })))),
|
|
6964
7042
|
react_1.default.createElement("div", { className: "mt-3 border-t pt-3 ".concat(dividerColor) },
|
|
6965
7043
|
react_1.default.createElement("p", { className: "text-sm font-medium ".concat(labelColor) }, "Rows per page"),
|
|
6966
7044
|
react_1.default.createElement("div", { className: "mt-2 flex flex-row flex-wrap gap-2" }, PAGE_LIMIT_OPTIONS.map(function (eachOption) { return (react_1.default.createElement("button", { key: eachOption, type: "button", "data-testid": "dtw-page-limit-".concat(eachOption), className: "rounded-md border px-3 py-1 text-sm ".concat(pageLimit === eachOption
|
|
@@ -8028,7 +8106,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8028
8106
|
props.renderSettings.renderListUI(actionComponent, filterComponent_1, dataComponent)));
|
|
8029
8107
|
}
|
|
8030
8108
|
var renderListFilterElements = function () {
|
|
8031
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
8109
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8032
8110
|
// INFO: When bareListFilterAsPopup is true, filters are shown in a popup instead.
|
|
8033
8111
|
if ((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareListFilterAsPopup)
|
|
8034
8112
|
return null;
|
|
@@ -8054,7 +8132,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8054
8132
|
var filterElementList = [];
|
|
8055
8133
|
if (!((_f = props.organise) === null || _f === void 0 ? void 0 : _f.filterComponentNewRow)) {
|
|
8056
8134
|
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",
|
|
8135
|
+
filterElementList.push(react_1.default.createElement(select_1.Select, { portalDropdown: true, label: "Group", darkMode: (_h = props.organise) === null || _h === void 0 ? void 0 : _h.darkMode, options: handleGetGroupByOptions(), value: groupId !== null && groupId !== void 0 ? groupId : "", onChange: function (value) { return handleChangeGroupBy(value !== null && value !== void 0 ? value : "", true); } }));
|
|
8058
8136
|
}
|
|
8059
8137
|
if (filterComponent_1 &&
|
|
8060
8138
|
Array.isArray(filterComponent_1) &&
|
|
@@ -8201,7 +8279,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8201
8279
|
return null;
|
|
8202
8280
|
};
|
|
8203
8281
|
var renderListNewRowFilterElements = function () {
|
|
8204
|
-
var _a, _b, _c, _d, _e
|
|
8282
|
+
var _a, _b, _c, _d, _e;
|
|
8205
8283
|
var filterElementList = [];
|
|
8206
8284
|
// INFO: bareCompactMode + bareListFilterAsPopup both tuck filters
|
|
8207
8285
|
// behind the popup, so skip the new-row render path too.
|
|
@@ -8213,7 +8291,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8213
8291
|
}
|
|
8214
8292
|
if ((_d = props.organise) === null || _d === void 0 ? void 0 : _d.filterComponentNewRow) {
|
|
8215
8293
|
if (props.organise.showGroupByFeature) {
|
|
8216
|
-
filterElementList.push(react_1.default.createElement(select_1.Select, { portalDropdown: true, label: "Group",
|
|
8294
|
+
filterElementList.push(react_1.default.createElement(select_1.Select, { portalDropdown: true, label: "Group", darkMode: (_e = props.organise) === null || _e === void 0 ? void 0 : _e.darkMode, options: handleGetGroupByOptions(), value: groupId !== null && groupId !== void 0 ? groupId : "", onChange: function (value) { return handleChangeGroupBy(value !== null && value !== void 0 ? value : "", true); } }));
|
|
8217
8295
|
}
|
|
8218
8296
|
if (filterComponent_1 &&
|
|
8219
8297
|
Array.isArray(filterComponent_1) &&
|
|
@@ -8538,6 +8616,26 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8538
8616
|
var _a;
|
|
8539
8617
|
return ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.paginationType) === "scroll";
|
|
8540
8618
|
};
|
|
8619
|
+
// INFO: groups page themselves only when every group is known before its
|
|
8620
|
+
// rows load — a list column's options plus "Unknown/No Value" for any other
|
|
8621
|
+
// value. Grouping by a free-form column builds groups from loaded rows, so a
|
|
8622
|
+
// group absent from the first page would never appear; those keep the
|
|
8623
|
+
// global scroll instead. Firebase pages by document cursor, not by count.
|
|
8624
|
+
var renderCheckGroupPaging = function () {
|
|
8625
|
+
var _a, _b, _c, _d;
|
|
8626
|
+
var paginationType = renderResolvedPaginationType();
|
|
8627
|
+
if (paginationType !== "scroll" && paginationType !== "page")
|
|
8628
|
+
return false;
|
|
8629
|
+
if (!groupId || isFirebase)
|
|
8630
|
+
return false;
|
|
8631
|
+
// INFO: the mobile list draws no bands, so it keeps the normal pagination
|
|
8632
|
+
if (!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW) ||
|
|
8633
|
+
((_b = props.bareSettings) === null || _b === void 0 ? void 0 : _b.bareListMobileView))
|
|
8634
|
+
return false;
|
|
8635
|
+
var groupAttributeDS = structure.find(function (eachDS) { return eachDS.id === groupId; });
|
|
8636
|
+
return ((groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.type) === "list" &&
|
|
8637
|
+
((_d = (_c = groupAttributeDS.listSelection) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0);
|
|
8638
|
+
};
|
|
8541
8639
|
var renderResolvedPaginationType = function () {
|
|
8542
8640
|
var _a;
|
|
8543
8641
|
if ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.paginationType)
|
|
@@ -8564,6 +8662,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8564
8662
|
var renderScrollSentinel = function () {
|
|
8565
8663
|
if (!renderCheckScrollMode())
|
|
8566
8664
|
return null;
|
|
8665
|
+
// INFO: when every group pages itself, the single global bottom sentinel is
|
|
8666
|
+
// suppressed to avoid a competing "load the whole list" fire. Any other
|
|
8667
|
+
// grouping keeps it, so rows of groups not loaded yet stay reachable.
|
|
8668
|
+
if (renderCheckGroupPaging())
|
|
8669
|
+
return null;
|
|
8567
8670
|
if (renderCheckScrollExhausted())
|
|
8568
8671
|
return null;
|
|
8569
8672
|
// INFO: only show the append spinner once we already have rows. On the
|
|
@@ -8750,11 +8853,29 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8750
8853
|
// INFO: for NewTable, groupBy stays inside one table — rows are handed over
|
|
8751
8854
|
// as coloured, collapsible bands keyed the same way the legacy split is
|
|
8752
8855
|
var handleBuildNewTableGroups = function () {
|
|
8753
|
-
var _a;
|
|
8856
|
+
var _a, _b;
|
|
8754
8857
|
if (!groupId || !((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW))
|
|
8755
8858
|
return undefined;
|
|
8756
8859
|
var groupAttributeDS = structure.find(function (eachDS) { return eachDS.id === groupId; });
|
|
8860
|
+
var isGroupPaging = renderCheckGroupPaging();
|
|
8861
|
+
var listSelection = (_b = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelection) !== null && _b !== void 0 ? _b : [];
|
|
8757
8862
|
var groups = [];
|
|
8863
|
+
// INFO: with per-group paging every option is a band from the start, even
|
|
8864
|
+
// with no row loaded yet, so its sentinel can load it; "Unknown/No Value"
|
|
8865
|
+
// holds every value outside the options, matching its "!in" query
|
|
8866
|
+
if (isGroupPaging)
|
|
8867
|
+
__spreadArray(__spreadArray([], listSelection, true), ["Unknown/No Value"], false).forEach(function (key, optionIndex) {
|
|
8868
|
+
var _a, _b;
|
|
8869
|
+
return groups.push({
|
|
8870
|
+
id: key,
|
|
8871
|
+
title: key,
|
|
8872
|
+
colour: (_a = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelectionColour) === null || _a === void 0 ? void 0 : _a[optionIndex],
|
|
8873
|
+
rowIds: [],
|
|
8874
|
+
count: ((_b = groupPageState[key]) === null || _b === void 0 ? void 0 : _b.fetched)
|
|
8875
|
+
? groupPageState[key].size
|
|
8876
|
+
: undefined,
|
|
8877
|
+
});
|
|
8878
|
+
});
|
|
8758
8879
|
(spaceTableData !== null && spaceTableData !== void 0 ? spaceTableData : []).forEach(function (eachData, index) {
|
|
8759
8880
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8760
8881
|
// INFO: key off the raw row — the display row holds a Tag element for a
|
|
@@ -8771,6 +8892,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8771
8892
|
rawValue && rawValue !== " - " && typeof rawValue !== "object"
|
|
8772
8893
|
? String(rawValue)
|
|
8773
8894
|
: "Unknown/No Value";
|
|
8895
|
+
if (isGroupPaging && !listSelection.includes(key))
|
|
8896
|
+
key = "Unknown/No Value";
|
|
8774
8897
|
}
|
|
8775
8898
|
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
8899
|
if (!rowId)
|
|
@@ -8790,8 +8913,212 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8790
8913
|
}
|
|
8791
8914
|
group.rowIds.push(rowId);
|
|
8792
8915
|
});
|
|
8916
|
+
// INFO: a group whose own query came back empty has nothing to show
|
|
8917
|
+
if (isGroupPaging)
|
|
8918
|
+
return groups.filter(function (eachGroup) {
|
|
8919
|
+
var _a, _b;
|
|
8920
|
+
return eachGroup.rowIds.length > 0 ||
|
|
8921
|
+
!(((_a = groupPageState[eachGroup.id]) === null || _a === void 0 ? void 0 : _a.fetched) &&
|
|
8922
|
+
((_b = groupPageState[eachGroup.id]) === null || _b === void 0 ? void 0 : _b.size) === 0);
|
|
8923
|
+
});
|
|
8793
8924
|
return groups;
|
|
8794
8925
|
};
|
|
8926
|
+
// INFO: a row's band under per-group paging — its option, or
|
|
8927
|
+
// "Unknown/No Value" for any value outside the options (the "!in" query)
|
|
8928
|
+
var handleResolveGroupKey = function (row) {
|
|
8929
|
+
var _a, _b;
|
|
8930
|
+
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 : [];
|
|
8931
|
+
var value = groupId ? row === null || row === void 0 ? void 0 : row[groupId] : undefined;
|
|
8932
|
+
return typeof value === "string" && listSelection.includes(value)
|
|
8933
|
+
? value
|
|
8934
|
+
: "Unknown/No Value";
|
|
8935
|
+
};
|
|
8936
|
+
var handleSetGroupPageState = function (groupKey, state) {
|
|
8937
|
+
return setGroupPageState(function (previous) {
|
|
8938
|
+
var _a;
|
|
8939
|
+
var _b;
|
|
8940
|
+
var next = __assign(__assign({}, previous), (_a = {}, _a[groupKey] = __assign(__assign({}, ((_b = previous[groupKey]) !== null && _b !== void 0 ? _b : {
|
|
8941
|
+
cursor: 0,
|
|
8942
|
+
size: 0,
|
|
8943
|
+
loadingMore: false,
|
|
8944
|
+
exhausted: false,
|
|
8945
|
+
})), state), _a));
|
|
8946
|
+
groupPageStateRef.current = next;
|
|
8947
|
+
return next;
|
|
8948
|
+
});
|
|
8949
|
+
};
|
|
8950
|
+
// INFO: reads one page of ONE group from the same list endpoint, filters and
|
|
8951
|
+
// sort the main read uses, scoped to that group, and runs it through the
|
|
8952
|
+
// same prettifier so its rows carry the shape of every other row. Returns
|
|
8953
|
+
// undefined when the list was re-read while the page was in flight.
|
|
8954
|
+
var handleReadGroupPage = function (groupKey, cursor) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8955
|
+
var generation, groupAttributeDS, groupQuery, baseQuery, responseData, rawRows, count, prettierRows;
|
|
8956
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8957
|
+
return __generator(this, function (_j) {
|
|
8958
|
+
switch (_j.label) {
|
|
8959
|
+
case 0:
|
|
8960
|
+
generation = groupPagingGenRef.current;
|
|
8961
|
+
groupAttributeDS = structure.find(function (eachDS) { return eachDS.id === groupId; });
|
|
8962
|
+
groupQuery = groupKey === "Unknown/No Value"
|
|
8963
|
+
? [
|
|
8964
|
+
{
|
|
8965
|
+
type: "!in",
|
|
8966
|
+
queryId: groupId !== null && groupId !== void 0 ? groupId : "",
|
|
8967
|
+
value: (_a = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelection) !== null && _a !== void 0 ? _a : [],
|
|
8968
|
+
},
|
|
8969
|
+
]
|
|
8970
|
+
: [{ type: "=", queryId: groupId !== null && groupId !== void 0 ? groupId : "", value: groupKey }];
|
|
8971
|
+
baseQuery = (_b = renderImpSearchFilterConditions()) !== null && _b !== void 0 ? _b : [];
|
|
8972
|
+
return [4 /*yield*/, readServerQuery.call({
|
|
8973
|
+
type: "list",
|
|
8974
|
+
query: __spreadArray(__spreadArray([], baseQuery, true), groupQuery, true),
|
|
8975
|
+
cursor: cursor,
|
|
8976
|
+
limit: limit,
|
|
8977
|
+
sort: handleReadQueryHocSort(baseQuery),
|
|
8978
|
+
})];
|
|
8979
|
+
case 1:
|
|
8980
|
+
responseData = _j.sent();
|
|
8981
|
+
if (generation !== groupPagingGenRef.current)
|
|
8982
|
+
return [2 /*return*/, undefined];
|
|
8983
|
+
rawRows = (_c = responseData === null || responseData === void 0 ? void 0 : responseData.data) !== null && _c !== void 0 ? _c : [];
|
|
8984
|
+
count = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.count) !== null && _d !== void 0 ? _d : 0;
|
|
8985
|
+
prettierRows = [];
|
|
8986
|
+
if (!(rawRows.length > 0)) return [3 /*break*/, 3];
|
|
8987
|
+
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)];
|
|
8988
|
+
case 2:
|
|
8989
|
+
prettierRows = _j.sent();
|
|
8990
|
+
rawRows.forEach(function (eachData) {
|
|
8991
|
+
// INFO: normalise _id -> id to match the shape the main list carries
|
|
8992
|
+
if (eachData["_id"]) {
|
|
8993
|
+
eachData["id"] = eachData["_id"];
|
|
8994
|
+
delete eachData["_id"];
|
|
8995
|
+
}
|
|
8996
|
+
});
|
|
8997
|
+
_j.label = 3;
|
|
8998
|
+
case 3:
|
|
8999
|
+
if (generation !== groupPagingGenRef.current)
|
|
9000
|
+
return [2 /*return*/, undefined];
|
|
9001
|
+
return [2 /*return*/, { rawRows: rawRows, prettierRows: prettierRows, count: count }];
|
|
9002
|
+
}
|
|
9003
|
+
});
|
|
9004
|
+
}); };
|
|
9005
|
+
// INFO: scroll mode — appends the NEXT page of ONE group to the shared flat
|
|
9006
|
+
// tableData / spaceTableData, so handleBuildNewTableGroups() keeps building
|
|
9007
|
+
// bands from one source; each group advances its own cursor
|
|
9008
|
+
var handleFetchGroupNextPage = function (groupKey) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9009
|
+
var current, cursor, generation, page_1, existingIds_1, appendRaw_1, appendPretty_1, nextCursor, err_30;
|
|
9010
|
+
var _a, _b, _c, _d;
|
|
9011
|
+
return __generator(this, function (_e) {
|
|
9012
|
+
switch (_e.label) {
|
|
9013
|
+
case 0:
|
|
9014
|
+
if (!renderCheckGroupPaging() || !renderCheckScrollMode())
|
|
9015
|
+
return [2 /*return*/];
|
|
9016
|
+
current = groupPageStateRef.current[groupKey];
|
|
9017
|
+
if ((current === null || current === void 0 ? void 0 : current.loadingMore) || (current === null || current === void 0 ? void 0 : current.exhausted))
|
|
9018
|
+
return [2 /*return*/];
|
|
9019
|
+
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;
|
|
9020
|
+
generation = groupPagingGenRef.current;
|
|
9021
|
+
handleSetGroupPageState(groupKey, { cursor: cursor, loadingMore: true });
|
|
9022
|
+
_e.label = 1;
|
|
9023
|
+
case 1:
|
|
9024
|
+
_e.trys.push([1, 3, , 4]);
|
|
9025
|
+
return [4 /*yield*/, handleReadGroupPage(groupKey, cursor)];
|
|
9026
|
+
case 2:
|
|
9027
|
+
page_1 = _e.sent();
|
|
9028
|
+
if (!page_1)
|
|
9029
|
+
return [2 /*return*/];
|
|
9030
|
+
existingIds_1 = new Set(tableDataRef.current.map(function (eachRow) { var _a; return (_a = eachRow.id) !== null && _a !== void 0 ? _a : eachRow._id; }));
|
|
9031
|
+
appendRaw_1 = [];
|
|
9032
|
+
appendPretty_1 = [];
|
|
9033
|
+
page_1.rawRows.forEach(function (eachRow, eachIndex) {
|
|
9034
|
+
var _a;
|
|
9035
|
+
if (existingIds_1.has((_a = eachRow.id) !== null && _a !== void 0 ? _a : eachRow._id))
|
|
9036
|
+
return;
|
|
9037
|
+
appendRaw_1.push(eachRow);
|
|
9038
|
+
appendPretty_1.push(page_1.prettierRows[eachIndex]);
|
|
9039
|
+
});
|
|
9040
|
+
handleSetListData(tableDataRef.current.concat(appendRaw_1), spaceTableDataRef.current.concat(appendPretty_1));
|
|
9041
|
+
nextCursor = cursor + page_1.rawRows.length;
|
|
9042
|
+
handleSetGroupPageState(groupKey, {
|
|
9043
|
+
cursor: nextCursor,
|
|
9044
|
+
size: page_1.count,
|
|
9045
|
+
loadingMore: false,
|
|
9046
|
+
fetched: true,
|
|
9047
|
+
exhausted: page_1.rawRows.length === 0 || nextCursor >= page_1.count,
|
|
9048
|
+
});
|
|
9049
|
+
return [3 /*break*/, 4];
|
|
9050
|
+
case 3:
|
|
9051
|
+
err_30 = _e.sent();
|
|
9052
|
+
if (generation !== groupPagingGenRef.current)
|
|
9053
|
+
return [2 /*return*/];
|
|
9054
|
+
// INFO: clear the in-flight flag so a failed page can be retried on the
|
|
9055
|
+
// next scroll rather than wedging the band in a loading state
|
|
9056
|
+
handleSetGroupPageState(groupKey, { loadingMore: false });
|
|
9057
|
+
return [3 /*break*/, 4];
|
|
9058
|
+
case 4: return [2 /*return*/];
|
|
9059
|
+
}
|
|
9060
|
+
});
|
|
9061
|
+
}); };
|
|
9062
|
+
// INFO: page mode — swaps ONE group's rows for its page `page`; every other
|
|
9063
|
+
// group keeps the page it is on
|
|
9064
|
+
var handleFetchGroupPage = function (groupKey, page) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9065
|
+
var generation, result, keptRaw_1, keptPretty_1, loaded, err_31;
|
|
9066
|
+
return __generator(this, function (_a) {
|
|
9067
|
+
switch (_a.label) {
|
|
9068
|
+
case 0:
|
|
9069
|
+
if (!renderCheckGroupPaging() || renderCheckScrollMode())
|
|
9070
|
+
return [2 /*return*/];
|
|
9071
|
+
generation = groupPagingGenRef.current;
|
|
9072
|
+
handleSetGroupPageState(groupKey, { loadingMore: true });
|
|
9073
|
+
_a.label = 1;
|
|
9074
|
+
case 1:
|
|
9075
|
+
_a.trys.push([1, 3, , 4]);
|
|
9076
|
+
return [4 /*yield*/, handleReadGroupPage(groupKey, page * limit)];
|
|
9077
|
+
case 2:
|
|
9078
|
+
result = _a.sent();
|
|
9079
|
+
if (!result)
|
|
9080
|
+
return [2 /*return*/];
|
|
9081
|
+
keptRaw_1 = [];
|
|
9082
|
+
keptPretty_1 = [];
|
|
9083
|
+
tableDataRef.current.forEach(function (eachRow, eachIndex) {
|
|
9084
|
+
if (handleResolveGroupKey(eachRow) === groupKey)
|
|
9085
|
+
return;
|
|
9086
|
+
keptRaw_1.push(eachRow);
|
|
9087
|
+
keptPretty_1.push(spaceTableDataRef.current[eachIndex]);
|
|
9088
|
+
});
|
|
9089
|
+
handleSetListData(keptRaw_1.concat(result.rawRows), keptPretty_1.concat(result.prettierRows));
|
|
9090
|
+
loaded = page * limit + result.rawRows.length;
|
|
9091
|
+
handleSetGroupPageState(groupKey, {
|
|
9092
|
+
page: page,
|
|
9093
|
+
cursor: loaded,
|
|
9094
|
+
size: result.count,
|
|
9095
|
+
loadingMore: false,
|
|
9096
|
+
fetched: true,
|
|
9097
|
+
exhausted: loaded >= result.count,
|
|
9098
|
+
});
|
|
9099
|
+
return [3 /*break*/, 4];
|
|
9100
|
+
case 3:
|
|
9101
|
+
err_31 = _a.sent();
|
|
9102
|
+
if (generation !== groupPagingGenRef.current)
|
|
9103
|
+
return [2 /*return*/];
|
|
9104
|
+
handleSetGroupPageState(groupKey, { loadingMore: false });
|
|
9105
|
+
return [3 /*break*/, 4];
|
|
9106
|
+
case 4: return [2 /*return*/];
|
|
9107
|
+
}
|
|
9108
|
+
});
|
|
9109
|
+
}); };
|
|
9110
|
+
// INFO: page mode — after each fresh read every band reads its own first
|
|
9111
|
+
// page, so each shows its real total and pages on its own
|
|
9112
|
+
var handleLoadGroupFirstPages = function () {
|
|
9113
|
+
var _a, _b;
|
|
9114
|
+
groupPagingGenRef.current += 1;
|
|
9115
|
+
groupPageStateRef.current = {};
|
|
9116
|
+
setGroupPageState({});
|
|
9117
|
+
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 : [];
|
|
9118
|
+
__spreadArray(__spreadArray([], listSelection, true), ["Unknown/No Value"], false).forEach(function (groupKey) {
|
|
9119
|
+
return handleFetchGroupPage(groupKey, 0);
|
|
9120
|
+
});
|
|
9121
|
+
};
|
|
8795
9122
|
var renderGroupTable = function (multipleSelect) {
|
|
8796
9123
|
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
9124
|
if (groupId && !((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW)) {
|
|
@@ -8915,11 +9242,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8915
9242
|
}, onObjectEdit: handleObjectCellEdit, addable: {
|
|
8916
9243
|
active: ((_u = props.edit) === null || _u === void 0 ? void 0 : _u.listAddable) ? true : false,
|
|
8917
9244
|
onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9245
|
+
var createdId;
|
|
8918
9246
|
return __generator(this, function (_a) {
|
|
8919
9247
|
switch (_a.label) {
|
|
8920
9248
|
case 0: return [4 /*yield*/, handleSubmitData("create", "", "", data)];
|
|
8921
9249
|
case 1:
|
|
8922
|
-
_a.sent();
|
|
9250
|
+
createdId = _a.sent();
|
|
9251
|
+
if (!createdId)
|
|
9252
|
+
throw new Error("Create failed");
|
|
8923
9253
|
return [2 /*return*/];
|
|
8924
9254
|
}
|
|
8925
9255
|
});
|
|
@@ -8931,7 +9261,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8931
9261
|
else {
|
|
8932
9262
|
// INFO: when bareNewDTW is enabled, render NewTable instead of legacy Table
|
|
8933
9263
|
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(),
|
|
9264
|
+
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(),
|
|
9265
|
+
// INFO: per-group paging — scroll appends inside a band, page
|
|
9266
|
+
// mode gives each band its own pager; undefined = bands as before
|
|
9267
|
+
onGroupLoadMore: renderCheckGroupPaging() && renderCheckScrollMode()
|
|
9268
|
+
? function (groupKey) { return handleFetchGroupNextPage(groupKey); }
|
|
9269
|
+
: undefined, onGroupPageChange: renderCheckGroupPaging() && !renderCheckScrollMode()
|
|
9270
|
+
? function (groupKey, page) {
|
|
9271
|
+
return handleFetchGroupPage(groupKey, page);
|
|
9272
|
+
}
|
|
9273
|
+
: 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
9274
|
!((_j = props.bareSettings) === null || _j === void 0 ? void 0 : _j.bareHideTableExtraMultipleAction)
|
|
8936
9275
|
? [
|
|
8937
9276
|
{
|
|
@@ -9063,16 +9402,23 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
9063
9402
|
}, onObjectEdit: handleObjectCellEdit, addable: {
|
|
9064
9403
|
active: ((_5 = props.edit) === null || _5 === void 0 ? void 0 : _5.listAddable) ? true : false,
|
|
9065
9404
|
onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9405
|
+
var createdId;
|
|
9066
9406
|
return __generator(this, function (_a) {
|
|
9067
9407
|
switch (_a.label) {
|
|
9068
9408
|
case 0: return [4 /*yield*/, handleSubmitData("create", "", "", data)];
|
|
9069
9409
|
case 1:
|
|
9070
|
-
_a.sent();
|
|
9410
|
+
createdId = _a.sent();
|
|
9411
|
+
if (!createdId)
|
|
9412
|
+
throw new Error("Create failed");
|
|
9071
9413
|
return [2 /*return*/];
|
|
9072
9414
|
}
|
|
9073
9415
|
});
|
|
9074
9416
|
}); },
|
|
9075
|
-
}, darkMode: (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.darkMode,
|
|
9417
|
+
}, darkMode: (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.darkMode,
|
|
9418
|
+
// INFO: each band pages itself, so the list-wide pager would only
|
|
9419
|
+
// page the read that seeded them
|
|
9420
|
+
hidePagination: ((_7 = props.organise) === null || _7 === void 0 ? void 0 : _7.hidePagination) ||
|
|
9421
|
+
(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
9422
|
}
|
|
9077
9423
|
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
9424
|
selectedIds.length > 0 &&
|
|
@@ -9157,11 +9503,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
9157
9503
|
}, onObjectEdit: handleObjectCellEdit, addable: {
|
|
9158
9504
|
active: ((_26 = props.edit) === null || _26 === void 0 ? void 0 : _26.listAddable) ? true : false,
|
|
9159
9505
|
onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9506
|
+
var createdId;
|
|
9160
9507
|
return __generator(this, function (_a) {
|
|
9161
9508
|
switch (_a.label) {
|
|
9162
9509
|
case 0: return [4 /*yield*/, handleSubmitData("create", "", "", data)];
|
|
9163
9510
|
case 1:
|
|
9164
|
-
_a.sent();
|
|
9511
|
+
createdId = _a.sent();
|
|
9512
|
+
if (!createdId)
|
|
9513
|
+
throw new Error("Create failed");
|
|
9165
9514
|
return [2 /*return*/];
|
|
9166
9515
|
}
|
|
9167
9516
|
});
|
|
@@ -10719,7 +11068,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
10719
11068
|
var _a, _b;
|
|
10720
11069
|
return (react_1.default.createElement(activityModal_1.ActivityModal, { title: props.title && typeof props.title === "string"
|
|
10721
11070
|
? 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 }));
|
|
11071
|
+
: "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
11072
|
}, maxWidth: "4xl", onClose: function () {
|
|
10724
11073
|
setActivityModal(false);
|
|
10725
11074
|
setActivityId("");
|