blixify-ui-web 1.2.196 → 1.2.198

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/lib/components/data/columnTypes/buttonCell.d.ts +15 -0
  2. package/lib/components/data/columnTypes/buttonCell.d.ts.map +1 -0
  3. package/lib/components/data/columnTypes/buttonCell.js +156 -0
  4. package/lib/components/data/columnTypes/buttonCell.js.map +1 -0
  5. package/lib/components/data/columnTypes/context.d.ts +13 -0
  6. package/lib/components/data/columnTypes/context.d.ts.map +1 -0
  7. package/lib/components/data/columnTypes/context.js +8 -0
  8. package/lib/components/data/columnTypes/context.js.map +1 -0
  9. package/lib/components/data/columnTypes/dateRange.d.ts +24 -0
  10. package/lib/components/data/columnTypes/dateRange.d.ts.map +1 -0
  11. package/lib/components/data/columnTypes/dateRange.js +75 -0
  12. package/lib/components/data/columnTypes/dateRange.js.map +1 -0
  13. package/lib/components/data/columnTypes/groupSections.d.ts +56 -0
  14. package/lib/components/data/columnTypes/groupSections.d.ts.map +1 -0
  15. package/lib/components/data/columnTypes/groupSections.js +170 -0
  16. package/lib/components/data/columnTypes/groupSections.js.map +1 -0
  17. package/lib/components/data/columnTypes/index.d.ts +14 -0
  18. package/lib/components/data/columnTypes/index.d.ts.map +1 -0
  19. package/lib/components/data/columnTypes/index.js +30 -0
  20. package/lib/components/data/columnTypes/index.js.map +1 -0
  21. package/lib/components/data/columnTypes/ratingCell.d.ts +29 -0
  22. package/lib/components/data/columnTypes/ratingCell.d.ts.map +1 -0
  23. package/lib/components/data/columnTypes/ratingCell.js +176 -0
  24. package/lib/components/data/columnTypes/ratingCell.js.map +1 -0
  25. package/lib/components/data/columnTypes/systemColumns.d.ts +27 -0
  26. package/lib/components/data/columnTypes/systemColumns.d.ts.map +1 -0
  27. package/lib/components/data/columnTypes/systemColumns.js +118 -0
  28. package/lib/components/data/columnTypes/systemColumns.js.map +1 -0
  29. package/lib/components/data/columnTypes/timeTracking.d.ts +27 -0
  30. package/lib/components/data/columnTypes/timeTracking.d.ts.map +1 -0
  31. package/lib/components/data/columnTypes/timeTracking.js +127 -0
  32. package/lib/components/data/columnTypes/timeTracking.js.map +1 -0
  33. package/lib/components/data/columnTypes/timeTrackingCell.d.ts +17 -0
  34. package/lib/components/data/columnTypes/timeTrackingCell.d.ts.map +1 -0
  35. package/lib/components/data/columnTypes/timeTrackingCell.js +146 -0
  36. package/lib/components/data/columnTypes/timeTrackingCell.js.map +1 -0
  37. package/lib/components/data/dataTemplate/activityChanges.d.ts.map +1 -1
  38. package/lib/components/data/dataTemplate/activityChanges.js +7 -0
  39. package/lib/components/data/dataTemplate/activityChanges.js.map +1 -1
  40. package/lib/components/data/dataTemplate/dataStateModel.d.ts +6 -0
  41. package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
  42. package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
  43. package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
  44. package/lib/components/data/dataTemplate/index.js +399 -323
  45. package/lib/components/data/dataTemplate/index.js.map +1 -1
  46. package/lib/components/data/dataTemplate/model.d.ts +26 -2
  47. package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
  48. package/lib/components/data/dataTemplate/settingsModal.d.ts.map +1 -1
  49. package/lib/components/data/dataTemplate/settingsModal.js +13 -6
  50. package/lib/components/data/dataTemplate/settingsModal.js.map +1 -1
  51. package/lib/components/data/dataTemplate/viewStatePersistence.d.ts +1 -0
  52. package/lib/components/data/dataTemplate/viewStatePersistence.d.ts.map +1 -1
  53. package/lib/components/data/dataTemplate/viewStatePersistence.js +18 -3
  54. package/lib/components/data/dataTemplate/viewStatePersistence.js.map +1 -1
  55. package/lib/components/data/flexFilter/index.d.ts.map +1 -1
  56. package/lib/components/data/flexFilter/index.js +23 -1
  57. package/lib/components/data/flexFilter/index.js.map +1 -1
  58. package/lib/components/data/formula/builder.d.ts.map +1 -1
  59. package/lib/components/data/formula/builder.js +30 -10
  60. package/lib/components/data/formula/builder.js.map +1 -1
  61. package/lib/components/data/formula/functions.d.ts +3 -0
  62. package/lib/components/data/formula/functions.d.ts.map +1 -1
  63. package/lib/components/data/formula/functions.js +269 -1
  64. package/lib/components/data/formula/functions.js.map +1 -1
  65. package/lib/components/data/formula/index.d.ts +8 -0
  66. package/lib/components/data/formula/index.d.ts.map +1 -1
  67. package/lib/components/data/formula/index.js +77 -12
  68. package/lib/components/data/formula/index.js.map +1 -1
  69. package/lib/components/data/listModule.d.ts.map +1 -1
  70. package/lib/components/data/listModule.js +42 -1
  71. package/lib/components/data/listModule.js.map +1 -1
  72. package/lib/components/data/readModule.d.ts.map +1 -1
  73. package/lib/components/data/readModule.js +105 -74
  74. package/lib/components/data/readModule.js.map +1 -1
  75. package/lib/components/data/updateModule.d.ts.map +1 -1
  76. package/lib/components/data/updateModule.js +75 -28
  77. package/lib/components/data/updateModule.js.map +1 -1
  78. package/lib/components/data/utils.d.ts.map +1 -1
  79. package/lib/components/data/utils.js +13 -0
  80. package/lib/components/data/utils.js.map +1 -1
  81. package/lib/components/display/newTable/index.d.ts +1 -0
  82. package/lib/components/display/newTable/index.d.ts.map +1 -1
  83. package/lib/components/display/newTable/index.js +53 -14
  84. package/lib/components/display/newTable/index.js.map +1 -1
  85. package/lib/tail.css +2 -2
  86. package/package.json +1 -1
@@ -148,6 +148,10 @@ var writeQuery_1 = require("../writeQuery");
148
148
  var activityModal_1 = require("./activityModal");
149
149
  var authModal_1 = require("./authModal");
150
150
  var indexedDb_1 = require("./indexedDb");
151
+ var context_1 = require("../columnTypes/context");
152
+ var groupSections_1 = require("../columnTypes/groupSections");
153
+ var systemColumns_1 = require("../columnTypes/systemColumns");
154
+ var dateRange_1 = require("../columnTypes/dateRange");
151
155
  var socket_1 = require("./socket");
152
156
  var newPagination_1 = require("../../display/newPagination");
153
157
  var pagination_1 = require("./pagination");
@@ -215,10 +219,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
215
219
  // Every read of the view type below uses resolvedType. The distinction matters
216
220
  // most in effect dependency arrays — following props.type there would leave
217
221
  // the list never refetching while the panel is open, which fails silently.
218
- 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;
222
+ 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;
219
223
  // INFO: the panel cannot navigate its way out — handleNavigate("read") is
220
224
  // routed straight back into it — so expand-to-full-page is local state.
221
- var _103 = (0, react_1.useState)(false), drawerPageView = _103[0], setDrawerPageView = _103[1];
225
+ var _106 = (0, react_1.useState)(false), drawerPageView = _106[0], setDrawerPageView = _106[1];
222
226
  // INFO: the panel keeps rendering the record it was opened with rather than
223
227
  // live props. Without this, navigating back to the list would re-render the
224
228
  // still-mounted panel as a second list behind the overlay.
@@ -310,14 +314,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
310
314
  initialFilterReferenceDate: initialFilterReferenceDate,
311
315
  };
312
316
  };
313
- var _104 = intialiseDefaultFilterValues(), initialFilterSearch = _104.initialFilterSearch, initialFilterSearchParams = _104.initialFilterSearchParams, initialFilterSelection = _104.initialFilterSelection, initialFilterReference = _104.initialFilterReference, initialFilterReferenceDate = _104.initialFilterReferenceDate;
317
+ var _107 = intialiseDefaultFilterValues(), initialFilterSearch = _107.initialFilterSearch, initialFilterSearchParams = _107.initialFilterSearchParams, initialFilterSelection = _107.initialFilterSelection, initialFilterReference = _107.initialFilterReference, initialFilterReferenceDate = _107.initialFilterReferenceDate;
314
318
  // INFO: Persist view state hook — handles storage read/write for filter/sort/column state
315
- var _105 = (0, viewStatePersistence_1.usePersistedViewState)({
319
+ var _108 = (0, viewStatePersistence_1.usePersistedViewState)({
316
320
  mode: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.persistViewState,
317
321
  collectionId: props.collectionId,
318
322
  persistKey: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.persistKey,
319
323
  type: resolvedType,
320
- }), rawPersistedState = _105.persistedState, isPersistEnabled = _105.isEnabled, handleSaveView = _105.handleSaveView, handleRegisterViewSnapshot = _105.handleRegisterViewSnapshot;
324
+ }), rawPersistedState = _108.persistedState, isPersistEnabled = _108.isEnabled, handleSaveView = _108.handleSaveView, handleRegisterViewSnapshot = _108.handleRegisterViewSnapshot;
321
325
  // INFO: drop stored filters/sort on removed columns — they would empty the table
322
326
  var persistedState = (0, react_1.useMemo)(function () {
323
327
  var _a, _b, _c;
@@ -331,8 +335,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
331
335
  (_d = props.bareSettings) === null || _d === void 0 ? void 0 : _d.bareFlexFilterReferences,
332
336
  (_e = props.bareSettings) === null || _e === void 0 ? void 0 : _e.bareFlexFilterListObjects,
333
337
  ]);
334
- var _106 = (0, react_1.useState)(false), loading = _106[0], setLoading = _106[1];
335
- var _107 = (0, react_1.useState)(), notification = _107[0], setNotification = _107[1];
338
+ var _109 = (0, react_1.useState)(false), loading = _109[0], setLoading = _109[1];
339
+ var _110 = (0, react_1.useState)(), notification = _110[0], setNotification = _110[1];
336
340
  // INFO: a success toast is confirmation, not a decision — it clears itself so
337
341
  // it never sits on the floating step bar; errors stay until dismissed
338
342
  (0, react_1.useEffect)(function () {
@@ -342,63 +346,75 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
342
346
  return function () { return clearTimeout(timer); };
343
347
  }, [notification]);
344
348
  //INFO : Used by List
345
- var _108 = (0, react_1.useState)((_f = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _f !== void 0 ? _f : initialFilterSearch), filterSearch = _108[0], setFilterSearch = _108[1];
346
- var _109 = (0, react_1.useState)((_g = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _g !== void 0 ? _g : initialFilterSearchParams), filterSearchParams = _109[0], setFilterSearchParams = _109[1];
347
- var _110 = (0, react_1.useState)((_h = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _h !== void 0 ? _h : initialFilterSelection), filterSelection = _110[0], setFilterSelection = _110[1];
348
- var _111 = (0, react_1.useState)((_j = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _j !== void 0 ? _j : initialFilterReference), filterReference = _111[0], setFilterReference = _111[1];
349
- var _112 = (0, react_1.useState)({}), filterReferenceSearch = _112[0], setFilterReferenceSearch = _112[1];
350
- var _113 = (0, react_1.useState)({}), filterReferenceList = _113[0], setFilterReferenceList = _113[1];
351
- var _114 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
349
+ var _111 = (0, react_1.useState)((_f = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _f !== void 0 ? _f : initialFilterSearch), filterSearch = _111[0], setFilterSearch = _111[1];
350
+ var _112 = (0, react_1.useState)((_g = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _g !== void 0 ? _g : initialFilterSearchParams), filterSearchParams = _112[0], setFilterSearchParams = _112[1];
351
+ var _113 = (0, react_1.useState)((_h = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _h !== void 0 ? _h : initialFilterSelection), filterSelection = _113[0], setFilterSelection = _113[1];
352
+ var _114 = (0, react_1.useState)((_j = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _j !== void 0 ? _j : initialFilterReference), filterReference = _114[0], setFilterReference = _114[1];
353
+ var _115 = (0, react_1.useState)({}), filterReferenceSearch = _115[0], setFilterReferenceSearch = _115[1];
354
+ var _116 = (0, react_1.useState)({}), filterReferenceList = _116[0], setFilterReferenceList = _116[1];
355
+ var _117 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
352
356
  ? (0, viewStatePersistence_1.parseDateFilterState)(persistedState.filterReferenceDate)
353
- : initialFilterReferenceDate), filterReferenceDate = _114[0], setFilterReferenceDate = _114[1];
354
- var _115 = (0, react_1.useState)(true), tableLoading = _115[0], setTableLoading = _115[1];
355
- var _116 = (0, react_1.useState)(""), cursor = _116[0], setCursor = _116[1];
356
- var _117 = (0, react_1.useState)(""), lastCursor = _117[0], setLastCursor = _117[1];
357
- var _118 = (0, react_1.useState)([]), tableData = _118[0], setTableData = _118[1];
358
- var _119 = (0, react_1.useState)([]), spaceTableData = _119[0], setSpaceTableData = _119[1];
357
+ : initialFilterReferenceDate), filterReferenceDate = _117[0], setFilterReferenceDate = _117[1];
358
+ var _118 = (0, react_1.useState)(true), tableLoading = _118[0], setTableLoading = _118[1];
359
+ var _119 = (0, react_1.useState)(""), cursor = _119[0], setCursor = _119[1];
360
+ var _120 = (0, react_1.useState)(""), lastCursor = _120[0], setLastCursor = _120[1];
361
+ var _121 = (0, react_1.useState)([]), tableData = _121[0], setTableData = _121[1];
362
+ var _122 = (0, react_1.useState)([]), spaceTableData = _122[0], setSpaceTableData = _122[1];
359
363
  // INFO: a save resolves after later renders, so it reads the table from here —
360
364
  // the state it closed over can predate an earlier save on the same row
361
365
  var tableDataRef = (0, react_1.useRef)([]);
362
366
  var spaceTableDataRef = (0, react_1.useRef)([]);
363
367
  tableDataRef.current = tableData;
364
368
  spaceTableDataRef.current = spaceTableData;
365
- var _120 = (0, react_1.useState)(0), size = _120[0], setSize = _120[1];
366
- var _121 = (0, react_1.useState)((_m = (_k = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _k !== void 0 ? _k : (_l = props.organise) === null || _l === void 0 ? void 0 : _l.pageIndex) !== null && _m !== void 0 ? _m : 0), pageIndex = _121[0], setPageIndex = _121[1];
367
- var _122 = (0, react_1.useState)([]), selectedIds = _122[0], setSelectedIds = _122[1];
368
- var _123 = (0, react_1.useState)(false), selectAll = _123[0], setSelectAll = _123[1];
369
- var _124 = (0, react_1.useState)(""), deletePasscode = _124[0], setDeletePasscode = _124[1];
370
- var _125 = (0, react_1.useState)(""), deletePasscodeInput = _125[0], setDeletePasscodeInput = _125[1];
371
- var _126 = (0, react_1.useState)(""), deleteFeedId = _126[0], setDeleteFeedId = _126[1];
369
+ var _123 = (0, react_1.useState)(0), size = _123[0], setSize = _123[1];
370
+ var _124 = (0, react_1.useState)((_m = (_k = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _k !== void 0 ? _k : (_l = props.organise) === null || _l === void 0 ? void 0 : _l.pageIndex) !== null && _m !== void 0 ? _m : 0), pageIndex = _124[0], setPageIndex = _124[1];
371
+ var _125 = (0, react_1.useState)([]), selectedIds = _125[0], setSelectedIds = _125[1];
372
+ var _126 = (0, react_1.useState)(false), selectAll = _126[0], setSelectAll = _126[1];
373
+ var _127 = (0, react_1.useState)(""), deletePasscode = _127[0], setDeletePasscode = _127[1];
374
+ var _128 = (0, react_1.useState)(""), deletePasscodeInput = _128[0], setDeletePasscodeInput = _128[1];
375
+ var _129 = (0, react_1.useState)(""), deleteFeedId = _129[0], setDeleteFeedId = _129[1];
372
376
  //INFO : Used by List Organise
373
377
  // INFO: Internal sort state that overrides props.organise?.sort when
374
378
  // persistViewState is enabled and a persisted sort exists
375
- var _127 = (0, react_1.useState)((_o = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _o !== void 0 ? _o : undefined), persistedSort = _127[0], setPersistedSort = _127[1];
376
- var _128 = (0, react_1.useState)(false), filterDraft = _128[0], setFilterDraft = _128[1];
377
- var _129 = (0, react_1.useState)(false), addTabModal = _129[0], setAddTabModal = _129[1];
378
- var _130 = (0, react_1.useState)(-1), editTabIndex = _130[0], setEditTabIndex = _130[1];
379
+ var _130 = (0, react_1.useState)((_o = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _o !== void 0 ? _o : undefined), persistedSort = _130[0], setPersistedSort = _130[1];
380
+ var _131 = (0, react_1.useState)(false), filterDraft = _131[0], setFilterDraft = _131[1];
381
+ var _132 = (0, react_1.useState)(false), addTabModal = _132[0], setAddTabModal = _132[1];
382
+ var _133 = (0, react_1.useState)(-1), editTabIndex = _133[0], setEditTabIndex = _133[1];
379
383
  //INFO : resolve the initial tab synchronously so the mount cond is already
380
384
  // tab-scoped — an empty initial tab caused a second wasted list fetch
381
- var _131 = (0, react_1.useState)(function () {
385
+ var _134 = (0, react_1.useState)(function () {
382
386
  var _a, _b;
383
387
  return (0, listModule_1.renderSelectedRefreshTab)(props.localURLEndpoint, resolvedType, props.collectionId, props.id, (_a = props.organise) === null || _a === void 0 ? void 0 : _a.extendedTabs, (_b = props.organise) === null || _b === void 0 ? void 0 : _b.viewId);
384
- }), selectedTab = _131[0], setSelectedTab = _131[1];
385
- var _132 = (0, react_1.useState)("dayGridMonth"), calendarView = _132[0], setCalendarView = _132[1];
388
+ }), selectedTab = _134[0], setSelectedTab = _134[1];
389
+ var _135 = (0, react_1.useState)("dayGridMonth"), calendarView = _135[0], setCalendarView = _135[1];
386
390
  // INFO: bareNewDTW calendar viewSwitch mode — drives the NewCalendar variant
387
391
  // (calendarView above drives the matching range query)
388
- var _133 = (0, react_1.useState)("month"), newCalendarViewMode = _133[0], setNewCalendarViewMode = _133[1];
389
- var _134 = (0, react_1.useState)(new Date()), calendarTabMonth = _134[0], setCalendarTabMonth = _134[1];
392
+ var _136 = (0, react_1.useState)("month"), newCalendarViewMode = _136[0], setNewCalendarViewMode = _136[1];
393
+ var _137 = (0, react_1.useState)(new Date()), calendarTabMonth = _137[0], setCalendarTabMonth = _137[1];
390
394
  // INFO: defaultViewSwitch picks the opening view only — the tab re-inits
391
395
  // whenever its settings change, and that must not undo the user's switch
392
396
  var calendarViewInitRef = (0, react_1.useRef)(false);
393
- var _135 = (0, react_1.useState)(true), kanbanDroppable = _135[0], setKanbanDroppable = _135[1];
394
- var _136 = (0, react_1.useState)([]), kanbanOptions = _136[0], setKanbanOptions = _136[1];
395
- var _137 = (0, react_1.useState)(false), batchUpdateModal = _137[0], setBatchUpdateModal = _137[1];
396
- var _138 = (0, react_1.useState)({
397
+ var _138 = (0, react_1.useState)(true), kanbanDroppable = _138[0], setKanbanDroppable = _138[1];
398
+ var _139 = (0, react_1.useState)([]), kanbanOptions = _139[0], setKanbanOptions = _139[1];
399
+ var _140 = (0, react_1.useState)(false), batchUpdateModal = _140[0], setBatchUpdateModal = _140[1];
400
+ var _141 = (0, react_1.useState)({
397
401
  columnId: "",
398
402
  columnData: {},
399
- }), batchUpdateData = _138[0], setBatchUpdateData = _138[1];
400
- var _139 = (0, react_1.useState)(function () {
401
- var baseModel = (props === null || props === void 0 ? void 0 : props.model) || [];
403
+ }), batchUpdateData = _141[0], setBatchUpdateData = _141[1];
404
+ // INFO: system columns (created / updated at and by, record id, number)
405
+ // join the structure hidden; the ones a user shows are kept per view
406
+ var isSystemColumnsEnabled = !!((_p = props.bareSettings) === null || _p === void 0 ? void 0 : _p.bareSystemColumns);
407
+ var appendedSystemColumnIds = isSystemColumnsEnabled
408
+ ? 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; }); })
409
+ : [];
410
+ var _142 = (0, react_1.useState)((_q = persistedState === null || persistedState === void 0 ? void 0 : persistedState.shownSystemColumnIds) !== null && _q !== void 0 ? _q : []), shownSystemColumnIds = _142[0], setShownSystemColumnIds = _142[1];
411
+ var handleWithSystemColumns = function (model, shownIds) {
412
+ if (shownIds === void 0) { shownIds = shownSystemColumnIds; }
413
+ return isSystemColumnsEnabled ? (0, systemColumns_1.handleAppendSystemColumns)(model, shownIds) : model;
414
+ };
415
+ var _143 = (0, react_1.useState)(function () {
416
+ var _a;
417
+ 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 : []);
402
418
  if (!persistedState)
403
419
  return baseModel;
404
420
  // INFO: Apply persisted column visibility (hiddenColumnIds) and order (columnOrder)
@@ -423,8 +439,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
423
439
  });
424
440
  }
425
441
  return model;
426
- }), structure = _139[0], setStructure = _139[1];
427
- var _140 = (0, react_1.useState)(((_p = props === null || props === void 0 ? void 0 : props.organise) === null || _p === void 0 ? void 0 : _p.additionalQuery) || []), additionalQuery = _140[0], setAdditionalQuery = _140[1];
442
+ }), structure = _143[0], setStructure = _143[1];
443
+ var _144 = (0, react_1.useState)(((_r = props === null || props === void 0 ? void 0 : props.organise) === null || _r === void 0 ? void 0 : _r.additionalQuery) || []), additionalQuery = _144[0], setAdditionalQuery = _144[1];
428
444
  // INFO: State for user-configurable flex filters (Monday.com-style)
429
445
  // INFO: Initialize with one empty row so users see inputs immediately without clicking "Add Filter"
430
446
  var defaultFlexFilterRow = [
@@ -435,9 +451,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
435
451
  value: undefined,
436
452
  },
437
453
  ];
438
- var _141 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
454
+ var _145 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
439
455
  ? persistedState.flexFilters
440
- : defaultFlexFilterRow), flexFilters = _141[0], setFlexFilters = _141[1];
456
+ : defaultFlexFilterRow), flexFilters = _145[0], setFlexFilters = _145[1];
441
457
  // INFO: always-current mirror of flexFilters, read by the imperative apply/
442
458
  // clear methods so chained calls in one tick aren't stale.
443
459
  var flexFiltersRef = (0, react_1.useRef)(flexFilters);
@@ -450,76 +466,76 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
450
466
  }, [flexFilters]);
451
467
  // INFO: Debounced version of flexFilters used by renderImpSearchFilterConditions
452
468
  // to prevent API calls on every keystroke when typing in value inputs
453
- var _142 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
469
+ var _146 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
454
470
  ? persistedState.flexFilters
455
- : defaultFlexFilterRow), flexFiltersDebounced = _142[0], setFlexFiltersDebounced = _142[1];
471
+ : defaultFlexFilterRow), flexFiltersDebounced = _146[0], setFlexFiltersDebounced = _146[1];
456
472
  // INFO: the filter rows of the export being set up — started from the
457
473
  // list's own when the export opens, so changing them leaves the list as it is
458
- var _143 = (0, react_1.useState)(defaultFlexFilterRow), exportFlexFilters = _143[0], setExportFlexFilters = _143[1];
459
- var _144 = (0, react_1.useState)({}), flexFilterReferenceOptions = _144[0], setFlexFilterReferenceOptions = _144[1];
460
- var _145 = (0, react_1.useState)({}), flexFilterReferenceSearch = _145[0], setFlexFilterReferenceSearch = _145[1];
461
- var _146 = (0, react_1.useState)(false), flexFilterModalOpen = _146[0], setFlexFilterModalOpen = _146[1];
462
- var _147 = (0, react_1.useState)(false), viewSettingsModalOpen = _147[0], setViewSettingsModalOpen = _147[1];
474
+ var _147 = (0, react_1.useState)(defaultFlexFilterRow), exportFlexFilters = _147[0], setExportFlexFilters = _147[1];
475
+ var _148 = (0, react_1.useState)({}), flexFilterReferenceOptions = _148[0], setFlexFilterReferenceOptions = _148[1];
476
+ var _149 = (0, react_1.useState)({}), flexFilterReferenceSearch = _149[0], setFlexFilterReferenceSearch = _149[1];
477
+ var _150 = (0, react_1.useState)(false), flexFilterModalOpen = _150[0], setFlexFilterModalOpen = _150[1];
478
+ var _151 = (0, react_1.useState)(false), viewSettingsModalOpen = _151[0], setViewSettingsModalOpen = _151[1];
463
479
  // INFO: Columns the end user chose to hide (bareSettings.bareViewSettings).
464
480
  // Deliberately kept out of `structure`: the props-sync effect below resets
465
481
  // structure to props.model whenever props change, which would wipe the
466
482
  // choice, and the persist effect derives schema-level hiddenColumnIds from
467
483
  // structure — writing user hides there would blur the two concepts.
468
- var _148 = (0, react_1.useState)((_q = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _q !== void 0 ? _q : []), userHiddenColumnIds = _148[0], setUserHiddenColumnIds = _148[1];
469
- var _149 = (0, react_1.useState)(""), columnSearch = _149[0], setColumnSearch = _149[1];
470
- var _150 = (0, react_1.useState)([]), savedViews = _150[0], setSavedViews = _150[1];
471
- var _151 = (0, react_1.useState)(null), activeSavedViewId = _151[0], setActiveSavedViewId = _151[1];
484
+ var _152 = (0, react_1.useState)((_s = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _s !== void 0 ? _s : []), userHiddenColumnIds = _152[0], setUserHiddenColumnIds = _152[1];
485
+ var _153 = (0, react_1.useState)(""), columnSearch = _153[0], setColumnSearch = _153[1];
486
+ var _154 = (0, react_1.useState)([]), savedViews = _154[0], setSavedViews = _154[1];
487
+ var _155 = (0, react_1.useState)(null), activeSavedViewId = _155[0], setActiveSavedViewId = _155[1];
472
488
  // INFO: null while the name box is closed
473
- var _152 = (0, react_1.useState)(null), savedViewName = _152[0], setSavedViewName = _152[1];
474
- var _153 = (0, react_1.useState)(null), deletingSavedViewId = _153[0], setDeletingSavedViewId = _153[1];
475
- var _154 = (0, react_1.useState)(null), draggingColumnId = _154[0], setDraggingColumnId = _154[1];
489
+ var _156 = (0, react_1.useState)(null), savedViewName = _156[0], setSavedViewName = _156[1];
490
+ var _157 = (0, react_1.useState)(null), deletingSavedViewId = _157[0], setDeletingSavedViewId = _157[1];
491
+ var _158 = (0, react_1.useState)(null), draggingColumnId = _158[0], setDraggingColumnId = _158[1];
476
492
  var columnRowRefs = (0, react_1.useRef)({});
477
493
  //INFO : Used by Auth
478
- var _155 = (0, react_1.useState)({
494
+ var _159 = (0, react_1.useState)({
479
495
  email: "",
480
496
  google: "",
481
497
  phone: "",
482
498
  disabled: false,
483
499
  create: false,
484
- }), authMethods = _155[0], setAuthMethods = _155[1];
485
- var _156 = (0, react_1.useState)(""), selectedAuthMethod = _156[0], setSelectedAuthMethod = _156[1];
500
+ }), authMethods = _159[0], setAuthMethods = _159[1];
501
+ var _160 = (0, react_1.useState)(""), selectedAuthMethod = _160[0], setSelectedAuthMethod = _160[1];
486
502
  // INFO: the sign-in check of a users datasheet's record is running; the
487
503
  // panel shows a spinner rather than nothing, which read as "no login"
488
- var _157 = (0, react_1.useState)(false), authLoading = _157[0], setAuthLoading = _157[1];
504
+ var _161 = (0, react_1.useState)(false), authLoading = _161[0], setAuthLoading = _161[1];
489
505
  // INFO: a delete is running — the ref answers a second tap at once, before
490
506
  // the state has rendered, and the state disables the confirm button
491
507
  var deletingRef = (0, react_1.useRef)(false);
492
- var _158 = (0, react_1.useState)(false), deleting = _158[0], setDeleting = _158[1];
508
+ var _162 = (0, react_1.useState)(false), deleting = _162[0], setDeleting = _162[1];
493
509
  // INFO: Used by Activity Log
494
- var _159 = (0, react_1.useState)(false), activityModal = _159[0], setActivityModal = _159[1];
495
- var _160 = (0, react_1.useState)(""), activityId = _160[0], setActivityId = _160[1];
510
+ var _163 = (0, react_1.useState)(false), activityModal = _163[0], setActivityModal = _163[1];
511
+ var _164 = (0, react_1.useState)(""), activityId = _164[0], setActivityId = _164[1];
496
512
  //INFO : Used by Export
497
- var _161 = (0, react_1.useState)(null), csvFile = _161[0], setCSVFile = _161[1];
498
- var _162 = (0, react_1.useState)([]), csvFileData = _162[0], setCSVFileData = _162[1];
499
- var _163 = (0, react_1.useState)(0), stepCSVIndex = _163[0], setStepCSVIndex = _163[1];
500
- var _164 = (0, react_1.useState)({}), listCSVMapAttribute = _164[0], setListCSVMapAttribute = _164[1];
501
- var _165 = (0, react_1.useState)({}), listCSVObjAttribute = _165[0], setListCSVObjAttribute = _165[1];
502
- var _166 = (0, react_1.useState)([]), csvAPIAttribute = _166[0], setCSVAPIAttribute = _166[1];
503
- var _167 = (0, react_1.useState)(((_r = props.devSettings.currentUser) === null || _r === void 0 ? void 0 : _r.userEmail) || ""), exportCSVEmail = _167[0], setExportCSVEmail = _167[1];
504
- var _168 = (0, react_1.useState)(((_t = (_s = props.organise) === null || _s === void 0 ? void 0 : _s.exportSettings) === null || _t === void 0 ? void 0 : _t.defaultExportPDFName) || ""), exportPDFTitle = _168[0], setExportPDFTitle = _168[1];
505
- var _169 = (0, react_1.useState)(false), exportPDFLoading = _169[0], setExportPDFLoading = _169[1];
506
- var _170 = (0, react_1.useState)(false), exportReadPDFLoading = _170[0], setExportReadPDFLoading = _170[1];
507
- var _171 = (0, react_1.useState)((_w = (_v = (_u = props.organise) === null || _u === void 0 ? void 0 : _u.exportSettings) === null || _v === void 0 ? void 0 : _v.sumColumnId) !== null && _w !== void 0 ? _w : []), exportSumAttributeIds = _171[0], setExportSumAttributeIds = _171[1];
508
- var _172 = (0, react_1.useState)((_z = (_y = (_x = props.organise) === null || _x === void 0 ? void 0 : _x.exportSettings) === null || _y === void 0 ? void 0 : _y.hideSubItems) !== null && _z !== void 0 ? _z : false), hideSubItems = _172[0], setHideSubItems = _172[1];
509
- var _173 = (0, react_1.useState)([]), importTableData = _173[0], setImportTableData = _173[1];
510
- var _174 = (0, react_1.useState)([]), queryList = _174[0], setQueryList = _174[1];
511
- var _175 = (0, react_1.useState)(undefined), allQueryList = _175[0], setAllQueryList = _175[1];
513
+ var _165 = (0, react_1.useState)(null), csvFile = _165[0], setCSVFile = _165[1];
514
+ var _166 = (0, react_1.useState)([]), csvFileData = _166[0], setCSVFileData = _166[1];
515
+ var _167 = (0, react_1.useState)(0), stepCSVIndex = _167[0], setStepCSVIndex = _167[1];
516
+ var _168 = (0, react_1.useState)({}), listCSVMapAttribute = _168[0], setListCSVMapAttribute = _168[1];
517
+ var _169 = (0, react_1.useState)({}), listCSVObjAttribute = _169[0], setListCSVObjAttribute = _169[1];
518
+ var _170 = (0, react_1.useState)([]), csvAPIAttribute = _170[0], setCSVAPIAttribute = _170[1];
519
+ var _171 = (0, react_1.useState)(((_t = props.devSettings.currentUser) === null || _t === void 0 ? void 0 : _t.userEmail) || ""), exportCSVEmail = _171[0], setExportCSVEmail = _171[1];
520
+ var _172 = (0, react_1.useState)(((_v = (_u = props.organise) === null || _u === void 0 ? void 0 : _u.exportSettings) === null || _v === void 0 ? void 0 : _v.defaultExportPDFName) || ""), exportPDFTitle = _172[0], setExportPDFTitle = _172[1];
521
+ var _173 = (0, react_1.useState)(false), exportPDFLoading = _173[0], setExportPDFLoading = _173[1];
522
+ var _174 = (0, react_1.useState)(false), exportReadPDFLoading = _174[0], setExportReadPDFLoading = _174[1];
523
+ var _175 = (0, react_1.useState)((_y = (_x = (_w = props.organise) === null || _w === void 0 ? void 0 : _w.exportSettings) === null || _x === void 0 ? void 0 : _x.sumColumnId) !== null && _y !== void 0 ? _y : []), exportSumAttributeIds = _175[0], setExportSumAttributeIds = _175[1];
524
+ var _176 = (0, react_1.useState)((_1 = (_0 = (_z = props.organise) === null || _z === void 0 ? void 0 : _z.exportSettings) === null || _0 === void 0 ? void 0 : _0.hideSubItems) !== null && _1 !== void 0 ? _1 : false), hideSubItems = _176[0], setHideSubItems = _176[1];
525
+ var _177 = (0, react_1.useState)([]), importTableData = _177[0], setImportTableData = _177[1];
526
+ var _178 = (0, react_1.useState)([]), queryList = _178[0], setQueryList = _178[1];
527
+ var _179 = (0, react_1.useState)(undefined), allQueryList = _179[0], setAllQueryList = _179[1];
512
528
  // INFO: a restored state wins over the prop; its "" is a list the user
513
529
  // ungrouped, so it opens ungrouped
514
- var _176 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupBy) !== undefined
530
+ var _180 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupBy) !== undefined
515
531
  ? persistedState.groupBy || undefined
516
- : (_0 = props.organise) === null || _0 === void 0 ? void 0 : _0.groupBy), groupId = _176[0], setGroupId = _176[1];
532
+ : (_2 = props.organise) === null || _2 === void 0 ? void 0 : _2.groupBy), groupId = _180[0], setGroupId = _180[1];
517
533
  // INFO: Monday-board per-group paging. Keyed by the group key that
518
- // handleBuildNewTableGroups() produces (a list option or "Unknown/No Value").
534
+ // handleBuildNewTableGroups() produces (an option, Unknown or No Value).
519
535
  // Each group tracks its own loaded cursor + total so it can lazily load its
520
536
  // next page as the user scrolls inside that band, independent of every other
521
537
  // group. Only used when renderCheckGroupPaging() is true.
522
- var _177 = (0, react_1.useState)({}), groupPageState = _177[0], setGroupPageState = _177[1];
538
+ var _181 = (0, react_1.useState)({}), groupPageState = _181[0], setGroupPageState = _181[1];
523
539
  // INFO: read fresh inside the async per-group fetch so chained scroll fires
524
540
  // in one tick do not re-fetch an already in-flight page.
525
541
  var groupPageStateRef = (0, react_1.useRef)({});
@@ -528,59 +544,59 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
528
544
  // list was re-read (new search, filter, sort or grouping) is dropped on
529
545
  // arrival instead of appending rows that belong to the old list
530
546
  var groupPagingGenRef = (0, react_1.useRef)(0);
531
- var _178 = (0, react_1.useState)(""), readTabSection = _178[0], setReadTabSection = _178[1];
532
- var _179 = (0, react_1.useState)(false), readFloatingNav = _179[0], setReadFloatingNav = _179[1];
547
+ var _182 = (0, react_1.useState)(""), readTabSection = _182[0], setReadTabSection = _182[1];
548
+ var _183 = (0, react_1.useState)(false), readFloatingNav = _183[0], setReadFloatingNav = _183[1];
533
549
  var readTabSectionRefs = (0, react_1.useRef)({});
534
550
  //INFO : Used by Read
535
551
  //INFO : Used by Update
536
- var _180 = (0, react_1.useState)(false), modalVisible = _180[0], setModalVisible = _180[1];
537
- var _181 = (0, react_1.useState)(false), deleteModal = _181[0], setDeleteModal = _181[1];
538
- var _182 = (0, react_1.useState)(false), excelModal = _182[0], setExcelModal = _182[1];
539
- var _183 = (0, react_1.useState)(false), exportExcel = _183[0], setExportExcel = _183[1];
540
- var _184 = (0, react_1.useState)(""), exportType = _184[0], setExportType = _184[1];
541
- var _185 = (0, react_1.useState)(false), exportQR = _185[0], setExportQR = _185[1];
542
- var _186 = (0, react_1.useState)(function () {
552
+ var _184 = (0, react_1.useState)(false), modalVisible = _184[0], setModalVisible = _184[1];
553
+ var _185 = (0, react_1.useState)(false), deleteModal = _185[0], setDeleteModal = _185[1];
554
+ var _186 = (0, react_1.useState)(false), excelModal = _186[0], setExcelModal = _186[1];
555
+ var _187 = (0, react_1.useState)(false), exportExcel = _187[0], setExportExcel = _187[1];
556
+ var _188 = (0, react_1.useState)(""), exportType = _188[0], setExportType = _188[1];
557
+ var _189 = (0, react_1.useState)(false), exportQR = _189[0], setExportQR = _189[1];
558
+ var _190 = (0, react_1.useState)(function () {
543
559
  var _a, _b;
544
560
  var firstTabId = (_b = (_a = structure.find(function (item) { return item.tabId; })) === null || _a === void 0 ? void 0 : _a.tabId) !== null && _b !== void 0 ? _b : "";
545
561
  return firstTabId;
546
- }), activeTab = _186[0], setActiveTab = _186[1];
547
- var _187 = (0, react_1.useState)(false), signatureSigning = _187[0], setSignatureSigning = _187[1];
548
- var _188 = (0, react_1.useState)({}), selectedData = _188[0], setSelectedData = _188[1];
549
- var _189 = (0, react_1.useState)(""), selectedObjectStructureId = _189[0], setSelectedObjectStructureId = _189[1];
550
- var _190 = (0, react_1.useState)(""), selectedObjectId = _190[0], setSelectedObjectId = _190[1];
551
- var _191 = (0, react_1.useState)(""), selectedListAddressId = _191[0], setSelectedListAddressId = _191[1];
552
- var _192 = (0, react_1.useState)(-1), selectedListAddressIndex = _192[0], setSelectedListAddressIndex = _192[1];
553
- var _193 = (0, react_1.useState)({
562
+ }), activeTab = _190[0], setActiveTab = _190[1];
563
+ var _191 = (0, react_1.useState)(false), signatureSigning = _191[0], setSignatureSigning = _191[1];
564
+ var _192 = (0, react_1.useState)({}), selectedData = _192[0], setSelectedData = _192[1];
565
+ var _193 = (0, react_1.useState)(""), selectedObjectStructureId = _193[0], setSelectedObjectStructureId = _193[1];
566
+ var _194 = (0, react_1.useState)(""), selectedObjectId = _194[0], setSelectedObjectId = _194[1];
567
+ var _195 = (0, react_1.useState)(""), selectedListAddressId = _195[0], setSelectedListAddressId = _195[1];
568
+ var _196 = (0, react_1.useState)(-1), selectedListAddressIndex = _196[0], setSelectedListAddressIndex = _196[1];
569
+ var _197 = (0, react_1.useState)({
554
570
  lat: 0,
555
571
  lng: 0,
556
572
  name: "",
557
- }), selectedListAddress = _193[0], setSelectedListAddress = _193[1];
558
- var _194 = (0, react_1.useState)({}), selectedObjectData = _194[0], setSelectedObjectData = _194[1];
559
- var _195 = (0, react_1.useState)(null), objectCellEdit = _195[0], setObjectCellEdit = _195[1];
560
- var _196 = (0, react_1.useState)(false), referenceLoading = _196[0], setReferenceLoading = _196[1];
561
- var _197 = (0, react_1.useState)({}), referencesOptions = _197[0], setReferencesOptions = _197[1];
562
- var _198 = (0, react_1.useState)({}), referencesDetails = _198[0], setReferencesDetails = _198[1];
563
- var _199 = (0, react_1.useState)({}), listReferencesOptions = _199[0], setListReferencesOptions = _199[1];
564
- var _200 = (0, react_1.useState)({}), referenceDeleteTableData = _200[0], setReferenceDeleteTableData = _200[1];
565
- var _201 = (0, react_1.useState)([]), relatedSections = _201[0], setRelatedSections = _201[1];
566
- var _202 = (0, react_1.useState)(0), referenceDeleteIndex = _202[0], setReferenceDeleteIndex = _202[1];
567
- var _203 = (0, react_1.useState)({
573
+ }), selectedListAddress = _197[0], setSelectedListAddress = _197[1];
574
+ var _198 = (0, react_1.useState)({}), selectedObjectData = _198[0], setSelectedObjectData = _198[1];
575
+ var _199 = (0, react_1.useState)(null), objectCellEdit = _199[0], setObjectCellEdit = _199[1];
576
+ var _200 = (0, react_1.useState)(false), referenceLoading = _200[0], setReferenceLoading = _200[1];
577
+ var _201 = (0, react_1.useState)({}), referencesOptions = _201[0], setReferencesOptions = _201[1];
578
+ var _202 = (0, react_1.useState)({}), referencesDetails = _202[0], setReferencesDetails = _202[1];
579
+ var _203 = (0, react_1.useState)({}), listReferencesOptions = _203[0], setListReferencesOptions = _203[1];
580
+ var _204 = (0, react_1.useState)({}), referenceDeleteTableData = _204[0], setReferenceDeleteTableData = _204[1];
581
+ var _205 = (0, react_1.useState)([]), relatedSections = _205[0], setRelatedSections = _205[1];
582
+ var _206 = (0, react_1.useState)(0), referenceDeleteIndex = _206[0], setReferenceDeleteIndex = _206[1];
583
+ var _207 = (0, react_1.useState)({
568
584
  id: "",
569
585
  name: "",
570
586
  type: "string",
571
- }), referenceCreationModal = _203[0], setReferenceCreationModal = _203[1];
572
- var _204 = (0, react_1.useState)({}), referenceModelSchema = _204[0], setReferenceSchema = _204[1];
573
- var _205 = (0, react_1.useState)([]), kanbanChecked = _205[0], setKanbanChecked = _205[1];
587
+ }), referenceCreationModal = _207[0], setReferenceCreationModal = _207[1];
588
+ var _208 = (0, react_1.useState)({}), referenceModelSchema = _208[0], setReferenceSchema = _208[1];
589
+ var _209 = (0, react_1.useState)([]), kanbanChecked = _209[0], setKanbanChecked = _209[1];
574
590
  //INFO : Offline
575
- var _206 = (0, react_1.useState)(0), offlineDataLength = _206[0], setOfflineDataLength = _206[1];
576
- var _207 = (0, react_1.useState)(false), offlineModal = _207[0], setOfflineModal = _207[1];
591
+ var _210 = (0, react_1.useState)(0), offlineDataLength = _210[0], setOfflineDataLength = _210[1];
592
+ var _211 = (0, react_1.useState)(false), offlineModal = _211[0], setOfflineModal = _211[1];
577
593
  // INFO: live-stream state — driven by socket connection and navigator.onLine
578
- var _208 = (0, react_1.useState)(false), isLive = _208[0], setIsLive = _208[1];
579
- var _209 = (0, react_1.useState)(false), isLiveOffline = _209[0], setIsLiveOffline = _209[1];
594
+ var _212 = (0, react_1.useState)(false), isLive = _212[0], setIsLive = _212[1];
595
+ var _213 = (0, react_1.useState)(false), isLiveOffline = _213[0], setIsLiveOffline = _213[1];
580
596
  // INFO: true when navigator is offline — used to switch ReadQueryHoc between
581
597
  // server reads (online, full pagination) and IndexedDB reads (offline, cached data).
582
598
  // Independent of SSE status so it works even when bareSocketName is not set.
583
- var _210 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _210[0], setIsNetworkOffline = _210[1];
599
+ var _214 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _214[0], setIsNetworkOffline = _214[1];
584
600
  var previousType = (0, react_1.useRef)(null);
585
601
  var previousSelectedData = (0, react_1.useRef)(null);
586
602
  var scrollSentinelRef = (0, react_1.useRef)(null);
@@ -697,16 +713,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
697
713
  * viewId still wins when present: it is a deliberate destination, from a
698
714
  * shared link or a back button.
699
715
  */
700
- var defaultTabName = (_3 = (_2 = (_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.extendedTabs) === null || _2 === void 0 ? void 0 : _2.find(function (eachTab) { return eachTab.defaultTab; })) === null || _3 === void 0 ? void 0 : _3.name;
716
+ var defaultTabName = (_5 = (_4 = (_3 = props.organise) === null || _3 === void 0 ? void 0 : _3.extendedTabs) === null || _4 === void 0 ? void 0 : _4.find(function (eachTab) { return eachTab.defaultTab; })) === null || _5 === void 0 ? void 0 : _5.name;
701
717
  // INFO: the pinned tab is a LIST destination. Falling back to it while a
702
718
  // record is open resolved the read view to a list tab, which renderTabContent
703
719
  // refuses — so General Details rendered nothing. Only a list falls back.
704
- var viewType = (_5 = (_4 = props.organise) === null || _4 === void 0 ? void 0 : _4.viewId) !== null && _5 !== void 0 ? _5 : (resolvedType === "list" && defaultTabName
720
+ var viewType = (_7 = (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.viewId) !== null && _7 !== void 0 ? _7 : (resolvedType === "list" && defaultTabName
705
721
  ? (0, utils_1.lowercaseTextToId)(defaultTabName)
706
722
  : "general");
707
723
  var isFirebaseClient = devSettings.server === "firebase";
708
724
  var isFirebase = isFirebaseClient || devSettings.server === "fbServer";
709
- var dbModule = isFirebaseClient ? (_6 = props.lib) === null || _6 === void 0 ? void 0 : _6.firebase : (_7 = props.lib) === null || _7 === void 0 ? void 0 : _7.axios;
725
+ var dbModule = isFirebaseClient ? (_8 = props.lib) === null || _8 === void 0 ? void 0 : _8.firebase : (_9 = props.lib) === null || _9 === void 0 ? void 0 : _9.axios;
710
726
  var schemaPresent = props.devSettings.schemaEndpoint ? true : false;
711
727
  var selectedRelated = resolvedType === "read"
712
728
  ? relatedSections.find(function (eachSection) { return eachSection.id === viewType; })
@@ -784,32 +800,32 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
784
800
  }, [
785
801
  resolvedType,
786
802
  props.id,
787
- (_8 = props.space) === null || _8 === void 0 ? void 0 : _8._id,
803
+ (_10 = props.space) === null || _10 === void 0 ? void 0 : _10._id,
788
804
  props.devSettings.schemaEndpoint,
789
- (_9 = props.organise) === null || _9 === void 0 ? void 0 : _9.showRelatedTab,
805
+ (_11 = props.organise) === null || _11 === void 0 ? void 0 : _11.showRelatedTab,
790
806
  ]);
791
807
  /* eslint-enable */
792
808
  // INFO: the view settings panel (columns, sort, rows per page) is standard on
793
809
  // the new DTW; bareViewSettings stays the opt-in for legacy and bare DTWs
794
- var isViewSettingsEnabled = ((_10 = props.bareSettings) === null || _10 === void 0 ? void 0 : _10.bareViewSettings) || ((_11 = props.bareSettings) === null || _11 === void 0 ? void 0 : _11.bareNewDTW)
810
+ var isViewSettingsEnabled = ((_12 = props.bareSettings) === null || _12 === void 0 ? void 0 : _12.bareViewSettings) || ((_13 = props.bareSettings) === null || _13 === void 0 ? void 0 : _13.bareNewDTW)
795
811
  ? true
796
812
  : false;
797
813
  // INFO: a consumer that wires onChangeHide owns the hide at schema level
798
814
  // (shared by every user) — toggling writes to the model and calls back. Without it
799
815
  // the hide is this user's own and lives in userHiddenColumnIds.
800
- var isSchemaHideMode = ((_12 = props.organise) === null || _12 === void 0 ? void 0 : _12.onChangeHide) ? true : false;
816
+ var isSchemaHideMode = ((_14 = props.organise) === null || _14 === void 0 ? void 0 : _14.onChangeHide) ? true : false;
801
817
  // INFO: rows per page is a view setting the user can change, so it starts from
802
818
  // the persisted value and falls back to the consumer's limit
803
- var _211 = (0, react_1.useState)((_14 = (_13 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _13 !== void 0 ? _13 : props.limit) !== null && _14 !== void 0 ? _14 : 10), pageLimit = _211[0], setPageLimit = _211[1];
819
+ var _215 = (0, react_1.useState)((_16 = (_15 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _15 !== void 0 ? _15 : props.limit) !== null && _16 !== void 0 ? _16 : 10), pageLimit = _215[0], setPageLimit = _215[1];
804
820
  var limit = pageLimit;
805
- var isSavedViewsEnabled = !!((_15 = props.organise) === null || _15 === void 0 ? void 0 : _15.savedViews) && resolvedType === "list";
821
+ var isSavedViewsEnabled = !!((_17 = props.organise) === null || _17 === void 0 ? void 0 : _17.savedViews) && resolvedType === "list";
806
822
  // INFO: an app that stores views takes over from this browser's storage, so
807
823
  // every view is the team's and nothing is kept locally
808
- var isAppViews = ((_16 = props.organise) === null || _16 === void 0 ? void 0 : _16.sharedViews) !== undefined ||
809
- !!((_17 = props.organise) === null || _17 === void 0 ? void 0 : _17.onChangeSharedViews);
824
+ var isAppViews = ((_18 = props.organise) === null || _18 === void 0 ? void 0 : _18.sharedViews) !== undefined ||
825
+ !!((_19 = props.organise) === null || _19 === void 0 ? void 0 : _19.onChangeSharedViews);
810
826
  // INFO: a saved view carries its sort, so the sort is held here as with persistViewState
811
827
  var isInternalSort = isPersistEnabled || isSavedViewsEnabled;
812
- var activeSortId = (isInternalSort && persistedSort) || ((_18 = props.organise) === null || _18 === void 0 ? void 0 : _18.sort);
828
+ var activeSortId = (isInternalSort && persistedSort) || ((_20 = props.organise) === null || _20 === void 0 ? void 0 : _20.sort);
813
829
  var handleSortColumn = function (value) {
814
830
  var _a, _b, _c, _d;
815
831
  if (isInternalSort)
@@ -839,7 +855,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
839
855
  // INFO: Firebase pages by document cursor and a union by skip, so neither
840
856
  // can hand over the whole set — there formula columns are not offered for
841
857
  // sorting or filtering, rather than ordering one page
842
- var isFormulaViewSupported = !isFirebase && !((_20 = (_19 = props.organise) === null || _19 === void 0 ? void 0 : _19.unionCollections) === null || _20 === void 0 ? void 0 : _20.length);
858
+ var isFormulaViewSupported = !isFirebase && !((_22 = (_21 = props.organise) === null || _21 === void 0 ? void 0 : _21.unionCollections) === null || _22 === void 0 ? void 0 : _22.length);
843
859
  var formulaSort = isFormulaViewSupported &&
844
860
  (activeSortId === null || activeSortId === void 0 ? void 0 : activeSortId.sortId) &&
845
861
  formulaColumnIds.includes(activeSortId.sortId)
@@ -848,10 +864,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
848
864
  // INFO: a referenced record is joined by MongoWrapper's lookup and a list
849
865
  // row is matched by its Mongo path — neither Firebase nor a union read runs
850
866
  // them
851
- var flexFilterExtras = !isFirebase && !((_22 = (_21 = props.organise) === null || _21 === void 0 ? void 0 : _21.unionCollections) === null || _22 === void 0 ? void 0 : _22.length)
867
+ var flexFilterExtras = !isFirebase && !((_24 = (_23 = props.organise) === null || _23 === void 0 ? void 0 : _23.unionCollections) === null || _24 === void 0 ? void 0 : _24.length)
852
868
  ? {
853
- references: (_23 = props.bareSettings) === null || _23 === void 0 ? void 0 : _23.bareFlexFilterReferences,
854
- listObjects: (_24 = props.bareSettings) === null || _24 === void 0 ? void 0 : _24.bareFlexFilterListObjects,
869
+ references: (_25 = props.bareSettings) === null || _25 === void 0 ? void 0 : _25.bareFlexFilterReferences,
870
+ listObjects: (_26 = props.bareSettings) === null || _26 === void 0 ? void 0 : _26.bareFlexFilterListObjects,
855
871
  }
856
872
  : undefined;
857
873
  var formulaFlexQueries = isFormulaViewSupported && formulaColumnIds.length > 0
@@ -904,18 +920,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
904
920
  displayRows: filtered.map(function (eachEntry) { return eachEntry.displayRow; }),
905
921
  };
906
922
  };
907
- var _212 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _212.canUpdateRecord, canInlineUpdate = _212.canInlineUpdate, canBatchUpdate = _212.canBatchUpdate, canDeleteRecord = _212.canDeleteRecord;
908
- var isEditor = ((_25 = props.edit) === null || _25 === void 0 ? void 0 : _25.allEditable) ? true : false;
909
- var isOffline = (_26 = props.bareSettings) === null || _26 === void 0 ? void 0 : _26.bareOffline;
923
+ var _216 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _216.canUpdateRecord, canInlineUpdate = _216.canInlineUpdate, canBatchUpdate = _216.canBatchUpdate, canDeleteRecord = _216.canDeleteRecord;
924
+ var isEditor = ((_27 = props.edit) === null || _27 === void 0 ? void 0 : _27.allEditable) ? true : false;
925
+ var isOffline = (_28 = props.bareSettings) === null || _28 === void 0 ? void 0 : _28.bareOffline;
910
926
  // INFO: when bareOfflineNetworkAware is true, the save path is also gated on
911
927
  // the live network state — online saves go to the server even if bareOffline
912
928
  // is true, offline saves go to IDB as normal.
913
- var isOfflineNetworkListener = isOffline && ((_27 = props.bareSettings) === null || _27 === void 0 ? void 0 : _27.bareOfflineNetworkListener);
914
- var showId = (_28 = props.space) === null || _28 === void 0 ? void 0 : _28.showId;
929
+ var isOfflineNetworkListener = isOffline && ((_29 = props.bareSettings) === null || _29 === void 0 ? void 0 : _29.bareOfflineNetworkListener);
930
+ var showId = (_30 = props.space) === null || _30 === void 0 ? void 0 : _30.showId;
915
931
  var remainId = showId || selectedObjectStructureId ? true : false;
916
- var idField = ((_29 = props.space) === null || _29 === void 0 ? void 0 : _29.idField) || ((_30 = props.organise) === null || _30 === void 0 ? void 0 : _30.idField);
917
- var pipeline = (_31 = props === null || props === void 0 ? void 0 : props.space) === null || _31 === void 0 ? void 0 : _31.pipeline;
918
- if ((_32 = props.bareSettings) === null || _32 === void 0 ? void 0 : _32.bareListPipeline) {
932
+ var idField = ((_31 = props.space) === null || _31 === void 0 ? void 0 : _31.idField) || ((_32 = props.organise) === null || _32 === void 0 ? void 0 : _32.idField);
933
+ var pipeline = (_33 = props === null || props === void 0 ? void 0 : props.space) === null || _33 === void 0 ? void 0 : _33.pipeline;
934
+ if ((_34 = props.bareSettings) === null || _34 === void 0 ? void 0 : _34.bareListPipeline) {
919
935
  pipeline = pipeline
920
936
  ? __spreadArray(__spreadArray([], pipeline, true), props.bareSettings.bareListPipeline, true) : props.bareSettings.bareListPipeline;
921
937
  }
@@ -928,24 +944,24 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
928
944
  * three records came back instead of five files, and each tile received the
929
945
  * whole array rather than one file, so every one of them read "Attachment".
930
946
  */
931
- var fileViewColumnId = (_36 = (_35 = ((_34 = (_33 = props.organise) === null || _33 === void 0 ? void 0 : _33.extendedTabs) !== null && _34 !== void 0 ? _34 : []).find(function (eachTab) {
947
+ var fileViewColumnId = (_38 = (_37 = ((_36 = (_35 = props.organise) === null || _35 === void 0 ? void 0 : _35.extendedTabs) !== null && _36 !== void 0 ? _36 : []).find(function (eachTab) {
932
948
  return eachTab.viewType === "file" &&
933
949
  (0, utils_1.lowercaseTextToId)(eachTab.name) === viewType;
934
- })) === null || _35 === void 0 ? void 0 : _35.fileSettings) === null || _36 === void 0 ? void 0 : _36.columnId;
935
- var hasNavigation = ((_37 = props.organise) === null || _37 === void 0 ? void 0 : _37.handleNavigate) ? true : false;
950
+ })) === null || _37 === void 0 ? void 0 : _37.fileSettings) === null || _38 === void 0 ? void 0 : _38.columnId;
951
+ var hasNavigation = ((_39 = props.organise) === null || _39 === void 0 ? void 0 : _39.handleNavigate) ? true : false;
936
952
  var formColumn = "grid-cols-12";
937
- var useMobileView = (_39 = (_38 = props.bareSettings) === null || _38 === void 0 ? void 0 : _38.bareUpdateMobileView) !== null && _39 !== void 0 ? _39 : false;
953
+ var useMobileView = (_41 = (_40 = props.bareSettings) === null || _40 === void 0 ? void 0 : _40.bareUpdateMobileView) !== null && _41 !== void 0 ? _41 : false;
938
954
  var gridGap = useMobileView ? "gap-x-6 gap-y-2 md:gap-y-6" : "gap-6";
939
- var isActivityLog = (((_41 = (_40 = props.edit) === null || _40 === void 0 ? void 0 : _40.activityLog) === null || _41 === void 0 ? void 0 : _41.enableComments) &&
940
- ((_42 = props.edit) === null || _42 === void 0 ? void 0 : _42.activityLog.commentCollectionId)) ||
941
- (((_44 = (_43 = props.edit) === null || _43 === void 0 ? void 0 : _43.activityLog) === null || _44 === void 0 ? void 0 : _44.enableLogs) &&
942
- ((_45 = props.edit) === null || _45 === void 0 ? void 0 : _45.activityLog.logsCollectionId));
943
- var customPaginationSize = ((_46 = props.organise) === null || _46 === void 0 ? void 0 : _46.customPaginationCount)
955
+ var isActivityLog = (((_43 = (_42 = props.edit) === null || _42 === void 0 ? void 0 : _42.activityLog) === null || _43 === void 0 ? void 0 : _43.enableComments) &&
956
+ ((_44 = props.edit) === null || _44 === void 0 ? void 0 : _44.activityLog.commentCollectionId)) ||
957
+ (((_46 = (_45 = props.edit) === null || _45 === void 0 ? void 0 : _45.activityLog) === null || _46 === void 0 ? void 0 : _46.enableLogs) &&
958
+ ((_47 = props.edit) === null || _47 === void 0 ? void 0 : _47.activityLog.logsCollectionId));
959
+ var customPaginationSize = ((_48 = props.organise) === null || _48 === void 0 ? void 0 : _48.customPaginationCount)
944
960
  ? props.organise.customPaginationCount(size)
945
961
  : undefined;
946
962
  //TODO : Code - Pass ...devSettings, search dbEndpoint:
947
963
  var writeServerQuery = new writeQuery_1.WriteQuery({
948
- dbModule: (_47 = props.lib) === null || _47 === void 0 ? void 0 : _47.axios,
964
+ dbModule: (_49 = props.lib) === null || _49 === void 0 ? void 0 : _49.axios,
949
965
  dbType: devSettings.server,
950
966
  dbCollection: props.collectionId,
951
967
  dbEndpoint: devSettings.dbEndpoint,
@@ -953,7 +969,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
953
969
  dbUserToken: devSettings.dbUserToken,
954
970
  });
955
971
  var readServerQuery = new readQuery_1.ReadQuery({
956
- dbModule: (_48 = props.lib) === null || _48 === void 0 ? void 0 : _48.axios,
972
+ dbModule: (_50 = props.lib) === null || _50 === void 0 ? void 0 : _50.axios,
957
973
  dbType: devSettings.server,
958
974
  dbCollection: props.collectionId,
959
975
  dbEndpoint: devSettings.dbEndpoint,
@@ -961,12 +977,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
961
977
  dbUserToken: devSettings.dbUserToken,
962
978
  });
963
979
  var moreButtonPopUp = [
964
- ((_49 = props.edit) === null || _49 === void 0 ? void 0 : _49.allEditable) &&
980
+ ((_51 = props.edit) === null || _51 === void 0 ? void 0 : _51.allEditable) &&
965
981
  // INFO: the import runs on the server (importEndpoint), so a Firestore
966
982
  // datasheet served through one can import; only the browser-direct
967
983
  // Firebase client has no server to import through
968
984
  !isFirebaseClient &&
969
- !((_51 = (_50 = props.organise) === null || _50 === void 0 ? void 0 : _50.exportSettings) === null || _51 === void 0 ? void 0 : _51.hideImportCSV)
985
+ !((_53 = (_52 = props.organise) === null || _52 === void 0 ? void 0 : _52.exportSettings) === null || _53 === void 0 ? void 0 : _53.hideImportCSV)
970
986
  ? {
971
987
  text: "Import Excel",
972
988
  onClick: function () {
@@ -975,7 +991,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
975
991
  },
976
992
  }
977
993
  : null,
978
- !((_53 = (_52 = props.organise) === null || _52 === void 0 ? void 0 : _52.exportSettings) === null || _53 === void 0 ? void 0 : _53.hideExportCSV)
994
+ !((_55 = (_54 = props.organise) === null || _54 === void 0 ? void 0 : _54.exportSettings) === null || _55 === void 0 ? void 0 : _55.hideExportCSV)
979
995
  ? {
980
996
  text: "Export CSV",
981
997
  onClick: function () {
@@ -985,7 +1001,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
985
1001
  },
986
1002
  }
987
1003
  : null,
988
- !((_55 = (_54 = props.organise) === null || _54 === void 0 ? void 0 : _54.exportSettings) === null || _55 === void 0 ? void 0 : _55.hideExportExcel)
1004
+ !((_57 = (_56 = props.organise) === null || _56 === void 0 ? void 0 : _56.exportSettings) === null || _57 === void 0 ? void 0 : _57.hideExportExcel)
989
1005
  ? {
990
1006
  text: "Export Excel",
991
1007
  onClick: function () {
@@ -995,7 +1011,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
995
1011
  },
996
1012
  }
997
1013
  : null,
998
- !((_57 = (_56 = props.organise) === null || _56 === void 0 ? void 0 : _56.exportSettings) === null || _57 === void 0 ? void 0 : _57.hideExportPDF)
1014
+ !((_59 = (_58 = props.organise) === null || _58 === void 0 ? void 0 : _58.exportSettings) === null || _59 === void 0 ? void 0 : _59.hideExportPDF)
999
1015
  ? {
1000
1016
  text: "Export PDF",
1001
1017
  onClick: function () {
@@ -1005,7 +1021,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1005
1021
  },
1006
1022
  }
1007
1023
  : null,
1008
- !((_59 = (_58 = props.organise) === null || _58 === void 0 ? void 0 : _58.exportSettings) === null || _59 === void 0 ? void 0 : _59.hideExportQR)
1024
+ !((_61 = (_60 = props.organise) === null || _60 === void 0 ? void 0 : _60.exportSettings) === null || _61 === void 0 ? void 0 : _61.hideExportQR)
1009
1025
  ? {
1010
1026
  text: "Export QR",
1011
1027
  onClick: function () {
@@ -1015,7 +1031,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1015
1031
  },
1016
1032
  }
1017
1033
  : null,
1018
- !((_61 = (_60 = props.organise) === null || _60 === void 0 ? void 0 : _60.exportSettings) === null || _61 === void 0 ? void 0 : _61.hideExportQR)
1034
+ !((_63 = (_62 = props.organise) === null || _62 === void 0 ? void 0 : _62.exportSettings) === null || _63 === void 0 ? void 0 : _63.hideExportQR)
1019
1035
  ? {
1020
1036
  text: "Export QR(Data)",
1021
1037
  onClick: function () {
@@ -1025,7 +1041,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1025
1041
  },
1026
1042
  }
1027
1043
  : null,
1028
- !((_63 = (_62 = props.organise) === null || _62 === void 0 ? void 0 : _62.exportSettings) === null || _63 === void 0 ? void 0 : _63.hideExportPrint)
1044
+ !((_65 = (_64 = props.organise) === null || _64 === void 0 ? void 0 : _64.exportSettings) === null || _65 === void 0 ? void 0 : _65.hideExportPrint)
1029
1045
  ? {
1030
1046
  text: "Print",
1031
1047
  onClick: function () {
@@ -1035,7 +1051,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1035
1051
  },
1036
1052
  }
1037
1053
  : null,
1038
- !((_65 = (_64 = props.organise) === null || _64 === void 0 ? void 0 : _64.exportSettings) === null || _65 === void 0 ? void 0 : _65.hideExportDraft)
1054
+ !((_67 = (_66 = props.organise) === null || _66 === void 0 ? void 0 : _66.exportSettings) === null || _67 === void 0 ? void 0 : _67.hideExportDraft)
1039
1055
  ? {
1040
1056
  text: filterDraft ? "Show All Items" : "Filter Draft",
1041
1057
  onClick: function () {
@@ -1044,7 +1060,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1044
1060
  }
1045
1061
  : null,
1046
1062
  ].filter(Boolean);
1047
- if ((_66 = props.organise) === null || _66 === void 0 ? void 0 : _66.moreSettings)
1063
+ if ((_68 = props.organise) === null || _68 === void 0 ? void 0 : _68.moreSettings)
1048
1064
  moreButtonPopUp = moreButtonPopUp.concat(props.organise.moreSettings);
1049
1065
  //=====================================================================================
1050
1066
  //SECTION: User Column Visibility Handlers
@@ -1052,14 +1068,32 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1052
1068
  // INFO: a write-back carries the schema's columns plus the user's one change,
1053
1069
  // never the hide/order a personal saved view put on screen
1054
1070
  var handleUpdateSchemaStructure = function (update) {
1055
- var _a;
1071
+ var _a, _b;
1056
1072
  var schemaColumns = update((_a = schemaStructureRef.current) !== null && _a !== void 0 ? _a : structure);
1057
1073
  if (schemaStructureRef.current)
1058
1074
  schemaStructureRef.current = schemaColumns;
1059
- return schemaColumns;
1075
+ // INFO: system columns were never the host's — they are not written back
1076
+ return (0, systemColumns_1.handleStripSystemColumns)(schemaColumns, ((_b = props.model) !== null && _b !== void 0 ? _b : []).map(function (each) { return each.id; }));
1077
+ };
1078
+ var handleSetShownSystemColumns = function (nextIds) {
1079
+ setShownSystemColumnIds(nextIds);
1080
+ setStructure(function (previous) {
1081
+ return previous.map(function (eachColumn) {
1082
+ return appendedSystemColumnIds.includes(eachColumn.id)
1083
+ ? __assign(__assign({}, eachColumn), { hide: !nextIds.includes(eachColumn.id) }) : eachColumn;
1084
+ });
1085
+ });
1060
1086
  };
1061
1087
  var handleToggleUserHiddenColumn = function (columnId) {
1062
1088
  var _a, _b;
1089
+ // INFO: a system column is shown or hidden for this view only, in either
1090
+ // hide mode — the host's schema never holds it
1091
+ if (appendedSystemColumnIds.includes(columnId)) {
1092
+ handleSetShownSystemColumns(shownSystemColumnIds.includes(columnId)
1093
+ ? shownSystemColumnIds.filter(function (eachId) { return eachId !== columnId; })
1094
+ : __spreadArray(__spreadArray([], shownSystemColumnIds, true), [columnId], false));
1095
+ return;
1096
+ }
1063
1097
  if ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeHide) {
1064
1098
  var nextHide_1 = !((_b = structure.find(function (eachColumn) { return eachColumn.id === columnId; })) === null || _b === void 0 ? void 0 : _b.hide);
1065
1099
  var handleSetHide = function (columns) {
@@ -1083,6 +1117,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1083
1117
  };
1084
1118
  var handleShowAllUserHiddenColumns = function () {
1085
1119
  var _a;
1120
+ if (appendedSystemColumnIds.length)
1121
+ handleSetShownSystemColumns(appendedSystemColumnIds);
1086
1122
  if ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeHide) {
1087
1123
  var handleShowAll = function (columns) {
1088
1124
  return columns.map(function (eachColumn) { return (__assign(__assign({}, eachColumn), { hide: false })); });
@@ -1407,13 +1443,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1407
1443
  // INFO: scroll mode reloads from page 0; the anchor restores the position
1408
1444
  pageIndex: renderCheckScrollMode() ? 0 : pageIndex, hiddenColumnIds: structure.filter(function (col) { return col.hide; }).map(function (col) { return col.id; }),
1409
1445
  // INFO: raw, so switching bareViewSettings off does not wipe the user's choice
1410
- userHiddenColumnIds: userHiddenColumnIds, columnOrder: structure.map(function (col) { return col.id; }), groupBy: groupId !== null && groupId !== void 0 ? groupId : "" }, scrollCaptureRef.current));
1446
+ userHiddenColumnIds: userHiddenColumnIds, shownSystemColumnIds: shownSystemColumnIds, columnOrder: structure.map(function (col) { return col.id; }), groupBy: groupId !== null && groupId !== void 0 ? groupId : "" }, scrollCaptureRef.current));
1411
1447
  };
1412
1448
  handleRegisterViewSnapshot(handleBuildViewSnapshot);
1413
1449
  //=====================================================================================
1414
1450
  //SECTION: Saved Views
1415
1451
  //=====================================================================================
1416
- var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_67 = props.organise) === null || _67 === void 0 ? void 0 : _67.persistKey, (_68 = devSettings.currentUser) === null || _68 === void 0 ? void 0 : _68.userEmail);
1452
+ var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_69 = props.organise) === null || _69 === void 0 ? void 0 : _69.persistKey, (_70 = devSettings.currentUser) === null || _70 === void 0 ? void 0 : _70.userEmail);
1417
1453
  (0, react_1.useEffect)(function () {
1418
1454
  if (isSavedViewsEnabled && !isAppViews)
1419
1455
  setSavedViews((0, viewStatePersistence_1.handleReadSavedViews)(savedViewsKey));
@@ -1468,7 +1504,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1468
1504
  var lastSentSharedViewsRef = (0, react_1.useRef)(null);
1469
1505
  (0, react_1.useEffect)(function () {
1470
1506
  lastSentSharedViewsRef.current = null;
1471
- }, [(_69 = props.organise) === null || _69 === void 0 ? void 0 : _69.sharedViews]);
1507
+ }, [(_71 = props.organise) === null || _71 === void 0 ? void 0 : _71.sharedViews]);
1472
1508
  var handleStoreSharedViews = function (update) {
1473
1509
  var _a, _b, _c;
1474
1510
  if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeSharedViews))
@@ -1504,13 +1540,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1504
1540
  /* eslint-disable */
1505
1541
  }, [
1506
1542
  isSavedViewsEnabled,
1507
- (_70 = props.organise) === null || _70 === void 0 ? void 0 : _70.initialSavedViewId,
1508
- (_71 = props.organise) === null || _71 === void 0 ? void 0 : _71.defaultSavedViewId,
1509
- (_72 = props.organise) === null || _72 === void 0 ? void 0 : _72.sharedViews,
1543
+ (_72 = props.organise) === null || _72 === void 0 ? void 0 : _72.initialSavedViewId,
1544
+ (_73 = props.organise) === null || _73 === void 0 ? void 0 : _73.defaultSavedViewId,
1545
+ (_74 = props.organise) === null || _74 === void 0 ? void 0 : _74.sharedViews,
1510
1546
  savedViews,
1511
1547
  ]);
1512
1548
  /* eslint-enable */
1513
- var defaultSavedViewIds = ((_74 = (_73 = props.organise) === null || _73 === void 0 ? void 0 : _73.defaultSavedViews) !== null && _74 !== void 0 ? _74 : [])
1549
+ var defaultSavedViewIds = ((_76 = (_75 = props.organise) === null || _75 === void 0 ? void 0 : _75.defaultSavedViews) !== null && _76 !== void 0 ? _76 : [])
1514
1550
  .map(function (eachView) { var _a; return (_a = eachView.id) !== null && _a !== void 0 ? _a : ""; })
1515
1551
  .join("|");
1516
1552
  // INFO: keyed on the ids, not the array, so an inline literal passed on every
@@ -1526,28 +1562,43 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1526
1562
  var handleResolveViewState = function (state) {
1527
1563
  var _a, _b, _c, _d, _e, _f;
1528
1564
  var model = (_a = props.model) !== null && _a !== void 0 ? _a : [];
1529
- return ((_f = (0, viewStatePersistence_1.handlePruneStaleColumns)(__assign({ filterSearchParams: initialFilterSearchParams, filterSelection: initialFilterSelection, filterReference: initialFilterReference, filterReferenceDate: (0, viewStatePersistence_1.serializeDateFilterState)(initialFilterReferenceDate), sort: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.sort, pageLimit: (_c = props.limit) !== null && _c !== void 0 ? _c : 10, userHiddenColumnIds: [], hiddenColumnIds: model
1565
+ return ((_f = (0, viewStatePersistence_1.handlePruneStaleColumns)(__assign({ filterSearchParams: initialFilterSearchParams, filterSelection: initialFilterSelection, filterReference: initialFilterReference, filterReferenceDate: (0, viewStatePersistence_1.serializeDateFilterState)(initialFilterReferenceDate), sort: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.sort, pageLimit: (_c = props.limit) !== null && _c !== void 0 ? _c : 10, userHiddenColumnIds: [], shownSystemColumnIds: [], hiddenColumnIds: model
1530
1566
  .filter(function (eachColumn) { return eachColumn.hide; })
1531
1567
  .map(function (eachColumn) { return eachColumn.id; }), columnOrder: model.map(function (eachColumn) { return eachColumn.id; }), groupBy: (_e = (_d = props.organise) === null || _d === void 0 ? void 0 : _d.groupBy) !== null && _e !== void 0 ? _e : "" }, (state !== null && state !== void 0 ? state : {})), model, (0, flexFilter_1.handleBuildFlexFilterStructure)(model, flexFilterExtras))) !== null && _f !== void 0 ? _f : {});
1532
1568
  };
1533
1569
  var handleApplyViewColumns = function (columns, state) {
1534
- var _a;
1570
+ var _a, _b;
1535
1571
  var order = new Map(((_a = state.columnOrder) !== null && _a !== void 0 ? _a : []).map(function (eachId, index) { return [eachId, index]; }));
1536
1572
  var ordered = __spreadArray([], columns, true).sort(function (a, b) { var _a, _b; return ((_a = order.get(a.id)) !== null && _a !== void 0 ? _a : order.size) - ((_b = order.get(b.id)) !== null && _b !== void 0 ? _b : order.size); });
1573
+ var shownSystemIds = (_b = state.shownSystemColumnIds) !== null && _b !== void 0 ? _b : [];
1574
+ var handleSystemHide = function (columns) {
1575
+ return appendedSystemColumnIds.length
1576
+ ? columns.map(function (eachColumn) {
1577
+ return appendedSystemColumnIds.includes(eachColumn.id)
1578
+ ? __assign(__assign({}, eachColumn), { hide: !shownSystemIds.includes(eachColumn.id) }) : eachColumn;
1579
+ })
1580
+ : columns;
1581
+ };
1537
1582
  // INFO: schema-level hides move only in schema-hide mode, and only on this
1538
1583
  // screen — a personal view never writes back through onChangeHide
1539
1584
  if (!isSchemaHideMode || !state.hiddenColumnIds)
1540
- return ordered;
1541
- return ordered.map(function (eachColumn) {
1585
+ return handleSystemHide(ordered);
1586
+ return handleSystemHide(ordered.map(function (eachColumn) {
1542
1587
  var _a, _b;
1543
1588
  return (__assign(__assign({}, eachColumn), { hide: (_b = (_a = state.hiddenColumnIds) === null || _a === void 0 ? void 0 : _a.includes(eachColumn.id)) !== null && _b !== void 0 ? _b : false }));
1544
- });
1589
+ }));
1545
1590
  };
1546
1591
  // INFO: the columns a list can be grouped by — the app's own list, else
1547
- // every column the reference picker offers
1592
+ // every column the reference picker offers, else the status, checkbox and
1593
+ // person columns, monday's groupable kinds
1548
1594
  var handleGetGroupByOptions = function () {
1549
1595
  var _a, _b, _c, _d, _e, _f;
1550
- return (_f = (_c = (_b = (_a = props === null || props === void 0 ? void 0 : props.organise) === null || _a === void 0 ? void 0 : _a.renderGroupByOptions) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : (_e = (_d = props === null || props === void 0 ? void 0 : props.organise) === null || _d === void 0 ? void 0 : _d.renderReferenceLabelOptions) === null || _e === void 0 ? void 0 : _e.call(_d, props.collectionId, true)) !== null && _f !== void 0 ? _f : [];
1596
+ return (_f = (_c = (_b = (_a = props === null || props === void 0 ? void 0 : props.organise) === null || _a === void 0 ? void 0 : _a.renderGroupByOptions) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : (_e = (_d = props === null || props === void 0 ? void 0 : props.organise) === null || _d === void 0 ? void 0 : _d.renderReferenceLabelOptions) === null || _e === void 0 ? void 0 : _e.call(_d, props.collectionId, true)) !== null && _f !== void 0 ? _f : structure
1597
+ .filter(function (eachColumn) {
1598
+ return !eachColumn.hide &&
1599
+ ["list", "boolean", "person"].includes(eachColumn.type);
1600
+ })
1601
+ .map(function (eachColumn) { return ({ key: eachColumn.id, label: eachColumn.name }); });
1551
1602
  };
1552
1603
  // INFO: notify — only a user's choice is handed back; a list opening on a
1553
1604
  // view or syncing the host's own groupBy tells the host nothing new
@@ -1563,7 +1614,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1563
1614
  // so its sort is not handed back (a host saving sort would write it on
1564
1615
  // every open)
1565
1616
  var handleApplySavedView = function (view, isOpening) {
1566
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1617
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
1567
1618
  var next = handleResolveViewState((_a = view === null || view === void 0 ? void 0 : view.state) !== null && _a !== void 0 ? _a : null);
1568
1619
  var isQueryChanged = !(0, viewStatePersistence_1.handleIsSameViewState)((0, viewStatePersistence_1.handlePickQueryState)(handleBuildViewSnapshot()), (0, viewStatePersistence_1.handlePickQueryState)(next));
1569
1620
  handleClearFlexFilterTypingTimeout();
@@ -1588,6 +1639,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1588
1639
  setPageLimit(next.pageLimit);
1589
1640
  handleChangeGroupBy((_j = next.groupBy) !== null && _j !== void 0 ? _j : "", !isOpening);
1590
1641
  setUserHiddenColumnIds((_k = next.userHiddenColumnIds) !== null && _k !== void 0 ? _k : []);
1642
+ setShownSystemColumnIds((_l = next.shownSystemColumnIds) !== null && _l !== void 0 ? _l : []);
1591
1643
  if (view) {
1592
1644
  if (!schemaStructureRef.current)
1593
1645
  schemaStructureRef.current = structure;
@@ -1602,12 +1654,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1602
1654
  pendingViewCondKeyRef.current = JSON.stringify(handleReadQueryHocCond());
1603
1655
  handleClearDataByFilter();
1604
1656
  if (pageIndex !== 0)
1605
- (_m = (_l = props.organise) === null || _l === void 0 ? void 0 : _l.onChangePagination) === null || _m === void 0 ? void 0 : _m.call(_l, 0);
1606
- (_p = (_o = props.bareSettings) === null || _o === void 0 ? void 0 : _o.bareListHandleFilter) === null || _p === void 0 ? void 0 : _p.call(_o, (_q = next.filterSearchParams) !== null && _q !== void 0 ? _q : {}, (_r = next.filterSelection) !== null && _r !== void 0 ? _r : {}, next.filterReferenceDate
1657
+ (_o = (_m = props.organise) === null || _m === void 0 ? void 0 : _m.onChangePagination) === null || _o === void 0 ? void 0 : _o.call(_m, 0);
1658
+ (_q = (_p = props.bareSettings) === null || _p === void 0 ? void 0 : _p.bareListHandleFilter) === null || _q === void 0 ? void 0 : _q.call(_p, (_r = next.filterSearchParams) !== null && _r !== void 0 ? _r : {}, (_s = next.filterSelection) !== null && _s !== void 0 ? _s : {}, next.filterReferenceDate
1607
1659
  ? (0, viewStatePersistence_1.parseDateFilterState)(next.filterReferenceDate)
1608
- : initialFilterReferenceDate, (_s = next.filterReference) !== null && _s !== void 0 ? _s : {});
1660
+ : initialFilterReferenceDate, (_t = next.filterReference) !== null && _t !== void 0 ? _t : {});
1609
1661
  }
1610
- setActiveSavedViewId((_t = view === null || view === void 0 ? void 0 : view.id) !== null && _t !== void 0 ? _t : null);
1662
+ setActiveSavedViewId((_u = view === null || view === void 0 ? void 0 : view.id) !== null && _u !== void 0 ? _u : null);
1611
1663
  setDeletingSavedViewId(null);
1612
1664
  };
1613
1665
  // INFO: re-read storage before each write so a change made in another browser
@@ -1752,6 +1804,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1752
1804
  structure,
1753
1805
  persistedSort,
1754
1806
  userHiddenColumnIds,
1807
+ shownSystemColumnIds,
1755
1808
  pageLimit,
1756
1809
  ]);
1757
1810
  /* eslint-enable */
@@ -1775,7 +1828,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1775
1828
  var isOtherListReturn = !(0, viewStatePersistence_1.handleIsLastDrill)(props.collectionId, (_c = props.organise) === null || _c === void 0 ? void 0 : _c.persistKey);
1776
1829
  scrollRestoredRef.current = isSwitch || isOtherListReturn;
1777
1830
  /* eslint-disable */
1778
- }, [props.collectionId, (_75 = props.organise) === null || _75 === void 0 ? void 0 : _75.persistKey]);
1831
+ }, [props.collectionId, (_77 = props.organise) === null || _77 === void 0 ? void 0 : _77.persistKey]);
1779
1832
  /* eslint-enable */
1780
1833
  // INFO: wait a frame — rows land in state one tick before layout
1781
1834
  (0, react_1.useEffect)(function () {
@@ -1810,7 +1863,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1810
1863
  (0, react_1.useEffect)(function () {
1811
1864
  handleOfflinePrefetch();
1812
1865
  /* eslint-disable */
1813
- }, [props.collectionId, (_76 = props.bareSettings) === null || _76 === void 0 ? void 0 : _76.bareOffline]);
1866
+ }, [props.collectionId, (_78 = props.bareSettings) === null || _78 === void 0 ? void 0 : _78.bareOffline]);
1814
1867
  /* eslint-enable */
1815
1868
  // INFO: MRQ polling — calls handleRefresh every N ms (e.g. 1500) as a fallback.
1816
1869
  // Calls through handleRefreshRef so the interval always dispatches the latest
@@ -1830,7 +1883,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1830
1883
  }, interval);
1831
1884
  return function () { return clearInterval(timer); };
1832
1885
  /* eslint-disable */
1833
- }, [(_77 = props.bareSettings) === null || _77 === void 0 ? void 0 : _77.barePollingInterval, isLive, isNetworkOffline]);
1886
+ }, [(_79 = props.bareSettings) === null || _79 === void 0 ? void 0 : _79.barePollingInterval, isLive, isNetworkOffline]);
1834
1887
  /* eslint-enable */
1835
1888
  // INFO: Pub/Sub → SSE live-stream — driven by bareSettings.bareSocketName
1836
1889
  // EventSource URL: {sseEndpoint}/{room}?bm_apiToken={token}
@@ -1872,7 +1925,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1872
1925
  };
1873
1926
  /* eslint-disable */
1874
1927
  }, [
1875
- (_78 = props.bareSettings) === null || _78 === void 0 ? void 0 : _78.bareSocketName,
1928
+ (_80 = props.bareSettings) === null || _80 === void 0 ? void 0 : _80.bareSocketName,
1876
1929
  props.collectionId,
1877
1930
  props.devSettings.sseEndpoint,
1878
1931
  props.devSettings.dbAPIToken,
@@ -2088,7 +2141,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2088
2141
  // restored column visibility/order from localStorage
2089
2142
  var isRestoringView = isPersistEnabled && !!persistedState && !persistedViewMountedRef.current;
2090
2143
  if (!isRestoringView) {
2091
- setStructure((_a = props.model) !== null && _a !== void 0 ? _a : []);
2144
+ setStructure(handleWithSystemColumns((_a = props.model) !== null && _a !== void 0 ? _a : []));
2092
2145
  schemaStructureRef.current = null;
2093
2146
  }
2094
2147
  persistedViewMountedRef.current = true;
@@ -2132,10 +2185,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2132
2185
  props.collectionId,
2133
2186
  props.model,
2134
2187
  props.localURLEndpoint,
2135
- (_79 = props.organise) === null || _79 === void 0 ? void 0 : _79.extendedTabs,
2136
- (_80 = props.organise) === null || _80 === void 0 ? void 0 : _80.viewId,
2137
- (_81 = props.organise) === null || _81 === void 0 ? void 0 : _81.additionalQuery,
2138
- (_82 = props.organise) === null || _82 === void 0 ? void 0 : _82.groupBy,
2188
+ (_81 = props.organise) === null || _81 === void 0 ? void 0 : _81.extendedTabs,
2189
+ (_82 = props.organise) === null || _82 === void 0 ? void 0 : _82.viewId,
2190
+ (_83 = props.organise) === null || _83 === void 0 ? void 0 : _83.additionalQuery,
2191
+ (_84 = props.organise) === null || _84 === void 0 ? void 0 : _84.groupBy,
2139
2192
  resolvedType,
2140
2193
  ]);
2141
2194
  /**
@@ -2287,7 +2340,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2287
2340
  };
2288
2341
  }, 100);
2289
2342
  return function () { return clearTimeout(timeoutId); };
2290
- }, [(_83 = props.organise) === null || _83 === void 0 ? void 0 : _83.showReadFloatingNav, resolvedType, props.id, loading]);
2343
+ }, [(_85 = props.organise) === null || _85 === void 0 ? void 0 : _85.showReadFloatingNav, resolvedType, props.id, loading]);
2291
2344
  (0, react_1.useEffect)(function () {
2292
2345
  if (resolvedType !== "read")
2293
2346
  return;
@@ -2771,6 +2824,17 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2771
2824
  var sort = (activeSortId === null || activeSortId === void 0 ? void 0 : activeSortId.sortId) && formulaColumnIds.includes(activeSortId.sortId)
2772
2825
  ? undefined
2773
2826
  : activeSortId || undefined;
2827
+ // INFO: a date range sorts on its start, a timer on its total and the
2828
+ // Record ID column on the record's own id
2829
+ if (sort === null || sort === void 0 ? void 0 : sort.sortId) {
2830
+ var sortColumn = structure.find(function (each) { return each.id === (sort === null || sort === void 0 ? void 0 : sort.sortId); });
2831
+ if ((sortColumn === null || sortColumn === void 0 ? void 0 : sortColumn.type) === "dateRange")
2832
+ sort = __assign(__assign({}, sort), { sortId: (0, dateRange_1.handleGetDateRangeQueryId)(sortColumn.id) });
2833
+ else if ((sortColumn === null || sortColumn === void 0 ? void 0 : sortColumn.type) === "timeTracking")
2834
+ sort = __assign(__assign({}, sort), { sortId: "".concat(sortColumn.id, ".totalSeconds") });
2835
+ else
2836
+ sort = __assign(__assign({}, sort), { sortId: (0, systemColumns_1.handleGetSystemColumnQueryId)(sort.sortId) });
2837
+ }
2774
2838
  if (isFirebase) {
2775
2839
  // INFO: Firestore requires the first orderBy to match the range/startAt
2776
2840
  // field, so a search query always forces the sort onto the search column
@@ -5279,6 +5343,42 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
5279
5343
  }
5280
5344
  });
5281
5345
  }); };
5346
+ var handleStripUnsavedFields = function (data) {
5347
+ if (!data || typeof data !== "object")
5348
+ return data;
5349
+ var stripped = __assign({}, data);
5350
+ structure.forEach(function (eachColumn) {
5351
+ var isUnsaved = eachColumn.type === "button" ||
5352
+ eachColumn.type === "timeTracking" ||
5353
+ (appendedSystemColumnIds.includes(eachColumn.id) &&
5354
+ eachColumn.id !== "baseUpdatedAt");
5355
+ if (isUnsaved)
5356
+ delete stripped[eachColumn.id];
5357
+ });
5358
+ return stripped;
5359
+ };
5360
+ // INFO: what button, timer and rating cells call — the same single-field
5361
+ // update an inline cell edit makes, gated on the same update right
5362
+ var columnTypeActions = {
5363
+ canUpdate: canUpdateRecord,
5364
+ onButtonClick: (_86 = props.organise) === null || _86 === void 0 ? void 0 : _86.onButtonClick,
5365
+ onUpdateCell: function (rowId, columnId, value) { return __awaiter(void 0, void 0, void 0, function () {
5366
+ var _a;
5367
+ return __generator(this, function (_b) {
5368
+ switch (_b.label) {
5369
+ case 0:
5370
+ if (!canUpdateRecord)
5371
+ return [2 /*return*/];
5372
+ return [4 /*yield*/, handleSubmitData("update", rowId, columnId, (_a = {},
5373
+ _a[columnId] = value,
5374
+ _a))];
5375
+ case 1:
5376
+ _b.sent();
5377
+ return [2 /*return*/];
5378
+ }
5379
+ });
5380
+ }); },
5381
+ };
5282
5382
  var handleSubmitData = function (type, rowId, columnId, data, offlineId, isOfflineUpdate, isDraft) { return __awaiter(void 0, void 0, void 0, function () {
5283
5383
  var selectedId, id, createSelectedData_1, uniqueDataStructure, uniqueColumnId, res, offlineDataResp, offlineData, clonedForOffline, tempData, selectedIndex_3, err_20, isUniqueIdFieldCreate, isExistingDoc, newRecordData_1, changedAttributeIds, baseDraftValue, hasBaseDraftChange, offlineDataResp, clonedForOffline, tempData, selectedIndex_4, offlineData, err_21, dataToSubmit_2, changedAttributeIds, baseDraftValue, hasBaseDraftChange, operationType, currentRow, wentToServer, dataId, err_22, offlineDataResp, offlineData, clonedForOffline, tempData, selectedIndex_5, _a;
5284
5384
  var _b, _c, _d, _e;
@@ -5323,6 +5423,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
5323
5423
  createSelectedData_1 = _z.sent();
5324
5424
  _z.label = 4;
5325
5425
  case 4:
5426
+ // INFO: a whole-form save never writes what the form cannot edit — a
5427
+ // button stores nothing, a timer moves only by start / stop (a flow may
5428
+ // have moved it since the form opened) and system columns are stamped
5429
+ // by the server. A single-cell save (columnId) writes just that cell.
5430
+ if (!columnId && createSelectedData_1 !== selectedData)
5431
+ createSelectedData_1 = handleStripUnsavedFields(createSelectedData_1);
5326
5432
  uniqueDataStructure = structure.filter(function (eachStructure) {
5327
5433
  return eachStructure.unique;
5328
5434
  });
@@ -7286,11 +7392,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7286
7392
  if (eachAttribute.id === "_id" ||
7287
7393
  eachAttribute.id === "id" ||
7288
7394
  eachAttribute.id === "baseDraft" ||
7289
- (!includeSchemaHidden && eachAttribute.hide) ||
7395
+ // INFO: a system column starts hidden yet is always offered
7396
+ (!includeSchemaHidden &&
7397
+ eachAttribute.hide &&
7398
+ !appendedSystemColumnIds.includes(eachAttribute.id)) ||
7290
7399
  utils_1.NON_TABLE_COLUMN_DATA_TYPES.includes(eachAttribute.type)) {
7291
7400
  return false;
7292
7401
  }
7293
7402
  if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.showBaseUpdatedAt) &&
7403
+ !isSystemColumnsEnabled &&
7294
7404
  eachAttribute.id === "baseUpdatedAt") {
7295
7405
  return false;
7296
7406
  }
@@ -7313,7 +7423,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7313
7423
  var handleGetSortOptions = function () {
7314
7424
  var _a, _b, _c;
7315
7425
  var baseOptions = (_c = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.renderReferenceLabelOptions) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : (isViewSettingsEnabled
7316
- ? getViewSettingsColumns().map(function (eachColumn) {
7426
+ ? getViewSettingsColumns()
7427
+ .filter(function (eachColumn) { return eachColumn.type !== "button"; })
7428
+ .map(function (eachColumn) {
7317
7429
  var _a;
7318
7430
  return ({
7319
7431
  key: eachColumn.id,
@@ -7337,7 +7449,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7337
7449
  }), true);
7338
7450
  };
7339
7451
  var getIsColumnHidden = function (column) {
7340
- return isSchemaHideMode
7452
+ return isSchemaHideMode || appendedSystemColumnIds.includes(column.id)
7341
7453
  ? !!column.hide
7342
7454
  : getActiveUserHiddenColumnIds().includes(column.id);
7343
7455
  };
@@ -7445,6 +7557,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7445
7557
  return null;
7446
7558
  }
7447
7559
  if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.showBaseUpdatedAt) &&
7560
+ !isSystemColumnsEnabled &&
7448
7561
  eachAttribute.id === "baseUpdatedAt") {
7449
7562
  return null;
7450
7563
  }
@@ -8756,7 +8869,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8756
8869
  //=====================================================================================
8757
8870
  var renderDataTemplateFormContent = function (state, model, ref, isObject, isObjectList, modalInput, parentData) {
8758
8871
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
8759
- return (0, updateModule_1.renderDataTemplateForm)(state, model, ref, {
8872
+ // INFO: the server stamps system columns; a form never shows them
8873
+ var formModel = appendedSystemColumnIds.length
8874
+ ? model.filter(function (each) { return !appendedSystemColumnIds.includes(each.id); })
8875
+ : model;
8876
+ return (0, updateModule_1.renderDataTemplateForm)(state, formModel, ref, {
8760
8877
  handleOnChangeAddress: handleOnChangeAddress,
8761
8878
  handleOnChangeText: handleOnChangeText,
8762
8879
  handleOnChangeSelect: handleOnChangeSelect,
@@ -8883,7 +9000,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8883
9000
  selectedModel.enableCheckbox) {
8884
9001
  return null;
8885
9002
  }
8886
- if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.showBaseUpdatedAt) && eachKey === "baseUpdatedAt") {
9003
+ if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.showBaseUpdatedAt) &&
9004
+ !isSystemColumnsEnabled &&
9005
+ eachKey === "baseUpdatedAt") {
8887
9006
  return null;
8888
9007
  }
8889
9008
  if ((type === "grid" || type === "kanban") &&
@@ -9010,12 +9129,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9010
9129
  return ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.paginationType) === "scroll";
9011
9130
  };
9012
9131
  // INFO: groups page themselves only when every group is known before its
9013
- // rows load — a list column's options plus "Unknown/No Value" for any other
9014
- // value. Grouping by a free-form column builds groups from loaded rows, so a
9132
+ // rows load — a list column's options (or Yes / No) plus Unknown and No
9133
+ // Value. Grouping by a free-form column builds groups from loaded rows, so a
9015
9134
  // group absent from the first page would never appear; those keep the
9016
9135
  // global scroll instead. Firebase pages by document cursor, not by count.
9017
9136
  var renderCheckGroupPaging = function () {
9018
- var _a, _b, _c, _d, _e, _f;
9137
+ var _a, _b, _c, _d, _e;
9019
9138
  var paginationType = renderResolvedPaginationType();
9020
9139
  if (paginationType !== "scroll" && paginationType !== "page")
9021
9140
  return false;
@@ -9041,9 +9160,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9041
9160
  if (!((_c = props.bareSettings) === null || _c === void 0 ? void 0 : _c.bareNewDTW) ||
9042
9161
  ((_d = props.bareSettings) === null || _d === void 0 ? void 0 : _d.bareListMobileView))
9043
9162
  return false;
9163
+ // INFO: a person column's sections come from the loaded rows — reading
9164
+ // one band per member would cost a request per member on every load
9044
9165
  var groupAttributeDS = structure.find(function (eachDS) { return eachDS.id === groupId; });
9045
- return ((groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.type) === "list" &&
9046
- ((_f = (_e = groupAttributeDS.listSelection) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0) > 0);
9166
+ return (((groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.type) === "list" ||
9167
+ (groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.type) === "boolean") &&
9168
+ !!((_e = (0, groupSections_1.handleGetGroupOptions)(groupAttributeDS)) === null || _e === void 0 ? void 0 : _e.length));
9047
9169
  };
9048
9170
  var renderResolvedPaginationType = function () {
9049
9171
  var _a;
@@ -9282,88 +9404,52 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9282
9404
  var _a, _b, _c;
9283
9405
  return (react_1.default.createElement(settingsModal_1.ExpressionModal, { selectedId: id, model: structure, renderReferenceLabelOptions: (_a = props.organise) === null || _a === void 0 ? void 0 : _a.renderReferenceLabelOptions, renderReferenceSpaceOptions: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.renderReferenceSpaceOptions, onAddModelSchema: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.onAddColumns, onClose: onClose }));
9284
9406
  };
9407
+ // INFO: the grouped column and its sections in option order — a status
9408
+ // column's options, Yes / No, or the workspace's members
9409
+ var handleGetGroupColumn = function () {
9410
+ return groupId ? structure.find(function (eachDS) { return eachDS.id === groupId; }) : undefined;
9411
+ };
9412
+ var handleGetGroupColumnOptions = function () {
9413
+ return (0, groupSections_1.handleGetGroupOptions)(handleGetGroupColumn(), props.devSettings.organisationMembers);
9414
+ };
9285
9415
  // INFO: for NewTable, groupBy stays inside one table — rows are handed over
9286
- // as coloured, collapsible bands keyed the same way the legacy split is
9416
+ // as coloured, collapsible sections: every option in its order, then
9417
+ // Unknown (a value outside the options) and No Value
9287
9418
  var handleBuildNewTableGroups = function () {
9288
- var _a, _b;
9419
+ var _a;
9289
9420
  if (!groupId || !((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW))
9290
9421
  return undefined;
9291
- var groupAttributeDS = structure.find(function (eachDS) { return eachDS.id === groupId; });
9292
9422
  var isGroupPaging = renderCheckGroupPaging();
9293
- var listSelection = (_b = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelection) !== null && _b !== void 0 ? _b : [];
9294
- var groups = [];
9295
- // INFO: with per-group paging every option is a band from the start, even
9296
- // with no row loaded yet, so its sentinel can load it; "Unknown/No Value"
9297
- // holds every value outside the options, matching its "!in" query
9298
- if (isGroupPaging)
9299
- __spreadArray(__spreadArray([], listSelection, true), ["Unknown/No Value"], false).forEach(function (key, optionIndex) {
9300
- var _a, _b;
9301
- return groups.push({
9302
- id: key,
9303
- title: key,
9304
- colour: (_a = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelectionColour) === null || _a === void 0 ? void 0 : _a[optionIndex],
9305
- rowIds: [],
9306
- count: ((_b = groupPageState[key]) === null || _b === void 0 ? void 0 : _b.fetched)
9307
- ? groupPageState[key].size
9308
- : undefined,
9309
- });
9310
- });
9311
- (spaceTableData !== null && spaceTableData !== void 0 ? spaceTableData : []).forEach(function (eachData, index) {
9312
- var _a, _b, _c, _d, _e, _f, _g, _h;
9423
+ var sections = (0, groupSections_1.handleBuildGroupSections)({
9424
+ column: handleGetGroupColumn(),
9313
9425
  // INFO: key off the raw row — the display row holds a Tag element for a
9314
- // coloured list value, which would put every row under "Unknown"
9315
- var rawValue = (_b = (_a = tableData === null || tableData === void 0 ? void 0 : tableData[index]) === null || _a === void 0 ? void 0 : _a[groupId]) !== null && _b !== void 0 ? _b : eachData === null || eachData === void 0 ? void 0 : eachData[groupId];
9316
- var key;
9317
- if ((groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.type) === "date" && rawValue && rawValue !== " - ") {
9318
- key = (0, dayjs_1.default)(isFirebase ? (rawValue === null || rawValue === void 0 ? void 0 : rawValue._seconds) * 1000 : rawValue)
9319
- .startOf("day")
9320
- .format("YYYY-MM-DD");
9321
- }
9322
- else {
9323
- key =
9324
- rawValue && rawValue !== " - " && typeof rawValue !== "object"
9325
- ? String(rawValue)
9326
- : "Unknown/No Value";
9327
- if (isGroupPaging && !listSelection.includes(key))
9328
- key = "Unknown/No Value";
9329
- }
9330
- var rowId = (_d = (_c = tableData === null || tableData === void 0 ? void 0 : tableData[index]) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : (_e = tableData === null || tableData === void 0 ? void 0 : tableData[index]) === null || _e === void 0 ? void 0 : _e._id;
9331
- if (!rowId)
9332
- return;
9333
- var group = groups.find(function (eachGroup) { return eachGroup.id === key; });
9334
- if (!group) {
9335
- var optionIndex = (_g = (_f = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelection) === null || _f === void 0 ? void 0 : _f.indexOf(key)) !== null && _g !== void 0 ? _g : -1;
9336
- group = {
9337
- id: key,
9338
- title: key,
9339
- colour: optionIndex >= 0
9340
- ? (_h = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelectionColour) === null || _h === void 0 ? void 0 : _h[optionIndex]
9341
- : undefined,
9342
- rowIds: [],
9343
- };
9344
- groups.push(group);
9345
- }
9346
- group.rowIds.push(rowId);
9426
+ // coloured list value
9427
+ rows: tableData !== null && tableData !== void 0 ? tableData : [],
9428
+ getRowId: function (row) { var _a; return (_a = row === null || row === void 0 ? void 0 : row.id) !== null && _a !== void 0 ? _a : row === null || row === void 0 ? void 0 : row._id; },
9429
+ options: handleGetGroupColumnOptions(),
9430
+ // INFO: with per-group paging every section is there from the start,
9431
+ // even with no row loaded yet, so its sentinel can load it
9432
+ keepEmptyOptions: isGroupPaging,
9433
+ isFirebase: isFirebase,
9434
+ }).map(function (eachSection) {
9435
+ var _a;
9436
+ return (__assign(__assign({}, eachSection), { count: isGroupPaging && ((_a = groupPageState[eachSection.id]) === null || _a === void 0 ? void 0 : _a.fetched)
9437
+ ? groupPageState[eachSection.id].size
9438
+ : undefined }));
9347
9439
  });
9348
- // INFO: a group whose own query came back empty has nothing to show
9440
+ // INFO: a section whose own query came back empty has nothing to show
9349
9441
  if (isGroupPaging)
9350
- return groups.filter(function (eachGroup) {
9442
+ return sections.filter(function (eachGroup) {
9351
9443
  var _a, _b;
9352
9444
  return eachGroup.rowIds.length > 0 ||
9353
9445
  !(((_a = groupPageState[eachGroup.id]) === null || _a === void 0 ? void 0 : _a.fetched) &&
9354
9446
  ((_b = groupPageState[eachGroup.id]) === null || _b === void 0 ? void 0 : _b.size) === 0);
9355
9447
  });
9356
- return groups;
9448
+ return sections;
9357
9449
  };
9358
- // INFO: a row's band under per-group paging — its option, or
9359
- // "Unknown/No Value" for any value outside the options (the "!in" query)
9450
+ // INFO: a row's section under per-group paging
9360
9451
  var handleResolveGroupKey = function (row) {
9361
- var _a, _b;
9362
- var listSelection = (_b = (_a = structure.find(function (eachDS) { return eachDS.id === groupId; })) === null || _a === void 0 ? void 0 : _a.listSelection) !== null && _b !== void 0 ? _b : [];
9363
- var value = groupId ? row === null || row === void 0 ? void 0 : row[groupId] : undefined;
9364
- return typeof value === "string" && listSelection.includes(value)
9365
- ? value
9366
- : "Unknown/No Value";
9452
+ return (0, groupSections_1.handleGetGroupKey)(handleGetGroupColumn(), groupId ? row === null || row === void 0 ? void 0 : row[groupId] : undefined, handleGetGroupColumnOptions(), isFirebase);
9367
9453
  };
9368
9454
  var handleSetGroupPageState = function (groupKey, state) {
9369
9455
  return setGroupPageState(function (previous) {
@@ -9390,16 +9476,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9390
9476
  switch (_j.label) {
9391
9477
  case 0:
9392
9478
  generation = groupPagingGenRef.current;
9393
- groupAttributeDS = structure.find(function (eachDS) { return eachDS.id === groupId; });
9394
- groupQuery = groupKey === "Unknown/No Value"
9395
- ? [
9396
- {
9397
- type: "!in",
9398
- queryId: groupId !== null && groupId !== void 0 ? groupId : "",
9399
- value: (_a = groupAttributeDS === null || groupAttributeDS === void 0 ? void 0 : groupAttributeDS.listSelection) !== null && _a !== void 0 ? _a : [],
9400
- },
9401
- ]
9402
- : [{ type: "=", queryId: groupId !== null && groupId !== void 0 ? groupId : "", value: groupKey }];
9479
+ groupAttributeDS = handleGetGroupColumn();
9480
+ if (!groupAttributeDS)
9481
+ return [2 /*return*/, undefined];
9482
+ groupQuery = (0, groupSections_1.handleGetGroupSectionQuery)(groupAttributeDS, groupKey, (_a = handleGetGroupColumnOptions()) !== null && _a !== void 0 ? _a : []);
9403
9483
  mainCond = handleReadQueryHocCond();
9404
9484
  return [4 /*yield*/, readServerQuery.call(__assign(__assign({}, mainCond), { query: __spreadArray(__spreadArray([], ((_b = mainCond.query) !== null && _b !== void 0 ? _b : []), true), groupQuery, true), cursor: cursor, limit: limit, stopLimit: undefined, skip: 0 }))];
9405
9485
  case 1:
@@ -9536,44 +9616,40 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9536
9616
  // INFO: page mode — after each fresh read every band reads its own first
9537
9617
  // page, so each shows its real total and pages on its own
9538
9618
  var handleLoadGroupFirstPages = function () {
9539
- var _a, _b;
9619
+ var _a;
9540
9620
  groupPagingGenRef.current += 1;
9541
9621
  groupPageStateRef.current = {};
9542
9622
  setGroupPageState({});
9543
- var listSelection = (_b = (_a = structure.find(function (eachDS) { return eachDS.id === groupId; })) === null || _a === void 0 ? void 0 : _a.listSelection) !== null && _b !== void 0 ? _b : [];
9544
- __spreadArray(__spreadArray([], listSelection, true), ["Unknown/No Value"], false).forEach(function (groupKey) {
9545
- return handleFetchGroupPage(groupKey, 0);
9546
- });
9623
+ __spreadArray(__spreadArray([], ((_a = handleGetGroupColumnOptions()) !== null && _a !== void 0 ? _a : []).map(function (each) { return each.key; }), true), [
9624
+ groupSections_1.GROUP_UNKNOWN_KEY,
9625
+ groupSections_1.GROUP_EMPTY_KEY,
9626
+ ], false).forEach(function (groupKey) { return handleFetchGroupPage(groupKey, 0); });
9547
9627
  };
9548
9628
  var renderGroupTable = function (multipleSelect) {
9549
9629
  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;
9550
9630
  if (groupId && !((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW)) {
9551
- var groupAttributeDS_1 = structure.find(function (eachDS) { return eachDS.id === groupId; });
9552
- var groupedSpaceTableData = spaceTableData.reduce(function (acc, eachData) {
9553
- var _a;
9554
- var key;
9555
- if ((groupAttributeDS_1 === null || groupAttributeDS_1 === void 0 ? void 0 : groupAttributeDS_1.type) === "date" &&
9556
- (eachData === null || eachData === void 0 ? void 0 : eachData[groupId]) &&
9557
- (eachData === null || eachData === void 0 ? void 0 : eachData[groupId]) !== " - ") {
9558
- key = (0, dayjs_1.default)(isFirebase ? ((_a = eachData[groupId]) === null || _a === void 0 ? void 0 : _a._seconds) * 1000 : eachData[groupId])
9559
- .startOf("day")
9560
- .format("YYYY-MM-DD");
9561
- }
9562
- else {
9563
- key =
9564
- (eachData === null || eachData === void 0 ? void 0 : eachData[groupId]) && (eachData === null || eachData === void 0 ? void 0 : eachData[groupId]) !== " - "
9565
- ? eachData === null || eachData === void 0 ? void 0 : eachData[groupId]
9566
- : "Unknown/No Value";
9567
- }
9568
- acc[key] = acc[key] || [];
9569
- acc[key].push(eachData);
9570
- return acc;
9571
- }, {});
9572
- if (Object.values(groupedSpaceTableData).length === 0 && !tableLoading) {
9631
+ // INFO: sections are keyed off the raw rows, in option order, with
9632
+ // Unknown and No Value last — the same sections the new table draws
9633
+ var sections = (0, groupSections_1.handleBuildGroupSections)({
9634
+ column: handleGetGroupColumn(),
9635
+ rows: tableData !== null && tableData !== void 0 ? tableData : [],
9636
+ getRowId: function (row) { var _a; return (_a = row === null || row === void 0 ? void 0 : row.id) !== null && _a !== void 0 ? _a : row === null || row === void 0 ? void 0 : row._id; },
9637
+ options: handleGetGroupColumnOptions(),
9638
+ isFirebase: isFirebase,
9639
+ });
9640
+ var displayRowById_1 = new Map();
9641
+ (tableData !== null && tableData !== void 0 ? tableData : []).forEach(function (eachRow, index) { var _a; return displayRowById_1.set((_a = eachRow === null || eachRow === void 0 ? void 0 : eachRow.id) !== null && _a !== void 0 ? _a : eachRow === null || eachRow === void 0 ? void 0 : eachRow._id, spaceTableData[index]); });
9642
+ var groupedSpaceTableData_1 = {};
9643
+ sections.forEach(function (eachSection) {
9644
+ groupedSpaceTableData_1[eachSection.title] = eachSection.rowIds
9645
+ .map(function (eachId) { return displayRowById_1.get(eachId); })
9646
+ .filter(Boolean);
9647
+ });
9648
+ if (Object.values(groupedSpaceTableData_1).length === 0 && !tableLoading) {
9573
9649
  return (react_1.default.createElement(emptyState_1.EmptyState, { text: "There is no data to display", icon: react_1.default.createElement(outline_1.InformationCircleIcon, { className: "h-10 text-gray-600" }) }));
9574
9650
  }
9575
9651
  else {
9576
- return Object.entries(groupedSpaceTableData).map(function (_a) {
9652
+ return Object.entries(groupedSpaceTableData_1).map(function (_a) {
9577
9653
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
9578
9654
  var eachKey = _a[0], eachValue = _a[1];
9579
9655
  var dataList = eachValue;
@@ -11414,16 +11490,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11414
11490
  setDeleteFeedId(id);
11415
11491
  } }))));
11416
11492
  };
11417
- return (react_1.default.createElement(react_1.default.Fragment, null,
11493
+ return (react_1.default.createElement(context_1.ColumnTypeContext.Provider, { value: columnTypeActions },
11418
11494
  renderNotification("root"),
11419
- ((_85 = (_84 = props.renderSettings) === null || _84 === void 0 ? void 0 : _84.renderLoadingUI) === null || _85 === void 0 ? void 0 : _85.call(_84)) && loading ? ((_86 = props.renderSettings) === null || _86 === void 0 ? void 0 : _86.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_87 = props.organise) === null || _87 === void 0 ? void 0 : _87.darkMode, darkModeBg: (_88 = props.organise) === null || _88 === void 0 ? void 0 : _88.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
11495
+ ((_88 = (_87 = props.renderSettings) === null || _87 === void 0 ? void 0 : _87.renderLoadingUI) === null || _88 === void 0 ? void 0 : _88.call(_87)) && loading ? ((_89 = props.renderSettings) === null || _89 === void 0 ? void 0 : _89.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_90 = props.organise) === null || _90 === void 0 ? void 0 : _90.darkMode, darkModeBg: (_91 = props.organise) === null || _91 === void 0 ? void 0 : _91.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
11420
11496
  var _a, _b;
11421
11497
  if (loading)
11422
11498
  return;
11423
11499
  handlePopUpModal(false);
11424
11500
  setExportCSVEmail((_b = (_a = props.devSettings.currentUser) === null || _a === void 0 ? void 0 : _a.userEmail) !== null && _b !== void 0 ? _b : "");
11425
11501
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) })),
11426
- react_1.default.createElement(modal_1.Modal, { darkMode: (_89 = props.organise) === null || _89 === void 0 ? void 0 : _89.darkMode, darkModeBg: (_90 = props.organise) === null || _90 === void 0 ? void 0 : _90.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
11502
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_92 = props.organise) === null || _92 === void 0 ? void 0 : _92.darkMode, darkModeBg: (_93 = props.organise) === null || _93 === void 0 ? void 0 : _93.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
11427
11503
  return (react_1.default.createElement(referenceModal_1.ReferenceModal, { referenceModelSchema: referenceModelSchema, referenceDataStructure: referenceCreationModal, devSettings: props.devSettings, handleCreateRefId: function (dataId) {
11428
11504
  if (dataId) {
11429
11505
  var currentValue = selectedData[referenceCreationModal.id];
@@ -11439,19 +11515,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11439
11515
  }, onClose: function () {
11440
11516
  setReferenceCreationModal({ id: "", name: "", type: "string" });
11441
11517
  } }),
11442
- react_1.default.createElement(modal_1.Modal, { darkMode: (_91 = props.organise) === null || _91 === void 0 ? void 0 : _91.darkMode, darkModeBg: (_92 = props.organise) === null || _92 === void 0 ? void 0 : _92.darkModeBg, maxWidth: "2xl", open: Object.keys(referenceDeleteTableData).length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
11518
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_94 = props.organise) === null || _94 === void 0 ? void 0 : _94.darkMode, darkModeBg: (_95 = props.organise) === null || _95 === void 0 ? void 0 : _95.darkModeBg, maxWidth: "2xl", open: Object.keys(referenceDeleteTableData).length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
11443
11519
  setReferenceDeleteTableData({});
11444
11520
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
11445
- react_1.default.createElement(modal_1.Modal, { darkMode: (_93 = props.organise) === null || _93 === void 0 ? void 0 : _93.darkMode, darkModeBg: (_94 = props.organise) === null || _94 === void 0 ? void 0 : _94.darkModeBg, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
11521
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_96 = props.organise) === null || _96 === void 0 ? void 0 : _96.darkMode, darkModeBg: (_97 = props.organise) === null || _97 === void 0 ? void 0 : _97.darkModeBg, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
11446
11522
  setDeletePasscodeInput("");
11447
11523
  setDeleteModal(!deleteModal);
11448
11524
  setDeleteFeedId("");
11449
11525
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
11450
- react_1.default.createElement(modal_1.Modal, { darkMode: (_95 = props.organise) === null || _95 === void 0 ? void 0 : _95.darkMode, darkModeBg: (_96 = props.organise) === null || _96 === void 0 ? void 0 : _96.darkModeBg, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
11526
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_98 = props.organise) === null || _98 === void 0 ? void 0 : _98.darkMode, darkModeBg: (_99 = props.organise) === null || _99 === void 0 ? void 0 : _99.darkModeBg, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
11451
11527
  setBatchUpdateData({ columnId: "", columnData: {} });
11452
11528
  setBatchUpdateModal(false);
11453
11529
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
11454
- react_1.default.createElement(modal_1.Modal, { darkMode: (_97 = props.organise) === null || _97 === void 0 ? void 0 : _97.darkMode, darkModeBg: (_98 = props.organise) === null || _98 === void 0 ? void 0 : _98.darkModeBg, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
11530
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_100 = props.organise) === null || _100 === void 0 ? void 0 : _100.darkMode, darkModeBg: (_101 = props.organise) === null || _101 === void 0 ? void 0 : _101.darkModeBg, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
11455
11531
  var _a, _b;
11456
11532
  if (props.space)
11457
11533
  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 }));
@@ -11466,13 +11542,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11466
11542
  (0, react_dom_1.createPortal)(
11467
11543
  // INFO: z-50 lifts it over a Modal the table may sit in (z-40)
11468
11544
  react_1.default.createElement("div", { className: "relative z-50" },
11469
- react_1.default.createElement(drawer_1.Drawer, { darkMode: (_99 = props.organise) === null || _99 === void 0 ? void 0 : _99.darkMode, darkModeBg: (_100 = props.organise) === null || _100 === void 0 ? void 0 : _100.darkModeBg, testId: "dt-activity-drawer", open: activityModal,
11545
+ react_1.default.createElement(drawer_1.Drawer, { darkMode: (_102 = props.organise) === null || _102 === void 0 ? void 0 : _102.darkMode, darkModeBg: (_103 = props.organise) === null || _103 === void 0 ? void 0 : _103.darkModeBg, testId: "dt-activity-drawer", open: activityModal,
11470
11546
  // INFO: the record stays set while the drawer slides out — clearing it
11471
11547
  // would remount the hidden panel collection-wide and fetch again. The
11472
11548
  // toolbar's collection-wide button clears it when it opens.
11473
11549
  onClose: function () { return setActivityModal(false); }, anchor: "responsive", maxWidth: "2xl", maxHeight: "75", title: "Activity Log", content: react_1.default.createElement(activityModal_1.ActivityModal, { title: props.title && typeof props.title === "string"
11474
11550
  ? props.title
11475
- : "this collection", devSettings: props.devSettings, collectionId: props.collectionId, dataId: resolvedType === "read" ? ((_101 = props.id) !== null && _101 !== void 0 ? _101 : "") : activityId, activityLog: (_102 = props.edit) === null || _102 === void 0 ? void 0 : _102.activityLog, model: structure }) })), document.body),
11551
+ : "this collection", devSettings: props.devSettings, collectionId: props.collectionId, dataId: resolvedType === "read" ? ((_104 = props.id) !== null && _104 !== void 0 ? _104 : "") : activityId, activityLog: (_105 = props.edit) === null || _105 === void 0 ? void 0 : _105.activityLog, model: structure }) })), document.body),
11476
11552
  renderScrollSentinel()));
11477
11553
  });
11478
11554
  //# sourceMappingURL=index.js.map