blixify-ui-web 1.3.30 → 1.3.31

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.
@@ -257,11 +257,13 @@ exports.handleCheckEmptyCardValue = handleCheckEmptyCardValue;
257
257
  // INFO: rows a select-all update sends by id at most, and ids per delete
258
258
  // request — both keep a request within what the server accepts
259
259
  var SELECT_ALL_ID_CAP = 5000;
260
+ // INFO: rows the "Can't delete yet" box lists before "and N more"
261
+ var DELETE_BLOCKED_ROWS = 50;
260
262
  // INFO: the conditions a server's batch update reads the same way as a list
261
263
  var BATCH_UPDATE_QUERY_TYPES = ["=", "!=", ">", "<", "in", "!in"];
262
264
  var DELETE_ID_CHUNK = 1000;
263
265
  exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
264
- 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, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130;
266
+ 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, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133;
265
267
  // INFO: every view draws a lookup as its source column's type, read-only, so
266
268
  // no type branch below meets "lookup"; rawProps.model keeps the lookups as
267
269
  // stored for the columns handed back to the host
@@ -280,7 +282,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
280
282
  // the list never refetching while the panel is open, which fails silently.
281
283
  // INFO: the panel cannot navigate its way out — handleNavigate("read") is
282
284
  // routed straight back into it — so expand-to-full-page is local state.
283
- var _131 = (0, react_1.useState)(false), drawerPageView = _131[0], setDrawerPageView = _131[1];
285
+ var _134 = (0, react_1.useState)(false), drawerPageView = _134[0], setDrawerPageView = _134[1];
284
286
  // INFO: the panel keeps rendering the record it was opened with rather than
285
287
  // live props. Without this, navigating back to the list would re-render the
286
288
  // still-mounted panel as a second list behind the overlay.
@@ -335,7 +337,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
335
337
  drawerFormEditedRef.current = false;
336
338
  }
337
339
  drawerOpenRef.current = isDrawerHost;
338
- var _132 = (0, react_1.useState)(false), drawerDiscardModal = _132[0], setDrawerDiscardModal = _132[1];
340
+ var _135 = (0, react_1.useState)(false), drawerDiscardModal = _135[0], setDrawerDiscardModal = _135[1];
339
341
  // INFO: leaving the record ends the escape, so the next row opened from the
340
342
  // list peeks in the panel again rather than inheriting a full page the user
341
343
  // asked for once. Saving a form on the full page lands on its read view, which
@@ -414,7 +416,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
414
416
  initialFilterReferenceDate: initialFilterReferenceDate,
415
417
  };
416
418
  };
417
- var _133 = intialiseDefaultFilterValues(), initialFilterSearch = _133.initialFilterSearch, initialFilterSearchParams = _133.initialFilterSearchParams, initialFilterSelection = _133.initialFilterSelection, initialFilterReference = _133.initialFilterReference, initialFilterReferenceDate = _133.initialFilterReferenceDate;
419
+ var _136 = intialiseDefaultFilterValues(), initialFilterSearch = _136.initialFilterSearch, initialFilterSearchParams = _136.initialFilterSearchParams, initialFilterSelection = _136.initialFilterSelection, initialFilterReference = _136.initialFilterReference, initialFilterReferenceDate = _136.initialFilterReferenceDate;
418
420
  // INFO: organise.initialSearch fills the Quick find box, which sends its
419
421
  // value under "search". Without that box (hideSearch, Firebase, or a
420
422
  // "search" query taking its place) there is nothing to fill
@@ -430,19 +432,25 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
430
432
  // keyword: All's columns and sort, no stored filters, and nothing this
431
433
  // person kept in the browser (view drafts, persistViewState) is read or
432
434
  // written — until they pick a view, which is their own choice again
433
- var _134 = (0, react_1.useState)(function () { var _a; return handleCanInitialSearch((_a = props.organise) === null || _a === void 0 ? void 0 : _a.additionalQuery); }), isLinkOpen = _134[0], setIsLinkOpen = _134[1];
435
+ var _137 = (0, react_1.useState)(function () {
436
+ var _a, _b, _c;
437
+ return handleCanInitialSearch((_a = props.organise) === null || _a === void 0 ? void 0 : _a.additionalQuery) ||
438
+ !!((_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.linkFlexFilters) === null || _c === void 0 ? void 0 : _c.length);
439
+ }), isLinkOpen = _137[0], setIsLinkOpen = _137[1];
434
440
  var handleSeedInitialSearch = function (params) {
435
441
  var _a;
436
- return isLinkOpen && ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.initialSearch)
442
+ return isLinkOpen &&
443
+ ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.initialSearch) &&
444
+ handleCanInitialSearch(props.organise.additionalQuery)
437
445
  ? __assign(__assign({}, params), { search: props.organise.initialSearch }) : params;
438
446
  };
439
447
  // INFO: Persist view state hook — handles storage read/write for filter/sort/column state
440
- var _135 = (0, viewStatePersistence_1.usePersistedViewState)({
448
+ var _138 = (0, viewStatePersistence_1.usePersistedViewState)({
441
449
  mode: isLinkOpen ? undefined : (_k = props.organise) === null || _k === void 0 ? void 0 : _k.persistViewState,
442
450
  collectionId: props.collectionId,
443
451
  persistKey: (_l = props.organise) === null || _l === void 0 ? void 0 : _l.persistKey,
444
452
  type: resolvedType,
445
- }), rawPersistedState = _135.persistedState, isPersistEnabled = _135.isEnabled, handleSaveView = _135.handleSaveView, handleRegisterViewSnapshot = _135.handleRegisterViewSnapshot;
453
+ }), rawPersistedState = _138.persistedState, isPersistEnabled = _138.isEnabled, handleSaveView = _138.handleSaveView, handleRegisterViewSnapshot = _138.handleRegisterViewSnapshot;
446
454
  // INFO: drop stored filters/sort on removed columns — they would empty the table
447
455
  var persistedState = (0, react_1.useMemo)(function () {
448
456
  var _a, _b, _c, _d;
@@ -458,8 +466,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
458
466
  (_o = props.bareSettings) === null || _o === void 0 ? void 0 : _o.bareFlexFilterListObjects,
459
467
  (_p = props.bareSettings) === null || _p === void 0 ? void 0 : _p.bareFlexFilterRelated,
460
468
  ]);
461
- var _136 = (0, react_1.useState)(false), loading = _136[0], setLoading = _136[1];
462
- var _137 = (0, react_1.useState)(), notification = _137[0], setNotification = _137[1];
469
+ var _139 = (0, react_1.useState)(false), loading = _139[0], setLoading = _139[1];
470
+ var _140 = (0, react_1.useState)(), notification = _140[0], setNotification = _140[1];
463
471
  // INFO: a success toast is confirmation, not a decision — it clears itself so
464
472
  // it never sits on the floating step bar; errors stay until dismissed
465
473
  (0, react_1.useEffect)(function () {
@@ -469,80 +477,80 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
469
477
  return function () { return clearTimeout(timer); };
470
478
  }, [notification]);
471
479
  //INFO : Used by List
472
- var _138 = (0, react_1.useState)(function () {
480
+ var _141 = (0, react_1.useState)(function () {
473
481
  var _a;
474
482
  return handleSeedInitialSearch((_a = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _a !== void 0 ? _a : initialFilterSearch);
475
- }), filterSearch = _138[0], setFilterSearch = _138[1];
476
- var _139 = (0, react_1.useState)(function () {
483
+ }), filterSearch = _141[0], setFilterSearch = _141[1];
484
+ var _142 = (0, react_1.useState)(function () {
477
485
  var _a;
478
486
  return handleSeedInitialSearch((_a = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _a !== void 0 ? _a : initialFilterSearchParams);
479
- }), filterSearchParams = _139[0], setFilterSearchParams = _139[1];
480
- var _140 = (0, react_1.useState)((_q = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _q !== void 0 ? _q : initialFilterSelection), filterSelection = _140[0], setFilterSelection = _140[1];
481
- var _141 = (0, react_1.useState)((_r = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _r !== void 0 ? _r : initialFilterReference), filterReference = _141[0], setFilterReference = _141[1];
482
- var _142 = (0, react_1.useState)({}), filterReferenceSearch = _142[0], setFilterReferenceSearch = _142[1];
483
- var _143 = (0, react_1.useState)({}), filterReferenceList = _143[0], setFilterReferenceList = _143[1];
484
- var _144 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
487
+ }), filterSearchParams = _142[0], setFilterSearchParams = _142[1];
488
+ var _143 = (0, react_1.useState)((_q = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _q !== void 0 ? _q : initialFilterSelection), filterSelection = _143[0], setFilterSelection = _143[1];
489
+ var _144 = (0, react_1.useState)((_r = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _r !== void 0 ? _r : initialFilterReference), filterReference = _144[0], setFilterReference = _144[1];
490
+ var _145 = (0, react_1.useState)({}), filterReferenceSearch = _145[0], setFilterReferenceSearch = _145[1];
491
+ var _146 = (0, react_1.useState)({}), filterReferenceList = _146[0], setFilterReferenceList = _146[1];
492
+ var _147 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
485
493
  ? (0, viewStatePersistence_1.parseDateFilterState)(persistedState.filterReferenceDate)
486
- : initialFilterReferenceDate), filterReferenceDate = _144[0], setFilterReferenceDate = _144[1];
487
- var _145 = (0, react_1.useState)(true), tableLoading = _145[0], setTableLoading = _145[1];
488
- var _146 = (0, react_1.useState)(""), cursor = _146[0], setCursor = _146[1];
489
- var _147 = (0, react_1.useState)(""), lastCursor = _147[0], setLastCursor = _147[1];
490
- var _148 = (0, react_1.useState)([]), tableData = _148[0], setTableData = _148[1];
491
- var _149 = (0, react_1.useState)([]), spaceTableData = _149[0], setSpaceTableData = _149[1];
494
+ : initialFilterReferenceDate), filterReferenceDate = _147[0], setFilterReferenceDate = _147[1];
495
+ var _148 = (0, react_1.useState)(true), tableLoading = _148[0], setTableLoading = _148[1];
496
+ var _149 = (0, react_1.useState)(""), cursor = _149[0], setCursor = _149[1];
497
+ var _150 = (0, react_1.useState)(""), lastCursor = _150[0], setLastCursor = _150[1];
498
+ var _151 = (0, react_1.useState)([]), tableData = _151[0], setTableData = _151[1];
499
+ var _152 = (0, react_1.useState)([]), spaceTableData = _152[0], setSpaceTableData = _152[1];
492
500
  // INFO: a save resolves after later renders, so it reads the table from here —
493
501
  // the state it closed over can predate an earlier save on the same row
494
502
  var tableDataRef = (0, react_1.useRef)([]);
495
503
  var spaceTableDataRef = (0, react_1.useRef)([]);
496
504
  tableDataRef.current = tableData;
497
505
  spaceTableDataRef.current = spaceTableData;
498
- var _150 = (0, react_1.useState)(0), size = _150[0], setSize = _150[1];
499
- var _151 = (0, react_1.useState)((_u = (_s = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _s !== void 0 ? _s : (_t = props.organise) === null || _t === void 0 ? void 0 : _t.pageIndex) !== null && _u !== void 0 ? _u : 0), pageIndex = _151[0], setPageIndex = _151[1];
506
+ var _153 = (0, react_1.useState)(0), size = _153[0], setSize = _153[1];
507
+ var _154 = (0, react_1.useState)((_u = (_s = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _s !== void 0 ? _s : (_t = props.organise) === null || _t === void 0 ? void 0 : _t.pageIndex) !== null && _u !== void 0 ? _u : 0), pageIndex = _154[0], setPageIndex = _154[1];
500
508
  // INFO: every change of page, including the return to the first page when a
501
509
  // filter or search changes, which onChangePagination does not always report
502
510
  (0, react_1.useEffect)(function () {
503
511
  var _a, _b;
504
512
  (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangePageIndex) === null || _b === void 0 ? void 0 : _b.call(_a, pageIndex);
505
513
  }, [pageIndex]);
506
- var _152 = (0, react_1.useState)([]), selectedIds = _152[0], setSelectedIds = _152[1];
507
- var _153 = (0, react_1.useState)(false), selectAll = _153[0], setSelectAll = _153[1];
508
- var _154 = (0, react_1.useState)(""), deletePasscode = _154[0], setDeletePasscode = _154[1];
509
- var _155 = (0, react_1.useState)(""), deletePasscodeInput = _155[0], setDeletePasscodeInput = _155[1];
510
- var _156 = (0, react_1.useState)(""), deleteFeedId = _156[0], setDeleteFeedId = _156[1];
514
+ var _155 = (0, react_1.useState)([]), selectedIds = _155[0], setSelectedIds = _155[1];
515
+ var _156 = (0, react_1.useState)(false), selectAll = _156[0], setSelectAll = _156[1];
516
+ var _157 = (0, react_1.useState)(""), deletePasscode = _157[0], setDeletePasscode = _157[1];
517
+ var _158 = (0, react_1.useState)(""), deletePasscodeInput = _158[0], setDeletePasscodeInput = _158[1];
518
+ var _159 = (0, react_1.useState)(""), deleteFeedId = _159[0], setDeleteFeedId = _159[1];
511
519
  //INFO : Used by List Organise
512
520
  // INFO: Internal sort state that overrides props.organise?.sort when
513
521
  // persistViewState is enabled and a persisted sort exists
514
- var _157 = (0, react_1.useState)((_v = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _v !== void 0 ? _v : undefined), persistedSort = _157[0], setPersistedSort = _157[1];
515
- var _158 = (0, react_1.useState)(false), filterDraft = _158[0], setFilterDraft = _158[1];
516
- var _159 = (0, react_1.useState)(false), addTabModal = _159[0], setAddTabModal = _159[1];
517
- var _160 = (0, react_1.useState)(-1), editTabIndex = _160[0], setEditTabIndex = _160[1];
522
+ var _160 = (0, react_1.useState)((_v = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _v !== void 0 ? _v : undefined), persistedSort = _160[0], setPersistedSort = _160[1];
523
+ var _161 = (0, react_1.useState)(false), filterDraft = _161[0], setFilterDraft = _161[1];
524
+ var _162 = (0, react_1.useState)(false), addTabModal = _162[0], setAddTabModal = _162[1];
525
+ var _163 = (0, react_1.useState)(-1), editTabIndex = _163[0], setEditTabIndex = _163[1];
518
526
  //INFO : resolve the initial tab synchronously so the mount cond is already
519
527
  // tab-scoped — an empty initial tab caused a second wasted list fetch
520
- var _161 = (0, react_1.useState)(function () {
528
+ var _164 = (0, react_1.useState)(function () {
521
529
  var _a;
522
530
  return (0, listModule_1.renderSelectedRefreshTab)(props.localURLEndpoint, resolvedType, props.collectionId, props.id, (_a = props.organise) === null || _a === void 0 ? void 0 : _a.extendedTabs, listViewId);
523
- }), selectedTab = _161[0], setSelectedTab = _161[1];
524
- var _162 = (0, react_1.useState)("dayGridMonth"), calendarView = _162[0], setCalendarView = _162[1];
531
+ }), selectedTab = _164[0], setSelectedTab = _164[1];
532
+ var _165 = (0, react_1.useState)("dayGridMonth"), calendarView = _165[0], setCalendarView = _165[1];
525
533
  // INFO: bareNewDTW calendar viewSwitch mode — drives the NewCalendar variant
526
534
  // (calendarView above drives the matching range query)
527
- var _163 = (0, react_1.useState)("month"), newCalendarViewMode = _163[0], setNewCalendarViewMode = _163[1];
528
- var _164 = (0, react_1.useState)(new Date()), calendarTabMonth = _164[0], setCalendarTabMonth = _164[1];
535
+ var _166 = (0, react_1.useState)("month"), newCalendarViewMode = _166[0], setNewCalendarViewMode = _166[1];
536
+ var _167 = (0, react_1.useState)(new Date()), calendarTabMonth = _167[0], setCalendarTabMonth = _167[1];
529
537
  // INFO: read once per theme — it asks the browser to resolve a style
530
538
  var timelinePrimaryColour = (0, react_1.useMemo)(function () { return (0, timelineBars_1.handleReadPrimaryColour)(); },
531
539
  /* eslint-disable-next-line */
532
540
  [(_w = props.organise) === null || _w === void 0 ? void 0 : _w.darkMode]);
533
541
  // INFO: the period a timeline shows — it reads only the records whose bars
534
542
  // overlap it, so a large datasheet loads one month or quarter at a time
535
- var _165 = (0, react_1.useState)({ unit: "month", anchor: new Date() }), timelineRange = _165[0], setTimelineRange = _165[1];
543
+ var _168 = (0, react_1.useState)({ unit: "month", anchor: new Date() }), timelineRange = _168[0], setTimelineRange = _168[1];
536
544
  // INFO: defaultViewSwitch picks the opening view only — the tab re-inits
537
545
  // whenever its settings change, and that must not undo the user's switch
538
546
  var calendarViewInitRef = (0, react_1.useRef)(false);
539
- var _166 = (0, react_1.useState)(true), kanbanDroppable = _166[0], setKanbanDroppable = _166[1];
540
- var _167 = (0, react_1.useState)([]), kanbanOptions = _167[0], setKanbanOptions = _167[1];
541
- var _168 = (0, react_1.useState)(false), batchUpdateModal = _168[0], setBatchUpdateModal = _168[1];
542
- var _169 = (0, react_1.useState)({
547
+ var _169 = (0, react_1.useState)(true), kanbanDroppable = _169[0], setKanbanDroppable = _169[1];
548
+ var _170 = (0, react_1.useState)([]), kanbanOptions = _170[0], setKanbanOptions = _170[1];
549
+ var _171 = (0, react_1.useState)(false), batchUpdateModal = _171[0], setBatchUpdateModal = _171[1];
550
+ var _172 = (0, react_1.useState)({
543
551
  columnId: "",
544
552
  columnData: {},
545
- }), batchUpdateData = _169[0], setBatchUpdateData = _169[1];
553
+ }), batchUpdateData = _172[0], setBatchUpdateData = _172[1];
546
554
  // INFO: system columns (created / updated at and by, record id, number)
547
555
  // join the structure hidden; the ones a user shows are kept per view
548
556
  var isSystemColumnsEnabled = !!((_x = props.bareSettings) === null || _x === void 0 ? void 0 : _x.bareSystemColumns);
@@ -550,12 +558,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
550
558
  var appendedSystemColumnIds = isSystemColumnsEnabled
551
559
  ? systemColumns_1.SYSTEM_COLUMN_IDS.filter(function (eachId) { var _a; return !((_a = props.model) !== null && _a !== void 0 ? _a : []).some(function (each) { return each.id === eachId; }); })
552
560
  : [];
553
- var _170 = (0, react_1.useState)((_z = persistedState === null || persistedState === void 0 ? void 0 : persistedState.shownSystemColumnIds) !== null && _z !== void 0 ? _z : []), shownSystemColumnIds = _170[0], setShownSystemColumnIds = _170[1];
561
+ var _173 = (0, react_1.useState)((_z = persistedState === null || persistedState === void 0 ? void 0 : persistedState.shownSystemColumnIds) !== null && _z !== void 0 ? _z : []), shownSystemColumnIds = _173[0], setShownSystemColumnIds = _173[1];
554
562
  var handleWithSystemColumns = function (model, shownIds) {
555
563
  if (shownIds === void 0) { shownIds = shownSystemColumnIds; }
556
564
  return isSystemColumnsEnabled ? (0, systemColumns_1.handleAppendSystemColumns)(model, shownIds) : model;
557
565
  };
558
- var _171 = (0, react_1.useState)(function () {
566
+ var _174 = (0, react_1.useState)(function () {
559
567
  var _a;
560
568
  var baseModel = handleWithSystemColumns((props === null || props === void 0 ? void 0 : props.model) || [], (_a = persistedState === null || persistedState === void 0 ? void 0 : persistedState.shownSystemColumnIds) !== null && _a !== void 0 ? _a : []);
561
569
  if (!persistedState)
@@ -582,8 +590,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
582
590
  });
583
591
  }
584
592
  return model;
585
- }), structure = _171[0], setStructure = _171[1];
586
- var _172 = (0, react_1.useState)(((_0 = props === null || props === void 0 ? void 0 : props.organise) === null || _0 === void 0 ? void 0 : _0.additionalQuery) || []), additionalQuery = _172[0], setAdditionalQuery = _172[1];
593
+ }), structure = _174[0], setStructure = _174[1];
594
+ var _175 = (0, react_1.useState)(((_0 = props === null || props === void 0 ? void 0 : props.organise) === null || _0 === void 0 ? void 0 : _0.additionalQuery) || []), additionalQuery = _175[0], setAdditionalQuery = _175[1];
587
595
  // INFO: State for user-configurable flex filters (Monday.com-style)
588
596
  // INFO: Initialize with one empty row so users see inputs immediately without clicking "Add Filter"
589
597
  var defaultFlexFilterRow = [
@@ -595,13 +603,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
595
603
  },
596
604
  ];
597
605
  // INFO: rows the host opens the list with come before a saved view's
598
- var initialFlexFilterRows = ((_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.initialFlexFilters) &&
599
- props.organise.initialFlexFilters.length > 0
600
- ? props.organise.initialFlexFilters
601
- : (persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
602
- ? persistedState.flexFilters
603
- : defaultFlexFilterRow;
604
- var _173 = (0, react_1.useState)(initialFlexFilterRows), flexFilters = _173[0], setFlexFilters = _173[1];
606
+ var initialFlexFilterRows = ((_2 = (_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.linkFlexFilters) === null || _2 === void 0 ? void 0 : _2.length)
607
+ ? props.organise.linkFlexFilters
608
+ : ((_3 = props.organise) === null || _3 === void 0 ? void 0 : _3.initialFlexFilters) &&
609
+ props.organise.initialFlexFilters.length > 0
610
+ ? props.organise.initialFlexFilters
611
+ : (persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
612
+ ? persistedState.flexFilters
613
+ : defaultFlexFilterRow;
614
+ var _176 = (0, react_1.useState)(initialFlexFilterRows), flexFilters = _176[0], setFlexFilters = _176[1];
605
615
  // INFO: always-current mirror of flexFilters, read by the imperative apply/
606
616
  // clear methods so chained calls in one tick aren't stale.
607
617
  var flexFiltersRef = (0, react_1.useRef)(flexFilters);
@@ -614,111 +624,113 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
614
624
  }, [flexFilters]);
615
625
  // INFO: Debounced version of flexFilters used by renderImpSearchFilterConditions
616
626
  // to prevent API calls on every keystroke when typing in value inputs
617
- var _174 = (0, react_1.useState)(initialFlexFilterRows), flexFiltersDebounced = _174[0], setFlexFiltersDebounced = _174[1];
627
+ var _177 = (0, react_1.useState)(initialFlexFilterRows), flexFiltersDebounced = _177[0], setFlexFiltersDebounced = _177[1];
618
628
  // INFO: the filter rows of the export being set up — started from the
619
629
  // list's own when the export opens, so changing them leaves the list as it is
620
- var _175 = (0, react_1.useState)(defaultFlexFilterRow), exportFlexFilters = _175[0], setExportFlexFilters = _175[1];
621
- var _176 = (0, react_1.useState)({}), flexFilterReferenceOptions = _176[0], setFlexFilterReferenceOptions = _176[1];
622
- var _177 = (0, react_1.useState)({}), flexFilterReferenceSearch = _177[0], setFlexFilterReferenceSearch = _177[1];
623
- var _178 = (0, react_1.useState)(false), flexFilterModalOpen = _178[0], setFlexFilterModalOpen = _178[1];
624
- var _179 = (0, react_1.useState)(false), viewSettingsModalOpen = _179[0], setViewSettingsModalOpen = _179[1];
630
+ var _178 = (0, react_1.useState)(defaultFlexFilterRow), exportFlexFilters = _178[0], setExportFlexFilters = _178[1];
631
+ var _179 = (0, react_1.useState)({}), flexFilterReferenceOptions = _179[0], setFlexFilterReferenceOptions = _179[1];
632
+ var _180 = (0, react_1.useState)({}), flexFilterReferenceSearch = _180[0], setFlexFilterReferenceSearch = _180[1];
633
+ var _181 = (0, react_1.useState)(false), flexFilterModalOpen = _181[0], setFlexFilterModalOpen = _181[1];
634
+ var _182 = (0, react_1.useState)(false), viewSettingsModalOpen = _182[0], setViewSettingsModalOpen = _182[1];
625
635
  // INFO: Columns the end user chose to hide (bareSettings.bareViewSettings).
626
636
  // Deliberately kept out of `structure`: the props-sync effect below resets
627
637
  // structure to props.model whenever props change, which would wipe the
628
638
  // choice, and the persist effect derives schema-level hiddenColumnIds from
629
639
  // structure — writing user hides there would blur the two concepts.
630
- var _180 = (0, react_1.useState)((_2 = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _2 !== void 0 ? _2 : []), userHiddenColumnIds = _180[0], setUserHiddenColumnIds = _180[1];
631
- var _181 = (0, react_1.useState)(""), columnSearch = _181[0], setColumnSearch = _181[1];
632
- var _182 = (0, react_1.useState)([]), savedViews = _182[0], setSavedViews = _182[1];
633
- var _183 = (0, react_1.useState)(null), activeSavedViewId = _183[0], setActiveSavedViewId = _183[1];
640
+ var _183 = (0, react_1.useState)((_4 = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _4 !== void 0 ? _4 : []), userHiddenColumnIds = _183[0], setUserHiddenColumnIds = _183[1];
641
+ var _184 = (0, react_1.useState)(""), columnSearch = _184[0], setColumnSearch = _184[1];
642
+ var _185 = (0, react_1.useState)([]), savedViews = _185[0], setSavedViews = _185[1];
643
+ var _186 = (0, react_1.useState)(null), activeSavedViewId = _186[0], setActiveSavedViewId = _186[1];
634
644
  // INFO: the widths of the view on screen, by column id ("180px")
635
- var _184 = (0, react_1.useState)(function () { var _a, _b, _c; return (_c = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.columnWidths) !== null && _c !== void 0 ? _c : {}; }), columnWidths = _184[0], setColumnWidths = _184[1];
645
+ var _187 = (0, react_1.useState)(function () { var _a, _b, _c; return (_c = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.columnWidths) !== null && _c !== void 0 ? _c : {}; }), columnWidths = _187[0], setColumnWidths = _187[1];
636
646
  // INFO: the kanban lane widths of the view on screen, by lane id ("300px")
637
- var _185 = (0, react_1.useState)(function () { var _a, _b, _c; return (_c = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.laneWidths) !== null && _c !== void 0 ? _c : {}; }), laneWidths = _185[0], setLaneWidths = _185[1];
647
+ var _188 = (0, react_1.useState)(function () { var _a, _b, _c; return (_c = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.laneWidths) !== null && _c !== void 0 ? _c : {}; }), laneWidths = _188[0], setLaneWidths = _188[1];
638
648
  // INFO: the read drawer's dragged width ("520px"), kept in the view with the
639
649
  // column widths. A restored persistViewState wins over All's, as a saved
640
650
  // view or draft applied at opening replaces both
641
- var _186 = (0, react_1.useState)(function () {
651
+ var _189 = (0, react_1.useState)(function () {
642
652
  var _a, _b, _c;
643
653
  return (_a = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.drawerWidth : undefined)) !== null && _a !== void 0 ? _a : (_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.allView) === null || _c === void 0 ? void 0 : _c.drawerWidth;
644
- }), drawerWidth = _186[0], setDrawerWidth = _186[1];
654
+ }), drawerWidth = _189[0], setDrawerWidth = _189[1];
645
655
  // INFO: the columns the view on screen freezes at the left edge
646
- var _187 = (0, react_1.useState)(function () { var _a, _b; return (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.pinnedColumnIds; }), pinnedColumnIds = _187[0], setPinnedColumnIds = _187[1];
656
+ var _190 = (0, react_1.useState)(function () { var _a, _b; return (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.pinnedColumnIds; }), pinnedColumnIds = _190[0], setPinnedColumnIds = _190[1];
647
657
  // INFO: unsaved changes are kept only once the opening view is on screen,
648
658
  // so the defaults drawn before it never overwrite a person's own
649
- var _188 = (0, react_1.useState)(false), isViewDraftReady = _188[0], setIsViewDraftReady = _188[1];
659
+ var _191 = (0, react_1.useState)(false), isViewDraftReady = _191[0], setIsViewDraftReady = _191[1];
650
660
  // INFO: null while the name box is closed
651
- var _189 = (0, react_1.useState)(null), savedViewName = _189[0], setSavedViewName = _189[1];
652
- var _190 = (0, react_1.useState)(null), deletingSavedViewId = _190[0], setDeletingSavedViewId = _190[1];
661
+ var _192 = (0, react_1.useState)(null), savedViewName = _192[0], setSavedViewName = _192[1];
662
+ var _193 = (0, react_1.useState)(null), deletingSavedViewId = _193[0], setDeletingSavedViewId = _193[1];
653
663
  // INFO: the view chip being dragged, to drop it in another place
654
- var _191 = (0, react_1.useState)(null), draggingSavedViewId = _191[0], setDraggingSavedViewId = _191[1];
664
+ var _194 = (0, react_1.useState)(null), draggingSavedViewId = _194[0], setDraggingSavedViewId = _194[1];
655
665
  // INFO: the tab strip in the order a drag has reached, saved once on drop
656
- var _192 = (0, react_1.useState)(null), draggedTabs = _192[0], setDraggedTabs = _192[1];
657
- var _193 = (0, react_1.useState)(null), renamingSavedView = _193[0], setRenamingSavedView = _193[1];
658
- var _194 = (0, react_1.useState)(false), isSavedViewsExpanded = _194[0], setIsSavedViewsExpanded = _194[1];
659
- var _195 = (0, react_1.useState)(null), draggingColumnId = _195[0], setDraggingColumnId = _195[1];
666
+ var _195 = (0, react_1.useState)(null), draggedTabs = _195[0], setDraggedTabs = _195[1];
667
+ var _196 = (0, react_1.useState)(null), renamingSavedView = _196[0], setRenamingSavedView = _196[1];
668
+ var _197 = (0, react_1.useState)(false), isSavedViewsExpanded = _197[0], setIsSavedViewsExpanded = _197[1];
669
+ var _198 = (0, react_1.useState)(null), draggingColumnId = _198[0], setDraggingColumnId = _198[1];
660
670
  var columnRowRefs = (0, react_1.useRef)({});
661
671
  //INFO : Used by Auth
662
- var _196 = (0, react_1.useState)({
672
+ var _199 = (0, react_1.useState)({
663
673
  email: "",
664
674
  google: "",
665
675
  phone: "",
666
676
  disabled: false,
667
677
  create: false,
668
- }), authMethods = _196[0], setAuthMethods = _196[1];
669
- var _197 = (0, react_1.useState)(""), selectedAuthMethod = _197[0], setSelectedAuthMethod = _197[1];
678
+ }), authMethods = _199[0], setAuthMethods = _199[1];
679
+ var _200 = (0, react_1.useState)(""), selectedAuthMethod = _200[0], setSelectedAuthMethod = _200[1];
670
680
  // INFO: the sign-in check of a users datasheet's record is running; the
671
681
  // panel shows a spinner rather than nothing, which read as "no login"
672
- var _198 = (0, react_1.useState)(false), authLoading = _198[0], setAuthLoading = _198[1];
682
+ var _201 = (0, react_1.useState)(false), authLoading = _201[0], setAuthLoading = _201[1];
673
683
  // INFO: a delete is running — the ref answers a second tap at once, before
674
684
  // the state has rendered, and the state disables the confirm button
675
685
  var deletingRef = (0, react_1.useRef)(false);
676
- var _199 = (0, react_1.useState)(false), deleting = _199[0], setDeleting = _199[1];
686
+ var _202 = (0, react_1.useState)(false), deleting = _202[0], setDeleting = _202[1];
677
687
  // INFO: Used by Activity Log
678
- var _200 = (0, react_1.useState)(false), activityModal = _200[0], setActivityModal = _200[1];
679
- var _201 = (0, react_1.useState)(""), activityId = _201[0], setActivityId = _201[1];
688
+ var _203 = (0, react_1.useState)(false), activityModal = _203[0], setActivityModal = _203[1];
689
+ var _204 = (0, react_1.useState)(""), activityId = _204[0], setActivityId = _204[1];
680
690
  //INFO : Used by Export
681
- var _202 = (0, react_1.useState)(null), csvFile = _202[0], setCSVFile = _202[1];
682
- var _203 = (0, react_1.useState)([]), csvFileData = _203[0], setCSVFileData = _203[1];
683
- var _204 = (0, react_1.useState)(0), stepCSVIndex = _204[0], setStepCSVIndex = _204[1];
684
- var _205 = (0, react_1.useState)({}), listCSVMapAttribute = _205[0], setListCSVMapAttribute = _205[1];
685
- var _206 = (0, react_1.useState)({}), listCSVObjAttribute = _206[0], setListCSVObjAttribute = _206[1];
686
- var _207 = (0, react_1.useState)([]), csvAPIAttribute = _207[0], setCSVAPIAttribute = _207[1];
687
- var _208 = (0, react_1.useState)(((_3 = props.devSettings.currentUser) === null || _3 === void 0 ? void 0 : _3.userEmail) || ""), exportCSVEmail = _208[0], setExportCSVEmail = _208[1];
688
- var _209 = (0, react_1.useState)(((_5 = (_4 = props.organise) === null || _4 === void 0 ? void 0 : _4.exportSettings) === null || _5 === void 0 ? void 0 : _5.defaultExportPDFName) || ""), exportPDFTitle = _209[0], setExportPDFTitle = _209[1];
689
- var _210 = (0, react_1.useState)(false), exportPDFLoading = _210[0], setExportPDFLoading = _210[1];
690
- var _211 = (0, react_1.useState)(false), exportReadPDFLoading = _211[0], setExportReadPDFLoading = _211[1];
691
- var _212 = (0, react_1.useState)((_8 = (_7 = (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.exportSettings) === null || _7 === void 0 ? void 0 : _7.sumColumnId) !== null && _8 !== void 0 ? _8 : []), exportSumAttributeIds = _212[0], setExportSumAttributeIds = _212[1];
692
- var _213 = (0, react_1.useState)((_11 = (_10 = (_9 = props.organise) === null || _9 === void 0 ? void 0 : _9.exportSettings) === null || _10 === void 0 ? void 0 : _10.hideSubItems) !== null && _11 !== void 0 ? _11 : false), hideSubItems = _213[0], setHideSubItems = _213[1];
693
- var _214 = (0, react_1.useState)([]), importTableData = _214[0], setImportTableData = _214[1];
694
- var _215 = (0, react_1.useState)([]), queryList = _215[0], setQueryList = _215[1];
695
- var _216 = (0, react_1.useState)(undefined), allQueryList = _216[0], setAllQueryList = _216[1];
691
+ var _205 = (0, react_1.useState)(null), csvFile = _205[0], setCSVFile = _205[1];
692
+ var _206 = (0, react_1.useState)([]), csvFileData = _206[0], setCSVFileData = _206[1];
693
+ var _207 = (0, react_1.useState)(0), stepCSVIndex = _207[0], setStepCSVIndex = _207[1];
694
+ var _208 = (0, react_1.useState)({}), listCSVMapAttribute = _208[0], setListCSVMapAttribute = _208[1];
695
+ var _209 = (0, react_1.useState)({}), listCSVObjAttribute = _209[0], setListCSVObjAttribute = _209[1];
696
+ var _210 = (0, react_1.useState)([]), csvAPIAttribute = _210[0], setCSVAPIAttribute = _210[1];
697
+ var _211 = (0, react_1.useState)(((_5 = props.devSettings.currentUser) === null || _5 === void 0 ? void 0 : _5.userEmail) || ""), exportCSVEmail = _211[0], setExportCSVEmail = _211[1];
698
+ var _212 = (0, react_1.useState)(((_7 = (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.exportSettings) === null || _7 === void 0 ? void 0 : _7.defaultExportPDFName) || ""), exportPDFTitle = _212[0], setExportPDFTitle = _212[1];
699
+ var _213 = (0, react_1.useState)(false), exportPDFLoading = _213[0], setExportPDFLoading = _213[1];
700
+ var _214 = (0, react_1.useState)(false), exportReadPDFLoading = _214[0], setExportReadPDFLoading = _214[1];
701
+ var _215 = (0, react_1.useState)((_10 = (_9 = (_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.exportSettings) === null || _9 === void 0 ? void 0 : _9.sumColumnId) !== null && _10 !== void 0 ? _10 : []), exportSumAttributeIds = _215[0], setExportSumAttributeIds = _215[1];
702
+ var _216 = (0, react_1.useState)((_13 = (_12 = (_11 = props.organise) === null || _11 === void 0 ? void 0 : _11.exportSettings) === null || _12 === void 0 ? void 0 : _12.hideSubItems) !== null && _13 !== void 0 ? _13 : false), hideSubItems = _216[0], setHideSubItems = _216[1];
703
+ var _217 = (0, react_1.useState)([]), importTableData = _217[0], setImportTableData = _217[1];
704
+ var _218 = (0, react_1.useState)([]), queryList = _218[0], setQueryList = _218[1];
705
+ var _219 = (0, react_1.useState)(undefined), allQueryList = _219[0], setAllQueryList = _219[1];
696
706
  // INFO: a restored state wins over the prop; its "" is a list the user
697
707
  // ungrouped, so it opens ungrouped
698
- var _217 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupBy) !== undefined
708
+ var _220 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupBy) !== undefined
699
709
  ? persistedState.groupBy || undefined
700
- : (_12 = props.organise) === null || _12 === void 0 ? void 0 : _12.groupBy), groupId = _217[0], setGroupId = _217[1];
710
+ : (_14 = props.organise) === null || _14 === void 0 ? void 0 : _14.groupBy), groupId = _220[0], setGroupId = _220[1];
711
+ // INFO: groups by their record count, or in the column's own order
712
+ var _221 = (0, react_1.useState)((_15 = persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupOrder) !== null && _15 !== void 0 ? _15 : ""), groupOrder = _221[0], setGroupOrder = _221[1];
701
713
  // INFO: each group's total per number column, keyed by section id
702
- var _218 = (0, react_1.useState)({}), groupSummaries = _218[0], setGroupSummaries = _218[1];
714
+ var _222 = (0, react_1.useState)({}), groupSummaries = _222[0], setGroupSummaries = _222[1];
703
715
  // INFO: each group's row count over every row the filters match; null until
704
716
  // read. A band paged alone shows it until its own first page lands, and a
705
717
  // band it counts empty is left out instead of waiting to be read
706
- var _219 = (0, react_1.useState)(null), groupTotals = _219[0], setGroupTotals = _219[1];
718
+ var _223 = (0, react_1.useState)(null), groupTotals = _223[0], setGroupTotals = _223[1];
707
719
  // INFO: the last read of groupTotals failed, so bands fall back to the rows
708
720
  // loaded instead of waiting on a total that is not coming
709
- var _220 = (0, react_1.useState)(false), groupTotalsFailed = _220[0], setGroupTotalsFailed = _220[1];
721
+ var _224 = (0, react_1.useState)(false), groupTotalsFailed = _224[0], setGroupTotalsFailed = _224[1];
710
722
  var groupSummaryRequestRef = (0, react_1.useRef)(0);
711
723
  // INFO: the grouped count waiting to go out, so a filter change can stop it
712
724
  // before it sends the filters it was scheduled with
713
725
  var groupSummaryTimerRef = (0, react_1.useRef)(null);
714
- var _221 = (0, react_1.useState)({}), commentCounts = _221[0], setCommentCounts = _221[1];
715
- var _222 = (0, react_1.useState)({}), commentUnread = _222[0], setCommentUnread = _222[1];
726
+ var _225 = (0, react_1.useState)({}), commentCounts = _225[0], setCommentCounts = _225[1];
727
+ var _226 = (0, react_1.useState)({}), commentUnread = _226[0], setCommentUnread = _226[1];
716
728
  // INFO: Monday-board per-group paging. Keyed by the group key that
717
729
  // handleBuildNewTableGroups() produces (an option, Unknown or No Value).
718
730
  // Each group tracks its own loaded cursor + total so it can lazily load its
719
731
  // next page as the user scrolls inside that band, independent of every other
720
732
  // group. Only used when renderCheckGroupPaging() is true.
721
- var _223 = (0, react_1.useState)({}), groupPageState = _223[0], setGroupPageState = _223[1];
733
+ var _227 = (0, react_1.useState)({}), groupPageState = _227[0], setGroupPageState = _227[1];
722
734
  // INFO: read fresh inside the async per-group fetch so chained scroll fires
723
735
  // in one tick do not re-fetch an already in-flight page.
724
736
  var groupPageStateRef = (0, react_1.useRef)({});
@@ -733,62 +745,63 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
733
745
  var groupLoadingKeyRef = (0, react_1.useRef)(null);
734
746
  var groupLoadQueueRef = (0, react_1.useRef)([]);
735
747
  var handleFetchGroupNextPageRef = (0, react_1.useRef)(function () { });
736
- var _224 = (0, react_1.useState)(""), readTabSection = _224[0], setReadTabSection = _224[1];
737
- var _225 = (0, react_1.useState)(false), readFloatingNav = _225[0], setReadFloatingNav = _225[1];
748
+ var _228 = (0, react_1.useState)(""), readTabSection = _228[0], setReadTabSection = _228[1];
749
+ var _229 = (0, react_1.useState)(false), readFloatingNav = _229[0], setReadFloatingNav = _229[1];
738
750
  var readTabSectionRefs = (0, react_1.useRef)({});
739
751
  //INFO : Used by Read
740
752
  //INFO : Used by Update
741
- var _226 = (0, react_1.useState)(false), modalVisible = _226[0], setModalVisible = _226[1];
742
- var _227 = (0, react_1.useState)(false), deleteModal = _227[0], setDeleteModal = _227[1];
743
- var _228 = (0, react_1.useState)(false), excelModal = _228[0], setExcelModal = _228[1];
744
- var _229 = (0, react_1.useState)(false), exportExcel = _229[0], setExportExcel = _229[1];
745
- var _230 = (0, react_1.useState)(""), exportType = _230[0], setExportType = _230[1];
746
- var _231 = (0, react_1.useState)(false), exportQR = _231[0], setExportQR = _231[1];
747
- var _232 = (0, react_1.useState)(function () {
753
+ var _230 = (0, react_1.useState)(false), modalVisible = _230[0], setModalVisible = _230[1];
754
+ var _231 = (0, react_1.useState)(false), deleteModal = _231[0], setDeleteModal = _231[1];
755
+ var _232 = (0, react_1.useState)(false), excelModal = _232[0], setExcelModal = _232[1];
756
+ var _233 = (0, react_1.useState)(false), exportExcel = _233[0], setExportExcel = _233[1];
757
+ var _234 = (0, react_1.useState)(""), exportType = _234[0], setExportType = _234[1];
758
+ var _235 = (0, react_1.useState)(false), exportQR = _235[0], setExportQR = _235[1];
759
+ var _236 = (0, react_1.useState)(function () {
748
760
  var _a, _b;
749
761
  var firstTabId = (_b = (_a = structure.find(function (item) { return item.tabId; })) === null || _a === void 0 ? void 0 : _a.tabId) !== null && _b !== void 0 ? _b : "";
750
762
  return firstTabId;
751
- }), activeTab = _232[0], setActiveTab = _232[1];
752
- var _233 = (0, react_1.useState)(false), signatureSigning = _233[0], setSignatureSigning = _233[1];
753
- var _234 = (0, react_1.useState)({}), selectedData = _234[0], setSelectedData = _234[1];
754
- var _235 = (0, react_1.useState)(""), selectedObjectStructureId = _235[0], setSelectedObjectStructureId = _235[1];
755
- var _236 = (0, react_1.useState)(""), selectedObjectId = _236[0], setSelectedObjectId = _236[1];
756
- var _237 = (0, react_1.useState)(""), selectedListAddressId = _237[0], setSelectedListAddressId = _237[1];
757
- var _238 = (0, react_1.useState)(-1), selectedListAddressIndex = _238[0], setSelectedListAddressIndex = _238[1];
758
- var _239 = (0, react_1.useState)({
763
+ }), activeTab = _236[0], setActiveTab = _236[1];
764
+ var _237 = (0, react_1.useState)(false), signatureSigning = _237[0], setSignatureSigning = _237[1];
765
+ var _238 = (0, react_1.useState)({}), selectedData = _238[0], setSelectedData = _238[1];
766
+ var _239 = (0, react_1.useState)(""), selectedObjectStructureId = _239[0], setSelectedObjectStructureId = _239[1];
767
+ var _240 = (0, react_1.useState)(""), selectedObjectId = _240[0], setSelectedObjectId = _240[1];
768
+ var _241 = (0, react_1.useState)(""), selectedListAddressId = _241[0], setSelectedListAddressId = _241[1];
769
+ var _242 = (0, react_1.useState)(-1), selectedListAddressIndex = _242[0], setSelectedListAddressIndex = _242[1];
770
+ var _243 = (0, react_1.useState)({
759
771
  lat: 0,
760
772
  lng: 0,
761
773
  name: "",
762
- }), selectedListAddress = _239[0], setSelectedListAddress = _239[1];
763
- var _240 = (0, react_1.useState)({}), selectedObjectData = _240[0], setSelectedObjectData = _240[1];
764
- var _241 = (0, react_1.useState)(null), objectCellEdit = _241[0], setObjectCellEdit = _241[1];
765
- var _242 = (0, react_1.useState)(false), referenceLoading = _242[0], setReferenceLoading = _242[1];
766
- var _243 = (0, react_1.useState)({}), referencesOptions = _243[0], setReferencesOptions = _243[1];
767
- var _244 = (0, react_1.useState)({}), referencesDetails = _244[0], setReferencesDetails = _244[1];
768
- var _245 = (0, react_1.useState)({}), listReferencesOptions = _245[0], setListReferencesOptions = _245[1];
774
+ }), selectedListAddress = _243[0], setSelectedListAddress = _243[1];
775
+ var _244 = (0, react_1.useState)({}), selectedObjectData = _244[0], setSelectedObjectData = _244[1];
776
+ var _245 = (0, react_1.useState)(null), objectCellEdit = _245[0], setObjectCellEdit = _245[1];
777
+ var _246 = (0, react_1.useState)(false), referenceLoading = _246[0], setReferenceLoading = _246[1];
778
+ var _247 = (0, react_1.useState)({}), referencesOptions = _247[0], setReferencesOptions = _247[1];
779
+ var _248 = (0, react_1.useState)({}), referencesDetails = _248[0], setReferencesDetails = _248[1];
780
+ var _249 = (0, react_1.useState)({}), listReferencesOptions = _249[0], setListReferencesOptions = _249[1];
769
781
  // INFO: the referenced records themselves, for a table cell that picks from
770
782
  // a list on one (referenceSelection)
771
- var _246 = (0, react_1.useState)({}), listReferencesDetails = _246[0], setListReferencesDetails = _246[1];
772
- var _247 = (0, react_1.useState)({}), referenceDeleteTableData = _247[0], setReferenceDeleteTableData = _247[1];
773
- var _248 = (0, react_1.useState)([]), relatedSections = _248[0], setRelatedSections = _248[1];
774
- var _249 = (0, react_1.useState)(0), referenceDeleteIndex = _249[0], setReferenceDeleteIndex = _249[1];
775
- var _250 = (0, react_1.useState)({
783
+ var _250 = (0, react_1.useState)({}), listReferencesDetails = _250[0], setListReferencesDetails = _250[1];
784
+ // INFO: each record that could not be deleted, by the datasheet still
785
+ // linking to it
786
+ var _251 = (0, react_1.useState)([]), referenceDeleteTableData = _251[0], setReferenceDeleteTableData = _251[1];
787
+ var _252 = (0, react_1.useState)([]), relatedSections = _252[0], setRelatedSections = _252[1];
788
+ var _253 = (0, react_1.useState)({
776
789
  id: "",
777
790
  name: "",
778
791
  type: "string",
779
- }), referenceCreationModal = _250[0], setReferenceCreationModal = _250[1];
780
- var _251 = (0, react_1.useState)({}), referenceModelSchema = _251[0], setReferenceSchema = _251[1];
781
- var _252 = (0, react_1.useState)([]), kanbanChecked = _252[0], setKanbanChecked = _252[1];
792
+ }), referenceCreationModal = _253[0], setReferenceCreationModal = _253[1];
793
+ var _254 = (0, react_1.useState)({}), referenceModelSchema = _254[0], setReferenceSchema = _254[1];
794
+ var _255 = (0, react_1.useState)([]), kanbanChecked = _255[0], setKanbanChecked = _255[1];
782
795
  //INFO : Offline
783
- var _253 = (0, react_1.useState)(0), offlineDataLength = _253[0], setOfflineDataLength = _253[1];
784
- var _254 = (0, react_1.useState)(false), offlineModal = _254[0], setOfflineModal = _254[1];
796
+ var _256 = (0, react_1.useState)(0), offlineDataLength = _256[0], setOfflineDataLength = _256[1];
797
+ var _257 = (0, react_1.useState)(false), offlineModal = _257[0], setOfflineModal = _257[1];
785
798
  // INFO: live-stream state — driven by socket connection and navigator.onLine
786
- var _255 = (0, react_1.useState)(false), isLive = _255[0], setIsLive = _255[1];
787
- var _256 = (0, react_1.useState)(false), isLiveOffline = _256[0], setIsLiveOffline = _256[1];
799
+ var _258 = (0, react_1.useState)(false), isLive = _258[0], setIsLive = _258[1];
800
+ var _259 = (0, react_1.useState)(false), isLiveOffline = _259[0], setIsLiveOffline = _259[1];
788
801
  // INFO: true when navigator is offline — used to switch ReadQueryHoc between
789
802
  // server reads (online, full pagination) and IndexedDB reads (offline, cached data).
790
803
  // Independent of SSE status so it works even when bareSocketName is not set.
791
- var _257 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _257[0], setIsNetworkOffline = _257[1];
804
+ var _260 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _260[0], setIsNetworkOffline = _260[1];
792
805
  var previousType = (0, react_1.useRef)(null);
793
806
  var previousSelectedData = (0, react_1.useRef)(null);
794
807
  var scrollSentinelRef = (0, react_1.useRef)(null);
@@ -938,7 +951,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
938
951
  * viewId still wins when present: it is a deliberate destination, from a
939
952
  * shared link or a back button.
940
953
  */
941
- var defaultTabName = (_15 = (_14 = (_13 = props.organise) === null || _13 === void 0 ? void 0 : _13.extendedTabs) === null || _14 === void 0 ? void 0 : _14.find(function (eachTab) { return eachTab.defaultTab; })) === null || _15 === void 0 ? void 0 : _15.name;
954
+ var defaultTabName = (_18 = (_17 = (_16 = props.organise) === null || _16 === void 0 ? void 0 : _16.extendedTabs) === null || _17 === void 0 ? void 0 : _17.find(function (eachTab) { return eachTab.defaultTab; })) === null || _18 === void 0 ? void 0 : _18.name;
942
955
  // INFO: the pinned tab is a LIST destination. Falling back to it while a
943
956
  // record is open resolved the read view to a list tab, which renderTabContent
944
957
  // refuses — so General Details rendered nothing. Only a list falls back.
@@ -950,14 +963,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
950
963
  // INFO: Firestore reads and the monday wrapper join every condition with AND
951
964
  // (monday flattens all ORs into one), so a flex OR group is offered on Mongo only
952
965
  var isFlexOrSupported = !isFirebase && devSettings.server !== "mondayServer";
953
- var isDateWarnings = !!((_16 = props.organise) === null || _16 === void 0 ? void 0 : _16.dateWarnings);
954
- var isDatasheetDefaults = !!((_17 = props.organise) === null || _17 === void 0 ? void 0 : _17.datasheetDefaults);
966
+ var isDateWarnings = !!((_19 = props.organise) === null || _19 === void 0 ? void 0 : _19.dateWarnings);
967
+ var isDatasheetDefaults = !!((_20 = props.organise) === null || _20 === void 0 ? void 0 : _20.datasheetDefaults);
955
968
  // INFO: the columns as the views draw them — with datasheet defaults every
956
969
  // list option without a colour takes the palette colour of its position
957
970
  var displayStructure = isDatasheetDefaults
958
971
  ? (0, defaultColours_1.handleApplyDefaultColours)(structure)
959
972
  : structure;
960
- var dbModule = isFirebaseClient ? (_18 = props.lib) === null || _18 === void 0 ? void 0 : _18.firebase : (_19 = props.lib) === null || _19 === void 0 ? void 0 : _19.axios;
973
+ var dbModule = isFirebaseClient ? (_21 = props.lib) === null || _21 === void 0 ? void 0 : _21.firebase : (_22 = props.lib) === null || _22 === void 0 ? void 0 : _22.axios;
961
974
  var schemaPresent = props.devSettings.schemaEndpoint ? true : false;
962
975
  var selectedRelated = resolvedType === "read"
963
976
  ? relatedSections.find(function (eachSection) { return eachSection.id === viewType; })
@@ -1151,38 +1164,38 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1151
1164
  }, [
1152
1165
  resolvedType,
1153
1166
  props.id,
1154
- (_20 = props.space) === null || _20 === void 0 ? void 0 : _20._id,
1167
+ (_23 = props.space) === null || _23 === void 0 ? void 0 : _23._id,
1155
1168
  props.devSettings.schemaEndpoint,
1156
- (_21 = props.organise) === null || _21 === void 0 ? void 0 : _21.showRelatedTab,
1169
+ (_24 = props.organise) === null || _24 === void 0 ? void 0 : _24.showRelatedTab,
1157
1170
  ]);
1158
1171
  /* eslint-enable */
1159
1172
  // INFO: the view settings panel (columns, sort, rows per page) is standard on
1160
1173
  // the new DTW; bareViewSettings stays the opt-in for legacy and bare DTWs
1161
- var isViewSettingsEnabled = ((_22 = props.bareSettings) === null || _22 === void 0 ? void 0 : _22.bareViewSettings) || ((_23 = props.bareSettings) === null || _23 === void 0 ? void 0 : _23.bareNewDTW)
1174
+ var isViewSettingsEnabled = ((_25 = props.bareSettings) === null || _25 === void 0 ? void 0 : _25.bareViewSettings) || ((_26 = props.bareSettings) === null || _26 === void 0 ? void 0 : _26.bareNewDTW)
1162
1175
  ? true
1163
1176
  : false;
1164
1177
  // INFO: a consumer that wires onChangeHide owns the hide at schema level
1165
1178
  // (shared by every user) — toggling writes to the model and calls back. Without it
1166
1179
  // the hide is this user's own and lives in userHiddenColumnIds.
1167
- var isSchemaHideMode = ((_24 = props.organise) === null || _24 === void 0 ? void 0 : _24.onChangeHide) ? true : false;
1180
+ var isSchemaHideMode = ((_27 = props.organise) === null || _27 === void 0 ? void 0 : _27.onChangeHide) ? true : false;
1168
1181
  // INFO: rows per page is a view setting the user can change, so it starts from
1169
1182
  // the persisted value and falls back to the consumer's limit
1170
- var _258 = (0, react_1.useState)((_26 = (_25 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _25 !== void 0 ? _25 : props.limit) !== null && _26 !== void 0 ? _26 : 10), pageLimit = _258[0], setPageLimit = _258[1];
1183
+ var _261 = (0, react_1.useState)((_29 = (_28 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _28 !== void 0 ? _28 : props.limit) !== null && _29 !== void 0 ? _29 : 10), pageLimit = _261[0], setPageLimit = _261[1];
1171
1184
  var limit = pageLimit;
1172
- var isSavedViewsEnabled = !!((_27 = props.organise) === null || _27 === void 0 ? void 0 : _27.savedViews) && resolvedType === "list";
1185
+ var isSavedViewsEnabled = !!((_30 = props.organise) === null || _30 === void 0 ? void 0 : _30.savedViews) && resolvedType === "list";
1173
1186
  // INFO: a calendar and a chart draw their own way, so columns, sort and
1174
1187
  // group have nothing to change there
1175
1188
  var isViewSettingsHiddenForTab = (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.viewType) === "calendar" || (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.viewType) === "chart";
1176
1189
  // INFO: Group shapes a table, list or grid into sections, a map into routes
1177
1190
  // and a timeline into colours
1178
- var isGroupPickerShown = !!((_28 = props.organise) === null || _28 === void 0 ? void 0 : _28.showGroupByFeature) && !isViewSettingsHiddenForTab;
1191
+ var isGroupPickerShown = !!((_31 = props.organise) === null || _31 === void 0 ? void 0 : _31.showGroupByFeature) && !isViewSettingsHiddenForTab;
1179
1192
  // INFO: an app that stores views takes over from this browser's storage, so
1180
1193
  // every view is the team's and nothing is kept locally
1181
- var isAppViews = ((_29 = props.organise) === null || _29 === void 0 ? void 0 : _29.sharedViews) !== undefined ||
1182
- !!((_30 = props.organise) === null || _30 === void 0 ? void 0 : _30.onChangeSharedViews);
1194
+ var isAppViews = ((_32 = props.organise) === null || _32 === void 0 ? void 0 : _32.sharedViews) !== undefined ||
1195
+ !!((_33 = props.organise) === null || _33 === void 0 ? void 0 : _33.onChangeSharedViews);
1183
1196
  // INFO: a saved view carries its sort, so the sort is held here as with persistViewState
1184
1197
  var isInternalSort = isPersistEnabled || isSavedViewsEnabled;
1185
- var activeSortId = (isInternalSort && persistedSort) || ((_31 = props.organise) === null || _31 === void 0 ? void 0 : _31.sort);
1198
+ var activeSortId = (isInternalSort && persistedSort) || ((_34 = props.organise) === null || _34 === void 0 ? void 0 : _34.sort);
1186
1199
  var handleSortColumn = function (value) {
1187
1200
  var _a, _b, _c, _d;
1188
1201
  if (isInternalSort)
@@ -1212,7 +1225,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1212
1225
  // INFO: Firebase pages by document cursor and a union by skip, so neither
1213
1226
  // can hand over the whole set — there formula columns are not offered for
1214
1227
  // sorting or filtering, rather than ordering one page
1215
- var isFormulaViewSupported = !isFirebase && !((_33 = (_32 = props.organise) === null || _32 === void 0 ? void 0 : _32.unionCollections) === null || _33 === void 0 ? void 0 : _33.length);
1228
+ var isFormulaViewSupported = !isFirebase && !((_36 = (_35 = props.organise) === null || _35 === void 0 ? void 0 : _35.unionCollections) === null || _36 === void 0 ? void 0 : _36.length);
1216
1229
  var formulaSort = isFormulaViewSupported &&
1217
1230
  (activeSortId === null || activeSortId === void 0 ? void 0 : activeSortId.sortId) &&
1218
1231
  formulaColumnIds.includes(activeSortId.sortId)
@@ -1223,12 +1236,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1223
1236
  // a union read runs them
1224
1237
  // INFO: a people filter's "me" needs only who is signed in, which any
1225
1238
  // backend can match
1226
- var currentUserId = (_34 = props.devSettings.currentUser) === null || _34 === void 0 ? void 0 : _34.userId;
1227
- var flexFilterExtras = !isFirebase && !((_36 = (_35 = props.organise) === null || _35 === void 0 ? void 0 : _35.unionCollections) === null || _36 === void 0 ? void 0 : _36.length)
1239
+ var currentUserId = (_37 = props.devSettings.currentUser) === null || _37 === void 0 ? void 0 : _37.userId;
1240
+ var flexFilterExtras = !isFirebase && !((_39 = (_38 = props.organise) === null || _38 === void 0 ? void 0 : _38.unionCollections) === null || _39 === void 0 ? void 0 : _39.length)
1228
1241
  ? {
1229
- references: (_37 = props.bareSettings) === null || _37 === void 0 ? void 0 : _37.bareFlexFilterReferences,
1230
- listObjects: (_38 = props.bareSettings) === null || _38 === void 0 ? void 0 : _38.bareFlexFilterListObjects,
1231
- related: (_39 = props.bareSettings) === null || _39 === void 0 ? void 0 : _39.bareFlexFilterRelated,
1242
+ references: (_40 = props.bareSettings) === null || _40 === void 0 ? void 0 : _40.bareFlexFilterReferences,
1243
+ listObjects: (_41 = props.bareSettings) === null || _41 === void 0 ? void 0 : _41.bareFlexFilterListObjects,
1244
+ related: (_42 = props.bareSettings) === null || _42 === void 0 ? void 0 : _42.bareFlexFilterRelated,
1232
1245
  currentUserId: currentUserId,
1233
1246
  }
1234
1247
  : isFirebase
@@ -1371,18 +1384,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1371
1384
  var handleGetSelectAllText = function () {
1372
1385
  return "".concat(size.toLocaleString(), " records ").concat(handleCheckReaderFiltered() ? "matching your filters" : "in this list");
1373
1386
  };
1374
- var _259 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _259.canUpdateRecord, canInlineUpdate = _259.canInlineUpdate, canBatchUpdate = _259.canBatchUpdate, canDeleteRecord = _259.canDeleteRecord;
1375
- var isEditor = ((_40 = props.edit) === null || _40 === void 0 ? void 0 : _40.allEditable) ? true : false;
1376
- var isOffline = (_41 = props.bareSettings) === null || _41 === void 0 ? void 0 : _41.bareOffline;
1387
+ var _262 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _262.canUpdateRecord, canInlineUpdate = _262.canInlineUpdate, canBatchUpdate = _262.canBatchUpdate, canDeleteRecord = _262.canDeleteRecord;
1388
+ var isEditor = ((_43 = props.edit) === null || _43 === void 0 ? void 0 : _43.allEditable) ? true : false;
1389
+ var isOffline = (_44 = props.bareSettings) === null || _44 === void 0 ? void 0 : _44.bareOffline;
1377
1390
  // INFO: when bareOfflineNetworkAware is true, the save path is also gated on
1378
1391
  // the live network state — online saves go to the server even if bareOffline
1379
1392
  // is true, offline saves go to IDB as normal.
1380
- var isOfflineNetworkListener = isOffline && ((_42 = props.bareSettings) === null || _42 === void 0 ? void 0 : _42.bareOfflineNetworkListener);
1381
- var showId = (_43 = props.space) === null || _43 === void 0 ? void 0 : _43.showId;
1393
+ var isOfflineNetworkListener = isOffline && ((_45 = props.bareSettings) === null || _45 === void 0 ? void 0 : _45.bareOfflineNetworkListener);
1394
+ var showId = (_46 = props.space) === null || _46 === void 0 ? void 0 : _46.showId;
1382
1395
  var remainId = showId || selectedObjectStructureId ? true : false;
1383
- var idField = ((_44 = props.space) === null || _44 === void 0 ? void 0 : _44.idField) || ((_45 = props.organise) === null || _45 === void 0 ? void 0 : _45.idField);
1384
- var pipeline = (_46 = props === null || props === void 0 ? void 0 : props.space) === null || _46 === void 0 ? void 0 : _46.pipeline;
1385
- if ((_47 = props.bareSettings) === null || _47 === void 0 ? void 0 : _47.bareListPipeline) {
1396
+ var idField = ((_47 = props.space) === null || _47 === void 0 ? void 0 : _47.idField) || ((_48 = props.organise) === null || _48 === void 0 ? void 0 : _48.idField);
1397
+ var pipeline = (_49 = props === null || props === void 0 ? void 0 : props.space) === null || _49 === void 0 ? void 0 : _49.pipeline;
1398
+ if ((_50 = props.bareSettings) === null || _50 === void 0 ? void 0 : _50.bareListPipeline) {
1386
1399
  pipeline = pipeline
1387
1400
  ? __spreadArray(__spreadArray([], pipeline, true), props.bareSettings.bareListPipeline, true) : props.bareSettings.bareListPipeline;
1388
1401
  }
@@ -1395,38 +1408,38 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1395
1408
  * three records came back instead of five files, and each tile received the
1396
1409
  * whole array rather than one file, so every one of them read "Attachment".
1397
1410
  */
1398
- var fileViewColumnId = (_51 = (_50 = ((_49 = (_48 = props.organise) === null || _48 === void 0 ? void 0 : _48.extendedTabs) !== null && _49 !== void 0 ? _49 : []).find(function (eachTab) {
1411
+ var fileViewColumnId = (_54 = (_53 = ((_52 = (_51 = props.organise) === null || _51 === void 0 ? void 0 : _51.extendedTabs) !== null && _52 !== void 0 ? _52 : []).find(function (eachTab) {
1399
1412
  return eachTab.viewType === "file" &&
1400
1413
  (0, utils_1.lowercaseTextToId)(eachTab.name) === viewType;
1401
- })) === null || _50 === void 0 ? void 0 : _50.fileSettings) === null || _51 === void 0 ? void 0 : _51.columnId;
1414
+ })) === null || _53 === void 0 ? void 0 : _53.fileSettings) === null || _54 === void 0 ? void 0 : _54.columnId;
1402
1415
  // INFO: select-all promises "all N records", so it is offered only where N
1403
1416
  // is the total a delete reads — not on Firebase (N is the rows loaded so
1404
1417
  // far), a union of datasheets (N counts the others too), a file view (N
1405
1418
  // counts files, not records) or offline
1406
1419
  var isSelectAllUncountable = isFirebase ||
1407
- !!((_53 = (_52 = props.organise) === null || _52 === void 0 ? void 0 : _52.unionCollections) === null || _53 === void 0 ? void 0 : _53.length) ||
1420
+ !!((_56 = (_55 = props.organise) === null || _55 === void 0 ? void 0 : _55.unionCollections) === null || _56 === void 0 ? void 0 : _56.length) ||
1408
1421
  !!fileViewColumnId ||
1409
- !!((_54 = props.bareSettings) === null || _54 === void 0 ? void 0 : _54.bareOffline);
1410
- var hasNavigation = ((_55 = props.organise) === null || _55 === void 0 ? void 0 : _55.handleNavigate) ? true : false;
1422
+ !!((_57 = props.bareSettings) === null || _57 === void 0 ? void 0 : _57.bareOffline);
1423
+ var hasNavigation = ((_58 = props.organise) === null || _58 === void 0 ? void 0 : _58.handleNavigate) ? true : false;
1411
1424
  var formColumn = "grid-cols-12";
1412
- var useMobileView = (_57 = (_56 = props.bareSettings) === null || _56 === void 0 ? void 0 : _56.bareUpdateMobileView) !== null && _57 !== void 0 ? _57 : false;
1425
+ var useMobileView = (_60 = (_59 = props.bareSettings) === null || _59 === void 0 ? void 0 : _59.bareUpdateMobileView) !== null && _60 !== void 0 ? _60 : false;
1413
1426
  var gridGap = useMobileView ? "gap-x-6 gap-y-2 md:gap-y-6" : "gap-6";
1414
- var isActivityLog = (((_59 = (_58 = props.edit) === null || _58 === void 0 ? void 0 : _58.activityLog) === null || _59 === void 0 ? void 0 : _59.enableComments) &&
1415
- ((_60 = props.edit) === null || _60 === void 0 ? void 0 : _60.activityLog.commentCollectionId)) ||
1416
- (((_62 = (_61 = props.edit) === null || _61 === void 0 ? void 0 : _61.activityLog) === null || _62 === void 0 ? void 0 : _62.enableLogs) &&
1417
- ((_63 = props.edit) === null || _63 === void 0 ? void 0 : _63.activityLog.logsCollectionId));
1427
+ var isActivityLog = (((_62 = (_61 = props.edit) === null || _61 === void 0 ? void 0 : _61.activityLog) === null || _62 === void 0 ? void 0 : _62.enableComments) &&
1428
+ ((_63 = props.edit) === null || _63 === void 0 ? void 0 : _63.activityLog.commentCollectionId)) ||
1429
+ (((_65 = (_64 = props.edit) === null || _64 === void 0 ? void 0 : _64.activityLog) === null || _65 === void 0 ? void 0 : _65.enableLogs) &&
1430
+ ((_66 = props.edit) === null || _66 === void 0 ? void 0 : _66.activityLog.logsCollectionId));
1418
1431
  // INFO: a record's comments and logs shown in place of the record rather than
1419
1432
  // in a drawer of their own — a related tab already sits inside the read
1420
1433
  // drawer, and a second drawer over it hid the row being discussed. It opens
1421
1434
  // the row through handleNavigate, so without one it stays off and the
1422
1435
  // drawer is used, rather than leaving a comment button that does nothing
1423
1436
  var isInlineActivity = !!isActivityLog &&
1424
- !!((_64 = props.bareSettings) === null || _64 === void 0 ? void 0 : _64.bareInlineActivity) &&
1437
+ !!((_67 = props.bareSettings) === null || _67 === void 0 ? void 0 : _67.bareInlineActivity) &&
1425
1438
  hasNavigation;
1426
1439
  // INFO: each row button opens what it shows: the comment button the row's
1427
1440
  // comments and logs alone, the eye (or the row) its details alone, so
1428
1441
  // neither has to be scrolled past to reach the other
1429
- var _260 = (0, react_1.useState)(false), inlineActivityOnly = _260[0], setInlineActivityOnly = _260[1];
1442
+ var _263 = (0, react_1.useState)(false), inlineActivityOnly = _263[0], setInlineActivityOnly = _263[1];
1430
1443
  var isActivityOnly = isInlineActivity && inlineActivityOnly;
1431
1444
  // INFO: the row whose comments were shown; going back to the list asks its
1432
1445
  // comment count again, as the drawer does when it closes
@@ -1465,12 +1478,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1465
1478
  // column
1466
1479
  recordTitleColumn: (_d = ((_c = (_b = structure.find(function (eachDS) { return eachDS.id === "title"; })) !== null && _b !== void 0 ? _b : structure.find(function (eachDS) { return eachDS.id === "name"; })) !== null && _c !== void 0 ? _c : structure.find(function (eachDS) { return eachDS.type === "string"; }))) === null || _d === void 0 ? void 0 : _d.id, model: structure }));
1467
1480
  };
1468
- var customPaginationSize = ((_65 = props.organise) === null || _65 === void 0 ? void 0 : _65.customPaginationCount)
1481
+ var customPaginationSize = ((_68 = props.organise) === null || _68 === void 0 ? void 0 : _68.customPaginationCount)
1469
1482
  ? props.organise.customPaginationCount(size)
1470
1483
  : undefined;
1471
1484
  //TODO : Code - Pass ...devSettings, search dbEndpoint:
1472
1485
  var writeServerQuery = new writeQuery_1.WriteQuery({
1473
- dbModule: (_66 = props.lib) === null || _66 === void 0 ? void 0 : _66.axios,
1486
+ dbModule: (_69 = props.lib) === null || _69 === void 0 ? void 0 : _69.axios,
1474
1487
  dbType: devSettings.server,
1475
1488
  dbCollection: props.collectionId,
1476
1489
  dbEndpoint: devSettings.dbEndpoint,
@@ -1478,7 +1491,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1478
1491
  dbUserToken: devSettings.dbUserToken,
1479
1492
  });
1480
1493
  var readServerQuery = new readQuery_1.ReadQuery({
1481
- dbModule: (_67 = props.lib) === null || _67 === void 0 ? void 0 : _67.axios,
1494
+ dbModule: (_70 = props.lib) === null || _70 === void 0 ? void 0 : _70.axios,
1482
1495
  dbType: devSettings.server,
1483
1496
  dbCollection: props.collectionId,
1484
1497
  dbEndpoint: devSettings.dbEndpoint,
@@ -1486,12 +1499,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1486
1499
  dbUserToken: devSettings.dbUserToken,
1487
1500
  });
1488
1501
  var moreButtonPopUp = [
1489
- ((_68 = props.edit) === null || _68 === void 0 ? void 0 : _68.allEditable) &&
1502
+ ((_71 = props.edit) === null || _71 === void 0 ? void 0 : _71.allEditable) &&
1490
1503
  // INFO: the import runs on the server (importEndpoint), so a Firestore
1491
1504
  // datasheet served through one can import; only the browser-direct
1492
1505
  // Firebase client has no server to import through
1493
1506
  !isFirebaseClient &&
1494
- !((_70 = (_69 = props.organise) === null || _69 === void 0 ? void 0 : _69.exportSettings) === null || _70 === void 0 ? void 0 : _70.hideImportCSV)
1507
+ !((_73 = (_72 = props.organise) === null || _72 === void 0 ? void 0 : _72.exportSettings) === null || _73 === void 0 ? void 0 : _73.hideImportCSV)
1495
1508
  ? {
1496
1509
  text: "Import Excel",
1497
1510
  onClick: function () {
@@ -1500,7 +1513,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1500
1513
  },
1501
1514
  }
1502
1515
  : null,
1503
- !((_72 = (_71 = props.organise) === null || _71 === void 0 ? void 0 : _71.exportSettings) === null || _72 === void 0 ? void 0 : _72.hideExportCSV)
1516
+ !((_75 = (_74 = props.organise) === null || _74 === void 0 ? void 0 : _74.exportSettings) === null || _75 === void 0 ? void 0 : _75.hideExportCSV)
1504
1517
  ? {
1505
1518
  text: "Export CSV",
1506
1519
  onClick: function () {
@@ -1510,7 +1523,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1510
1523
  },
1511
1524
  }
1512
1525
  : null,
1513
- !((_74 = (_73 = props.organise) === null || _73 === void 0 ? void 0 : _73.exportSettings) === null || _74 === void 0 ? void 0 : _74.hideExportExcel)
1526
+ !((_77 = (_76 = props.organise) === null || _76 === void 0 ? void 0 : _76.exportSettings) === null || _77 === void 0 ? void 0 : _77.hideExportExcel)
1514
1527
  ? {
1515
1528
  text: "Export Excel",
1516
1529
  onClick: function () {
@@ -1520,7 +1533,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1520
1533
  },
1521
1534
  }
1522
1535
  : null,
1523
- !((_76 = (_75 = props.organise) === null || _75 === void 0 ? void 0 : _75.exportSettings) === null || _76 === void 0 ? void 0 : _76.hideExportPDF)
1536
+ !((_79 = (_78 = props.organise) === null || _78 === void 0 ? void 0 : _78.exportSettings) === null || _79 === void 0 ? void 0 : _79.hideExportPDF)
1524
1537
  ? {
1525
1538
  text: "Export PDF",
1526
1539
  onClick: function () {
@@ -1530,7 +1543,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1530
1543
  },
1531
1544
  }
1532
1545
  : null,
1533
- !((_78 = (_77 = props.organise) === null || _77 === void 0 ? void 0 : _77.exportSettings) === null || _78 === void 0 ? void 0 : _78.hideExportQR)
1546
+ !((_81 = (_80 = props.organise) === null || _80 === void 0 ? void 0 : _80.exportSettings) === null || _81 === void 0 ? void 0 : _81.hideExportQR)
1534
1547
  ? {
1535
1548
  text: "Export QR",
1536
1549
  onClick: function () {
@@ -1540,7 +1553,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1540
1553
  },
1541
1554
  }
1542
1555
  : null,
1543
- !((_80 = (_79 = props.organise) === null || _79 === void 0 ? void 0 : _79.exportSettings) === null || _80 === void 0 ? void 0 : _80.hideExportQR)
1556
+ !((_83 = (_82 = props.organise) === null || _82 === void 0 ? void 0 : _82.exportSettings) === null || _83 === void 0 ? void 0 : _83.hideExportQR)
1544
1557
  ? {
1545
1558
  text: "Export QR(Data)",
1546
1559
  onClick: function () {
@@ -1550,7 +1563,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1550
1563
  },
1551
1564
  }
1552
1565
  : null,
1553
- !((_82 = (_81 = props.organise) === null || _81 === void 0 ? void 0 : _81.exportSettings) === null || _82 === void 0 ? void 0 : _82.hideExportPrint)
1566
+ !((_85 = (_84 = props.organise) === null || _84 === void 0 ? void 0 : _84.exportSettings) === null || _85 === void 0 ? void 0 : _85.hideExportPrint)
1554
1567
  ? {
1555
1568
  text: "Print",
1556
1569
  onClick: function () {
@@ -1562,8 +1575,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1562
1575
  : null,
1563
1576
  // INFO: drafts only exist where the form can save one, so the filter has
1564
1577
  // nothing to find on any other page
1565
- ((_83 = props.edit) === null || _83 === void 0 ? void 0 : _83.enableUpdateDraft) &&
1566
- !((_85 = (_84 = props.organise) === null || _84 === void 0 ? void 0 : _84.exportSettings) === null || _85 === void 0 ? void 0 : _85.hideExportDraft)
1578
+ ((_86 = props.edit) === null || _86 === void 0 ? void 0 : _86.enableUpdateDraft) &&
1579
+ !((_88 = (_87 = props.organise) === null || _87 === void 0 ? void 0 : _87.exportSettings) === null || _88 === void 0 ? void 0 : _88.hideExportDraft)
1567
1580
  ? {
1568
1581
  text: filterDraft ? "Show All Items" : "Filter Draft",
1569
1582
  onClick: function () {
@@ -1572,7 +1585,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
1572
1585
  }
1573
1586
  : null,
1574
1587
  ].filter(Boolean);
1575
- if ((_86 = props.organise) === null || _86 === void 0 ? void 0 : _86.moreSettings)
1588
+ if ((_89 = props.organise) === null || _89 === void 0 ? void 0 : _89.moreSettings)
1576
1589
  moreButtonPopUp = moreButtonPopUp.concat(props.organise.moreSettings);
1577
1590
  //=====================================================================================
1578
1591
  //SECTION: User Column Visibility Handlers
@@ -2011,20 +2024,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2011
2024
  // INFO: scroll mode reloads from page 0; the anchor restores the position
2012
2025
  pageIndex: renderCheckScrollMode() ? 0 : pageIndex, hiddenColumnIds: structure.filter(function (col) { return col.hide; }).map(function (col) { return col.id; }),
2013
2026
  // INFO: raw, so switching bareViewSettings off does not wipe the user's choice
2014
- userHiddenColumnIds: userHiddenColumnIds, shownSystemColumnIds: shownSystemColumnIds, columnOrder: structure.map(function (col) { return col.id; }), columnWidths: columnWidths, laneWidths: laneWidths, drawerWidth: drawerWidth, pinnedColumnIds: pinnedColumnIds, groupBy: groupId !== null && groupId !== void 0 ? groupId : "" }, scrollCaptureRef.current));
2027
+ userHiddenColumnIds: userHiddenColumnIds, shownSystemColumnIds: shownSystemColumnIds, columnOrder: structure.map(function (col) { return col.id; }), columnWidths: columnWidths, laneWidths: laneWidths, drawerWidth: drawerWidth, pinnedColumnIds: pinnedColumnIds, groupBy: groupId !== null && groupId !== void 0 ? groupId : "", groupOrder: groupId ? groupOrder : "" }, scrollCaptureRef.current));
2015
2028
  };
2016
2029
  handleRegisterViewSnapshot(handleBuildViewSnapshot);
2017
2030
  //=====================================================================================
2018
2031
  //SECTION: Saved Views
2019
2032
  //=====================================================================================
2020
- var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_87 = props.organise) === null || _87 === void 0 ? void 0 : _87.persistKey, (_88 = devSettings.currentUser) === null || _88 === void 0 ? void 0 : _88.userEmail);
2033
+ var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_90 = props.organise) === null || _90 === void 0 ? void 0 : _90.persistKey, (_91 = devSettings.currentUser) === null || _91 === void 0 ? void 0 : _91.userEmail);
2021
2034
  (0, react_1.useEffect)(function () {
2022
2035
  if (isSavedViewsEnabled && !isAppViews)
2023
2036
  setSavedViews((0, viewStatePersistence_1.handleReadSavedViews)(savedViewsKey));
2024
2037
  }, [isSavedViewsEnabled, isAppViews, savedViewsKey]);
2025
2038
  // INFO: the app keeps All's settings, so every change is kept in this
2026
2039
  // browser until the person updates the view for everyone or resets it
2027
- var isViewDraftsEnabled = isSavedViewsEnabled && ((_89 = props.organise) === null || _89 === void 0 ? void 0 : _89.allView) !== undefined;
2040
+ var isViewDraftsEnabled = isSavedViewsEnabled && ((_92 = props.organise) === null || _92 === void 0 ? void 0 : _92.allView) !== undefined;
2028
2041
  var handleGetViewDraftKey = function (viewId) {
2029
2042
  var _a, _b;
2030
2043
  return (0, viewStatePersistence_1.buildViewDraftKey)(props.collectionId, viewId !== null && viewId !== void 0 ? viewId : "all", (_a = props.organise) === null || _a === void 0 ? void 0 : _a.persistKey, (_b = devSettings.currentUser) === null || _b === void 0 ? void 0 : _b.userEmail);
@@ -2153,7 +2166,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2153
2166
  var lastSentSharedViewsRef = (0, react_1.useRef)(null);
2154
2167
  (0, react_1.useEffect)(function () {
2155
2168
  lastSentSharedViewsRef.current = null;
2156
- }, [(_90 = props.organise) === null || _90 === void 0 ? void 0 : _90.sharedViews]);
2169
+ }, [(_93 = props.organise) === null || _93 === void 0 ? void 0 : _93.sharedViews]);
2157
2170
  var handleStoreSharedViews = function (update) {
2158
2171
  var _a, _b, _c;
2159
2172
  if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeSharedViews))
@@ -2170,15 +2183,21 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2170
2183
  var openingViewSettledRef = (0, react_1.useRef)(false);
2171
2184
  // INFO: keyed on the ids, so a list handed in again on every render does
2172
2185
  // not re-run the opening
2173
- var starredViewIdsKey = ((_92 = (_91 = props.organise) === null || _91 === void 0 ? void 0 : _91.defaultSavedViewIds) !== null && _92 !== void 0 ? _92 : []).join("|");
2186
+ var starredViewIdsKey = ((_95 = (_94 = props.organise) === null || _94 === void 0 ? void 0 : _94.defaultSavedViewIds) !== null && _95 !== void 0 ? _95 : []).join("|");
2174
2187
  (0, react_1.useEffect)(function () {
2175
- var _a, _b, _c, _d;
2188
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2176
2189
  if (!isSavedViewsEnabled || openingViewSettledRef.current)
2177
2190
  return;
2178
- // INFO: a link opens on All with only its keyword, never on a ★ view
2179
- if (isLinkOpen && ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.initialSearch)) {
2191
+ // INFO: a link opens on All with only its keyword or filters, never on a
2192
+ // ★ view
2193
+ if (isLinkOpen &&
2194
+ (((_a = props.organise) === null || _a === void 0 ? void 0 : _a.initialSearch) || ((_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.linkFlexFilters) === null || _c === void 0 ? void 0 : _c.length))) {
2180
2195
  openingViewSettledRef.current = true;
2181
- handleApplySavedView(null, true, props.organise.initialSearch);
2196
+ handleApplySavedView(null, true,
2197
+ // INFO: the keyword only where there is a Quick find box to show it
2198
+ handleCanInitialSearch((_d = props.organise) === null || _d === void 0 ? void 0 : _d.additionalQuery)
2199
+ ? (_e = props.organise) === null || _e === void 0 ? void 0 : _e.initialSearch
2200
+ : undefined, undefined, (_f = props.organise) === null || _f === void 0 ? void 0 : _f.linkFlexFilters);
2182
2201
  setIsViewDraftReady(true);
2183
2202
  return;
2184
2203
  }
@@ -2187,7 +2206,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2187
2206
  setIsViewDraftReady(true);
2188
2207
  return;
2189
2208
  }
2190
- var wantedId = (_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.initialSavedViewId) !== null && _c !== void 0 ? _c : handleGetStarredViewId();
2209
+ var wantedId = (_h = (_g = props.organise) === null || _g === void 0 ? void 0 : _g.initialSavedViewId) !== null && _h !== void 0 ? _h : handleGetStarredViewId();
2191
2210
  if (!wantedId) {
2192
2211
  // INFO: All opens with its stored settings and this person's changes
2193
2212
  if (isViewDraftsEnabled) {
@@ -2198,7 +2217,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2198
2217
  return;
2199
2218
  }
2200
2219
  // INFO: the app's views may still be loading
2201
- if (isAppViews && ((_d = props.organise) === null || _d === void 0 ? void 0 : _d.sharedViews) === undefined)
2220
+ if (isAppViews && ((_j = props.organise) === null || _j === void 0 ? void 0 : _j.sharedViews) === undefined)
2202
2221
  return;
2203
2222
  openingViewSettledRef.current = true;
2204
2223
  var view = handleGetTabSavedViews().find(function (eachView) { return eachView.id === wantedId; });
@@ -2208,13 +2227,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2208
2227
  /* eslint-disable */
2209
2228
  }, [
2210
2229
  isSavedViewsEnabled,
2211
- (_93 = props.organise) === null || _93 === void 0 ? void 0 : _93.initialSavedViewId,
2230
+ (_96 = props.organise) === null || _96 === void 0 ? void 0 : _96.initialSavedViewId,
2212
2231
  starredViewIdsKey,
2213
- (_94 = props.organise) === null || _94 === void 0 ? void 0 : _94.sharedViews,
2232
+ (_97 = props.organise) === null || _97 === void 0 ? void 0 : _97.sharedViews,
2214
2233
  savedViews,
2215
2234
  ]);
2216
2235
  /* eslint-enable */
2217
- var appDefaultViewIds = ((_96 = (_95 = props.organise) === null || _95 === void 0 ? void 0 : _95.defaultSavedViews) !== null && _96 !== void 0 ? _96 : [])
2236
+ var appDefaultViewIds = ((_99 = (_98 = props.organise) === null || _98 === void 0 ? void 0 : _98.defaultSavedViews) !== null && _99 !== void 0 ? _99 : [])
2218
2237
  .map(function (eachView) { var _a; return (_a = eachView.id) !== null && _a !== void 0 ? _a : ""; })
2219
2238
  .join("|");
2220
2239
  // INFO: keyed on the ids, not the array, so an inline literal passed on every
@@ -2288,11 +2307,23 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2288
2307
  };
2289
2308
  // INFO: notify — only a user's choice is handed back; a list opening on a
2290
2309
  // view or syncing the host's own groupBy tells the host nothing new
2310
+ // INFO: ordering groups applies where the rows are drawn in group sections
2311
+ // — the table, a list and a grid — not to a map's routes or a timeline's
2312
+ // colours
2313
+ var handleCheckGroupOrderShown = function () {
2314
+ var _a;
2315
+ return !!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW) &&
2316
+ !handleCheckLookupGroupBy() &&
2317
+ (!(selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.viewType) ||
2318
+ ["general", "table", "report", "list", "grid"].includes(selectedTab.viewType));
2319
+ };
2291
2320
  var handleChangeGroupBy = function (value, notify) {
2292
2321
  var _a, _b;
2293
2322
  if (value === (groupId !== null && groupId !== void 0 ? groupId : ""))
2294
2323
  return;
2295
2324
  setGroupId(value);
2325
+ if (!value)
2326
+ setGroupOrder("");
2296
2327
  if (notify)
2297
2328
  (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeGroupBy) === null || _b === void 0 ? void 0 : _b.call(_a, value);
2298
2329
  };
@@ -2302,15 +2333,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2302
2333
  // INFO: linkSearch — the list opens as a fresh datasheet with only that
2303
2334
  // keyword: All's columns and sort, none of its filters, and no draft.
2304
2335
  // restoredState — the state persistViewState kept, applied in place of a view
2305
- var handleApplySavedView = function (view, isOpening, linkSearch, restoredState) {
2306
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
2336
+ var handleApplySavedView = function (view, isOpening, linkSearch, restoredState, linkFlexFilters) {
2337
+ 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;
2307
2338
  var next;
2308
- if (linkSearch) {
2339
+ if (linkSearch || (linkFlexFilters === null || linkFlexFilters === void 0 ? void 0 : linkFlexFilters.length)) {
2309
2340
  // INFO: the filter keys are left out, not set to undefined, so the
2310
2341
  // app's own additionalQuery defaults still apply
2311
- var _z = (_a = handleGetStoredViewState(null)) !== null && _a !== void 0 ? _a : {}, _search = _z.filterSearchParams, _selection = _z.filterSelection, _reference = _z.filterReference, _date = _z.filterReferenceDate, _flex = _z.flexFilters, allLayout = __rest(_z, ["filterSearchParams", "filterSelection", "filterReference", "filterReferenceDate", "flexFilters"]);
2342
+ var _0 = (_a = handleGetStoredViewState(null)) !== null && _a !== void 0 ? _a : {}, _search = _0.filterSearchParams, _selection = _0.filterSelection, _reference = _0.filterReference, _date = _0.filterReferenceDate, _flex = _0.flexFilters, allLayout = __rest(_0, ["filterSearchParams", "filterSelection", "filterReference", "filterReferenceDate", "flexFilters"]);
2312
2343
  next = handleResolveViewState(allLayout);
2313
- next = __assign(__assign({}, next), { filterSearchParams: __assign(__assign({}, next.filterSearchParams), { search: linkSearch }) });
2344
+ next = __assign(__assign(__assign({}, next), (linkSearch
2345
+ ? {
2346
+ filterSearchParams: __assign(__assign({}, next.filterSearchParams), { search: linkSearch }),
2347
+ }
2348
+ : {})), ((linkFlexFilters === null || linkFlexFilters === void 0 ? void 0 : linkFlexFilters.length) ? { flexFilters: linkFlexFilters } : {}));
2314
2349
  }
2315
2350
  else if (restoredState) {
2316
2351
  next = handleResolveViewState(restoredState);
@@ -2347,10 +2382,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2347
2382
  if (next.pageLimit)
2348
2383
  setPageLimit(next.pageLimit);
2349
2384
  handleChangeGroupBy((_l = next.groupBy) !== null && _l !== void 0 ? _l : "", !isOpening);
2350
- setUserHiddenColumnIds((_m = next.userHiddenColumnIds) !== null && _m !== void 0 ? _m : []);
2351
- setShownSystemColumnIds((_o = next.shownSystemColumnIds) !== null && _o !== void 0 ? _o : []);
2352
- setColumnWidths((_p = next.columnWidths) !== null && _p !== void 0 ? _p : {});
2353
- setLaneWidths((_q = next.laneWidths) !== null && _q !== void 0 ? _q : {});
2385
+ setGroupOrder((_m = next.groupOrder) !== null && _m !== void 0 ? _m : "");
2386
+ setUserHiddenColumnIds((_o = next.userHiddenColumnIds) !== null && _o !== void 0 ? _o : []);
2387
+ setShownSystemColumnIds((_p = next.shownSystemColumnIds) !== null && _p !== void 0 ? _p : []);
2388
+ setColumnWidths((_q = next.columnWidths) !== null && _q !== void 0 ? _q : {});
2389
+ setLaneWidths((_r = next.laneWidths) !== null && _r !== void 0 ? _r : {});
2354
2390
  setDrawerWidth(next.drawerWidth);
2355
2391
  setPinnedColumnIds(next.pinnedColumnIds);
2356
2392
  if (view) {
@@ -2367,12 +2403,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2367
2403
  pendingViewCondKeyRef.current = JSON.stringify(handleReadQueryHocCond());
2368
2404
  handleClearDataByFilter();
2369
2405
  if (pageIndex !== 0)
2370
- (_s = (_r = props.organise) === null || _r === void 0 ? void 0 : _r.onChangePagination) === null || _s === void 0 ? void 0 : _s.call(_r, 0);
2371
- (_u = (_t = props.bareSettings) === null || _t === void 0 ? void 0 : _t.bareListHandleFilter) === null || _u === void 0 ? void 0 : _u.call(_t, (_v = next.filterSearchParams) !== null && _v !== void 0 ? _v : {}, (_w = next.filterSelection) !== null && _w !== void 0 ? _w : {}, next.filterReferenceDate
2406
+ (_t = (_s = props.organise) === null || _s === void 0 ? void 0 : _s.onChangePagination) === null || _t === void 0 ? void 0 : _t.call(_s, 0);
2407
+ (_v = (_u = props.bareSettings) === null || _u === void 0 ? void 0 : _u.bareListHandleFilter) === null || _v === void 0 ? void 0 : _v.call(_u, (_w = next.filterSearchParams) !== null && _w !== void 0 ? _w : {}, (_x = next.filterSelection) !== null && _x !== void 0 ? _x : {}, next.filterReferenceDate
2372
2408
  ? (0, viewStatePersistence_1.parseDateFilterState)(next.filterReferenceDate)
2373
- : initialFilterReferenceDate, (_x = next.filterReference) !== null && _x !== void 0 ? _x : {});
2409
+ : initialFilterReferenceDate, (_y = next.filterReference) !== null && _y !== void 0 ? _y : {});
2374
2410
  }
2375
- setActiveSavedViewId((_y = view === null || view === void 0 ? void 0 : view.id) !== null && _y !== void 0 ? _y : null);
2411
+ setActiveSavedViewId((_z = view === null || view === void 0 ? void 0 : view.id) !== null && _z !== void 0 ? _z : null);
2376
2412
  setDeletingSavedViewId(null);
2377
2413
  };
2378
2414
  // INFO: re-read storage before each write so a change made in another browser
@@ -2621,12 +2657,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2621
2657
  shownSystemColumnIds,
2622
2658
  pageLimit,
2623
2659
  groupId,
2660
+ groupOrder,
2624
2661
  columnWidths,
2625
2662
  laneWidths,
2626
2663
  drawerWidth,
2627
2664
  pinnedColumnIds,
2628
- (_97 = props.organise) === null || _97 === void 0 ? void 0 : _97.allView,
2629
- (_98 = props.organise) === null || _98 === void 0 ? void 0 : _98.sharedViews,
2665
+ (_100 = props.organise) === null || _100 === void 0 ? void 0 : _100.allView,
2666
+ (_101 = props.organise) === null || _101 === void 0 ? void 0 : _101.sharedViews,
2630
2667
  savedViews,
2631
2668
  ]);
2632
2669
  /* eslint-enable */
@@ -2670,7 +2707,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2670
2707
  if (scrollRestoredRef.current)
2671
2708
  scrollCatchUpRef.current = null;
2672
2709
  /* eslint-disable */
2673
- }, [props.collectionId, (_99 = props.organise) === null || _99 === void 0 ? void 0 : _99.persistKey]);
2710
+ }, [props.collectionId, (_102 = props.organise) === null || _102 === void 0 ? void 0 : _102.persistKey]);
2674
2711
  /* eslint-enable */
2675
2712
  // INFO: wait a frame — rows land in state one tick before layout
2676
2713
  (0, react_1.useEffect)(function () {
@@ -2705,7 +2742,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2705
2742
  (0, react_1.useEffect)(function () {
2706
2743
  handleOfflinePrefetch();
2707
2744
  /* eslint-disable */
2708
- }, [props.collectionId, (_100 = props.bareSettings) === null || _100 === void 0 ? void 0 : _100.bareOffline]);
2745
+ }, [props.collectionId, (_103 = props.bareSettings) === null || _103 === void 0 ? void 0 : _103.bareOffline]);
2709
2746
  /* eslint-enable */
2710
2747
  // INFO: MRQ polling — calls handleRefresh every N ms (e.g. 1500) as a fallback.
2711
2748
  // Calls through handleRefreshRef so the interval always dispatches the latest
@@ -2725,7 +2762,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2725
2762
  }, interval);
2726
2763
  return function () { return clearInterval(timer); };
2727
2764
  /* eslint-disable */
2728
- }, [(_101 = props.bareSettings) === null || _101 === void 0 ? void 0 : _101.barePollingInterval, isLive, isNetworkOffline]);
2765
+ }, [(_104 = props.bareSettings) === null || _104 === void 0 ? void 0 : _104.barePollingInterval, isLive, isNetworkOffline]);
2729
2766
  /* eslint-enable */
2730
2767
  // INFO: Pub/Sub → SSE live-stream — driven by bareSettings.bareSocketName
2731
2768
  // EventSource URL: {sseEndpoint}/{room}?bm_apiToken={token}
@@ -2767,7 +2804,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
2767
2804
  };
2768
2805
  /* eslint-disable */
2769
2806
  }, [
2770
- (_102 = props.bareSettings) === null || _102 === void 0 ? void 0 : _102.bareSocketName,
2807
+ (_105 = props.bareSettings) === null || _105 === void 0 ? void 0 : _105.bareSocketName,
2771
2808
  props.collectionId,
2772
2809
  props.devSettings.sseEndpoint,
2773
2810
  props.devSettings.dbAPIToken,
@@ -3041,10 +3078,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
3041
3078
  props.collectionId,
3042
3079
  props.model,
3043
3080
  props.localURLEndpoint,
3044
- (_103 = props.organise) === null || _103 === void 0 ? void 0 : _103.extendedTabs,
3081
+ (_106 = props.organise) === null || _106 === void 0 ? void 0 : _106.extendedTabs,
3045
3082
  listViewId,
3046
- (_104 = props.organise) === null || _104 === void 0 ? void 0 : _104.additionalQuery,
3047
- (_105 = props.organise) === null || _105 === void 0 ? void 0 : _105.groupBy,
3083
+ (_107 = props.organise) === null || _107 === void 0 ? void 0 : _107.additionalQuery,
3084
+ (_108 = props.organise) === null || _108 === void 0 ? void 0 : _108.groupBy,
3048
3085
  resolvedType,
3049
3086
  ]);
3050
3087
  /**
@@ -3196,7 +3233,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
3196
3233
  };
3197
3234
  }, 100);
3198
3235
  return function () { return clearTimeout(timeoutId); };
3199
- }, [(_106 = props.organise) === null || _106 === void 0 ? void 0 : _106.showReadFloatingNav, resolvedType, props.id, loading]);
3236
+ }, [(_109 = props.organise) === null || _109 === void 0 ? void 0 : _109.showReadFloatingNav, resolvedType, props.id, loading]);
3200
3237
  (0, react_1.useEffect)(function () {
3201
3238
  if (resolvedType !== "read")
3202
3239
  return;
@@ -4775,7 +4812,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
4775
4812
  // the link view ends and the list opens as it normally would. A change
4776
4813
  // while a record is open (opening one drops the link from the URL) waits
4777
4814
  // until the list shows again
4778
- var lastInitialSearchRef = (0, react_1.useRef)((_107 = props.organise) === null || _107 === void 0 ? void 0 : _107.initialSearch);
4815
+ var lastInitialSearchRef = (0, react_1.useRef)((_110 = props.organise) === null || _110 === void 0 ? void 0 : _110.initialSearch);
4779
4816
  // INFO: persistViewState reads its stored state only once the link view
4780
4817
  // has ended, a render later
4781
4818
  var isNormalOpenPendingRef = (0, react_1.useRef)(false);
@@ -4802,7 +4839,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
4802
4839
  setIsLinkOpen(true);
4803
4840
  handleApplySavedView(null, true, value);
4804
4841
  /* eslint-disable */
4805
- }, [(_108 = props.organise) === null || _108 === void 0 ? void 0 : _108.initialSearch, resolvedType]);
4842
+ }, [(_111 = props.organise) === null || _111 === void 0 ? void 0 : _111.initialSearch, resolvedType]);
4806
4843
  (0, react_1.useEffect)(function () {
4807
4844
  if (!isNormalOpenPendingRef.current || isLinkOpen)
4808
4845
  return;
@@ -5907,11 +5944,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
5907
5944
  setDeleting(true);
5908
5945
  _f.label = 1;
5909
5946
  case 1:
5910
- _f.trys.push([1, 23, 24, 25]);
5947
+ _f.trys.push([1, 24, 25, 26]);
5911
5948
  setLoading(true);
5912
5949
  setModalVisible(true);
5913
5950
  passcodeMatch = deletePasscodeInput === deletePasscode;
5914
- if (!passcodeMatch) return [3 /*break*/, 21];
5951
+ if (!passcodeMatch) return [3 /*break*/, 22];
5915
5952
  if (!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareOffline)) return [3 /*break*/, 4];
5916
5953
  return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
5917
5954
  case 2:
@@ -5926,7 +5963,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
5926
5963
  })];
5927
5964
  case 3:
5928
5965
  _f.sent();
5929
- return [3 /*break*/, 20];
5966
+ return [3 /*break*/, 21];
5930
5967
  case 4:
5931
5968
  ids = [];
5932
5969
  notReferenceId = [];
@@ -5988,7 +6025,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
5988
6025
  return [3 /*break*/, 7];
5989
6026
  case 12:
5990
6027
  ids = deletedIds;
5991
- return [3 /*break*/, 17];
6028
+ return [3 /*break*/, 18];
5992
6029
  case 13: return [4 /*yield*/, readServerQuery.call({
5993
6030
  type: "list",
5994
6031
  query: [
@@ -6005,14 +6042,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
6005
6042
  return [4 /*yield*/, handleCheckDeleteReference((_d = responseData === null || responseData === void 0 ? void 0 : responseData.data) !== null && _d !== void 0 ? _d : [], true)];
6006
6043
  case 15:
6007
6044
  notReferenceId = _f.sent();
6045
+ if (!((notReferenceId !== null && notReferenceId !== void 0 ? notReferenceId : []).length > 0)) return [3 /*break*/, 17];
6008
6046
  return [4 /*yield*/, writeServerQuery.call("batchDelete", {
6009
6047
  id: notReferenceId,
6010
6048
  })];
6011
6049
  case 16:
6012
- ids = _f.sent();
6050
+ _f.sent();
6013
6051
  _f.label = 17;
6014
6052
  case 17:
6015
- if (!((ids !== null && ids !== void 0 ? ids : []).length > 0)) return [3 /*break*/, 19];
6053
+ ids = notReferenceId !== null && notReferenceId !== void 0 ? notReferenceId : [];
6054
+ _f.label = 18;
6055
+ case 18:
6056
+ if (!((ids !== null && ids !== void 0 ? ids : []).length > 0)) return [3 /*break*/, 20];
6016
6057
  data = new FormData();
6017
6058
  data.append("data[assetCollectionName]", props.collectionId);
6018
6059
  data.append("data[assetParentId]", JSON.stringify(ids !== null && ids !== void 0 ? ids : []));
@@ -6027,15 +6068,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
6027
6068
  url: "".concat(uploadEndpoint, "/batchDeleteDirectory"),
6028
6069
  headers: { "Content-Type": "multipart/form-data" },
6029
6070
  }))];
6030
- case 18:
6031
- _f.sent();
6032
- _f.label = 19;
6033
6071
  case 19:
6072
+ _f.sent();
6073
+ _f.label = 20;
6074
+ case 20:
6034
6075
  if (mapViewRef.current)
6035
6076
  mapViewRef.current.handleClearPolygons();
6036
- _f.label = 20;
6037
- case 20: return [3 /*break*/, 22];
6038
- case 21:
6077
+ _f.label = 21;
6078
+ case 21: return [3 /*break*/, 23];
6079
+ case 22:
6039
6080
  setNotification({
6040
6081
  type: false,
6041
6082
  title: "Incorrect Passcode",
@@ -6044,15 +6085,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
6044
6085
  setLoading(false);
6045
6086
  setModalVisible(false);
6046
6087
  return [2 /*return*/];
6047
- case 22: return [3 /*break*/, 25];
6048
- case 23:
6049
- err_13 = _f.sent();
6050
- return [3 /*break*/, 25];
6088
+ case 23: return [3 /*break*/, 26];
6051
6089
  case 24:
6090
+ err_13 = _f.sent();
6091
+ return [3 /*break*/, 26];
6092
+ case 25:
6052
6093
  deletingRef.current = false;
6053
6094
  setDeleting(false);
6054
6095
  return [7 /*endfinally*/];
6055
- case 25:
6096
+ case 26:
6056
6097
  setDeletePasscodeInput("");
6057
6098
  // INFO: the selection is gone with the rows it covered
6058
6099
  if (selectAll)
@@ -6189,15 +6230,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
6189
6230
  switch (_d.label) {
6190
6231
  case 0:
6191
6232
  existDataIds = [];
6192
- existsData = {};
6233
+ existsData = [];
6193
6234
  _d.label = 1;
6194
6235
  case 1:
6195
6236
  _d.trys.push([1, 4, , 5]);
6196
6237
  handleFindReference_1 = function (data, referenceStructure, space, spaceId, spaceName) { return __awaiter(void 0, void 0, void 0, function () {
6197
6238
  var referenceRQ, currentReferenceSelectedList;
6198
- var _a, _b, _c, _d, _e, _f;
6199
- return __generator(this, function (_g) {
6200
- switch (_g.label) {
6239
+ var _a, _b, _c;
6240
+ return __generator(this, function (_d) {
6241
+ switch (_d.label) {
6201
6242
  case 0:
6202
6243
  referenceRQ = new readQuery_1.ReadQuery({
6203
6244
  dbModule: dbModule,
@@ -6214,19 +6255,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
6214
6255
  ],
6215
6256
  })];
6216
6257
  case 1:
6217
- currentReferenceSelectedList = _g.sent();
6258
+ currentReferenceSelectedList = _d.sent();
6218
6259
  if ((currentReferenceSelectedList === null || currentReferenceSelectedList === void 0 ? void 0 : currentReferenceSelectedList.data) &&
6219
6260
  (currentReferenceSelectedList === null || currentReferenceSelectedList === void 0 ? void 0 : currentReferenceSelectedList.data.length) > 0) {
6220
6261
  if (!existDataIds.includes(data[serverId]))
6221
6262
  existDataIds.push(data[serverId]);
6222
- if (existsData[(_b = data[(_a = referenceStructure === null || referenceStructure === void 0 ? void 0 : referenceStructure.referenceLabel) !== null && _a !== void 0 ? _a : ""]) !== null && _b !== void 0 ? _b : data[serverId]]) {
6223
- existsData[(_d = data[(_c = referenceStructure === null || referenceStructure === void 0 ? void 0 : referenceStructure.referenceLabel) !== null && _c !== void 0 ? _c : ""]) !== null && _d !== void 0 ? _d : data[serverId]].push("".concat(space ? space.name : (spaceName !== null && spaceName !== void 0 ? spaceName : ""), " - ").concat(currentReferenceSelectedList.count));
6224
- }
6225
- else {
6226
- existsData[(_f = data[(_e = referenceStructure.referenceLabel) !== null && _e !== void 0 ? _e : ""]) !== null && _f !== void 0 ? _f : data[serverId]] = [
6227
- "".concat(space ? space.name : (spaceName !== null && spaceName !== void 0 ? spaceName : ""), " - ").concat(currentReferenceSelectedList.count, " row(s)"),
6228
- ];
6229
- }
6263
+ existsData.push({
6264
+ collectionId: space ? space._id : (spaceId !== null && spaceId !== void 0 ? spaceId : ""),
6265
+ collectionName: space ? space.name : (spaceName !== null && spaceName !== void 0 ? spaceName : ""),
6266
+ columnId: referenceStructure.id,
6267
+ columnType: referenceStructure.type,
6268
+ recordId: data[serverId],
6269
+ recordLabel: String((_b = data[(_a = referenceStructure === null || referenceStructure === void 0 ? void 0 : referenceStructure.referenceLabel) !== null && _a !== void 0 ? _a : ""]) !== null && _b !== void 0 ? _b : data[serverId]),
6270
+ count: (_c = currentReferenceSelectedList.count) !== null && _c !== void 0 ? _c : currentReferenceSelectedList.data.length,
6271
+ });
6230
6272
  }
6231
6273
  return [2 /*return*/];
6232
6274
  }
@@ -6269,9 +6311,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
6269
6311
  return [3 /*break*/, 5];
6270
6312
  case 4:
6271
6313
  err_15 = _d.sent();
6272
- return [3 /*break*/, 5];
6314
+ // INFO: a datasheet that could not be checked may still link to these
6315
+ // records, so none of them is deleted
6316
+ setNotification({
6317
+ type: false,
6318
+ title: "Nothing deleted",
6319
+ msg: "Couldn't check where these records are used. Try again.",
6320
+ });
6321
+ return [2 /*return*/, []];
6273
6322
  case 5:
6274
- setReferenceDeleteTableData(existsData);
6323
+ setReferenceDeleteTableData(__spreadArray([], existsData, true).sort(function (left, right) {
6324
+ return left.recordLabel.localeCompare(right.recordLabel) ||
6325
+ left.collectionName.localeCompare(right.collectionName);
6326
+ }));
6275
6327
  return [2 /*return*/, selectedData
6276
6328
  .filter(function (eachData) {
6277
6329
  return !existDataIds.includes(eachData[serverId]);
@@ -6662,7 +6714,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
6662
6714
  var columnTypeActions = {
6663
6715
  canUpdate: canUpdateRecord,
6664
6716
  dateWarnings: isDateWarnings,
6665
- onButtonClick: (_109 = props.organise) === null || _109 === void 0 ? void 0 : _109.onButtonClick,
6717
+ onButtonClick: (_112 = props.organise) === null || _112 === void 0 ? void 0 : _112.onButtonClick,
6666
6718
  onUpdateCell: function (rowId, columnId, value) { return __awaiter(void 0, void 0, void 0, function () {
6667
6719
  var _a;
6668
6720
  return __generator(this, function (_b) {
@@ -6679,7 +6731,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
6679
6731
  }
6680
6732
  });
6681
6733
  }); },
6682
- onTimeTrackingAction: ((_110 = props.organise) === null || _110 === void 0 ? void 0 : _110.onTimeTrackingAction) && canUpdateRecord
6734
+ onTimeTrackingAction: ((_113 = props.organise) === null || _113 === void 0 ? void 0 : _113.onTimeTrackingAction) && canUpdateRecord
6683
6735
  ? function (rowId, columnId, action) {
6684
6736
  return handleTimeTrackingAction(rowId, columnId, action);
6685
6737
  }
@@ -8814,7 +8866,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
8814
8866
  : getActiveUserHiddenColumnIds().includes(column.id);
8815
8867
  };
8816
8868
  var renderViewSettingsContent = function () {
8817
- var _a, _b, _c, _d, _e, _f;
8869
+ var _a, _b, _c, _d, _e, _f, _g;
8818
8870
  var viewColumns = getViewSettingsColumns();
8819
8871
  var hiddenCount = viewColumns.filter(getIsColumnHidden).length;
8820
8872
  var visibleCount = viewColumns.length - hiddenCount;
@@ -8914,7 +8966,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
8914
8966
  react_1.default.createElement("div", { className: "mt-1" },
8915
8967
  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: (_f = props.organise) === null || _f === void 0 ? void 0 : _f.darkMode, options: handleGetGroupByOptions(), onChange: function (value) {
8916
8968
  return handleChangeGroupBy(value !== null && value !== void 0 ? value : "", true);
8917
- } })))),
8969
+ } })),
8970
+ groupId && handleCheckGroupOrderShown() && (react_1.default.createElement("div", { className: "mt-2" },
8971
+ react_1.default.createElement(select_1.Select, { id: "dtw-view-group-order", portalDropdown: true, label: "", value: groupOrder, darkMode: (_g = props.organise) === null || _g === void 0 ? void 0 : _g.darkMode, options: [
8972
+ { key: "", label: "Column order" },
8973
+ { key: "most", label: "Most records first" },
8974
+ { key: "fewest", label: "Fewest records first" },
8975
+ ], onChange: function (value) {
8976
+ return setGroupOrder((value !== null && value !== void 0 ? value : ""));
8977
+ } }))))),
8918
8978
  react_1.default.createElement("div", { className: "mt-3 border-t pt-3 ".concat(dividerColor) },
8919
8979
  react_1.default.createElement("p", { className: "text-sm font-medium ".concat(labelColor) }, "Rows per page"),
8920
8980
  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
@@ -8934,8 +8994,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
8934
8994
  : rows;
8935
8995
  };
8936
8996
  /* eslint-disable */
8937
- var newTableRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(tableData); }, [tableData, (_111 = props.bareSettings) === null || _111 === void 0 ? void 0 : _111.bareNewDTW]);
8938
- var newTableSpaceRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(spaceTableData); }, [spaceTableData, (_112 = props.bareSettings) === null || _112 === void 0 ? void 0 : _112.bareNewDTW]);
8997
+ var newTableRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(tableData); }, [tableData, (_114 = props.bareSettings) === null || _114 === void 0 ? void 0 : _114.bareNewDTW]);
8998
+ var newTableSpaceRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(spaceTableData); }, [spaceTableData, (_115 = props.bareSettings) === null || _115 === void 0 ? void 0 : _115.bareNewDTW]);
8939
8999
  /* eslint-enable */
8940
9000
  // INFO: beside a record's title, the pencil opens its edit form for whoever
8941
9001
  // may update, and the bubble opens comments and logs for anyone who can see
@@ -11146,7 +11206,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
11146
11206
  ((_b = groupPageState[eachGroup.id]) === null || _b === void 0 ? void 0 : _b.size) === 0);
11147
11207
  })
11148
11208
  : sections;
11149
- return handleApplyGroupDefaults(shownSections);
11209
+ // INFO: coloured in the column's order first, so a group keeps its colour
11210
+ // when the order changes
11211
+ return (0, groupSections_1.handleOrderGroupSections)(handleApplyGroupDefaults(shownSections), groupOrder);
11150
11212
  };
11151
11213
  // INFO: every section is coloured — by its option's
11152
11214
  // position, so a group keeps its colour as others empty — person groups
@@ -13459,39 +13521,52 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
13459
13521
  }
13460
13522
  };
13461
13523
  var renderReferenceDeleteTable = function () {
13462
- var _a;
13463
- var data = [];
13464
- for (var _i = 0, _b = Object.entries(referenceDeleteTableData); _i < _b.length; _i++) {
13465
- var _c = _b[_i], eachKey = _c[0], eachValue = _c[1];
13466
- data.push({
13467
- label: eachKey !== null && eachKey !== void 0 ? eachKey : "",
13468
- desc: (_a = eachValue === null || eachValue === void 0 ? void 0 : eachValue.toString()) !== null && _a !== void 0 ? _a : "",
13469
- });
13470
- }
13524
+ var _a, _b, _c, _d, _e;
13525
+ var canOpen = !!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onOpenReferencingRecords);
13526
+ var isMultiple = new Set(referenceDeleteTableData.map(function (each) { return each.recordId; })).size > 1;
13527
+ var handleGetRowKey = function (each) {
13528
+ return "".concat(each.recordId, "|").concat(each.collectionId, "|").concat(each.columnId);
13529
+ };
13530
+ // INFO: the first rows only — a select-all of many linked records would
13531
+ // otherwise list thousands
13532
+ var shownLinks = referenceDeleteTableData.slice(0, DELETE_BLOCKED_ROWS);
13533
+ var hiddenLinks = referenceDeleteTableData.length - shownLinks.length;
13534
+ var rows = shownLinks.map(function (each) { return ({
13535
+ id: handleGetRowKey(each),
13536
+ record: each.recordLabel,
13537
+ usedIn: each.collectionName,
13538
+ count: "".concat(each.count.toLocaleString(), " ").concat(each.count === 1 ? "record" : "records").concat(canOpen ? " ↗" : ""),
13539
+ }); });
13471
13540
  return (react_1.default.createElement("div", { className: "px-3 sm:px-0" },
13472
- react_1.default.createElement("div", { className: "flex" },
13473
- react_1.default.createElement("h2", { className: "mt-2 mb-2 text-xl font-bold text-gray-900" }, "Unable to Delete")),
13474
- react_1.default.createElement("p", { className: "mt-2 mb-4" }, "The data shown below is currently referenced in other spaces/collections. To proceed with deletion, you must first update or delete the referencing data in those respective spaces/collections:"),
13475
- react_1.default.createElement(table_1.Table, { data: data, header: [
13476
- {
13477
- key: "label",
13478
- title: "Data",
13479
- },
13480
- {
13481
- key: "desc",
13482
- title: "Space that consists data",
13483
- },
13484
- ], paginationType: "cursor", limit: 5, size: data.length, pageIndex: referenceDeleteIndex, handleUpdatePageIndex: function (value) {
13485
- if (value === "next")
13486
- setReferenceDeleteIndex(referenceDeleteIndex + 1);
13487
- else
13488
- setReferenceDeleteIndex(referenceDeleteIndex - 1);
13489
- }, loading: false }),
13541
+ react_1.default.createElement("h2", { className: "mt-2 mb-2 text-xl font-bold ".concat(((_b = props.organise) === null || _b === void 0 ? void 0 : _b.darkMode) ? "text-white" : "text-gray-900") }, "Can't delete yet"),
13542
+ react_1.default.createElement("p", { className: "mt-2 mb-4 text-sm ".concat(((_c = props.organise) === null || _c === void 0 ? void 0 : _c.darkMode) ? "text-gray-300" : "text-gray-600") },
13543
+ isMultiple ? "These records are" : "This record is",
13544
+ " still used in the datasheets below.",
13545
+ " ",
13546
+ canOpen
13547
+ ? "Open each to change or delete those records, then try again."
13548
+ : "Change or delete those records first, then try again."),
13549
+ react_1.default.createElement(newTable_1.NewTable, { loading: false, className: "w-full", darkMode: (_d = props.organise) === null || _d === void 0 ? void 0 : _d.darkMode, header: __spreadArray(__spreadArray([], (isMultiple ? [{ key: "record", title: "Record" }] : []), true), [
13550
+ { key: "usedIn", title: "Used in" },
13551
+ { key: "count", title: "Linked" },
13552
+ ], false), data: rows, onClickRow: canOpen
13553
+ ? function (rowId) {
13554
+ var _a, _b;
13555
+ var link = referenceDeleteTableData.find(function (each) { return handleGetRowKey(each) === rowId; });
13556
+ if (!link)
13557
+ return;
13558
+ // INFO: closed first, so it is not left over the datasheet
13559
+ // the app opens
13560
+ setReferenceDeleteTableData([]);
13561
+ (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onOpenReferencingRecords) === null || _b === void 0 ? void 0 : _b.call(_a, link);
13562
+ }
13563
+ : undefined }),
13564
+ hiddenLinks > 0 && (react_1.default.createElement("p", { className: "mt-2 text-xs ".concat(((_e = props.organise) === null || _e === void 0 ? void 0 : _e.darkMode) ? "text-gray-400" : "text-gray-500") },
13565
+ "And ",
13566
+ hiddenLinks.toLocaleString(),
13567
+ " more.")),
13490
13568
  react_1.default.createElement("div", { className: "flex flex-row justify-end pt-5 mt-6 space-x-2" },
13491
- react_1.default.createElement(button_1.Button, { text: "Close", size: "small", type: "normal", onClick: function () {
13492
- setReferenceDeleteIndex(0);
13493
- setReferenceDeleteTableData({});
13494
- } }))));
13569
+ react_1.default.createElement(button_1.Button, { text: "Close", size: "small", type: "normal", onClick: function () { return setReferenceDeleteTableData([]); } }))));
13495
13570
  };
13496
13571
  var renderDeleteModalContent = function () {
13497
13572
  var _a;
@@ -13636,14 +13711,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
13636
13711
  };
13637
13712
  return (react_1.default.createElement(context_1.ColumnTypeContext.Provider, { value: columnTypeActions },
13638
13713
  renderNotification("root"),
13639
- ((_114 = (_113 = props.renderSettings) === null || _113 === void 0 ? void 0 : _113.renderLoadingUI) === null || _114 === void 0 ? void 0 : _114.call(_113)) && loading ? ((_115 = props.renderSettings) === null || _115 === void 0 ? void 0 : _115.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_116 = props.organise) === null || _116 === void 0 ? void 0 : _116.darkMode, darkModeBg: (_117 = props.organise) === null || _117 === void 0 ? void 0 : _117.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
13714
+ ((_117 = (_116 = props.renderSettings) === null || _116 === void 0 ? void 0 : _116.renderLoadingUI) === null || _117 === void 0 ? void 0 : _117.call(_116)) && loading ? ((_118 = props.renderSettings) === null || _118 === void 0 ? void 0 : _118.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_119 = props.organise) === null || _119 === void 0 ? void 0 : _119.darkMode, darkModeBg: (_120 = props.organise) === null || _120 === void 0 ? void 0 : _120.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
13640
13715
  var _a, _b;
13641
13716
  if (loading)
13642
13717
  return;
13643
13718
  handlePopUpModal(false);
13644
13719
  setExportCSVEmail((_b = (_a = props.devSettings.currentUser) === null || _a === void 0 ? void 0 : _a.userEmail) !== null && _b !== void 0 ? _b : "");
13645
13720
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) })),
13646
- react_1.default.createElement(modal_1.Modal, { darkMode: (_118 = props.organise) === null || _118 === void 0 ? void 0 : _118.darkMode, darkModeBg: (_119 = props.organise) === null || _119 === void 0 ? void 0 : _119.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
13721
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_121 = props.organise) === null || _121 === void 0 ? void 0 : _121.darkMode, darkModeBg: (_122 = props.organise) === null || _122 === void 0 ? void 0 : _122.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
13647
13722
  return (react_1.default.createElement(referenceModal_1.ReferenceModal, { referenceModelSchema: referenceModelSchema, referenceDataStructure: referenceCreationModal, devSettings: props.devSettings, handleCreateRefId: function (dataId) {
13648
13723
  if (dataId) {
13649
13724
  var currentValue = selectedData[referenceCreationModal.id];
@@ -13659,19 +13734,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
13659
13734
  }, onClose: function () {
13660
13735
  setReferenceCreationModal({ id: "", name: "", type: "string" });
13661
13736
  } }),
13662
- react_1.default.createElement(modal_1.Modal, { darkMode: (_120 = props.organise) === null || _120 === void 0 ? void 0 : _120.darkMode, darkModeBg: (_121 = props.organise) === null || _121 === void 0 ? void 0 : _121.darkModeBg, maxWidth: "2xl", open: Object.keys(referenceDeleteTableData).length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
13663
- setReferenceDeleteTableData({});
13737
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_123 = props.organise) === null || _123 === void 0 ? void 0 : _123.darkMode, darkModeBg: (_124 = props.organise) === null || _124 === void 0 ? void 0 : _124.darkModeBg, maxWidth: "2xl", open: referenceDeleteTableData.length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
13738
+ setReferenceDeleteTableData([]);
13664
13739
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
13665
- react_1.default.createElement(modal_1.Modal, { darkMode: (_122 = props.organise) === null || _122 === void 0 ? void 0 : _122.darkMode, darkModeBg: (_123 = props.organise) === null || _123 === void 0 ? void 0 : _123.darkModeBg, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
13740
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_125 = props.organise) === null || _125 === void 0 ? void 0 : _125.darkMode, darkModeBg: (_126 = props.organise) === null || _126 === void 0 ? void 0 : _126.darkModeBg, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
13666
13741
  setDeletePasscodeInput("");
13667
13742
  setDeleteModal(!deleteModal);
13668
13743
  setDeleteFeedId("");
13669
13744
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
13670
- react_1.default.createElement(modal_1.Modal, { darkMode: (_124 = props.organise) === null || _124 === void 0 ? void 0 : _124.darkMode, darkModeBg: (_125 = props.organise) === null || _125 === void 0 ? void 0 : _125.darkModeBg, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
13745
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_127 = props.organise) === null || _127 === void 0 ? void 0 : _127.darkMode, darkModeBg: (_128 = props.organise) === null || _128 === void 0 ? void 0 : _128.darkModeBg, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
13671
13746
  setBatchUpdateData({ columnId: "", columnData: {} });
13672
13747
  setBatchUpdateModal(false);
13673
13748
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
13674
- react_1.default.createElement(modal_1.Modal, { darkMode: (_126 = props.organise) === null || _126 === void 0 ? void 0 : _126.darkMode, darkModeBg: (_127 = props.organise) === null || _127 === void 0 ? void 0 : _127.darkModeBg, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
13749
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_129 = props.organise) === null || _129 === void 0 ? void 0 : _129.darkMode, darkModeBg: (_130 = props.organise) === null || _130 === void 0 ? void 0 : _130.darkModeBg, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
13675
13750
  var _a, _b;
13676
13751
  if (props.space)
13677
13752
  return (react_1.default.createElement(authModal_1.AuthModal, { space: props.space, userId: (_a = props.id) !== null && _a !== void 0 ? _a : "", client: (_b = props.lib) === null || _b === void 0 ? void 0 : _b.axios, type: selectedAuthMethod, authMethods: authMethods, onComplete: handleAuthComplete }));
@@ -13688,14 +13763,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
13688
13763
  (0, react_dom_1.createPortal)(
13689
13764
  // INFO: z-50 lifts it over a Modal the table may sit in (z-40)
13690
13765
  react_1.default.createElement("div", { className: "relative z-50" },
13691
- react_1.default.createElement(drawer_1.Drawer, { darkMode: (_128 = props.organise) === null || _128 === void 0 ? void 0 : _128.darkMode, darkModeBg: (_129 = props.organise) === null || _129 === void 0 ? void 0 : _129.darkModeBg, testId: "dt-activity-drawer", open: activityModal,
13766
+ react_1.default.createElement(drawer_1.Drawer, { darkMode: (_131 = props.organise) === null || _131 === void 0 ? void 0 : _131.darkMode, darkModeBg: (_132 = props.organise) === null || _132 === void 0 ? void 0 : _132.darkModeBg, testId: "dt-activity-drawer", open: activityModal,
13692
13767
  // INFO: the record stays set while the drawer slides out — clearing it
13693
13768
  // would remount the hidden panel collection-wide and fetch again. The
13694
13769
  // toolbar's collection-wide button clears it when it opens.
13695
13770
  onClose: function () { return setActivityModal(false); }, anchor: "responsive", maxWidth: "2xl", maxHeight: "75",
13696
13771
  // INFO: dragged like the read drawer; the width sticks across
13697
13772
  // opens while the list stays mounted
13698
- resizable: true, title: "Activity Log", content: renderActivityPanel(resolvedType === "read" ? ((_130 = props.id) !== null && _130 !== void 0 ? _130 : "") : activityId) })), document.body),
13773
+ resizable: true, title: "Activity Log", content: renderActivityPanel(resolvedType === "read" ? ((_133 = props.id) !== null && _133 !== void 0 ? _133 : "") : activityId) })), document.body),
13699
13774
  renderScrollSentinel()));
13700
13775
  });
13701
13776
  //# sourceMappingURL=index.js.map