blixify-ui-web 1.2.181 → 1.2.182

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 (39) hide show
  1. package/lib/components/data/dataTemplate/activityChanges.d.ts.map +1 -1
  2. package/lib/components/data/dataTemplate/activityChanges.js +1 -0
  3. package/lib/components/data/dataTemplate/activityChanges.js.map +1 -1
  4. package/lib/components/data/dataTemplate/index.d.ts +1 -0
  5. package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
  6. package/lib/components/data/dataTemplate/index.js +502 -246
  7. package/lib/components/data/dataTemplate/index.js.map +1 -1
  8. package/lib/components/data/dataTemplate/model.d.ts +11 -2
  9. package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
  10. package/lib/components/data/flexFilter/index.d.ts.map +1 -1
  11. package/lib/components/data/flexFilter/index.js +41 -14
  12. package/lib/components/data/flexFilter/index.js.map +1 -1
  13. package/lib/components/data/formula/builder.d.ts +19 -0
  14. package/lib/components/data/formula/builder.d.ts.map +1 -0
  15. package/lib/components/data/formula/builder.js +189 -0
  16. package/lib/components/data/formula/builder.js.map +1 -0
  17. package/lib/components/data/formula/functions.d.ts +22 -0
  18. package/lib/components/data/formula/functions.d.ts.map +1 -0
  19. package/lib/components/data/formula/functions.js +773 -0
  20. package/lib/components/data/formula/functions.js.map +1 -0
  21. package/lib/components/data/formula/index.d.ts +75 -0
  22. package/lib/components/data/formula/index.d.ts.map +1 -0
  23. package/lib/components/data/formula/index.js +801 -0
  24. package/lib/components/data/formula/index.js.map +1 -0
  25. package/lib/components/data/listModule.d.ts.map +1 -1
  26. package/lib/components/data/listModule.js +7 -1
  27. package/lib/components/data/listModule.js.map +1 -1
  28. package/lib/components/data/readModule.d.ts.map +1 -1
  29. package/lib/components/data/readModule.js +25 -2
  30. package/lib/components/data/readModule.js.map +1 -1
  31. package/lib/components/data/utils.d.ts.map +1 -1
  32. package/lib/components/data/utils.js +4 -0
  33. package/lib/components/data/utils.js.map +1 -1
  34. package/lib/components/display/newTable/index.d.ts +1 -0
  35. package/lib/components/display/newTable/index.d.ts.map +1 -1
  36. package/lib/components/display/newTable/index.js +85 -30
  37. package/lib/components/display/newTable/index.js.map +1 -1
  38. package/lib/tail.css +1 -1
  39. package/package.json +1 -1
@@ -82,7 +82,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
82
82
  return (mod && mod.__esModule) ? mod : { "default": mod };
83
83
  };
84
84
  Object.defineProperty(exports, "__esModule", { value: true });
85
- exports.DataTemplate = void 0;
85
+ exports.DataTemplate = exports.FORMULA_VIEW_MAX_ROWS = void 0;
86
86
  var outline_1 = require("@heroicons/react/24/outline");
87
87
  var HeroIcons = __importStar(require("@heroicons/react/24/solid"));
88
88
  // INFO: the outline bookmark, for a tab that is not the default one. HeroIcons
@@ -135,6 +135,7 @@ var link_1 = require("../../structure/link");
135
135
  var authModule_1 = require("../authModule");
136
136
  var blobModule_1 = require("../blobModule");
137
137
  var listModule_1 = require("../listModule");
138
+ var formula_1 = require("../formula");
138
139
  var moduleUtils_1 = require("../moduleUtils");
139
140
  var queryForm_1 = require("../queryForm");
140
141
  var readModule_1 = require("../readModule");
@@ -187,6 +188,9 @@ var handleIsEmptyElement = function (element) {
187
188
  };
188
189
  // INFO: rows-per-page choices offered in the view settings panel
189
190
  var PAGE_LIMIT_OPTIONS = [10, 25, 50, 100];
191
+ // INFO: the most rows a formula sort or filter reads into the browser; each is
192
+ // evaluated, filtered and ordered locally, so a larger read could freeze the tab
193
+ exports.FORMULA_VIEW_MAX_ROWS = 5000;
190
194
  var CALENDAR_VIEW_BY_SWITCH = {
191
195
  month: "dayGridMonth",
192
196
  week: "timeGridWeek",
@@ -212,10 +216,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
212
216
  // Every read of the view type below uses resolvedType. The distinction matters
213
217
  // most in effect dependency arrays — following props.type there would leave
214
218
  // the list never refetching while the panel is open, which fails silently.
215
- 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;
219
+ 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;
216
220
  // INFO: the panel cannot navigate its way out — handleNavigate("read") is
217
221
  // routed straight back into it — so expand-to-full-page is local state.
218
- var _93 = (0, react_1.useState)(false), drawerPageView = _93[0], setDrawerPageView = _93[1];
222
+ var _95 = (0, react_1.useState)(false), drawerPageView = _95[0], setDrawerPageView = _95[1];
219
223
  // INFO: the panel keeps rendering the record it was opened with rather than
220
224
  // live props. Without this, navigating back to the list would re-render the
221
225
  // still-mounted panel as a second list behind the overlay.
@@ -307,18 +311,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
307
311
  initialFilterReferenceDate: initialFilterReferenceDate,
308
312
  };
309
313
  };
310
- var _94 = intialiseDefaultFilterValues(), initialFilterSearch = _94.initialFilterSearch, initialFilterSearchParams = _94.initialFilterSearchParams, initialFilterSelection = _94.initialFilterSelection, initialFilterReference = _94.initialFilterReference, initialFilterReferenceDate = _94.initialFilterReferenceDate;
314
+ var _96 = intialiseDefaultFilterValues(), initialFilterSearch = _96.initialFilterSearch, initialFilterSearchParams = _96.initialFilterSearchParams, initialFilterSelection = _96.initialFilterSelection, initialFilterReference = _96.initialFilterReference, initialFilterReferenceDate = _96.initialFilterReferenceDate;
311
315
  // INFO: Persist view state hook — handles storage read/write for filter/sort/column state
312
- var _95 = (0, viewStatePersistence_1.usePersistedViewState)({
316
+ var _97 = (0, viewStatePersistence_1.usePersistedViewState)({
313
317
  mode: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.persistViewState,
314
318
  collectionId: props.collectionId,
315
319
  persistKey: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.persistKey,
316
320
  type: resolvedType,
317
- }), rawPersistedState = _95.persistedState, isPersistEnabled = _95.isEnabled, handleSaveView = _95.handleSaveView, handleRegisterViewSnapshot = _95.handleRegisterViewSnapshot;
321
+ }), rawPersistedState = _97.persistedState, isPersistEnabled = _97.isEnabled, handleSaveView = _97.handleSaveView, handleRegisterViewSnapshot = _97.handleRegisterViewSnapshot;
318
322
  // INFO: drop stored filters/sort on removed columns — they would empty the table
319
323
  var persistedState = (0, react_1.useMemo)(function () { return (0, viewStatePersistence_1.handlePruneStaleColumns)(rawPersistedState, props.model); }, [rawPersistedState, props.model]);
320
- var _96 = (0, react_1.useState)(false), loading = _96[0], setLoading = _96[1];
321
- var _97 = (0, react_1.useState)(), notification = _97[0], setNotification = _97[1];
324
+ var _98 = (0, react_1.useState)(false), loading = _98[0], setLoading = _98[1];
325
+ var _99 = (0, react_1.useState)(), notification = _99[0], setNotification = _99[1];
322
326
  // INFO: a success toast is confirmation, not a decision — it clears itself so
323
327
  // it never sits on the floating step bar; errors stay until dismissed
324
328
  (0, react_1.useEffect)(function () {
@@ -328,63 +332,63 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
328
332
  return function () { return clearTimeout(timer); };
329
333
  }, [notification]);
330
334
  //INFO : Used by List
331
- var _98 = (0, react_1.useState)((_d = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _d !== void 0 ? _d : initialFilterSearch), filterSearch = _98[0], setFilterSearch = _98[1];
332
- var _99 = (0, react_1.useState)((_e = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _e !== void 0 ? _e : initialFilterSearchParams), filterSearchParams = _99[0], setFilterSearchParams = _99[1];
333
- var _100 = (0, react_1.useState)((_f = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _f !== void 0 ? _f : initialFilterSelection), filterSelection = _100[0], setFilterSelection = _100[1];
334
- var _101 = (0, react_1.useState)((_g = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _g !== void 0 ? _g : initialFilterReference), filterReference = _101[0], setFilterReference = _101[1];
335
- var _102 = (0, react_1.useState)({}), filterReferenceSearch = _102[0], setFilterReferenceSearch = _102[1];
336
- var _103 = (0, react_1.useState)({}), filterReferenceList = _103[0], setFilterReferenceList = _103[1];
337
- var _104 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
335
+ var _100 = (0, react_1.useState)((_d = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _d !== void 0 ? _d : initialFilterSearch), filterSearch = _100[0], setFilterSearch = _100[1];
336
+ var _101 = (0, react_1.useState)((_e = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _e !== void 0 ? _e : initialFilterSearchParams), filterSearchParams = _101[0], setFilterSearchParams = _101[1];
337
+ var _102 = (0, react_1.useState)((_f = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _f !== void 0 ? _f : initialFilterSelection), filterSelection = _102[0], setFilterSelection = _102[1];
338
+ var _103 = (0, react_1.useState)((_g = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _g !== void 0 ? _g : initialFilterReference), filterReference = _103[0], setFilterReference = _103[1];
339
+ var _104 = (0, react_1.useState)({}), filterReferenceSearch = _104[0], setFilterReferenceSearch = _104[1];
340
+ var _105 = (0, react_1.useState)({}), filterReferenceList = _105[0], setFilterReferenceList = _105[1];
341
+ var _106 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
338
342
  ? (0, viewStatePersistence_1.parseDateFilterState)(persistedState.filterReferenceDate)
339
- : initialFilterReferenceDate), filterReferenceDate = _104[0], setFilterReferenceDate = _104[1];
340
- var _105 = (0, react_1.useState)(true), tableLoading = _105[0], setTableLoading = _105[1];
341
- var _106 = (0, react_1.useState)(""), cursor = _106[0], setCursor = _106[1];
342
- var _107 = (0, react_1.useState)(""), lastCursor = _107[0], setLastCursor = _107[1];
343
- var _108 = (0, react_1.useState)([]), tableData = _108[0], setTableData = _108[1];
344
- var _109 = (0, react_1.useState)([]), spaceTableData = _109[0], setSpaceTableData = _109[1];
343
+ : initialFilterReferenceDate), filterReferenceDate = _106[0], setFilterReferenceDate = _106[1];
344
+ var _107 = (0, react_1.useState)(true), tableLoading = _107[0], setTableLoading = _107[1];
345
+ var _108 = (0, react_1.useState)(""), cursor = _108[0], setCursor = _108[1];
346
+ var _109 = (0, react_1.useState)(""), lastCursor = _109[0], setLastCursor = _109[1];
347
+ var _110 = (0, react_1.useState)([]), tableData = _110[0], setTableData = _110[1];
348
+ var _111 = (0, react_1.useState)([]), spaceTableData = _111[0], setSpaceTableData = _111[1];
345
349
  // INFO: a save resolves after later renders, so it reads the table from here —
346
350
  // the state it closed over can predate an earlier save on the same row
347
351
  var tableDataRef = (0, react_1.useRef)([]);
348
352
  var spaceTableDataRef = (0, react_1.useRef)([]);
349
353
  tableDataRef.current = tableData;
350
354
  spaceTableDataRef.current = spaceTableData;
351
- var _110 = (0, react_1.useState)(0), size = _110[0], setSize = _110[1];
352
- var _111 = (0, react_1.useState)((_k = (_h = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _h !== void 0 ? _h : (_j = props.organise) === null || _j === void 0 ? void 0 : _j.pageIndex) !== null && _k !== void 0 ? _k : 0), pageIndex = _111[0], setPageIndex = _111[1];
353
- var _112 = (0, react_1.useState)([]), selectedIds = _112[0], setSelectedIds = _112[1];
354
- var _113 = (0, react_1.useState)(false), selectAll = _113[0], setSelectAll = _113[1];
355
- var _114 = (0, react_1.useState)(""), deletePasscode = _114[0], setDeletePasscode = _114[1];
356
- var _115 = (0, react_1.useState)(""), deletePasscodeInput = _115[0], setDeletePasscodeInput = _115[1];
357
- var _116 = (0, react_1.useState)(""), deleteFeedId = _116[0], setDeleteFeedId = _116[1];
355
+ var _112 = (0, react_1.useState)(0), size = _112[0], setSize = _112[1];
356
+ var _113 = (0, react_1.useState)((_k = (_h = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _h !== void 0 ? _h : (_j = props.organise) === null || _j === void 0 ? void 0 : _j.pageIndex) !== null && _k !== void 0 ? _k : 0), pageIndex = _113[0], setPageIndex = _113[1];
357
+ var _114 = (0, react_1.useState)([]), selectedIds = _114[0], setSelectedIds = _114[1];
358
+ var _115 = (0, react_1.useState)(false), selectAll = _115[0], setSelectAll = _115[1];
359
+ var _116 = (0, react_1.useState)(""), deletePasscode = _116[0], setDeletePasscode = _116[1];
360
+ var _117 = (0, react_1.useState)(""), deletePasscodeInput = _117[0], setDeletePasscodeInput = _117[1];
361
+ var _118 = (0, react_1.useState)(""), deleteFeedId = _118[0], setDeleteFeedId = _118[1];
358
362
  //INFO : Used by List Organise
359
363
  // INFO: Internal sort state that overrides props.organise?.sort when
360
364
  // persistViewState is enabled and a persisted sort exists
361
- var _117 = (0, react_1.useState)((_l = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _l !== void 0 ? _l : undefined), persistedSort = _117[0], setPersistedSort = _117[1];
362
- var _118 = (0, react_1.useState)(false), filterDraft = _118[0], setFilterDraft = _118[1];
363
- var _119 = (0, react_1.useState)(false), addTabModal = _119[0], setAddTabModal = _119[1];
364
- var _120 = (0, react_1.useState)(-1), editTabIndex = _120[0], setEditTabIndex = _120[1];
365
+ var _119 = (0, react_1.useState)((_l = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _l !== void 0 ? _l : undefined), persistedSort = _119[0], setPersistedSort = _119[1];
366
+ var _120 = (0, react_1.useState)(false), filterDraft = _120[0], setFilterDraft = _120[1];
367
+ var _121 = (0, react_1.useState)(false), addTabModal = _121[0], setAddTabModal = _121[1];
368
+ var _122 = (0, react_1.useState)(-1), editTabIndex = _122[0], setEditTabIndex = _122[1];
365
369
  //INFO : resolve the initial tab synchronously so the mount cond is already
366
370
  // tab-scoped — an empty initial tab caused a second wasted list fetch
367
- var _121 = (0, react_1.useState)(function () {
371
+ var _123 = (0, react_1.useState)(function () {
368
372
  var _a, _b;
369
373
  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);
370
- }), selectedTab = _121[0], setSelectedTab = _121[1];
371
- var _122 = (0, react_1.useState)("dayGridMonth"), calendarView = _122[0], setCalendarView = _122[1];
374
+ }), selectedTab = _123[0], setSelectedTab = _123[1];
375
+ var _124 = (0, react_1.useState)("dayGridMonth"), calendarView = _124[0], setCalendarView = _124[1];
372
376
  // INFO: bareNewDTW calendar viewSwitch mode — drives the NewCalendar variant
373
377
  // (calendarView above drives the matching range query)
374
- var _123 = (0, react_1.useState)("month"), newCalendarViewMode = _123[0], setNewCalendarViewMode = _123[1];
375
- var _124 = (0, react_1.useState)(new Date()), calendarTabMonth = _124[0], setCalendarTabMonth = _124[1];
378
+ var _125 = (0, react_1.useState)("month"), newCalendarViewMode = _125[0], setNewCalendarViewMode = _125[1];
379
+ var _126 = (0, react_1.useState)(new Date()), calendarTabMonth = _126[0], setCalendarTabMonth = _126[1];
376
380
  // INFO: defaultViewSwitch picks the opening view only — the tab re-inits
377
381
  // whenever its settings change, and that must not undo the user's switch
378
382
  var calendarViewInitRef = (0, react_1.useRef)(false);
379
- var _125 = (0, react_1.useState)(true), kanbanDroppable = _125[0], setKanbanDroppable = _125[1];
380
- var _126 = (0, react_1.useState)([]), kanbanOptions = _126[0], setKanbanOptions = _126[1];
381
- var _127 = (0, react_1.useState)(false), queryForm = _127[0], setQueryForm = _127[1];
382
- var _128 = (0, react_1.useState)(false), batchUpdateModal = _128[0], setBatchUpdateModal = _128[1];
383
- var _129 = (0, react_1.useState)({
383
+ var _127 = (0, react_1.useState)(true), kanbanDroppable = _127[0], setKanbanDroppable = _127[1];
384
+ var _128 = (0, react_1.useState)([]), kanbanOptions = _128[0], setKanbanOptions = _128[1];
385
+ var _129 = (0, react_1.useState)(false), queryForm = _129[0], setQueryForm = _129[1];
386
+ var _130 = (0, react_1.useState)(false), batchUpdateModal = _130[0], setBatchUpdateModal = _130[1];
387
+ var _131 = (0, react_1.useState)({
384
388
  columnId: "",
385
389
  columnData: {},
386
- }), batchUpdateData = _129[0], setBatchUpdateData = _129[1];
387
- var _130 = (0, react_1.useState)(function () {
390
+ }), batchUpdateData = _131[0], setBatchUpdateData = _131[1];
391
+ var _132 = (0, react_1.useState)(function () {
388
392
  var baseModel = (props === null || props === void 0 ? void 0 : props.model) || [];
389
393
  if (!persistedState)
390
394
  return baseModel;
@@ -410,8 +414,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
410
414
  });
411
415
  }
412
416
  return model;
413
- }), structure = _130[0], setStructure = _130[1];
414
- var _131 = (0, react_1.useState)(((_m = props === null || props === void 0 ? void 0 : props.organise) === null || _m === void 0 ? void 0 : _m.additionalQuery) || []), additionalQuery = _131[0], setAdditionalQuery = _131[1];
417
+ }), structure = _132[0], setStructure = _132[1];
418
+ var _133 = (0, react_1.useState)(((_m = props === null || props === void 0 ? void 0 : props.organise) === null || _m === void 0 ? void 0 : _m.additionalQuery) || []), additionalQuery = _133[0], setAdditionalQuery = _133[1];
415
419
  // INFO: State for user-configurable flex filters (Monday.com-style)
416
420
  // INFO: Initialize with one empty row so users see inputs immediately without clicking "Add Filter"
417
421
  var defaultFlexFilterRow = [
@@ -422,9 +426,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
422
426
  value: undefined,
423
427
  },
424
428
  ];
425
- var _132 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
429
+ var _134 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
426
430
  ? persistedState.flexFilters
427
- : defaultFlexFilterRow), flexFilters = _132[0], setFlexFilters = _132[1];
431
+ : defaultFlexFilterRow), flexFilters = _134[0], setFlexFilters = _134[1];
428
432
  // INFO: always-current mirror of flexFilters, read by the imperative apply/
429
433
  // clear methods so chained calls in one tick aren't stale.
430
434
  var flexFiltersRef = (0, react_1.useRef)(flexFilters);
@@ -437,74 +441,74 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
437
441
  }, [flexFilters]);
438
442
  // INFO: Debounced version of flexFilters used by renderImpSearchFilterConditions
439
443
  // to prevent API calls on every keystroke when typing in value inputs
440
- var _133 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
444
+ var _135 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
441
445
  ? persistedState.flexFilters
442
- : defaultFlexFilterRow), flexFiltersDebounced = _133[0], setFlexFiltersDebounced = _133[1];
443
- var _134 = (0, react_1.useState)({}), flexFilterReferenceOptions = _134[0], setFlexFilterReferenceOptions = _134[1];
444
- var _135 = (0, react_1.useState)({}), flexFilterReferenceSearch = _135[0], setFlexFilterReferenceSearch = _135[1];
445
- var _136 = (0, react_1.useState)(false), flexFilterModalOpen = _136[0], setFlexFilterModalOpen = _136[1];
446
- var _137 = (0, react_1.useState)(false), viewSettingsModalOpen = _137[0], setViewSettingsModalOpen = _137[1];
446
+ : defaultFlexFilterRow), flexFiltersDebounced = _135[0], setFlexFiltersDebounced = _135[1];
447
+ var _136 = (0, react_1.useState)({}), flexFilterReferenceOptions = _136[0], setFlexFilterReferenceOptions = _136[1];
448
+ var _137 = (0, react_1.useState)({}), flexFilterReferenceSearch = _137[0], setFlexFilterReferenceSearch = _137[1];
449
+ var _138 = (0, react_1.useState)(false), flexFilterModalOpen = _138[0], setFlexFilterModalOpen = _138[1];
450
+ var _139 = (0, react_1.useState)(false), viewSettingsModalOpen = _139[0], setViewSettingsModalOpen = _139[1];
447
451
  // INFO: Columns the end user chose to hide (bareSettings.bareViewSettings).
448
452
  // Deliberately kept out of `structure`: the props-sync effect below resets
449
453
  // structure to props.model whenever props change, which would wipe the
450
454
  // choice, and the persist effect derives schema-level hiddenColumnIds from
451
455
  // structure — writing user hides there would blur the two concepts.
452
- var _138 = (0, react_1.useState)((_o = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _o !== void 0 ? _o : []), userHiddenColumnIds = _138[0], setUserHiddenColumnIds = _138[1];
453
- var _139 = (0, react_1.useState)(""), columnSearch = _139[0], setColumnSearch = _139[1];
454
- var _140 = (0, react_1.useState)([]), savedViews = _140[0], setSavedViews = _140[1];
455
- var _141 = (0, react_1.useState)(null), activeSavedViewId = _141[0], setActiveSavedViewId = _141[1];
456
+ var _140 = (0, react_1.useState)((_o = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _o !== void 0 ? _o : []), userHiddenColumnIds = _140[0], setUserHiddenColumnIds = _140[1];
457
+ var _141 = (0, react_1.useState)(""), columnSearch = _141[0], setColumnSearch = _141[1];
458
+ var _142 = (0, react_1.useState)([]), savedViews = _142[0], setSavedViews = _142[1];
459
+ var _143 = (0, react_1.useState)(null), activeSavedViewId = _143[0], setActiveSavedViewId = _143[1];
456
460
  // INFO: null while the name box is closed
457
- var _142 = (0, react_1.useState)(null), savedViewName = _142[0], setSavedViewName = _142[1];
458
- var _143 = (0, react_1.useState)(null), deletingSavedViewId = _143[0], setDeletingSavedViewId = _143[1];
459
- var _144 = (0, react_1.useState)(null), draggingColumnId = _144[0], setDraggingColumnId = _144[1];
461
+ var _144 = (0, react_1.useState)(null), savedViewName = _144[0], setSavedViewName = _144[1];
462
+ var _145 = (0, react_1.useState)(null), deletingSavedViewId = _145[0], setDeletingSavedViewId = _145[1];
463
+ var _146 = (0, react_1.useState)(null), draggingColumnId = _146[0], setDraggingColumnId = _146[1];
460
464
  var columnRowRefs = (0, react_1.useRef)({});
461
465
  //INFO : Used by Auth
462
- var _145 = (0, react_1.useState)({
466
+ var _147 = (0, react_1.useState)({
463
467
  email: "",
464
468
  google: "",
465
469
  phone: "",
466
470
  disabled: false,
467
471
  create: false,
468
- }), authMethods = _145[0], setAuthMethods = _145[1];
469
- var _146 = (0, react_1.useState)(""), selectedAuthMethod = _146[0], setSelectedAuthMethod = _146[1];
472
+ }), authMethods = _147[0], setAuthMethods = _147[1];
473
+ var _148 = (0, react_1.useState)(""), selectedAuthMethod = _148[0], setSelectedAuthMethod = _148[1];
470
474
  // INFO: the sign-in check of a users datasheet's record is running; the
471
475
  // panel shows a spinner rather than nothing, which read as "no login"
472
- var _147 = (0, react_1.useState)(false), authLoading = _147[0], setAuthLoading = _147[1];
476
+ var _149 = (0, react_1.useState)(false), authLoading = _149[0], setAuthLoading = _149[1];
473
477
  // INFO: a delete is running — the ref answers a second tap at once, before
474
478
  // the state has rendered, and the state disables the confirm button
475
479
  var deletingRef = (0, react_1.useRef)(false);
476
- var _148 = (0, react_1.useState)(false), deleting = _148[0], setDeleting = _148[1];
480
+ var _150 = (0, react_1.useState)(false), deleting = _150[0], setDeleting = _150[1];
477
481
  // INFO: Used by Activity Log
478
- var _149 = (0, react_1.useState)(false), activityModal = _149[0], setActivityModal = _149[1];
479
- var _150 = (0, react_1.useState)(""), activityId = _150[0], setActivityId = _150[1];
482
+ var _151 = (0, react_1.useState)(false), activityModal = _151[0], setActivityModal = _151[1];
483
+ var _152 = (0, react_1.useState)(""), activityId = _152[0], setActivityId = _152[1];
480
484
  //INFO : Used by Export
481
- var _151 = (0, react_1.useState)(null), csvFile = _151[0], setCSVFile = _151[1];
482
- var _152 = (0, react_1.useState)([]), csvFileData = _152[0], setCSVFileData = _152[1];
483
- var _153 = (0, react_1.useState)(0), stepCSVIndex = _153[0], setStepCSVIndex = _153[1];
484
- var _154 = (0, react_1.useState)({}), listCSVMapAttribute = _154[0], setListCSVMapAttribute = _154[1];
485
- var _155 = (0, react_1.useState)({}), listCSVObjAttribute = _155[0], setListCSVObjAttribute = _155[1];
486
- var _156 = (0, react_1.useState)([]), csvAPIAttribute = _156[0], setCSVAPIAttribute = _156[1];
487
- var _157 = (0, react_1.useState)(((_p = props.devSettings.currentUser) === null || _p === void 0 ? void 0 : _p.userEmail) || ""), exportCSVEmail = _157[0], setExportCSVEmail = _157[1];
488
- var _158 = (0, react_1.useState)(((_r = (_q = props.organise) === null || _q === void 0 ? void 0 : _q.exportSettings) === null || _r === void 0 ? void 0 : _r.defaultExportPDFName) || ""), exportPDFTitle = _158[0], setExportPDFTitle = _158[1];
489
- var _159 = (0, react_1.useState)(false), exportPDFLoading = _159[0], setExportPDFLoading = _159[1];
490
- var _160 = (0, react_1.useState)(false), exportReadPDFLoading = _160[0], setExportReadPDFLoading = _160[1];
491
- var _161 = (0, react_1.useState)((_u = (_t = (_s = props.organise) === null || _s === void 0 ? void 0 : _s.exportSettings) === null || _t === void 0 ? void 0 : _t.sumColumnId) !== null && _u !== void 0 ? _u : []), exportSumAttributeIds = _161[0], setExportSumAttributeIds = _161[1];
492
- var _162 = (0, react_1.useState)((_x = (_w = (_v = props.organise) === null || _v === void 0 ? void 0 : _v.exportSettings) === null || _w === void 0 ? void 0 : _w.hideSubItems) !== null && _x !== void 0 ? _x : false), hideSubItems = _162[0], setHideSubItems = _162[1];
493
- var _163 = (0, react_1.useState)([]), importTableData = _163[0], setImportTableData = _163[1];
494
- var _164 = (0, react_1.useState)([]), queryList = _164[0], setQueryList = _164[1];
495
- var _165 = (0, react_1.useState)(undefined), allQueryList = _165[0], setAllQueryList = _165[1];
496
- var _166 = (0, react_1.useState)(-1), queryIndex = _166[0], setQueryIndex = _166[1];
485
+ var _153 = (0, react_1.useState)(null), csvFile = _153[0], setCSVFile = _153[1];
486
+ var _154 = (0, react_1.useState)([]), csvFileData = _154[0], setCSVFileData = _154[1];
487
+ var _155 = (0, react_1.useState)(0), stepCSVIndex = _155[0], setStepCSVIndex = _155[1];
488
+ var _156 = (0, react_1.useState)({}), listCSVMapAttribute = _156[0], setListCSVMapAttribute = _156[1];
489
+ var _157 = (0, react_1.useState)({}), listCSVObjAttribute = _157[0], setListCSVObjAttribute = _157[1];
490
+ var _158 = (0, react_1.useState)([]), csvAPIAttribute = _158[0], setCSVAPIAttribute = _158[1];
491
+ var _159 = (0, react_1.useState)(((_p = props.devSettings.currentUser) === null || _p === void 0 ? void 0 : _p.userEmail) || ""), exportCSVEmail = _159[0], setExportCSVEmail = _159[1];
492
+ var _160 = (0, react_1.useState)(((_r = (_q = props.organise) === null || _q === void 0 ? void 0 : _q.exportSettings) === null || _r === void 0 ? void 0 : _r.defaultExportPDFName) || ""), exportPDFTitle = _160[0], setExportPDFTitle = _160[1];
493
+ var _161 = (0, react_1.useState)(false), exportPDFLoading = _161[0], setExportPDFLoading = _161[1];
494
+ var _162 = (0, react_1.useState)(false), exportReadPDFLoading = _162[0], setExportReadPDFLoading = _162[1];
495
+ var _163 = (0, react_1.useState)((_u = (_t = (_s = props.organise) === null || _s === void 0 ? void 0 : _s.exportSettings) === null || _t === void 0 ? void 0 : _t.sumColumnId) !== null && _u !== void 0 ? _u : []), exportSumAttributeIds = _163[0], setExportSumAttributeIds = _163[1];
496
+ var _164 = (0, react_1.useState)((_x = (_w = (_v = props.organise) === null || _v === void 0 ? void 0 : _v.exportSettings) === null || _w === void 0 ? void 0 : _w.hideSubItems) !== null && _x !== void 0 ? _x : false), hideSubItems = _164[0], setHideSubItems = _164[1];
497
+ var _165 = (0, react_1.useState)([]), importTableData = _165[0], setImportTableData = _165[1];
498
+ var _166 = (0, react_1.useState)([]), queryList = _166[0], setQueryList = _166[1];
499
+ var _167 = (0, react_1.useState)(undefined), allQueryList = _167[0], setAllQueryList = _167[1];
500
+ var _168 = (0, react_1.useState)(-1), queryIndex = _168[0], setQueryIndex = _168[1];
497
501
  // INFO: a restored state wins over the prop; its "" is a list the user
498
502
  // ungrouped, so it opens ungrouped
499
- var _167 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupBy) !== undefined
503
+ var _169 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupBy) !== undefined
500
504
  ? persistedState.groupBy || undefined
501
- : (_y = props.organise) === null || _y === void 0 ? void 0 : _y.groupBy), groupId = _167[0], setGroupId = _167[1];
505
+ : (_y = props.organise) === null || _y === void 0 ? void 0 : _y.groupBy), groupId = _169[0], setGroupId = _169[1];
502
506
  // INFO: Monday-board per-group paging. Keyed by the group key that
503
507
  // handleBuildNewTableGroups() produces (a list option or "Unknown/No Value").
504
508
  // Each group tracks its own loaded cursor + total so it can lazily load its
505
509
  // next page as the user scrolls inside that band, independent of every other
506
510
  // group. Only used when renderCheckGroupPaging() is true.
507
- var _168 = (0, react_1.useState)({}), groupPageState = _168[0], setGroupPageState = _168[1];
511
+ var _170 = (0, react_1.useState)({}), groupPageState = _170[0], setGroupPageState = _170[1];
508
512
  // INFO: read fresh inside the async per-group fetch so chained scroll fires
509
513
  // in one tick do not re-fetch an already in-flight page.
510
514
  var groupPageStateRef = (0, react_1.useRef)({});
@@ -513,59 +517,59 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
513
517
  // list was re-read (new search, filter, sort or grouping) is dropped on
514
518
  // arrival instead of appending rows that belong to the old list
515
519
  var groupPagingGenRef = (0, react_1.useRef)(0);
516
- var _169 = (0, react_1.useState)(""), readTabSection = _169[0], setReadTabSection = _169[1];
517
- var _170 = (0, react_1.useState)(false), readFloatingNav = _170[0], setReadFloatingNav = _170[1];
520
+ var _171 = (0, react_1.useState)(""), readTabSection = _171[0], setReadTabSection = _171[1];
521
+ var _172 = (0, react_1.useState)(false), readFloatingNav = _172[0], setReadFloatingNav = _172[1];
518
522
  var readTabSectionRefs = (0, react_1.useRef)({});
519
523
  //INFO : Used by Read
520
524
  //INFO : Used by Update
521
- var _171 = (0, react_1.useState)(false), modalVisible = _171[0], setModalVisible = _171[1];
522
- var _172 = (0, react_1.useState)(false), deleteModal = _172[0], setDeleteModal = _172[1];
523
- var _173 = (0, react_1.useState)(false), excelModal = _173[0], setExcelModal = _173[1];
524
- var _174 = (0, react_1.useState)(false), exportExcel = _174[0], setExportExcel = _174[1];
525
- var _175 = (0, react_1.useState)(""), exportType = _175[0], setExportType = _175[1];
526
- var _176 = (0, react_1.useState)(false), exportQR = _176[0], setExportQR = _176[1];
527
- var _177 = (0, react_1.useState)(function () {
525
+ var _173 = (0, react_1.useState)(false), modalVisible = _173[0], setModalVisible = _173[1];
526
+ var _174 = (0, react_1.useState)(false), deleteModal = _174[0], setDeleteModal = _174[1];
527
+ var _175 = (0, react_1.useState)(false), excelModal = _175[0], setExcelModal = _175[1];
528
+ var _176 = (0, react_1.useState)(false), exportExcel = _176[0], setExportExcel = _176[1];
529
+ var _177 = (0, react_1.useState)(""), exportType = _177[0], setExportType = _177[1];
530
+ var _178 = (0, react_1.useState)(false), exportQR = _178[0], setExportQR = _178[1];
531
+ var _179 = (0, react_1.useState)(function () {
528
532
  var _a, _b;
529
533
  var firstTabId = (_b = (_a = structure.find(function (item) { return item.tabId; })) === null || _a === void 0 ? void 0 : _a.tabId) !== null && _b !== void 0 ? _b : "";
530
534
  return firstTabId;
531
- }), activeTab = _177[0], setActiveTab = _177[1];
532
- var _178 = (0, react_1.useState)(false), signatureSigning = _178[0], setSignatureSigning = _178[1];
533
- var _179 = (0, react_1.useState)({}), selectedData = _179[0], setSelectedData = _179[1];
534
- var _180 = (0, react_1.useState)(""), selectedObjectStructureId = _180[0], setSelectedObjectStructureId = _180[1];
535
- var _181 = (0, react_1.useState)(""), selectedObjectId = _181[0], setSelectedObjectId = _181[1];
536
- var _182 = (0, react_1.useState)(""), selectedListAddressId = _182[0], setSelectedListAddressId = _182[1];
537
- var _183 = (0, react_1.useState)(-1), selectedListAddressIndex = _183[0], setSelectedListAddressIndex = _183[1];
538
- var _184 = (0, react_1.useState)({
535
+ }), activeTab = _179[0], setActiveTab = _179[1];
536
+ var _180 = (0, react_1.useState)(false), signatureSigning = _180[0], setSignatureSigning = _180[1];
537
+ var _181 = (0, react_1.useState)({}), selectedData = _181[0], setSelectedData = _181[1];
538
+ var _182 = (0, react_1.useState)(""), selectedObjectStructureId = _182[0], setSelectedObjectStructureId = _182[1];
539
+ var _183 = (0, react_1.useState)(""), selectedObjectId = _183[0], setSelectedObjectId = _183[1];
540
+ var _184 = (0, react_1.useState)(""), selectedListAddressId = _184[0], setSelectedListAddressId = _184[1];
541
+ var _185 = (0, react_1.useState)(-1), selectedListAddressIndex = _185[0], setSelectedListAddressIndex = _185[1];
542
+ var _186 = (0, react_1.useState)({
539
543
  lat: 0,
540
544
  lng: 0,
541
545
  name: "",
542
- }), selectedListAddress = _184[0], setSelectedListAddress = _184[1];
543
- var _185 = (0, react_1.useState)({}), selectedObjectData = _185[0], setSelectedObjectData = _185[1];
544
- var _186 = (0, react_1.useState)(null), objectCellEdit = _186[0], setObjectCellEdit = _186[1];
545
- var _187 = (0, react_1.useState)(false), referenceLoading = _187[0], setReferenceLoading = _187[1];
546
- var _188 = (0, react_1.useState)({}), referencesOptions = _188[0], setReferencesOptions = _188[1];
547
- var _189 = (0, react_1.useState)({}), referencesDetails = _189[0], setReferencesDetails = _189[1];
548
- var _190 = (0, react_1.useState)({}), listReferencesOptions = _190[0], setListReferencesOptions = _190[1];
549
- var _191 = (0, react_1.useState)({}), referenceDeleteTableData = _191[0], setReferenceDeleteTableData = _191[1];
550
- var _192 = (0, react_1.useState)([]), relatedSections = _192[0], setRelatedSections = _192[1];
551
- var _193 = (0, react_1.useState)(0), referenceDeleteIndex = _193[0], setReferenceDeleteIndex = _193[1];
552
- var _194 = (0, react_1.useState)({
546
+ }), selectedListAddress = _186[0], setSelectedListAddress = _186[1];
547
+ var _187 = (0, react_1.useState)({}), selectedObjectData = _187[0], setSelectedObjectData = _187[1];
548
+ var _188 = (0, react_1.useState)(null), objectCellEdit = _188[0], setObjectCellEdit = _188[1];
549
+ var _189 = (0, react_1.useState)(false), referenceLoading = _189[0], setReferenceLoading = _189[1];
550
+ var _190 = (0, react_1.useState)({}), referencesOptions = _190[0], setReferencesOptions = _190[1];
551
+ var _191 = (0, react_1.useState)({}), referencesDetails = _191[0], setReferencesDetails = _191[1];
552
+ var _192 = (0, react_1.useState)({}), listReferencesOptions = _192[0], setListReferencesOptions = _192[1];
553
+ var _193 = (0, react_1.useState)({}), referenceDeleteTableData = _193[0], setReferenceDeleteTableData = _193[1];
554
+ var _194 = (0, react_1.useState)([]), relatedSections = _194[0], setRelatedSections = _194[1];
555
+ var _195 = (0, react_1.useState)(0), referenceDeleteIndex = _195[0], setReferenceDeleteIndex = _195[1];
556
+ var _196 = (0, react_1.useState)({
553
557
  id: "",
554
558
  name: "",
555
559
  type: "string",
556
- }), referenceCreationModal = _194[0], setReferenceCreationModal = _194[1];
557
- var _195 = (0, react_1.useState)({}), referenceModelSchema = _195[0], setReferenceSchema = _195[1];
558
- var _196 = (0, react_1.useState)([]), kanbanChecked = _196[0], setKanbanChecked = _196[1];
560
+ }), referenceCreationModal = _196[0], setReferenceCreationModal = _196[1];
561
+ var _197 = (0, react_1.useState)({}), referenceModelSchema = _197[0], setReferenceSchema = _197[1];
562
+ var _198 = (0, react_1.useState)([]), kanbanChecked = _198[0], setKanbanChecked = _198[1];
559
563
  //INFO : Offline
560
- var _197 = (0, react_1.useState)(0), offlineDataLength = _197[0], setOfflineDataLength = _197[1];
561
- var _198 = (0, react_1.useState)(false), offlineModal = _198[0], setOfflineModal = _198[1];
564
+ var _199 = (0, react_1.useState)(0), offlineDataLength = _199[0], setOfflineDataLength = _199[1];
565
+ var _200 = (0, react_1.useState)(false), offlineModal = _200[0], setOfflineModal = _200[1];
562
566
  // INFO: live-stream state — driven by socket connection and navigator.onLine
563
- var _199 = (0, react_1.useState)(false), isLive = _199[0], setIsLive = _199[1];
564
- var _200 = (0, react_1.useState)(false), isLiveOffline = _200[0], setIsLiveOffline = _200[1];
567
+ var _201 = (0, react_1.useState)(false), isLive = _201[0], setIsLive = _201[1];
568
+ var _202 = (0, react_1.useState)(false), isLiveOffline = _202[0], setIsLiveOffline = _202[1];
565
569
  // INFO: true when navigator is offline — used to switch ReadQueryHoc between
566
570
  // server reads (online, full pagination) and IndexedDB reads (offline, cached data).
567
571
  // Independent of SSE status so it works even when bareSocketName is not set.
568
- var _201 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _201[0], setIsNetworkOffline = _201[1];
572
+ var _203 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _203[0], setIsNetworkOffline = _203[1];
569
573
  var previousType = (0, react_1.useRef)(null);
570
574
  var previousSelectedData = (0, react_1.useRef)(null);
571
575
  var scrollSentinelRef = (0, react_1.useRef)(null);
@@ -785,7 +789,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
785
789
  var isSchemaHideMode = ((_10 = props.organise) === null || _10 === void 0 ? void 0 : _10.onChangeHide) ? true : false;
786
790
  // INFO: rows per page is a view setting the user can change, so it starts from
787
791
  // the persisted value and falls back to the consumer's limit
788
- var _202 = (0, react_1.useState)((_12 = (_11 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _11 !== void 0 ? _11 : props.limit) !== null && _12 !== void 0 ? _12 : 10), pageLimit = _202[0], setPageLimit = _202[1];
792
+ var _204 = (0, react_1.useState)((_12 = (_11 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _11 !== void 0 ? _11 : props.limit) !== null && _12 !== void 0 ? _12 : 10), pageLimit = _204[0], setPageLimit = _204[1];
789
793
  var limit = pageLimit;
790
794
  var isSavedViewsEnabled = !!((_13 = props.organise) === null || _13 === void 0 ? void 0 : _13.savedViews) && resolvedType === "list";
791
795
  // INFO: an app that stores views takes over from this browser's storage, so
@@ -810,18 +814,84 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
810
814
  setCursor("");
811
815
  setLastCursor("");
812
816
  };
813
- var _203 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _203.canUpdateRecord, canInlineUpdate = _203.canInlineUpdate, canBatchUpdate = _203.canBatchUpdate, canDeleteRecord = _203.canDeleteRecord;
814
- var isEditor = ((_17 = props.edit) === null || _17 === void 0 ? void 0 : _17.allEditable) ? true : false;
815
- var isOffline = (_18 = props.bareSettings) === null || _18 === void 0 ? void 0 : _18.bareOffline;
817
+ //=====================================================================================
818
+ //SECTION: Formula columns — sorted and filtered on their computed value
819
+ //=====================================================================================
820
+ // INFO: a formula has no stored field, so a server sort or filter on one
821
+ // matches nothing. monday sorts and filters a formula on the value it shows,
822
+ // so the list does the same: the request leaves the formula out, reads every
823
+ // matching row, and the rows are filtered and ordered here. Only
824
+ // type "formula" columns take part — math columns behave as they always have.
825
+ var formulaColumnIds = structure
826
+ .filter(function (eachModel) { return eachModel.type === "formula"; })
827
+ .map(function (eachModel) { return eachModel.id; });
828
+ // INFO: Firebase pages by document cursor and a union by skip, so neither
829
+ // can hand over the whole set — there formula columns are not offered for
830
+ // sorting or filtering, rather than ordering one page
831
+ var isFormulaViewSupported = !isFirebase && !((_18 = (_17 = props.organise) === null || _17 === void 0 ? void 0 : _17.unionCollections) === null || _18 === void 0 ? void 0 : _18.length);
832
+ var formulaSort = isFormulaViewSupported &&
833
+ (activeSortId === null || activeSortId === void 0 ? void 0 : activeSortId.sortId) &&
834
+ formulaColumnIds.includes(activeSortId.sortId)
835
+ ? activeSortId
836
+ : undefined;
837
+ var formulaFlexQueries = isFormulaViewSupported && formulaColumnIds.length > 0
838
+ ? (0, listModule_1.renderFlexFilterConditions)(flexFiltersDebounced, structure).filter(function (eachQuery) { var _a; return formulaColumnIds.includes((_a = eachQuery.queryId) !== null && _a !== void 0 ? _a : ""); })
839
+ : [];
840
+ var isFormulaView = !!formulaSort || formulaFlexQueries.length > 0;
841
+ // INFO: the columns the flex filters offer — formulas only where they can
842
+ // be filtered on
843
+ var flexFilterStructure = isFormulaViewSupported
844
+ ? structure
845
+ : structure.filter(function (eachModel) { return eachModel.type !== "formula"; });
846
+ // INFO: every matching row of a formula view, unsorted — pages are cut
847
+ // from it locally, so paging does not read the collection again
848
+ // INFO: the formula sort and filter the row cap was last announced for
849
+ var formulaCapNoticeRef = (0, react_1.useRef)("");
850
+ var formulaFullReadRef = (0, react_1.useRef)(null);
851
+ var handleApplyFormulaView = function (rows, displayRows) {
852
+ if (!isFormulaView)
853
+ return { rows: rows, displayRows: displayRows };
854
+ var entries = rows.map(function (eachRow, index) { return ({
855
+ row: eachRow,
856
+ displayRow: displayRows[index],
857
+ results: (0, formula_1.handleEvaluateFormulaRow)(eachRow, displayRows[index], structure),
858
+ }); });
859
+ var filtered = entries.filter(function (eachEntry) {
860
+ return formulaFlexQueries.every(function (eachQuery) {
861
+ var _a;
862
+ return (0, formula_1.handleMatchFormulaQuery)(eachEntry.results[(_a = eachQuery.queryId) !== null && _a !== void 0 ? _a : ""], eachQuery);
863
+ });
864
+ });
865
+ if (formulaSort) {
866
+ var direction_1 = formulaSort.type === "asc" ? 1 : -1;
867
+ filtered.sort(function (a, b) {
868
+ var aResult = a.results[formulaSort.sortId];
869
+ var bResult = b.results[formulaSort.sortId];
870
+ var aEmpty = (0, formula_1.handleIsFormulaEmpty)(aResult);
871
+ var bEmpty = (0, formula_1.handleIsFormulaEmpty)(bResult);
872
+ // INFO: blanks and errors sink to the bottom in either direction
873
+ if (aEmpty || bEmpty)
874
+ return aEmpty === bEmpty ? 0 : aEmpty ? 1 : -1;
875
+ return direction_1 * (0, formula_1.handleCompareFormulaResults)(aResult, bResult);
876
+ });
877
+ }
878
+ return {
879
+ rows: filtered.map(function (eachEntry) { return eachEntry.row; }),
880
+ displayRows: filtered.map(function (eachEntry) { return eachEntry.displayRow; }),
881
+ };
882
+ };
883
+ var _205 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _205.canUpdateRecord, canInlineUpdate = _205.canInlineUpdate, canBatchUpdate = _205.canBatchUpdate, canDeleteRecord = _205.canDeleteRecord;
884
+ var isEditor = ((_19 = props.edit) === null || _19 === void 0 ? void 0 : _19.allEditable) ? true : false;
885
+ var isOffline = (_20 = props.bareSettings) === null || _20 === void 0 ? void 0 : _20.bareOffline;
816
886
  // INFO: when bareOfflineNetworkAware is true, the save path is also gated on
817
887
  // the live network state — online saves go to the server even if bareOffline
818
888
  // is true, offline saves go to IDB as normal.
819
- var isOfflineNetworkListener = isOffline && ((_19 = props.bareSettings) === null || _19 === void 0 ? void 0 : _19.bareOfflineNetworkListener);
820
- var showId = (_20 = props.space) === null || _20 === void 0 ? void 0 : _20.showId;
889
+ var isOfflineNetworkListener = isOffline && ((_21 = props.bareSettings) === null || _21 === void 0 ? void 0 : _21.bareOfflineNetworkListener);
890
+ var showId = (_22 = props.space) === null || _22 === void 0 ? void 0 : _22.showId;
821
891
  var remainId = showId || selectedObjectStructureId ? true : false;
822
- var idField = ((_21 = props.space) === null || _21 === void 0 ? void 0 : _21.idField) || ((_22 = props.organise) === null || _22 === void 0 ? void 0 : _22.idField);
823
- var pipeline = (_23 = props === null || props === void 0 ? void 0 : props.space) === null || _23 === void 0 ? void 0 : _23.pipeline;
824
- if ((_24 = props.bareSettings) === null || _24 === void 0 ? void 0 : _24.bareListPipeline) {
892
+ var idField = ((_23 = props.space) === null || _23 === void 0 ? void 0 : _23.idField) || ((_24 = props.organise) === null || _24 === void 0 ? void 0 : _24.idField);
893
+ var pipeline = (_25 = props === null || props === void 0 ? void 0 : props.space) === null || _25 === void 0 ? void 0 : _25.pipeline;
894
+ if ((_26 = props.bareSettings) === null || _26 === void 0 ? void 0 : _26.bareListPipeline) {
825
895
  pipeline = pipeline
826
896
  ? __spreadArray(__spreadArray([], pipeline, true), props.bareSettings.bareListPipeline, true) : props.bareSettings.bareListPipeline;
827
897
  }
@@ -834,24 +904,24 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
834
904
  * three records came back instead of five files, and each tile received the
835
905
  * whole array rather than one file, so every one of them read "Attachment".
836
906
  */
837
- var fileViewColumnId = (_28 = (_27 = ((_26 = (_25 = props.organise) === null || _25 === void 0 ? void 0 : _25.extendedTabs) !== null && _26 !== void 0 ? _26 : []).find(function (eachTab) {
907
+ var fileViewColumnId = (_30 = (_29 = ((_28 = (_27 = props.organise) === null || _27 === void 0 ? void 0 : _27.extendedTabs) !== null && _28 !== void 0 ? _28 : []).find(function (eachTab) {
838
908
  return eachTab.viewType === "file" &&
839
909
  (0, utils_1.lowercaseTextToId)(eachTab.name) === viewType;
840
- })) === null || _27 === void 0 ? void 0 : _27.fileSettings) === null || _28 === void 0 ? void 0 : _28.columnId;
841
- var hasNavigation = ((_29 = props.organise) === null || _29 === void 0 ? void 0 : _29.handleNavigate) ? true : false;
910
+ })) === null || _29 === void 0 ? void 0 : _29.fileSettings) === null || _30 === void 0 ? void 0 : _30.columnId;
911
+ var hasNavigation = ((_31 = props.organise) === null || _31 === void 0 ? void 0 : _31.handleNavigate) ? true : false;
842
912
  var formColumn = "grid-cols-12";
843
- var useMobileView = (_31 = (_30 = props.bareSettings) === null || _30 === void 0 ? void 0 : _30.bareUpdateMobileView) !== null && _31 !== void 0 ? _31 : false;
913
+ var useMobileView = (_33 = (_32 = props.bareSettings) === null || _32 === void 0 ? void 0 : _32.bareUpdateMobileView) !== null && _33 !== void 0 ? _33 : false;
844
914
  var gridGap = useMobileView ? "gap-x-6 gap-y-2 md:gap-y-6" : "gap-6";
845
- var isActivityLog = (((_33 = (_32 = props.edit) === null || _32 === void 0 ? void 0 : _32.activityLog) === null || _33 === void 0 ? void 0 : _33.enableComments) &&
846
- ((_34 = props.edit) === null || _34 === void 0 ? void 0 : _34.activityLog.commentCollectionId)) ||
847
- (((_36 = (_35 = props.edit) === null || _35 === void 0 ? void 0 : _35.activityLog) === null || _36 === void 0 ? void 0 : _36.enableLogs) &&
848
- ((_37 = props.edit) === null || _37 === void 0 ? void 0 : _37.activityLog.logsCollectionId));
849
- var customPaginationSize = ((_38 = props.organise) === null || _38 === void 0 ? void 0 : _38.customPaginationCount)
915
+ var isActivityLog = (((_35 = (_34 = props.edit) === null || _34 === void 0 ? void 0 : _34.activityLog) === null || _35 === void 0 ? void 0 : _35.enableComments) &&
916
+ ((_36 = props.edit) === null || _36 === void 0 ? void 0 : _36.activityLog.commentCollectionId)) ||
917
+ (((_38 = (_37 = props.edit) === null || _37 === void 0 ? void 0 : _37.activityLog) === null || _38 === void 0 ? void 0 : _38.enableLogs) &&
918
+ ((_39 = props.edit) === null || _39 === void 0 ? void 0 : _39.activityLog.logsCollectionId));
919
+ var customPaginationSize = ((_40 = props.organise) === null || _40 === void 0 ? void 0 : _40.customPaginationCount)
850
920
  ? props.organise.customPaginationCount(size)
851
921
  : undefined;
852
922
  //TODO : Code - Pass ...devSettings, search dbEndpoint:
853
923
  var writeServerQuery = new writeQuery_1.WriteQuery({
854
- dbModule: (_39 = props.lib) === null || _39 === void 0 ? void 0 : _39.axios,
924
+ dbModule: (_41 = props.lib) === null || _41 === void 0 ? void 0 : _41.axios,
855
925
  dbType: devSettings.server,
856
926
  dbCollection: props.collectionId,
857
927
  dbEndpoint: devSettings.dbEndpoint,
@@ -859,7 +929,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
859
929
  dbUserToken: devSettings.dbUserToken,
860
930
  });
861
931
  var readServerQuery = new readQuery_1.ReadQuery({
862
- dbModule: (_40 = props.lib) === null || _40 === void 0 ? void 0 : _40.axios,
932
+ dbModule: (_42 = props.lib) === null || _42 === void 0 ? void 0 : _42.axios,
863
933
  dbType: devSettings.server,
864
934
  dbCollection: props.collectionId,
865
935
  dbEndpoint: devSettings.dbEndpoint,
@@ -867,12 +937,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
867
937
  dbUserToken: devSettings.dbUserToken,
868
938
  });
869
939
  var moreButtonPopUp = [
870
- ((_41 = props.edit) === null || _41 === void 0 ? void 0 : _41.allEditable) &&
940
+ ((_43 = props.edit) === null || _43 === void 0 ? void 0 : _43.allEditable) &&
871
941
  // INFO: the import runs on the server (importEndpoint), so a Firestore
872
942
  // datasheet served through one can import; only the browser-direct
873
943
  // Firebase client has no server to import through
874
944
  !isFirebaseClient &&
875
- !((_43 = (_42 = props.organise) === null || _42 === void 0 ? void 0 : _42.exportSettings) === null || _43 === void 0 ? void 0 : _43.hideImportCSV)
945
+ !((_45 = (_44 = props.organise) === null || _44 === void 0 ? void 0 : _44.exportSettings) === null || _45 === void 0 ? void 0 : _45.hideImportCSV)
876
946
  ? {
877
947
  text: "Import Excel",
878
948
  onClick: function () {
@@ -881,7 +951,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
881
951
  },
882
952
  }
883
953
  : null,
884
- !((_45 = (_44 = props.organise) === null || _44 === void 0 ? void 0 : _44.exportSettings) === null || _45 === void 0 ? void 0 : _45.hideExportCSV)
954
+ !((_47 = (_46 = props.organise) === null || _46 === void 0 ? void 0 : _46.exportSettings) === null || _47 === void 0 ? void 0 : _47.hideExportCSV)
885
955
  ? {
886
956
  text: "Export CSV",
887
957
  onClick: function () {
@@ -891,7 +961,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
891
961
  },
892
962
  }
893
963
  : null,
894
- !((_47 = (_46 = props.organise) === null || _46 === void 0 ? void 0 : _46.exportSettings) === null || _47 === void 0 ? void 0 : _47.hideExportExcel)
964
+ !((_49 = (_48 = props.organise) === null || _48 === void 0 ? void 0 : _48.exportSettings) === null || _49 === void 0 ? void 0 : _49.hideExportExcel)
895
965
  ? {
896
966
  text: "Export Excel",
897
967
  onClick: function () {
@@ -901,7 +971,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
901
971
  },
902
972
  }
903
973
  : null,
904
- !((_49 = (_48 = props.organise) === null || _48 === void 0 ? void 0 : _48.exportSettings) === null || _49 === void 0 ? void 0 : _49.hideExportPDF)
974
+ !((_51 = (_50 = props.organise) === null || _50 === void 0 ? void 0 : _50.exportSettings) === null || _51 === void 0 ? void 0 : _51.hideExportPDF)
905
975
  ? {
906
976
  text: "Export PDF",
907
977
  onClick: function () {
@@ -911,7 +981,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
911
981
  },
912
982
  }
913
983
  : null,
914
- !((_51 = (_50 = props.organise) === null || _50 === void 0 ? void 0 : _50.exportSettings) === null || _51 === void 0 ? void 0 : _51.hideExportQR)
984
+ !((_53 = (_52 = props.organise) === null || _52 === void 0 ? void 0 : _52.exportSettings) === null || _53 === void 0 ? void 0 : _53.hideExportQR)
915
985
  ? {
916
986
  text: "Export QR",
917
987
  onClick: function () {
@@ -921,7 +991,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
921
991
  },
922
992
  }
923
993
  : null,
924
- !((_53 = (_52 = props.organise) === null || _52 === void 0 ? void 0 : _52.exportSettings) === null || _53 === void 0 ? void 0 : _53.hideExportQR)
994
+ !((_55 = (_54 = props.organise) === null || _54 === void 0 ? void 0 : _54.exportSettings) === null || _55 === void 0 ? void 0 : _55.hideExportQR)
925
995
  ? {
926
996
  text: "Export QR(Data)",
927
997
  onClick: function () {
@@ -931,7 +1001,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
931
1001
  },
932
1002
  }
933
1003
  : null,
934
- !((_55 = (_54 = props.organise) === null || _54 === void 0 ? void 0 : _54.exportSettings) === null || _55 === void 0 ? void 0 : _55.hideExportPrint)
1004
+ !((_57 = (_56 = props.organise) === null || _56 === void 0 ? void 0 : _56.exportSettings) === null || _57 === void 0 ? void 0 : _57.hideExportPrint)
935
1005
  ? {
936
1006
  text: "Print",
937
1007
  onClick: function () {
@@ -941,7 +1011,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
941
1011
  },
942
1012
  }
943
1013
  : null,
944
- !((_57 = (_56 = props.organise) === null || _56 === void 0 ? void 0 : _56.exportSettings) === null || _57 === void 0 ? void 0 : _57.hideExportDraft)
1014
+ !((_59 = (_58 = props.organise) === null || _58 === void 0 ? void 0 : _58.exportSettings) === null || _59 === void 0 ? void 0 : _59.hideExportDraft)
945
1015
  ? {
946
1016
  text: filterDraft ? "Show All Items" : "Filter Draft",
947
1017
  onClick: function () {
@@ -950,7 +1020,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
950
1020
  }
951
1021
  : null,
952
1022
  ].filter(Boolean);
953
- if ((_58 = props.organise) === null || _58 === void 0 ? void 0 : _58.moreSettings)
1023
+ if ((_60 = props.organise) === null || _60 === void 0 ? void 0 : _60.moreSettings)
954
1024
  moreButtonPopUp = moreButtonPopUp.concat(props.organise.moreSettings);
955
1025
  //=====================================================================================
956
1026
  //SECTION: User Column Visibility Handlers
@@ -1186,7 +1256,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1186
1256
  }, additionalQuery !== null && additionalQuery !== void 0 ? additionalQuery : [], (_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareListFilterQuery, selectedTab);
1187
1257
  // INFO: Merge flex filter conditions into the query array (uses debounced state to avoid API calls on every keystroke)
1188
1258
  if (flexFiltersDebounced.length > 0) {
1189
- var flexQuery = (0, listModule_1.renderFlexFilterConditions)(flexFiltersDebounced, structure);
1259
+ // INFO: formula conditions never reach the server — the field is not
1260
+ // stored — and are applied to the rows by handleApplyFormulaView
1261
+ var flexQuery = (0, listModule_1.renderFlexFilterConditions)(flexFiltersDebounced, structure).filter(function (eachQuery) { var _a; return !formulaColumnIds.includes((_a = eachQuery.queryId) !== null && _a !== void 0 ? _a : ""); });
1190
1262
  if (flexQuery.length > 0) {
1191
1263
  if (query) {
1192
1264
  query = __spreadArray(__spreadArray([], query, true), flexQuery, true);
@@ -1261,7 +1333,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1261
1333
  //=====================================================================================
1262
1334
  //SECTION: Saved Views
1263
1335
  //=====================================================================================
1264
- var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_59 = props.organise) === null || _59 === void 0 ? void 0 : _59.persistKey, (_60 = devSettings.currentUser) === null || _60 === void 0 ? void 0 : _60.userEmail);
1336
+ var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_61 = props.organise) === null || _61 === void 0 ? void 0 : _61.persistKey, (_62 = devSettings.currentUser) === null || _62 === void 0 ? void 0 : _62.userEmail);
1265
1337
  (0, react_1.useEffect)(function () {
1266
1338
  if (isSavedViewsEnabled && !isAppViews)
1267
1339
  setSavedViews((0, viewStatePersistence_1.handleReadSavedViews)(savedViewsKey));
@@ -1316,7 +1388,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1316
1388
  var lastSentSharedViewsRef = (0, react_1.useRef)(null);
1317
1389
  (0, react_1.useEffect)(function () {
1318
1390
  lastSentSharedViewsRef.current = null;
1319
- }, [(_61 = props.organise) === null || _61 === void 0 ? void 0 : _61.sharedViews]);
1391
+ }, [(_63 = props.organise) === null || _63 === void 0 ? void 0 : _63.sharedViews]);
1320
1392
  var handleStoreSharedViews = function (update) {
1321
1393
  var _a, _b, _c;
1322
1394
  if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeSharedViews))
@@ -1352,13 +1424,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1352
1424
  /* eslint-disable */
1353
1425
  }, [
1354
1426
  isSavedViewsEnabled,
1355
- (_62 = props.organise) === null || _62 === void 0 ? void 0 : _62.initialSavedViewId,
1356
- (_63 = props.organise) === null || _63 === void 0 ? void 0 : _63.defaultSavedViewId,
1357
- (_64 = props.organise) === null || _64 === void 0 ? void 0 : _64.sharedViews,
1427
+ (_64 = props.organise) === null || _64 === void 0 ? void 0 : _64.initialSavedViewId,
1428
+ (_65 = props.organise) === null || _65 === void 0 ? void 0 : _65.defaultSavedViewId,
1429
+ (_66 = props.organise) === null || _66 === void 0 ? void 0 : _66.sharedViews,
1358
1430
  savedViews,
1359
1431
  ]);
1360
1432
  /* eslint-enable */
1361
- var defaultSavedViewIds = ((_66 = (_65 = props.organise) === null || _65 === void 0 ? void 0 : _65.defaultSavedViews) !== null && _66 !== void 0 ? _66 : [])
1433
+ var defaultSavedViewIds = ((_68 = (_67 = props.organise) === null || _67 === void 0 ? void 0 : _67.defaultSavedViews) !== null && _68 !== void 0 ? _68 : [])
1362
1434
  .map(function (eachView) { var _a; return (_a = eachView.id) !== null && _a !== void 0 ? _a : ""; })
1363
1435
  .join("|");
1364
1436
  // INFO: keyed on the ids, not the array, so an inline literal passed on every
@@ -1623,7 +1695,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1623
1695
  var isOtherListReturn = !(0, viewStatePersistence_1.handleIsLastDrill)(props.collectionId, (_c = props.organise) === null || _c === void 0 ? void 0 : _c.persistKey);
1624
1696
  scrollRestoredRef.current = isSwitch || isOtherListReturn;
1625
1697
  /* eslint-disable */
1626
- }, [props.collectionId, (_67 = props.organise) === null || _67 === void 0 ? void 0 : _67.persistKey]);
1698
+ }, [props.collectionId, (_69 = props.organise) === null || _69 === void 0 ? void 0 : _69.persistKey]);
1627
1699
  /* eslint-enable */
1628
1700
  // INFO: wait a frame — rows land in state one tick before layout
1629
1701
  (0, react_1.useEffect)(function () {
@@ -1658,7 +1730,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1658
1730
  (0, react_1.useEffect)(function () {
1659
1731
  handleOfflinePrefetch();
1660
1732
  /* eslint-disable */
1661
- }, [props.collectionId, (_68 = props.bareSettings) === null || _68 === void 0 ? void 0 : _68.bareOffline]);
1733
+ }, [props.collectionId, (_70 = props.bareSettings) === null || _70 === void 0 ? void 0 : _70.bareOffline]);
1662
1734
  /* eslint-enable */
1663
1735
  // INFO: MRQ polling — calls handleRefresh every N ms (e.g. 1500) as a fallback.
1664
1736
  // Calls through handleRefreshRef so the interval always dispatches the latest
@@ -1678,7 +1750,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1678
1750
  }, interval);
1679
1751
  return function () { return clearInterval(timer); };
1680
1752
  /* eslint-disable */
1681
- }, [(_69 = props.bareSettings) === null || _69 === void 0 ? void 0 : _69.barePollingInterval, isLive, isNetworkOffline]);
1753
+ }, [(_71 = props.bareSettings) === null || _71 === void 0 ? void 0 : _71.barePollingInterval, isLive, isNetworkOffline]);
1682
1754
  /* eslint-enable */
1683
1755
  // INFO: Pub/Sub → SSE live-stream — driven by bareSettings.bareSocketName
1684
1756
  // EventSource URL: {sseEndpoint}/{room}?bm_apiToken={token}
@@ -1720,7 +1792,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1720
1792
  };
1721
1793
  /* eslint-disable */
1722
1794
  }, [
1723
- (_70 = props.bareSettings) === null || _70 === void 0 ? void 0 : _70.bareSocketName,
1795
+ (_72 = props.bareSettings) === null || _72 === void 0 ? void 0 : _72.bareSocketName,
1724
1796
  props.collectionId,
1725
1797
  props.devSettings.sseEndpoint,
1726
1798
  props.devSettings.dbAPIToken,
@@ -1980,10 +2052,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1980
2052
  props.collectionId,
1981
2053
  props.model,
1982
2054
  props.localURLEndpoint,
1983
- (_71 = props.organise) === null || _71 === void 0 ? void 0 : _71.extendedTabs,
1984
- (_72 = props.organise) === null || _72 === void 0 ? void 0 : _72.viewId,
1985
- (_73 = props.organise) === null || _73 === void 0 ? void 0 : _73.additionalQuery,
1986
- (_74 = props.organise) === null || _74 === void 0 ? void 0 : _74.groupBy,
2055
+ (_73 = props.organise) === null || _73 === void 0 ? void 0 : _73.extendedTabs,
2056
+ (_74 = props.organise) === null || _74 === void 0 ? void 0 : _74.viewId,
2057
+ (_75 = props.organise) === null || _75 === void 0 ? void 0 : _75.additionalQuery,
2058
+ (_76 = props.organise) === null || _76 === void 0 ? void 0 : _76.groupBy,
1987
2059
  resolvedType,
1988
2060
  ]);
1989
2061
  /**
@@ -2124,7 +2196,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2124
2196
  };
2125
2197
  }, 100);
2126
2198
  return function () { return clearTimeout(timeoutId); };
2127
- }, [(_75 = props.organise) === null || _75 === void 0 ? void 0 : _75.showReadFloatingNav, resolvedType, props.id, loading]);
2199
+ }, [(_77 = props.organise) === null || _77 === void 0 ? void 0 : _77.showReadFloatingNav, resolvedType, props.id, loading]);
2128
2200
  (0, react_1.useEffect)(function () {
2129
2201
  if (resolvedType !== "read")
2130
2202
  return;
@@ -2604,7 +2676,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2604
2676
  };
2605
2677
  var handleReadQueryHocSort = function (query) {
2606
2678
  // INFO: Use persisted sort when persistViewState is active, otherwise fall back to prop sort
2607
- var sort = activeSortId || undefined;
2679
+ // INFO: a formula sort is applied to the rows, so the server gets none
2680
+ var sort = (activeSortId === null || activeSortId === void 0 ? void 0 : activeSortId.sortId) && formulaColumnIds.includes(activeSortId.sortId)
2681
+ ? undefined
2682
+ : activeSortId || undefined;
2608
2683
  if (isFirebase) {
2609
2684
  // INFO: Firestore requires the first orderBy to match the range/startAt
2610
2685
  // field, so a search query always forces the sort onto the search column
@@ -2779,8 +2854,123 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2779
2854
  cond.skip = (0, unionPagination_1.handleGetUnionPageSkip)(pageIndex, limit);
2780
2855
  cond.sort = (0, unionPagination_1.handleBuildUnionPageSort)(handleReadQueryHocSort(query));
2781
2856
  }
2857
+ // INFO: sorting or filtering on a formula reads the matching rows, as
2858
+ // monday orders the whole board and not just the page on screen — up to
2859
+ // FORMULA_VIEW_MAX_ROWS, so one header click cannot pull a whole large
2860
+ // collection into the browser. The cursor is left out so paging cuts from
2861
+ // the rows already read.
2862
+ if (isFormulaView) {
2863
+ cond.limit = exports.FORMULA_VIEW_MAX_ROWS;
2864
+ cond.stopLimit = undefined;
2865
+ cond.cursor = undefined;
2866
+ cond.skip = 0;
2867
+ // INFO: past the cap the server picks which rows come back, so a fixed
2868
+ // order keeps those rows the same from one read to the next
2869
+ if (!cond.sort)
2870
+ cond.sort = { sortId: serverId, type: "asc" };
2871
+ }
2782
2872
  return cond;
2783
2873
  };
2874
+ // INFO: views that draw every row at once rather than a page of them — the
2875
+ // same views handleReadQueryHocCond reads in full
2876
+ var handleCheckFullSetView = function () {
2877
+ var _a;
2878
+ return (!!selectedTab &&
2879
+ (selectedTab.viewType === "calendar" ||
2880
+ selectedTab.viewType === "map" ||
2881
+ selectedTab.viewType === "timeline")) ||
2882
+ (!!groupId && !((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW));
2883
+ };
2884
+ var handleShowFormulaPage = function (index) {
2885
+ var _a;
2886
+ var cached = formulaFullReadRef.current;
2887
+ if (!cached)
2888
+ return;
2889
+ var view = handleApplyFormulaView(cached.rows, cached.displayRows);
2890
+ // INFO: page mode shows one page at a time, and so does NewTable in
2891
+ // cursor mode — it draws whatever rows it is given, where the legacy
2892
+ // Table cuts cursor pages itself. Scroll mode holds every row. A calendar,
2893
+ // map, timeline or legacy grouped list draws every row, so it is never cut.
2894
+ var paginationType = renderResolvedPaginationType();
2895
+ if (!handleCheckFullSetView() &&
2896
+ (paginationType === "page" ||
2897
+ (paginationType === "cursor" && !!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW)))) {
2898
+ var start = index * limit;
2899
+ handleSetListData(view.rows.slice(start, start + limit), view.displayRows.slice(start, start + limit));
2900
+ }
2901
+ else {
2902
+ handleSetListData(view.rows, view.displayRows);
2903
+ setCursor("");
2904
+ }
2905
+ setSize(view.rows.length);
2906
+ setTableLoading(false);
2907
+ };
2908
+ // INFO: adding or changing a formula changes no stored value, so nothing is
2909
+ // read again — the formula cells on screen are worked out afresh, as a
2910
+ // monday formula updates the moment it is set
2911
+ var formulaSignature = JSON.stringify(structure
2912
+ .filter(function (eachModel) { return eachModel.type === "formula"; })
2913
+ .map(function (eachModel) { return [eachModel.id, eachModel.formulaExpression]; }));
2914
+ var previousFormulaSignatureRef = (0, react_1.useRef)(formulaSignature);
2915
+ (0, react_1.useEffect)(function () {
2916
+ if (previousFormulaSignatureRef.current === formulaSignature)
2917
+ return;
2918
+ previousFormulaSignatureRef.current = formulaSignature;
2919
+ var handleRecomputeCells = function (rows, displayRows) {
2920
+ return displayRows.map(function (eachDisplayRow, index) {
2921
+ if (!eachDisplayRow || !rows[index])
2922
+ return eachDisplayRow;
2923
+ var nextDisplayRow = __assign({}, eachDisplayRow);
2924
+ var results = (0, formula_1.handleEvaluateFormulaRow)(rows[index], eachDisplayRow, structure);
2925
+ Object.entries(results).forEach(function (_a) {
2926
+ var columnId = _a[0], result = _a[1];
2927
+ nextDisplayRow[columnId] = (0, formula_1.handleFormatFormulaValue)(result);
2928
+ });
2929
+ return nextDisplayRow;
2930
+ });
2931
+ };
2932
+ var cached = formulaFullReadRef.current;
2933
+ if (cached) {
2934
+ cached.displayRows = handleRecomputeCells(cached.rows, cached.displayRows);
2935
+ handleShowFormulaPage(pageIndex);
2936
+ return;
2937
+ }
2938
+ if (tableDataRef.current.length === 0)
2939
+ return;
2940
+ handleSetListData(tableDataRef.current, handleRecomputeCells(tableDataRef.current, spaceTableDataRef.current));
2941
+ /* eslint-disable */
2942
+ }, [formulaSignature]);
2943
+ /* eslint-enable */
2944
+ // INFO: the read request of the previous render. A formula sort or filter
2945
+ // is not part of the request, so on a view that already reads every row
2946
+ // (calendar, map, timeline, legacy grouped) turning one on changes nothing
2947
+ // the reader would see — then the read is asked for here.
2948
+ var formulaCondKeyRef = (0, react_1.useRef)("");
2949
+ (0, react_1.useEffect)(function () {
2950
+ var _a;
2951
+ if (formulaFullReadRef.current) {
2952
+ // INFO: a page, page-size or formula change needs no new read — the
2953
+ // matching rows are already held
2954
+ handleShowFormulaPage(pageIndex);
2955
+ }
2956
+ else if (isFormulaView &&
2957
+ formulaCondKeyRef.current === JSON.stringify(handleReadQueryHocCond())) {
2958
+ (_a = listRQueryHocRef.current) === null || _a === void 0 ? void 0 : _a.handleRefresh();
2959
+ }
2960
+ /* eslint-disable */
2961
+ }, [
2962
+ pageIndex,
2963
+ limit,
2964
+ JSON.stringify(formulaSort !== null && formulaSort !== void 0 ? formulaSort : null),
2965
+ JSON.stringify(formulaFlexQueries),
2966
+ ]);
2967
+ /* eslint-enable */
2968
+ (0, react_1.useEffect)(function () {
2969
+ // INFO: a table without formula columns does no formula bookkeeping
2970
+ if (formulaColumnIds.length === 0)
2971
+ return;
2972
+ formulaCondKeyRef.current = JSON.stringify(handleReadQueryHocCond());
2973
+ });
2784
2974
  var handleSelectIds = function (selectedIds) {
2785
2975
  var _a;
2786
2976
  setSelectedIds(selectedIds);
@@ -2914,16 +3104,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2914
3104
  }
2915
3105
  };
2916
3106
  var handleGetListData = function (responseData, type, rowId, requestCond) { return __awaiter(void 0, void 0, void 0, function () {
2917
- var dataList, prettierDataList, clonedTableData, clonedSpaceTableData, dummyPrettierDataList_1, resolvedData, selectedIndex_1, isScrollMode, newTableData, newPrettierTableData, isFirstPage, listedIds_1, newIndexes, isExists, cursorResp, lastDataId, err_1;
2918
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2919
- return __generator(this, function (_l) {
2920
- switch (_l.label) {
3107
+ var dataList, prettierDataList, clonedTableData, clonedSpaceTableData, dummyPrettierDataList_1, resolvedData, selectedIndex_1, cachedFormulaRows, cachedIndex, capKey, isScrollMode, newTableData, newPrettierTableData, isFirstPage, listedIds_1, newIndexes, isExists, cursorResp, lastDataId, err_1;
3108
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
3109
+ return __generator(this, function (_p) {
3110
+ switch (_p.label) {
2921
3111
  case 0:
2922
3112
  dataList = [];
2923
3113
  prettierDataList = [];
2924
- _l.label = 1;
3114
+ _p.label = 1;
2925
3115
  case 1:
2926
- _l.trys.push([1, 7, , 8]);
3116
+ _p.trys.push([1, 7, , 8]);
2927
3117
  clonedTableData = __spreadArray([], tableDataRef.current, true);
2928
3118
  clonedSpaceTableData = __spreadArray([], spaceTableDataRef.current, true);
2929
3119
  if (!(responseData === null || responseData === void 0 ? void 0 : responseData.data)) return [3 /*break*/, 6];
@@ -2931,7 +3121,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2931
3121
  dummyPrettierDataList_1 = [];
2932
3122
  return [4 /*yield*/, handleResolveOfflineReferences(responseData.data)];
2933
3123
  case 2:
2934
- resolvedData = _l.sent();
3124
+ resolvedData = _p.sent();
2935
3125
  resolvedData.map(function (eachData) {
2936
3126
  var _a, _b;
2937
3127
  var tempData = eachData;
@@ -2943,7 +3133,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2943
3133
  return [3 /*break*/, 5];
2944
3134
  case 3: return [4 /*yield*/, (0, listModule_1.handleListDataBasedOnModel)(responseData === null || responseData === void 0 ? void 0 : responseData.data, props.devSettings, (_b = props.lib) === null || _b === void 0 ? void 0 : _b.axios, structure, (_c = props.organise) === null || _c === void 0 ? void 0 : _c.handleNavigate, setActivityModal, setActivityId, isActivityLog ? (_d = props.edit) === null || _d === void 0 ? void 0 : _d.activityLog : undefined, (_e = props.bareSettings) === null || _e === void 0 ? void 0 : _e.bareListActionBtns, !canUpdateRecord, undefined, handleSeedListReferenceOptions)];
2945
3135
  case 4:
2946
- prettierDataList = _l.sent();
3136
+ prettierDataList = _p.sent();
2947
3137
  if (props.groupId) {
2948
3138
  prettierDataList.forEach(function (item, idx) {
2949
3139
  var _a, _b;
@@ -2952,7 +3142,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2952
3142
  }
2953
3143
  });
2954
3144
  }
2955
- _l.label = 5;
3145
+ _p.label = 5;
2956
3146
  case 5:
2957
3147
  (_f = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _f === void 0 ? void 0 : _f.map(function (eachData, eachIndex) {
2958
3148
  if (eachData["_id"]) {
@@ -2978,7 +3168,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2978
3168
  return null;
2979
3169
  });
2980
3170
  dataList = responseData.data;
2981
- _l.label = 6;
3171
+ _p.label = 6;
2982
3172
  case 6:
2983
3173
  if (type === "update" || type === "create") {
2984
3174
  try {
@@ -2998,15 +3188,54 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2998
3188
  clonedTableData.push((_h = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _h === void 0 ? void 0 : _h[0]);
2999
3189
  clonedSpaceTableData.push(prettierDataList === null || prettierDataList === void 0 ? void 0 : prettierDataList[0]);
3000
3190
  }
3001
- handleSetListData(clonedTableData, clonedSpaceTableData);
3191
+ cachedFormulaRows = formulaFullReadRef.current;
3192
+ if (cachedFormulaRows) {
3193
+ cachedIndex = cachedFormulaRows.rows.findIndex(function (eachData) {
3194
+ return (eachData === null || eachData === void 0 ? void 0 : eachData.id) === rowId || (eachData === null || eachData === void 0 ? void 0 : eachData.recordId) === rowId;
3195
+ });
3196
+ if (type === "update" && cachedIndex > -1) {
3197
+ cachedFormulaRows.rows[cachedIndex] = (_j = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _j === void 0 ? void 0 : _j[0];
3198
+ cachedFormulaRows.displayRows[cachedIndex] =
3199
+ prettierDataList === null || prettierDataList === void 0 ? void 0 : prettierDataList[0];
3200
+ }
3201
+ else if (type === "create") {
3202
+ cachedFormulaRows.rows.push((_k = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _k === void 0 ? void 0 : _k[0]);
3203
+ cachedFormulaRows.displayRows.push(prettierDataList === null || prettierDataList === void 0 ? void 0 : prettierDataList[0]);
3204
+ }
3205
+ handleShowFormulaPage(pageIndex);
3206
+ }
3207
+ else
3208
+ handleSetListData(clonedTableData, clonedSpaceTableData);
3002
3209
  }
3003
3210
  catch (err) { }
3004
3211
  }
3212
+ else if (isFormulaView &&
3213
+ (requestCond === null || requestCond === void 0 ? void 0 : requestCond.limit) === exports.FORMULA_VIEW_MAX_ROWS &&
3214
+ !(requestCond === null || requestCond === void 0 ? void 0 : requestCond.cursor)) {
3215
+ // INFO: a formula view's read — held, then filtered, ordered and paged
3216
+ // from here
3217
+ formulaFullReadRef.current = {
3218
+ rows: dataList,
3219
+ displayRows: prettierDataList,
3220
+ };
3221
+ handleShowFormulaPage(pageIndex);
3222
+ capKey = JSON.stringify([formulaSort, formulaFlexQueries]);
3223
+ if (((_l = responseData.count) !== null && _l !== void 0 ? _l : 0) > dataList.length &&
3224
+ formulaCapNoticeRef.current !== capKey) {
3225
+ formulaCapNoticeRef.current = capKey;
3226
+ setNotification({
3227
+ type: true,
3228
+ title: "Sorted and filtered within ".concat(exports.FORMULA_VIEW_MAX_ROWS.toLocaleString("en-US"), " rows"),
3229
+ msg: "A formula sort or filter reads at most ".concat(exports.FORMULA_VIEW_MAX_ROWS.toLocaleString("en-US"), " of the ").concat(Number(responseData.count).toLocaleString("en-US"), " matching rows."),
3230
+ });
3231
+ }
3232
+ }
3005
3233
  else {
3234
+ formulaFullReadRef.current = null;
3006
3235
  isScrollMode = renderCheckScrollMode();
3007
3236
  if (!isScrollMode && !isFirebase) {
3008
3237
  handleSetListData(dataList, prettierDataList);
3009
- setSize((_j = responseData.count) !== null && _j !== void 0 ? _j : 0);
3238
+ setSize((_m = responseData.count) !== null && _m !== void 0 ? _m : 0);
3010
3239
  if (renderCheckGroupPaging())
3011
3240
  handleLoadGroupFirstPages();
3012
3241
  }
@@ -3066,13 +3295,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3066
3295
  }
3067
3296
  setCursor(cursorResp);
3068
3297
  if (isScrollMode && !isFirebase) {
3069
- setSize((_k = responseData.count) !== null && _k !== void 0 ? _k : 0);
3298
+ setSize((_o = responseData.count) !== null && _o !== void 0 ? _o : 0);
3070
3299
  }
3071
3300
  }
3072
3301
  }
3073
3302
  return [3 /*break*/, 8];
3074
3303
  case 7:
3075
- err_1 = _l.sent();
3304
+ err_1 = _p.sent();
3076
3305
  return [3 /*break*/, 8];
3077
3306
  case 8:
3078
3307
  // INFO: inline writes update rows too, but do not finish a pending list read.
@@ -6340,7 +6569,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
6340
6569
  });
6341
6570
  }); };
6342
6571
  var handleExportCSVData = function (downloadLinkOnly, printOnly) { return __awaiter(void 0, void 0, void 0, function () {
6343
- var exportQueryList, baseUrl, apiEndpoint, reqData, res, dataList, csvDownloadLink, notificaitonMsg, err_27;
6572
+ var exportQueryList, formulaRows, kept, baseUrl, apiEndpoint, reqData, res, dataList, csvDownloadLink, notificaitonMsg, err_27;
6344
6573
  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;
6345
6574
  return __generator(this, function (_1) {
6346
6575
  switch (_1.label) {
@@ -6352,6 +6581,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
6352
6581
  if (props.bareSettings.bareListFilterQuery)
6353
6582
  exportQueryList.push.apply(exportQueryList, props.bareSettings.bareListFilterQuery);
6354
6583
  }
6584
+ formulaRows = formulaFullReadRef.current;
6585
+ if (formulaFlexQueries.length > 0 && formulaRows) {
6586
+ kept = handleApplyFormulaView(formulaRows.rows, formulaRows.displayRows).rows;
6587
+ exportQueryList.push({
6588
+ type: "in",
6589
+ queryId: serverId,
6590
+ value: kept.map(function (eachRow) { return eachRow === null || eachRow === void 0 ? void 0 : eachRow[serverId]; }),
6591
+ });
6592
+ }
6355
6593
  baseUrl = props.devSettings.functionEndpoint;
6356
6594
  apiEndpoint = baseUrl;
6357
6595
  switch (exportType) {
@@ -7037,6 +7275,35 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7037
7275
  // INFO: in schema-hide mode a hidden column must stay listed so it can be
7038
7276
  // shown again; in per-user mode a developer-hidden column is never togglable
7039
7277
  var getViewSettingsColumns = function () { return getTogglableColumns(isSchemaHideMode); };
7278
+ // INFO: the header sort options, unchanged for every other column. Formula
7279
+ // columns sort on their computed value, so they are added where that is
7280
+ // supported and left out where it is not (Firebase, union).
7281
+ var handleGetSortOptions = function () {
7282
+ var _a, _b, _c;
7283
+ 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
7284
+ ? getViewSettingsColumns().map(function (eachColumn) {
7285
+ var _a;
7286
+ return ({
7287
+ key: eachColumn.id,
7288
+ label: (_a = eachColumn.name) !== null && _a !== void 0 ? _a : eachColumn.id,
7289
+ });
7290
+ })
7291
+ : undefined);
7292
+ if (!baseOptions || formulaColumnIds.length === 0)
7293
+ return baseOptions;
7294
+ var otherOptions = baseOptions.filter(function (eachOption) { return !formulaColumnIds.includes(eachOption.key); });
7295
+ if (!isFormulaViewSupported)
7296
+ return otherOptions;
7297
+ return __spreadArray(__spreadArray([], otherOptions, true), structure
7298
+ .filter(function (eachModel) { return eachModel.type === "formula"; })
7299
+ .map(function (eachModel) {
7300
+ var _a;
7301
+ return ({
7302
+ key: eachModel.id,
7303
+ label: (_a = eachModel.name) !== null && _a !== void 0 ? _a : eachModel.id,
7304
+ });
7305
+ }), true);
7306
+ };
7040
7307
  var getIsColumnHidden = function (column) {
7041
7308
  return isSchemaHideMode
7042
7309
  ? !!column.hide
@@ -7093,7 +7360,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7093
7360
  react_1.default.createElement("p", { className: "text-sm font-medium ".concat(labelColor) }, "Sort"),
7094
7361
  react_1.default.createElement("div", { className: "mt-1 flex flex-row items-center gap-x-2" },
7095
7362
  react_1.default.createElement("div", { className: "grow min-w-0" },
7096
- react_1.default.createElement(select_1.Select, { id: "dtw-view-sort-column", portalDropdown: true, label: "", containerClassName: "min-w-0", value: (_b = activeSortId === null || activeSortId === void 0 ? void 0 : activeSortId.sortId) !== null && _b !== void 0 ? _b : "", placeholder: "Column", darkMode: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.darkMode, options: viewColumns.map(function (eachColumn) {
7363
+ react_1.default.createElement(select_1.Select, { id: "dtw-view-sort-column", portalDropdown: true, label: "", containerClassName: "min-w-0", value: (_b = activeSortId === null || activeSortId === void 0 ? void 0 : activeSortId.sortId) !== null && _b !== void 0 ? _b : "", placeholder: "Column", darkMode: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.darkMode, options: viewColumns
7364
+ .filter(function (eachColumn) {
7365
+ return isFormulaViewSupported || eachColumn.type !== "formula";
7366
+ })
7367
+ .map(function (eachColumn) {
7097
7368
  var _a;
7098
7369
  return ({
7099
7370
  key: eachColumn.id,
@@ -8329,7 +8600,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8329
8600
  };
8330
8601
  // INFO: Desktop — PopUp (hidden on mobile)
8331
8602
  actionElementList.push(react_1.default.createElement("div", { className: "hidden md:block" },
8332
- react_1.default.createElement(popUp_1.PopUp, { darkMode: (_y = props.organise) === null || _y === void 0 ? void 0 : _y.darkMode, ctaComp: flexFilterIconBtn(), renderComp: (0, flexFilter_1.renderFlexFilterPopupContent)(flexFilters, structure, devSettings, dbModule, flexFilterReferenceOptions, flexFilterReferenceSearch, flexActions, (_z = props.bareSettings) === null || _z === void 0 ? void 0 : _z.bareListFilterQuery, searchInput, (_0 = props.bareSettings) === null || _0 === void 0 ? void 0 : _0.bareListFilterAddComponent, undefined, {
8603
+ react_1.default.createElement(popUp_1.PopUp, { darkMode: (_y = props.organise) === null || _y === void 0 ? void 0 : _y.darkMode, ctaComp: flexFilterIconBtn(), renderComp: (0, flexFilter_1.renderFlexFilterPopupContent)(flexFilters, flexFilterStructure, devSettings, dbModule, flexFilterReferenceOptions, flexFilterReferenceSearch, flexActions, (_z = props.bareSettings) === null || _z === void 0 ? void 0 : _z.bareListFilterQuery, searchInput, (_0 = props.bareSettings) === null || _0 === void 0 ? void 0 : _0.bareListFilterAddComponent, undefined, {
8333
8604
  darkMode: (_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.darkMode,
8334
8605
  darkModeBg: (_2 = props.organise) === null || _2 === void 0 ? void 0 : _2.darkModeBg,
8335
8606
  }), anchor: "right", excludePortalIds: ["datepicker-portal", "select-portal"], lib: { Transition: (_3 = props === null || props === void 0 ? void 0 : props.lib) === null || _3 === void 0 ? void 0 : _3.Transition } })));
@@ -8337,7 +8608,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8337
8608
  actionElementList.push(react_1.default.createElement("div", { className: "block md:hidden" },
8338
8609
  !((_4 = props.bareSettings) === null || _4 === void 0 ? void 0 : _4.bareListMobileFloatingSearch) &&
8339
8610
  flexFilterIconBtn(true),
8340
- (0, flexFilter_1.renderFlexFilterModal)(flexFilterModalOpen, flexFilters, structure, devSettings, dbModule, flexFilterReferenceOptions, flexFilterReferenceSearch, flexActions, function () { return setFlexFilterModalOpen(false); }, (_5 = props.bareSettings) === null || _5 === void 0 ? void 0 : _5.bareListFilterQuery, searchInput, (_6 = props.bareSettings) === null || _6 === void 0 ? void 0 : _6.bareListFilterAddComponent, {
8611
+ (0, flexFilter_1.renderFlexFilterModal)(flexFilterModalOpen, flexFilters, flexFilterStructure, devSettings, dbModule, flexFilterReferenceOptions, flexFilterReferenceSearch, flexActions, function () { return setFlexFilterModalOpen(false); }, (_5 = props.bareSettings) === null || _5 === void 0 ? void 0 : _5.bareListFilterQuery, searchInput, (_6 = props.bareSettings) === null || _6 === void 0 ? void 0 : _6.bareListFilterAddComponent, {
8341
8612
  darkMode: (_7 = props.organise) === null || _7 === void 0 ? void 0 : _7.darkMode,
8342
8613
  darkModeBg: (_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.darkModeBg,
8343
8614
  })));
@@ -8714,6 +8985,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8714
8985
  return false;
8715
8986
  if (!groupId || isFirebase)
8716
8987
  return false;
8988
+ // INFO: a formula sort or filter needs every row read and ordered at
8989
+ // once; band pages come straight from the server without it, so the bands
8990
+ // are built from the formula-ordered rows instead
8991
+ if (isFormulaView)
8992
+ return false;
8717
8993
  // INFO: a union list pages by skip, which a per-band cursor cannot express,
8718
8994
  // so it keeps the single pager and groups the loaded rows
8719
8995
  if ((_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.unionCollections) === null || _b === void 0 ? void 0 : _b.length)
@@ -9234,7 +9510,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9234
9510
  });
9235
9511
  };
9236
9512
  var renderGroupTable = function (multipleSelect) {
9237
- 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;
9513
+ 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;
9238
9514
  if (groupId && !((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW)) {
9239
9515
  var groupAttributeDS_1 = structure.find(function (eachDS) { return eachDS.id === groupId; });
9240
9516
  var groupedSpaceTableData = spaceTableData.reduce(function (acc, eachData) {
@@ -9262,7 +9538,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9262
9538
  }
9263
9539
  else {
9264
9540
  return Object.entries(groupedSpaceTableData).map(function (_a) {
9265
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
9541
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
9266
9542
  var eachKey = _a[0], eachValue = _a[1];
9267
9543
  var dataList = eachValue;
9268
9544
  var ids = (dataList === null || dataList === void 0 ? void 0 : dataList.map(function (eachData) { return eachData._id; })) || [];
@@ -9273,7 +9549,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9273
9549
  react_1.default.createElement("div", { className: "font-semibold text-md mt-5" },
9274
9550
  "Group By ",
9275
9551
  eachKey),
9276
- react_1.default.createElement(table_1.Table, { showId: showId, paginationType: renderResolvedPaginationType(), data: filterTableData, spaceData: dataList !== null && dataList !== void 0 ? dataList : [], referencesOptions: listReferencesOptions, size: (_b = dataList.length) !== null && _b !== void 0 ? _b : 0, limit: 5, cursor: "", loading: tableLoading !== null && tableLoading !== void 0 ? tableLoading : true, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, selectAllText: selectAll ? "from filter" : "", disableSelectFullData: (_d = (_c = props.organise) === null || _c === void 0 ? void 0 : _c.disableSelectFullData) === null || _d === void 0 ? void 0 : _d.table, multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
9552
+ react_1.default.createElement(table_1.Table, { showId: showId, paginationType: renderResolvedPaginationType(), data: filterTableData, spaceData: dataList !== null && dataList !== void 0 ? dataList : [], referencesOptions: listReferencesOptions, size: (_b = dataList.length) !== null && _b !== void 0 ? _b : 0, limit: 5, cursor: "", loading: tableLoading !== null && tableLoading !== void 0 ? tableLoading : true, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, selectAllText: selectAll ? "from filter" : "", disableSelectFullData: ((_d = (_c = props.organise) === null || _c === void 0 ? void 0 : _c.disableSelectFullData) === null || _d === void 0 ? void 0 : _d.table) ||
9553
+ isFormulaView, multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
9277
9554
  selectedIds.length > 0 &&
9278
9555
  canBatchUpdate &&
9279
9556
  !((_e = props.bareSettings) === null || _e === void 0 ? void 0 : _e.bareHideTableExtraMultipleAction) && (react_1.default.createElement(react_1.default.Fragment, null,
@@ -9308,15 +9585,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9308
9585
  // INFO: per-column header filter is replaced by the flex filters
9309
9586
  filterEnabled: false,
9310
9587
  sortId: activeSortId,
9311
- sortOptions: (_t = (_s = (_r = props.organise) === null || _r === void 0 ? void 0 : _r.renderReferenceLabelOptions) === null || _s === void 0 ? void 0 : _s.call(_r)) !== null && _t !== void 0 ? _t : (isViewSettingsEnabled
9312
- ? getViewSettingsColumns().map(function (eachColumn) {
9313
- var _a;
9314
- return ({
9315
- key: eachColumn.id,
9316
- label: (_a = eachColumn.name) !== null && _a !== void 0 ? _a : eachColumn.id,
9317
- });
9318
- })
9319
- : undefined),
9588
+ sortOptions: handleGetSortOptions(),
9320
9589
  onSortColumn: handleSortColumn,
9321
9590
  // INFO: header drag and the panel handle run the same reorder, so the
9322
9591
  // order persists identically whichever one the user grabs
@@ -9354,7 +9623,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9354
9623
  });
9355
9624
  }); },
9356
9625
  }, onObjectEdit: handleObjectCellEdit, addable: {
9357
- active: ((_u = props.edit) === null || _u === void 0 ? void 0 : _u.listAddable) ? true : false,
9626
+ active: ((_r = props.edit) === null || _r === void 0 ? void 0 : _r.listAddable) ? true : false,
9358
9627
  onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
9359
9628
  var createdId;
9360
9629
  return __generator(this, function (_a) {
@@ -9368,7 +9637,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9368
9637
  }
9369
9638
  });
9370
9639
  }); },
9371
- }, darkMode: (_v = props.organise) === null || _v === void 0 ? void 0 : _v.darkMode, hidePagination: true, disableEllipsisOnLongWord: (_w = props.organise) === null || _w === void 0 ? void 0 : _w.disableEllipsisOnLongWord })));
9640
+ }, darkMode: (_s = props.organise) === null || _s === void 0 ? void 0 : _s.darkMode, hidePagination: true, disableEllipsisOnLongWord: (_t = props.organise) === null || _t === void 0 ? void 0 : _t.disableEllipsisOnLongWord })));
9372
9641
  });
9373
9642
  }
9374
9643
  }
@@ -9384,7 +9653,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9384
9653
  ? function (groupKey, page) {
9385
9654
  return handleFetchGroupPage(groupKey, page);
9386
9655
  }
9387
- : undefined, groupLoadingStatus: renderCheckGroupPaging() ? groupPageState : undefined, size: size !== null && size !== void 0 ? size : 0, limit: limit, cursor: cursor !== null && cursor !== void 0 ? cursor : "", loading: tableLoading !== null && tableLoading !== void 0 ? tableLoading : true, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, selectAllText: selectAll ? "from filter" : "", disableSelectFullData: (_e = (_d = props.organise) === null || _d === void 0 ? void 0 : _d.disableSelectFullData) === null || _e === void 0 ? void 0 : _e.table, maxSelectedCount: (_f = props.bareSettings) === null || _f === void 0 ? void 0 : _f.bareListMaxSelectedCount, mobileView: (_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareListMobileView, mobileTooltip: (_h = props.bareSettings) === null || _h === void 0 ? void 0 : _h.bareMobileTooltip, multiActionFloatingBtns: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], (canBatchUpdate &&
9656
+ : undefined, groupLoadingStatus: renderCheckGroupPaging() ? groupPageState : undefined, size: size !== null && size !== void 0 ? size : 0, limit: limit, cursor: cursor !== null && cursor !== void 0 ? cursor : "", loading: tableLoading !== null && tableLoading !== void 0 ? tableLoading : true, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, selectAllText: selectAll ? "from filter" : "", disableSelectFullData: ((_e = (_d = props.organise) === null || _d === void 0 ? void 0 : _d.disableSelectFullData) === null || _e === void 0 ? void 0 : _e.table) || isFormulaView, maxSelectedCount: (_f = props.bareSettings) === null || _f === void 0 ? void 0 : _f.bareListMaxSelectedCount, mobileView: (_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareListMobileView, mobileTooltip: (_h = props.bareSettings) === null || _h === void 0 ? void 0 : _h.bareMobileTooltip, multiActionFloatingBtns: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], (canBatchUpdate &&
9388
9657
  !((_j = props.bareSettings) === null || _j === void 0 ? void 0 : _j.bareHideTableExtraMultipleAction)
9389
9658
  ? [
9390
9659
  {
@@ -9454,28 +9723,23 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9454
9723
  return structure.find(function (eachColumn) { return eachColumn.id === columnId; });
9455
9724
  }
9456
9725
  : undefined,
9457
- renderAddColumnElements: ((_z = props.bareSettings) === null || _z === void 0 ? void 0 : _z.bareAddColumns)
9726
+ getSchema: ((_z = props.bareSettings) === null || _z === void 0 ? void 0 : _z.bareAddColumns)
9727
+ ? function () { return structure; }
9728
+ : undefined,
9729
+ renderAddColumnElements: ((_0 = props.bareSettings) === null || _0 === void 0 ? void 0 : _0.bareAddColumns)
9458
9730
  ? undefined
9459
9731
  : renderAddMathColumn,
9460
9732
  // INFO: the popup's reference pickers read from the same providers
9461
9733
  // the schema editor uses — without them a reference column would be
9462
9734
  // created with no target and resolve nothing
9463
- renderReferenceSpaceOptions: (_0 = props.organise) === null || _0 === void 0 ? void 0 : _0.renderReferenceSpaceOptions,
9464
- renderReferenceLabelOptions: (_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.renderReferenceLabelOptions,
9735
+ renderReferenceSpaceOptions: (_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.renderReferenceSpaceOptions,
9736
+ renderReferenceLabelOptions: (_2 = props.organise) === null || _2 === void 0 ? void 0 : _2.renderReferenceLabelOptions,
9465
9737
  dragEnabled: isViewSettingsEnabled,
9466
9738
  sortEnabled: isViewSettingsEnabled,
9467
9739
  // INFO: per-column header filter is replaced by the flex filters
9468
9740
  filterEnabled: false,
9469
9741
  sortId: activeSortId,
9470
- sortOptions: (_4 = (_3 = (_2 = props.organise) === null || _2 === void 0 ? void 0 : _2.renderReferenceLabelOptions) === null || _3 === void 0 ? void 0 : _3.call(_2)) !== null && _4 !== void 0 ? _4 : (isViewSettingsEnabled
9471
- ? getViewSettingsColumns().map(function (eachColumn) {
9472
- var _a;
9473
- return ({
9474
- key: eachColumn.id,
9475
- label: (_a = eachColumn.name) !== null && _a !== void 0 ? _a : eachColumn.id,
9476
- });
9477
- })
9478
- : undefined),
9742
+ sortOptions: handleGetSortOptions(),
9479
9743
  onSortColumn: handleSortColumn,
9480
9744
  // INFO: header drag and the panel handle run the same reorder, so the
9481
9745
  // order persists identically whichever one the user grabs
@@ -9514,7 +9778,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9514
9778
  });
9515
9779
  }); },
9516
9780
  }, onObjectEdit: handleObjectCellEdit, addable: {
9517
- active: ((_5 = props.edit) === null || _5 === void 0 ? void 0 : _5.listAddable) ? true : false,
9781
+ active: ((_3 = props.edit) === null || _3 === void 0 ? void 0 : _3.listAddable) ? true : false,
9518
9782
  onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
9519
9783
  var createdId;
9520
9784
  return __generator(this, function (_a) {
@@ -9528,16 +9792,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9528
9792
  }
9529
9793
  });
9530
9794
  }); },
9531
- }, darkMode: (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.darkMode,
9795
+ }, darkMode: (_4 = props.organise) === null || _4 === void 0 ? void 0 : _4.darkMode,
9532
9796
  // INFO: each band pages itself, so the list-wide pager would only
9533
9797
  // page the read that seeded them
9534
- hidePagination: ((_7 = props.organise) === null || _7 === void 0 ? void 0 : _7.hidePagination) ||
9535
- (renderCheckGroupPaging() && !renderCheckScrollMode()), customPaginationSize: customPaginationSize, disableEllipsisOnLongWord: (_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.disableEllipsisOnLongWord, pinColumns: (_9 = props.bareSettings) === null || _9 === void 0 ? void 0 : _9.bareListTablePinColumns }));
9798
+ hidePagination: ((_5 = props.organise) === null || _5 === void 0 ? void 0 : _5.hidePagination) ||
9799
+ (renderCheckGroupPaging() && !renderCheckScrollMode()), customPaginationSize: customPaginationSize, disableEllipsisOnLongWord: (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.disableEllipsisOnLongWord, pinColumns: (_7 = props.bareSettings) === null || _7 === void 0 ? void 0 : _7.bareListTablePinColumns }));
9536
9800
  }
9537
- return (react_1.default.createElement(table_1.Table, { showId: showId, paginationType: renderResolvedPaginationType(), data: tableData, spaceData: spaceTableData !== null && spaceTableData !== void 0 ? spaceTableData : [], referencesOptions: listReferencesOptions, size: size !== null && size !== void 0 ? size : 0, limit: limit, cursor: cursor !== null && cursor !== void 0 ? cursor : "", loading: tableLoading !== null && tableLoading !== void 0 ? tableLoading : true, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, selectAllText: selectAll ? "from filter" : "", disableSelectFullData: (_11 = (_10 = props.organise) === null || _10 === void 0 ? void 0 : _10.disableSelectFullData) === null || _11 === void 0 ? void 0 : _11.table, multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
9801
+ return (react_1.default.createElement(table_1.Table, { showId: showId, paginationType: renderResolvedPaginationType(), data: tableData, spaceData: spaceTableData !== null && spaceTableData !== void 0 ? spaceTableData : [], referencesOptions: listReferencesOptions, size: size !== null && size !== void 0 ? size : 0, limit: limit, cursor: cursor !== null && cursor !== void 0 ? cursor : "", loading: tableLoading !== null && tableLoading !== void 0 ? tableLoading : true, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, selectAllText: selectAll ? "from filter" : "", disableSelectFullData: ((_9 = (_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.disableSelectFullData) === null || _9 === void 0 ? void 0 : _9.table) || isFormulaView, multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
9538
9802
  selectedIds.length > 0 &&
9539
9803
  canBatchUpdate &&
9540
- !((_12 = props.bareSettings) === null || _12 === void 0 ? void 0 : _12.bareHideTableExtraMultipleAction) && (react_1.default.createElement(react_1.default.Fragment, null,
9804
+ !((_10 = props.bareSettings) === null || _10 === void 0 ? void 0 : _10.bareHideTableExtraMultipleAction) && (react_1.default.createElement(react_1.default.Fragment, null,
9541
9805
  react_1.default.createElement(textButton_1.TextButton, { className: "text-sm", text: "Change to Draft", disable: loading, onClick: function () {
9542
9806
  handleBatchDraftData();
9543
9807
  } }),
@@ -9551,8 +9815,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9551
9815
  !isFirebase && canBatchUpdate && (react_1.default.createElement(textButton_1.TextButton, { className: "text-sm", text: "Update", onClick: function () {
9552
9816
  setBatchUpdateModal(true);
9553
9817
  } })),
9554
- ((_13 = props.bareSettings) === null || _13 === void 0 ? void 0 : _13.bareListMultipleSelectAddtionalActions) &&
9555
- ((_15 = (_14 = props.bareSettings) === null || _14 === void 0 ? void 0 : _14.bareListMultipleSelectAddtionalActions) === null || _15 === void 0 ? void 0 : _15.map(function (eachButton) {
9818
+ ((_11 = props.bareSettings) === null || _11 === void 0 ? void 0 : _11.bareListMultipleSelectAddtionalActions) &&
9819
+ ((_13 = (_12 = props.bareSettings) === null || _12 === void 0 ? void 0 : _12.bareListMultipleSelectAddtionalActions) === null || _13 === void 0 ? void 0 : _13.map(function (eachButton) {
9556
9820
  return (react_1.default.createElement(textButton_1.TextButton, { className: "text-sm ".concat(eachButton.className), text: eachButton.text, onClick: function () {
9557
9821
  var _a, _b;
9558
9822
  (_a = eachButton.onClick) === null || _a === void 0 ? void 0 : _a.call(eachButton, selectedIds, selectAll, (_b = renderImpSearchFilterConditions()) !== null && _b !== void 0 ? _b : []);
@@ -9561,25 +9825,17 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9561
9825
  var _a, _b;
9562
9826
  handleCaptureListScroll(id);
9563
9827
  (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", id, "general");
9564
- }, linkType: props.linkType, custom: props.custom, newTabUrl: (_17 = (_16 = props.newTabUrl) === null || _16 === void 0 ? void 0 : _16.default) !== null && _17 !== void 0 ? _17 : "".concat(props.localURLEndpoint, "?data="), addNewTabUrl: (_19 = (_18 = props.newTabUrl) === null || _18 === void 0 ? void 0 : _18.addons) !== null && _19 !== void 0 ? _19 : "&type=read&collection=".concat(props.collectionId, "&view=general"), handleUpdatePageIndex: function (value) {
9828
+ }, linkType: props.linkType, custom: props.custom, newTabUrl: (_15 = (_14 = props.newTabUrl) === null || _14 === void 0 ? void 0 : _14.default) !== null && _15 !== void 0 ? _15 : "".concat(props.localURLEndpoint, "?data="), addNewTabUrl: (_17 = (_16 = props.newTabUrl) === null || _16 === void 0 ? void 0 : _16.addons) !== null && _17 !== void 0 ? _17 : "&type=read&collection=".concat(props.collectionId, "&view=general"), handleUpdatePageIndex: function (value) {
9565
9829
  handlePagination(value);
9566
- }, className: "mt-5", lib: { axios: (_20 = props.lib) === null || _20 === void 0 ? void 0 : _20.axios }, devSettings: props.devSettings, bareSettings: props.bareSettings, fixedPagination: (_21 = props.organise) === null || _21 === void 0 ? void 0 : _21.fixedPagination, advSettings: {
9567
- addColumnEnabled: (_22 = props.organise) === null || _22 === void 0 ? void 0 : _22.addColumnEnabled,
9830
+ }, className: "mt-5", lib: { axios: (_18 = props.lib) === null || _18 === void 0 ? void 0 : _18.axios }, devSettings: props.devSettings, bareSettings: props.bareSettings, fixedPagination: (_19 = props.organise) === null || _19 === void 0 ? void 0 : _19.fixedPagination, advSettings: {
9831
+ addColumnEnabled: (_20 = props.organise) === null || _20 === void 0 ? void 0 : _20.addColumnEnabled,
9568
9832
  renderAddColumnElements: renderAddMathColumn,
9569
9833
  dragEnabled: isViewSettingsEnabled,
9570
9834
  sortEnabled: isViewSettingsEnabled,
9571
9835
  // INFO: per-column header filter is replaced by the flex filters
9572
9836
  filterEnabled: false,
9573
9837
  sortId: activeSortId,
9574
- sortOptions: (_25 = (_24 = (_23 = props.organise) === null || _23 === void 0 ? void 0 : _23.renderReferenceLabelOptions) === null || _24 === void 0 ? void 0 : _24.call(_23)) !== null && _25 !== void 0 ? _25 : (isViewSettingsEnabled
9575
- ? getViewSettingsColumns().map(function (eachColumn) {
9576
- var _a;
9577
- return ({
9578
- key: eachColumn.id,
9579
- label: (_a = eachColumn.name) !== null && _a !== void 0 ? _a : eachColumn.id,
9580
- });
9581
- })
9582
- : undefined),
9838
+ sortOptions: handleGetSortOptions(),
9583
9839
  onSortColumn: handleSortColumn,
9584
9840
  // INFO: header drag and the panel handle run the same reorder, so the
9585
9841
  // order persists identically whichever one the user grabs
@@ -9615,7 +9871,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9615
9871
  });
9616
9872
  }); },
9617
9873
  }, onObjectEdit: handleObjectCellEdit, addable: {
9618
- active: ((_26 = props.edit) === null || _26 === void 0 ? void 0 : _26.listAddable) ? true : false,
9874
+ active: ((_21 = props.edit) === null || _21 === void 0 ? void 0 : _21.listAddable) ? true : false,
9619
9875
  onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
9620
9876
  var createdId;
9621
9877
  return __generator(this, function (_a) {
@@ -9629,7 +9885,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9629
9885
  }
9630
9886
  });
9631
9887
  }); },
9632
- }, darkMode: (_27 = props.organise) === null || _27 === void 0 ? void 0 : _27.darkMode, hidePagination: (_28 = props.organise) === null || _28 === void 0 ? void 0 : _28.hidePagination, customPaginationSize: customPaginationSize, disableEllipsisOnLongWord: (_29 = props.organise) === null || _29 === void 0 ? void 0 : _29.disableEllipsisOnLongWord }));
9888
+ }, darkMode: (_22 = props.organise) === null || _22 === void 0 ? void 0 : _22.darkMode, hidePagination: (_23 = props.organise) === null || _23 === void 0 ? void 0 : _23.hidePagination, customPaginationSize: customPaginationSize, disableEllipsisOnLongWord: (_24 = props.organise) === null || _24 === void 0 ? void 0 : _24.disableEllipsisOnLongWord }));
9633
9889
  }
9634
9890
  };
9635
9891
  // INFO: `hidden` keeps the markers out of space-y spacing
@@ -9932,7 +10188,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9932
10188
  else if (selectedTabData.viewType === "list") {
9933
10189
  // INFO: when bareNewDTW is enabled, render NewList instead of legacy List
9934
10190
  if ((_t = props.bareSettings) === null || _t === void 0 ? void 0 : _t.bareNewDTW) {
9935
- return (react_1.default.createElement(newList_1.NewList, { darkModeBg: (_u = props.organise) === null || _u === void 0 ? void 0 : _u.darkModeBg, paginationType: renderResolvedPaginationType(), list: renderGridAndListData(selectedTabData.viewImage, "list", undefined, true), size: size, limit: limit, cursor: cursor, loading: tableLoading, pageIndex: pageIndex, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, disableSelectFullData: (_w = (_v = props.organise) === null || _v === void 0 ? void 0 : _v.disableSelectFullData) === null || _w === void 0 ? void 0 : _w.list, handleSelectAll: handleSelectAllPages, handleSelectedIds: handleSelectIds, selectAllText: selectAll ? "from filter" : "", maxSelectedCount: (_x = props.bareSettings) === null || _x === void 0 ? void 0 : _x.bareListMaxSelectedCount, multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
10191
+ return (react_1.default.createElement(newList_1.NewList, { darkModeBg: (_u = props.organise) === null || _u === void 0 ? void 0 : _u.darkModeBg, paginationType: renderResolvedPaginationType(), list: renderGridAndListData(selectedTabData.viewImage, "list", undefined, true), size: size, limit: limit, cursor: cursor, loading: tableLoading, pageIndex: pageIndex, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, disableSelectFullData: ((_w = (_v = props.organise) === null || _v === void 0 ? void 0 : _v.disableSelectFullData) === null || _w === void 0 ? void 0 : _w.list) || isFormulaView, handleSelectAll: handleSelectAllPages, handleSelectedIds: handleSelectIds, selectAllText: selectAll ? "from filter" : "", maxSelectedCount: (_x = props.bareSettings) === null || _x === void 0 ? void 0 : _x.bareListMaxSelectedCount, multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
9936
10192
  selectedIds.length > 0 && canBatchUpdate && (react_1.default.createElement(react_1.default.Fragment, null,
9937
10193
  react_1.default.createElement(textButton_1.TextButton, { className: "text-sm", text: "Change to Draft", disable: loading, onClick: function () {
9938
10194
  handleBatchDraftData();
@@ -9955,7 +10211,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9955
10211
  }, darkMode: (_2 = props.organise) === null || _2 === void 0 ? void 0 : _2.darkMode, className: "mt-5", hidePagination: (_3 = props.organise) === null || _3 === void 0 ? void 0 : _3.hidePagination, customPaginationSize: customPaginationSize, mobileTooltip: (_4 = props.bareSettings) === null || _4 === void 0 ? void 0 : _4.bareListMobileTooltip }));
9956
10212
  }
9957
10213
  return (react_1.default.createElement(react_1.default.Fragment, null,
9958
- react_1.default.createElement(list_1.List, { darkModeBg: (_5 = props.organise) === null || _5 === void 0 ? void 0 : _5.darkModeBg, paginationType: renderResolvedPaginationType(), list: renderGridAndListData(selectedTabData.viewImage, "list", undefined, true), size: size, limit: limit, cursor: cursor, loading: tableLoading, pageIndex: pageIndex, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, disableSelectFullData: (_7 = (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.disableSelectFullData) === null || _7 === void 0 ? void 0 : _7.list, handleSelectAll: handleSelectAllPages, handleSelectedIds: handleSelectIds, selectAllText: selectAll ? "from filter" : "", multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
10214
+ react_1.default.createElement(list_1.List, { darkModeBg: (_5 = props.organise) === null || _5 === void 0 ? void 0 : _5.darkModeBg, paginationType: renderResolvedPaginationType(), list: renderGridAndListData(selectedTabData.viewImage, "list", undefined, true), size: size, limit: limit, cursor: cursor, loading: tableLoading, pageIndex: pageIndex, checkbox: multipleSelect, selectAll: selectAll, selectedIds: selectedIds, disableSelectFullData: ((_7 = (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.disableSelectFullData) === null || _7 === void 0 ? void 0 : _7.list) || isFormulaView, handleSelectAll: handleSelectAllPages, handleSelectedIds: handleSelectIds, selectAllText: selectAll ? "from filter" : "", multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
9959
10215
  selectedIds.length > 0 && canBatchUpdate && (react_1.default.createElement(react_1.default.Fragment, null,
9960
10216
  react_1.default.createElement(textButton_1.TextButton, { className: "text-sm", text: "Change to Draft", disable: loading, onClick: function () {
9961
10217
  handleBatchDraftData();
@@ -11131,7 +11387,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11131
11387
  };
11132
11388
  return (react_1.default.createElement(react_1.default.Fragment, null,
11133
11389
  renderNotification("root"),
11134
- ((_77 = (_76 = props.renderSettings) === null || _76 === void 0 ? void 0 : _76.renderLoadingUI) === null || _77 === void 0 ? void 0 : _77.call(_76)) && loading ? ((_78 = props.renderSettings) === null || _78 === void 0 ? void 0 : _78.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_79 = props.organise) === null || _79 === void 0 ? void 0 : _79.darkMode, darkModeBg: (_80 = props.organise) === null || _80 === void 0 ? void 0 : _80.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
11390
+ ((_79 = (_78 = props.renderSettings) === null || _78 === void 0 ? void 0 : _78.renderLoadingUI) === null || _79 === void 0 ? void 0 : _79.call(_78)) && loading ? ((_80 = props.renderSettings) === null || _80 === void 0 ? void 0 : _80.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_81 = props.organise) === null || _81 === void 0 ? void 0 : _81.darkMode, darkModeBg: (_82 = props.organise) === null || _82 === void 0 ? void 0 : _82.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
11135
11391
  var _a, _b;
11136
11392
  if (loading)
11137
11393
  return;
@@ -11142,7 +11398,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11142
11398
  setExportCSVEmail((_b = (_a = props.devSettings.currentUser) === null || _a === void 0 ? void 0 : _a.userEmail) !== null && _b !== void 0 ? _b : "");
11143
11399
  }
11144
11400
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) })),
11145
- react_1.default.createElement(modal_1.Modal, { darkMode: (_81 = props.organise) === null || _81 === void 0 ? void 0 : _81.darkMode, darkModeBg: (_82 = props.organise) === null || _82 === void 0 ? void 0 : _82.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
11401
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_83 = props.organise) === null || _83 === void 0 ? void 0 : _83.darkMode, darkModeBg: (_84 = props.organise) === null || _84 === void 0 ? void 0 : _84.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
11146
11402
  return (react_1.default.createElement(referenceModal_1.ReferenceModal, { referenceModelSchema: referenceModelSchema, referenceDataStructure: referenceCreationModal, devSettings: props.devSettings, handleCreateRefId: function (dataId) {
11147
11403
  if (dataId) {
11148
11404
  var currentValue = selectedData[referenceCreationModal.id];
@@ -11158,19 +11414,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11158
11414
  }, onClose: function () {
11159
11415
  setReferenceCreationModal({ id: "", name: "", type: "string" });
11160
11416
  } }),
11161
- react_1.default.createElement(modal_1.Modal, { darkMode: (_83 = props.organise) === null || _83 === void 0 ? void 0 : _83.darkMode, darkModeBg: (_84 = props.organise) === null || _84 === void 0 ? void 0 : _84.darkModeBg, maxWidth: "2xl", open: Object.keys(referenceDeleteTableData).length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
11417
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_85 = props.organise) === null || _85 === void 0 ? void 0 : _85.darkMode, darkModeBg: (_86 = props.organise) === null || _86 === void 0 ? void 0 : _86.darkModeBg, maxWidth: "2xl", open: Object.keys(referenceDeleteTableData).length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
11162
11418
  setReferenceDeleteTableData({});
11163
11419
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
11164
- react_1.default.createElement(modal_1.Modal, { darkMode: (_85 = props.organise) === null || _85 === void 0 ? void 0 : _85.darkMode, darkModeBg: (_86 = props.organise) === null || _86 === void 0 ? void 0 : _86.darkModeBg, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
11420
+ 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, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
11165
11421
  setDeletePasscodeInput("");
11166
11422
  setDeleteModal(!deleteModal);
11167
11423
  setDeleteFeedId("");
11168
11424
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
11169
- 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, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
11425
+ 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, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
11170
11426
  setBatchUpdateData({ columnId: "", columnData: {} });
11171
11427
  setBatchUpdateModal(false);
11172
11428
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
11173
- 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, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
11429
+ 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, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
11174
11430
  var _a, _b;
11175
11431
  if (props.space)
11176
11432
  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 }));
@@ -11178,7 +11434,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11178
11434
  }, onClose: function () {
11179
11435
  setSelectedAuthMethod("");
11180
11436
  } }),
11181
- isActivityLog && (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, open: activityModal, title: "Activity Log", renderContent: function () {
11437
+ isActivityLog && (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: activityModal, title: "Activity Log", renderContent: function () {
11182
11438
  var _a, _b;
11183
11439
  return (react_1.default.createElement(activityModal_1.ActivityModal, { title: props.title && typeof props.title === "string"
11184
11440
  ? props.title