blixify-ui-web 1.2.266 → 1.2.267

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.
@@ -631,14 +631,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
631
631
  // read. A band paged alone shows it until its own first page lands, and a
632
632
  // band it counts empty is left out instead of waiting to be read
633
633
  var _207 = (0, react_1.useState)(null), groupTotals = _207[0], setGroupTotals = _207[1];
634
+ // INFO: the last read of groupTotals failed, so bands fall back to the rows
635
+ // loaded instead of waiting on a total that is not coming
636
+ var _208 = (0, react_1.useState)(false), groupTotalsFailed = _208[0], setGroupTotalsFailed = _208[1];
634
637
  var groupSummaryRequestRef = (0, react_1.useRef)(0);
635
- var _208 = (0, react_1.useState)({}), commentCounts = _208[0], setCommentCounts = _208[1];
638
+ // INFO: the grouped count waiting to go out, so a filter change can stop it
639
+ // before it sends the filters it was scheduled with
640
+ var groupSummaryTimerRef = (0, react_1.useRef)(null);
641
+ var _209 = (0, react_1.useState)({}), commentCounts = _209[0], setCommentCounts = _209[1];
636
642
  // INFO: Monday-board per-group paging. Keyed by the group key that
637
643
  // handleBuildNewTableGroups() produces (an option, Unknown or No Value).
638
644
  // Each group tracks its own loaded cursor + total so it can lazily load its
639
645
  // next page as the user scrolls inside that band, independent of every other
640
646
  // group. Only used when renderCheckGroupPaging() is true.
641
- var _209 = (0, react_1.useState)({}), groupPageState = _209[0], setGroupPageState = _209[1];
647
+ var _210 = (0, react_1.useState)({}), groupPageState = _210[0], setGroupPageState = _210[1];
642
648
  // INFO: read fresh inside the async per-group fetch so chained scroll fires
643
649
  // in one tick do not re-fetch an already in-flight page.
644
650
  var groupPageStateRef = (0, react_1.useRef)({});
@@ -653,62 +659,62 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
653
659
  var groupLoadingKeyRef = (0, react_1.useRef)(null);
654
660
  var groupLoadQueueRef = (0, react_1.useRef)([]);
655
661
  var handleFetchGroupNextPageRef = (0, react_1.useRef)(function () { });
656
- var _210 = (0, react_1.useState)(""), readTabSection = _210[0], setReadTabSection = _210[1];
657
- var _211 = (0, react_1.useState)(false), readFloatingNav = _211[0], setReadFloatingNav = _211[1];
662
+ var _211 = (0, react_1.useState)(""), readTabSection = _211[0], setReadTabSection = _211[1];
663
+ var _212 = (0, react_1.useState)(false), readFloatingNav = _212[0], setReadFloatingNav = _212[1];
658
664
  var readTabSectionRefs = (0, react_1.useRef)({});
659
665
  //INFO : Used by Read
660
666
  //INFO : Used by Update
661
- var _212 = (0, react_1.useState)(false), modalVisible = _212[0], setModalVisible = _212[1];
662
- var _213 = (0, react_1.useState)(false), deleteModal = _213[0], setDeleteModal = _213[1];
663
- var _214 = (0, react_1.useState)(false), excelModal = _214[0], setExcelModal = _214[1];
664
- var _215 = (0, react_1.useState)(false), exportExcel = _215[0], setExportExcel = _215[1];
665
- var _216 = (0, react_1.useState)(""), exportType = _216[0], setExportType = _216[1];
666
- var _217 = (0, react_1.useState)(false), exportQR = _217[0], setExportQR = _217[1];
667
- var _218 = (0, react_1.useState)(function () {
667
+ var _213 = (0, react_1.useState)(false), modalVisible = _213[0], setModalVisible = _213[1];
668
+ var _214 = (0, react_1.useState)(false), deleteModal = _214[0], setDeleteModal = _214[1];
669
+ var _215 = (0, react_1.useState)(false), excelModal = _215[0], setExcelModal = _215[1];
670
+ var _216 = (0, react_1.useState)(false), exportExcel = _216[0], setExportExcel = _216[1];
671
+ var _217 = (0, react_1.useState)(""), exportType = _217[0], setExportType = _217[1];
672
+ var _218 = (0, react_1.useState)(false), exportQR = _218[0], setExportQR = _218[1];
673
+ var _219 = (0, react_1.useState)(function () {
668
674
  var _a, _b;
669
675
  var firstTabId = (_b = (_a = structure.find(function (item) { return item.tabId; })) === null || _a === void 0 ? void 0 : _a.tabId) !== null && _b !== void 0 ? _b : "";
670
676
  return firstTabId;
671
- }), activeTab = _218[0], setActiveTab = _218[1];
672
- var _219 = (0, react_1.useState)(false), signatureSigning = _219[0], setSignatureSigning = _219[1];
673
- var _220 = (0, react_1.useState)({}), selectedData = _220[0], setSelectedData = _220[1];
674
- var _221 = (0, react_1.useState)(""), selectedObjectStructureId = _221[0], setSelectedObjectStructureId = _221[1];
675
- var _222 = (0, react_1.useState)(""), selectedObjectId = _222[0], setSelectedObjectId = _222[1];
676
- var _223 = (0, react_1.useState)(""), selectedListAddressId = _223[0], setSelectedListAddressId = _223[1];
677
- var _224 = (0, react_1.useState)(-1), selectedListAddressIndex = _224[0], setSelectedListAddressIndex = _224[1];
678
- var _225 = (0, react_1.useState)({
677
+ }), activeTab = _219[0], setActiveTab = _219[1];
678
+ var _220 = (0, react_1.useState)(false), signatureSigning = _220[0], setSignatureSigning = _220[1];
679
+ var _221 = (0, react_1.useState)({}), selectedData = _221[0], setSelectedData = _221[1];
680
+ var _222 = (0, react_1.useState)(""), selectedObjectStructureId = _222[0], setSelectedObjectStructureId = _222[1];
681
+ var _223 = (0, react_1.useState)(""), selectedObjectId = _223[0], setSelectedObjectId = _223[1];
682
+ var _224 = (0, react_1.useState)(""), selectedListAddressId = _224[0], setSelectedListAddressId = _224[1];
683
+ var _225 = (0, react_1.useState)(-1), selectedListAddressIndex = _225[0], setSelectedListAddressIndex = _225[1];
684
+ var _226 = (0, react_1.useState)({
679
685
  lat: 0,
680
686
  lng: 0,
681
687
  name: "",
682
- }), selectedListAddress = _225[0], setSelectedListAddress = _225[1];
683
- var _226 = (0, react_1.useState)({}), selectedObjectData = _226[0], setSelectedObjectData = _226[1];
684
- var _227 = (0, react_1.useState)(null), objectCellEdit = _227[0], setObjectCellEdit = _227[1];
685
- var _228 = (0, react_1.useState)(false), referenceLoading = _228[0], setReferenceLoading = _228[1];
686
- var _229 = (0, react_1.useState)({}), referencesOptions = _229[0], setReferencesOptions = _229[1];
687
- var _230 = (0, react_1.useState)({}), referencesDetails = _230[0], setReferencesDetails = _230[1];
688
- var _231 = (0, react_1.useState)({}), listReferencesOptions = _231[0], setListReferencesOptions = _231[1];
688
+ }), selectedListAddress = _226[0], setSelectedListAddress = _226[1];
689
+ var _227 = (0, react_1.useState)({}), selectedObjectData = _227[0], setSelectedObjectData = _227[1];
690
+ var _228 = (0, react_1.useState)(null), objectCellEdit = _228[0], setObjectCellEdit = _228[1];
691
+ var _229 = (0, react_1.useState)(false), referenceLoading = _229[0], setReferenceLoading = _229[1];
692
+ var _230 = (0, react_1.useState)({}), referencesOptions = _230[0], setReferencesOptions = _230[1];
693
+ var _231 = (0, react_1.useState)({}), referencesDetails = _231[0], setReferencesDetails = _231[1];
694
+ var _232 = (0, react_1.useState)({}), listReferencesOptions = _232[0], setListReferencesOptions = _232[1];
689
695
  // INFO: the referenced records themselves, for a table cell that picks from
690
696
  // a list on one (referenceSelection)
691
- var _232 = (0, react_1.useState)({}), listReferencesDetails = _232[0], setListReferencesDetails = _232[1];
692
- var _233 = (0, react_1.useState)({}), referenceDeleteTableData = _233[0], setReferenceDeleteTableData = _233[1];
693
- var _234 = (0, react_1.useState)([]), relatedSections = _234[0], setRelatedSections = _234[1];
694
- var _235 = (0, react_1.useState)(0), referenceDeleteIndex = _235[0], setReferenceDeleteIndex = _235[1];
695
- var _236 = (0, react_1.useState)({
697
+ var _233 = (0, react_1.useState)({}), listReferencesDetails = _233[0], setListReferencesDetails = _233[1];
698
+ var _234 = (0, react_1.useState)({}), referenceDeleteTableData = _234[0], setReferenceDeleteTableData = _234[1];
699
+ var _235 = (0, react_1.useState)([]), relatedSections = _235[0], setRelatedSections = _235[1];
700
+ var _236 = (0, react_1.useState)(0), referenceDeleteIndex = _236[0], setReferenceDeleteIndex = _236[1];
701
+ var _237 = (0, react_1.useState)({
696
702
  id: "",
697
703
  name: "",
698
704
  type: "string",
699
- }), referenceCreationModal = _236[0], setReferenceCreationModal = _236[1];
700
- var _237 = (0, react_1.useState)({}), referenceModelSchema = _237[0], setReferenceSchema = _237[1];
701
- var _238 = (0, react_1.useState)([]), kanbanChecked = _238[0], setKanbanChecked = _238[1];
705
+ }), referenceCreationModal = _237[0], setReferenceCreationModal = _237[1];
706
+ var _238 = (0, react_1.useState)({}), referenceModelSchema = _238[0], setReferenceSchema = _238[1];
707
+ var _239 = (0, react_1.useState)([]), kanbanChecked = _239[0], setKanbanChecked = _239[1];
702
708
  //INFO : Offline
703
- var _239 = (0, react_1.useState)(0), offlineDataLength = _239[0], setOfflineDataLength = _239[1];
704
- var _240 = (0, react_1.useState)(false), offlineModal = _240[0], setOfflineModal = _240[1];
709
+ var _240 = (0, react_1.useState)(0), offlineDataLength = _240[0], setOfflineDataLength = _240[1];
710
+ var _241 = (0, react_1.useState)(false), offlineModal = _241[0], setOfflineModal = _241[1];
705
711
  // INFO: live-stream state — driven by socket connection and navigator.onLine
706
- var _241 = (0, react_1.useState)(false), isLive = _241[0], setIsLive = _241[1];
707
- var _242 = (0, react_1.useState)(false), isLiveOffline = _242[0], setIsLiveOffline = _242[1];
712
+ var _242 = (0, react_1.useState)(false), isLive = _242[0], setIsLive = _242[1];
713
+ var _243 = (0, react_1.useState)(false), isLiveOffline = _243[0], setIsLiveOffline = _243[1];
708
714
  // INFO: true when navigator is offline — used to switch ReadQueryHoc between
709
715
  // server reads (online, full pagination) and IndexedDB reads (offline, cached data).
710
716
  // Independent of SSE status so it works even when bareSocketName is not set.
711
- var _243 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _243[0], setIsNetworkOffline = _243[1];
717
+ var _244 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _244[0], setIsNetworkOffline = _244[1];
712
718
  var previousType = (0, react_1.useRef)(null);
713
719
  var previousSelectedData = (0, react_1.useRef)(null);
714
720
  var scrollSentinelRef = (0, react_1.useRef)(null);
@@ -870,6 +876,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
870
876
  // request waits for the reads to settle and goes once
871
877
  (0, react_1.useEffect)(function () {
872
878
  var timer = setTimeout(function () { return handleFetchGroupSummaries(); }, 300);
879
+ groupSummaryTimerRef.current = timer;
873
880
  return function () { return clearTimeout(timer); };
874
881
  /* eslint-disable */
875
882
  }, [groupId, tableData]);
@@ -1036,7 +1043,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1036
1043
  var isSchemaHideMode = ((_25 = props.organise) === null || _25 === void 0 ? void 0 : _25.onChangeHide) ? true : false;
1037
1044
  // INFO: rows per page is a view setting the user can change, so it starts from
1038
1045
  // the persisted value and falls back to the consumer's limit
1039
- var _244 = (0, react_1.useState)((_27 = (_26 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _26 !== void 0 ? _26 : props.limit) !== null && _27 !== void 0 ? _27 : 10), pageLimit = _244[0], setPageLimit = _244[1];
1046
+ var _245 = (0, react_1.useState)((_27 = (_26 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _26 !== void 0 ? _26 : props.limit) !== null && _27 !== void 0 ? _27 : 10), pageLimit = _245[0], setPageLimit = _245[1];
1040
1047
  var limit = pageLimit;
1041
1048
  var isSavedViewsEnabled = !!((_28 = props.organise) === null || _28 === void 0 ? void 0 : _28.savedViews) && resolvedType === "list";
1042
1049
  // INFO: an app that stores views takes over from this browser's storage, so
@@ -1183,7 +1190,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1183
1190
  displayRows: filtered.map(function (eachEntry) { return eachEntry.displayRow; }),
1184
1191
  };
1185
1192
  };
1186
- var _245 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _245.canUpdateRecord, canInlineUpdate = _245.canInlineUpdate, canBatchUpdate = _245.canBatchUpdate, canDeleteRecord = _245.canDeleteRecord;
1193
+ var _246 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _246.canUpdateRecord, canInlineUpdate = _246.canInlineUpdate, canBatchUpdate = _246.canBatchUpdate, canDeleteRecord = _246.canDeleteRecord;
1187
1194
  var isEditor = ((_40 = props.edit) === null || _40 === void 0 ? void 0 : _40.allEditable) ? true : false;
1188
1195
  var isOffline = (_41 = props.bareSettings) === null || _41 === void 0 ? void 0 : _41.bareOffline;
1189
1196
  // INFO: when bareOfflineNetworkAware is true, the save path is also gated on
@@ -1230,7 +1237,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1230
1237
  // INFO: each row button opens what it shows: the comment button the row's
1231
1238
  // comments and logs alone, the eye (or the row) its details alone, so
1232
1239
  // neither has to be scrolled past to reach the other
1233
- var _246 = (0, react_1.useState)(false), inlineActivityOnly = _246[0], setInlineActivityOnly = _246[1];
1240
+ var _247 = (0, react_1.useState)(false), inlineActivityOnly = _247[0], setInlineActivityOnly = _247[1];
1234
1241
  var isActivityOnly = isInlineActivity && inlineActivityOnly;
1235
1242
  // INFO: the row whose comments were shown; going back to the list asks its
1236
1243
  // comment count again, as the drawer does when it closes
@@ -4259,6 +4266,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
4259
4266
  groupPageStateRef.current = {};
4260
4267
  setGroupPageState({});
4261
4268
  setGroupTotals(null);
4269
+ // INFO: a grouped count still in flight counts the list being cleared;
4270
+ // moving the request on drops its reply, so a band keeps pulsing until
4271
+ // the new list's count lands instead of taking the old total
4272
+ groupSummaryRequestRef.current += 1;
4273
+ // INFO: and one still waiting to go out would send the old filters — the
4274
+ // rows of a paged list stay until the new read, so its effect never
4275
+ // clears it. The new read lands new rows, which schedule the next count
4276
+ if (groupSummaryTimerRef.current)
4277
+ clearTimeout(groupSummaryTimerRef.current);
4262
4278
  // INFO: In scroll mode, accumulated rows must be cleared on refresh/filter change
4263
4279
  // so the fresh response replaces stale data instead of being deduped away.
4264
4280
  if (renderCheckScrollMode()) {
@@ -10340,7 +10356,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
10340
10356
  handleCheckLookupGroupBy())
10341
10357
  return undefined;
10342
10358
  var isGroupPaging = renderCheckGroupPaging();
10343
- var sections = (0, groupSections_1.handleBuildGroupSections)({
10359
+ // INFO: the grouped count is on its way, so a band without its total yet
10360
+ // waits for it instead of counting the rows of the first page
10361
+ var isCountPending = groupTotals === null &&
10362
+ !groupTotalsFailed &&
10363
+ handleCheckGroupCountNeeded() &&
10364
+ handleCheckGroupAggregatable();
10365
+ var countedSections = (0, groupSections_1.handleBuildGroupSections)({
10344
10366
  column: handleGetGroupColumn(),
10345
10367
  // INFO: key off the raw row — the display row holds a Tag element for a
10346
10368
  // coloured list value
@@ -10369,6 +10391,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
10369
10391
  ? Math.max(groupTotals[eachSection.id], eachSection.rowIds.length)
10370
10392
  : undefined }));
10371
10393
  });
10394
+ var sections = countedSections.map(function (eachSection) { return (__assign(__assign({}, eachSection), { countPending: eachSection.count === undefined && isCountPending })); });
10372
10395
  // INFO: a section whose own query came back empty has nothing to show
10373
10396
  var shownSections = isGroupPaging
10374
10397
  ? sections.filter(function (eachGroup) {
@@ -10433,6 +10456,25 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
10433
10456
  })
10434
10457
  .map(function (eachColumn) { return eachColumn.id; });
10435
10458
  };
10459
+ // INFO: whether the database can sum and count the groups of this list
10460
+ var handleCheckGroupAggregatable = function () {
10461
+ var _a, _b, _c;
10462
+ return !!handleGetGroupColumn() &&
10463
+ !!isDatasheetDefaults &&
10464
+ !!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW) &&
10465
+ !isFirebase &&
10466
+ // INFO: a formula filter is applied here, not on the server, so the
10467
+ // server's sums would include rows it hides; a union list cannot take
10468
+ // an aggregate
10469
+ !isFormulaView &&
10470
+ !((_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.unionCollections) === null || _c === void 0 ? void 0 : _c.length);
10471
+ };
10472
+ // INFO: in page mode every band reads its first page at once and takes
10473
+ // its total from that; a band paged by scroll is read only once it comes
10474
+ // into view, so until then its total comes from the grouped count
10475
+ var handleCheckGroupCountNeeded = function () {
10476
+ return !renderCheckGroupPaging() || renderCheckScrollMode();
10477
+ };
10436
10478
  /**
10437
10479
  * INFO: each group's total per number column over every row the filters
10438
10480
  * match — the database sums them, one request per column, as a chart's
@@ -10442,23 +10484,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
10442
10484
  */
10443
10485
  var handleFetchGroupSummaries = function () { return __awaiter(void 0, void 0, void 0, function () {
10444
10486
  var column, requestId, sumIds, isCountNeeded, query, range, _a, results, countResult, options_1, totals_1, sums_1, _b;
10445
- var _c, _d, _e, _f;
10446
- return __generator(this, function (_g) {
10447
- switch (_g.label) {
10487
+ var _c;
10488
+ return __generator(this, function (_d) {
10489
+ switch (_d.label) {
10448
10490
  case 0:
10449
10491
  column = handleGetGroupColumn();
10450
10492
  requestId = ++groupSummaryRequestRef.current;
10451
10493
  sumIds = handleGetGroupSumIds();
10452
- isCountNeeded = !renderCheckGroupPaging() || renderCheckScrollMode();
10494
+ isCountNeeded = handleCheckGroupCountNeeded();
10453
10495
  if (!column ||
10454
- !isDatasheetDefaults ||
10455
- !((_c = props.bareSettings) === null || _c === void 0 ? void 0 : _c.bareNewDTW) ||
10456
- isFirebase ||
10457
- // INFO: a formula filter is applied here, not on the server, so the
10458
- // server's sums would include rows it hides; a union list cannot take
10459
- // an aggregate
10460
- isFormulaView ||
10461
- !!((_e = (_d = props.organise) === null || _d === void 0 ? void 0 : _d.unionCollections) === null || _e === void 0 ? void 0 : _e.length) ||
10496
+ !handleCheckGroupAggregatable() ||
10462
10497
  (sumIds.length === 0 && !isCountNeeded)) {
10463
10498
  setGroupSummaries(function (previous) {
10464
10499
  return Object.keys(previous).length > 0 ? {} : previous;
@@ -10466,11 +10501,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
10466
10501
  setGroupTotals(null);
10467
10502
  return [2 /*return*/];
10468
10503
  }
10469
- query = (_f = renderImpSearchFilterConditions()) !== null && _f !== void 0 ? _f : [];
10504
+ setGroupTotalsFailed(false);
10505
+ query = (_c = renderImpSearchFilterConditions()) !== null && _c !== void 0 ? _c : [];
10470
10506
  range = [(0, dayjs_1.default)().add(1, "day").format("DD/MM/YYYY HH:mm:ss")];
10471
- _g.label = 1;
10507
+ _d.label = 1;
10472
10508
  case 1:
10473
- _g.trys.push([1, 3, , 4]);
10509
+ _d.trys.push([1, 3, , 4]);
10474
10510
  return [4 /*yield*/, Promise.all([
10475
10511
  Promise.all(sumIds.map(function (eachId) {
10476
10512
  return readServerQuery.call({
@@ -10500,7 +10536,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
10500
10536
  : undefined,
10501
10537
  ])];
10502
10538
  case 2:
10503
- _a = _g.sent(), results = _a[0], countResult = _a[1];
10539
+ _a = _d.sent(), results = _a[0], countResult = _a[1];
10504
10540
  if (requestId !== groupSummaryRequestRef.current)
10505
10541
  return [2 /*return*/];
10506
10542
  options_1 = handleGetGroupColumnOptions();
@@ -10524,10 +10560,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
10524
10560
  setGroupTotals(countResult ? totals_1 : null);
10525
10561
  return [3 /*break*/, 4];
10526
10562
  case 3:
10527
- _b = _g.sent();
10563
+ _b = _d.sent();
10528
10564
  if (requestId === groupSummaryRequestRef.current) {
10529
10565
  setGroupSummaries({});
10530
10566
  setGroupTotals(null);
10567
+ setGroupTotalsFailed(true);
10531
10568
  }
10532
10569
  return [3 /*break*/, 4];
10533
10570
  case 4: return [2 /*return*/];