blixify-ui-web 1.2.156 → 1.2.159

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.
@@ -69,13 +69,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
70
  }
71
71
  };
72
- var __asyncValues = (this && this.__asyncValues) || function (o) {
73
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
74
- var m = o[Symbol.asyncIterator], i;
75
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
76
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
77
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
78
- };
79
72
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
80
73
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
81
74
  if (ar || !(i in from)) {
@@ -161,6 +154,8 @@ var pagination_1 = require("./pagination");
161
154
  var referenceModal_1 = require("./referenceModal");
162
155
  var settingsModal_1 = require("./settingsModal");
163
156
  var chartView_1 = require("./chartView");
157
+ var referenceScan_1 = require("./referenceScan");
158
+ var relatedRecords_1 = require("./relatedRecords");
164
159
  var flexFilter_1 = require("../flexFilter");
165
160
  var viewStatePersistence_1 = require("./viewStatePersistence");
166
161
  var permissions_1 = require("./permissions");
@@ -217,10 +212,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
217
212
  // Every read of the view type below uses resolvedType. The distinction matters
218
213
  // most in effect dependency arrays — following props.type there would leave
219
214
  // the list never refetching while the panel is open, which fails silently.
220
- 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;
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;
221
216
  // INFO: the panel cannot navigate its way out — handleNavigate("read") is
222
217
  // routed straight back into it — so expand-to-full-page is local state.
223
- var _85 = (0, react_1.useState)(false), drawerPageView = _85[0], setDrawerPageView = _85[1];
218
+ var _93 = (0, react_1.useState)(false), drawerPageView = _93[0], setDrawerPageView = _93[1];
224
219
  // INFO: the panel keeps rendering the record it was opened with rather than
225
220
  // live props. Without this, navigating back to the list would re-render the
226
221
  // still-mounted panel as a second list behind the overlay.
@@ -302,18 +297,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
302
297
  initialFilterReferenceDate: initialFilterReferenceDate,
303
298
  };
304
299
  };
305
- var _86 = intialiseDefaultFilterValues(), initialFilterSearch = _86.initialFilterSearch, initialFilterSearchParams = _86.initialFilterSearchParams, initialFilterSelection = _86.initialFilterSelection, initialFilterReference = _86.initialFilterReference, initialFilterReferenceDate = _86.initialFilterReferenceDate;
300
+ var _94 = intialiseDefaultFilterValues(), initialFilterSearch = _94.initialFilterSearch, initialFilterSearchParams = _94.initialFilterSearchParams, initialFilterSelection = _94.initialFilterSelection, initialFilterReference = _94.initialFilterReference, initialFilterReferenceDate = _94.initialFilterReferenceDate;
306
301
  // INFO: Persist view state hook — handles storage read/write for filter/sort/column state
307
- var _87 = (0, viewStatePersistence_1.usePersistedViewState)({
302
+ var _95 = (0, viewStatePersistence_1.usePersistedViewState)({
308
303
  mode: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.persistViewState,
309
304
  collectionId: props.collectionId,
310
305
  persistKey: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.persistKey,
311
306
  type: resolvedType,
312
- }), rawPersistedState = _87.persistedState, isPersistEnabled = _87.isEnabled, handleSaveView = _87.handleSaveView, handleRegisterViewSnapshot = _87.handleRegisterViewSnapshot;
307
+ }), rawPersistedState = _95.persistedState, isPersistEnabled = _95.isEnabled, handleSaveView = _95.handleSaveView, handleRegisterViewSnapshot = _95.handleRegisterViewSnapshot;
313
308
  // INFO: drop stored filters/sort on removed columns — they would empty the table
314
309
  var persistedState = (0, react_1.useMemo)(function () { return (0, viewStatePersistence_1.handlePruneStaleColumns)(rawPersistedState, props.model); }, [rawPersistedState, props.model]);
315
- var _88 = (0, react_1.useState)(false), loading = _88[0], setLoading = _88[1];
316
- var _89 = (0, react_1.useState)(), notification = _89[0], setNotification = _89[1];
310
+ var _96 = (0, react_1.useState)(false), loading = _96[0], setLoading = _96[1];
311
+ var _97 = (0, react_1.useState)(), notification = _97[0], setNotification = _97[1];
317
312
  // INFO: a success toast is confirmation, not a decision — it clears itself so
318
313
  // it never sits on the floating step bar; errors stay until dismissed
319
314
  (0, react_1.useEffect)(function () {
@@ -323,62 +318,62 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
323
318
  return function () { return clearTimeout(timer); };
324
319
  }, [notification]);
325
320
  //INFO : Used by List
326
- var _90 = (0, react_1.useState)((_d = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _d !== void 0 ? _d : initialFilterSearch), filterSearch = _90[0], setFilterSearch = _90[1];
327
- var _91 = (0, react_1.useState)((_e = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _e !== void 0 ? _e : initialFilterSearchParams), filterSearchParams = _91[0], setFilterSearchParams = _91[1];
328
- var _92 = (0, react_1.useState)((_f = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _f !== void 0 ? _f : initialFilterSelection), filterSelection = _92[0], setFilterSelection = _92[1];
329
- var _93 = (0, react_1.useState)((_g = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _g !== void 0 ? _g : initialFilterReference), filterReference = _93[0], setFilterReference = _93[1];
330
- var _94 = (0, react_1.useState)({}), filterReferenceSearch = _94[0], setFilterReferenceSearch = _94[1];
331
- var _95 = (0, react_1.useState)({}), filterReferenceList = _95[0], setFilterReferenceList = _95[1];
332
- var _96 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
321
+ 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];
322
+ 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];
323
+ 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];
324
+ 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];
325
+ var _102 = (0, react_1.useState)({}), filterReferenceSearch = _102[0], setFilterReferenceSearch = _102[1];
326
+ var _103 = (0, react_1.useState)({}), filterReferenceList = _103[0], setFilterReferenceList = _103[1];
327
+ var _104 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
333
328
  ? (0, viewStatePersistence_1.parseDateFilterState)(persistedState.filterReferenceDate)
334
- : initialFilterReferenceDate), filterReferenceDate = _96[0], setFilterReferenceDate = _96[1];
335
- var _97 = (0, react_1.useState)(true), tableLoading = _97[0], setTableLoading = _97[1];
336
- var _98 = (0, react_1.useState)(""), cursor = _98[0], setCursor = _98[1];
337
- var _99 = (0, react_1.useState)(""), lastCursor = _99[0], setLastCursor = _99[1];
338
- var _100 = (0, react_1.useState)([]), tableData = _100[0], setTableData = _100[1];
339
- var _101 = (0, react_1.useState)([]), spaceTableData = _101[0], setSpaceTableData = _101[1];
329
+ : initialFilterReferenceDate), filterReferenceDate = _104[0], setFilterReferenceDate = _104[1];
330
+ var _105 = (0, react_1.useState)(true), tableLoading = _105[0], setTableLoading = _105[1];
331
+ var _106 = (0, react_1.useState)(""), cursor = _106[0], setCursor = _106[1];
332
+ var _107 = (0, react_1.useState)(""), lastCursor = _107[0], setLastCursor = _107[1];
333
+ var _108 = (0, react_1.useState)([]), tableData = _108[0], setTableData = _108[1];
334
+ var _109 = (0, react_1.useState)([]), spaceTableData = _109[0], setSpaceTableData = _109[1];
340
335
  // INFO: a save resolves after later renders, so it reads the table from here —
341
336
  // the state it closed over can predate an earlier save on the same row
342
337
  var tableDataRef = (0, react_1.useRef)([]);
343
338
  var spaceTableDataRef = (0, react_1.useRef)([]);
344
339
  tableDataRef.current = tableData;
345
340
  spaceTableDataRef.current = spaceTableData;
346
- var _102 = (0, react_1.useState)(0), size = _102[0], setSize = _102[1];
347
- var _103 = (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 = _103[0], setPageIndex = _103[1];
348
- var _104 = (0, react_1.useState)([]), selectedIds = _104[0], setSelectedIds = _104[1];
349
- var _105 = (0, react_1.useState)(false), selectAll = _105[0], setSelectAll = _105[1];
350
- var _106 = (0, react_1.useState)(""), deletePasscode = _106[0], setDeletePasscode = _106[1];
351
- var _107 = (0, react_1.useState)(""), deletePasscodeInput = _107[0], setDeletePasscodeInput = _107[1];
352
- var _108 = (0, react_1.useState)(""), deleteFeedId = _108[0], setDeleteFeedId = _108[1];
341
+ var _110 = (0, react_1.useState)(0), size = _110[0], setSize = _110[1];
342
+ 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];
343
+ var _112 = (0, react_1.useState)([]), selectedIds = _112[0], setSelectedIds = _112[1];
344
+ var _113 = (0, react_1.useState)(false), selectAll = _113[0], setSelectAll = _113[1];
345
+ var _114 = (0, react_1.useState)(""), deletePasscode = _114[0], setDeletePasscode = _114[1];
346
+ var _115 = (0, react_1.useState)(""), deletePasscodeInput = _115[0], setDeletePasscodeInput = _115[1];
347
+ var _116 = (0, react_1.useState)(""), deleteFeedId = _116[0], setDeleteFeedId = _116[1];
353
348
  //INFO : Used by List Organise
354
349
  // INFO: Internal sort state that overrides props.organise?.sort when
355
350
  // persistViewState is enabled and a persisted sort exists
356
- var _109 = (0, react_1.useState)((_l = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _l !== void 0 ? _l : undefined), persistedSort = _109[0], setPersistedSort = _109[1];
357
- var _110 = (0, react_1.useState)(false), filterDraft = _110[0], setFilterDraft = _110[1];
358
- var _111 = (0, react_1.useState)(false), addTabModal = _111[0], setAddTabModal = _111[1];
351
+ 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];
352
+ var _118 = (0, react_1.useState)(false), filterDraft = _118[0], setFilterDraft = _118[1];
353
+ var _119 = (0, react_1.useState)(false), addTabModal = _119[0], setAddTabModal = _119[1];
359
354
  //INFO : resolve the initial tab synchronously so the mount cond is already
360
355
  // tab-scoped — an empty initial tab caused a second wasted list fetch
361
- var _112 = (0, react_1.useState)(function () {
356
+ var _120 = (0, react_1.useState)(function () {
362
357
  var _a, _b;
363
358
  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);
364
- }), selectedTab = _112[0], setSelectedTab = _112[1];
365
- var _113 = (0, react_1.useState)("dayGridMonth"), calendarView = _113[0], setCalendarView = _113[1];
359
+ }), selectedTab = _120[0], setSelectedTab = _120[1];
360
+ var _121 = (0, react_1.useState)("dayGridMonth"), calendarView = _121[0], setCalendarView = _121[1];
366
361
  // INFO: bareNewDTW calendar viewSwitch mode — drives the NewCalendar variant
367
362
  // (calendarView above drives the matching range query)
368
- var _114 = (0, react_1.useState)("month"), newCalendarViewMode = _114[0], setNewCalendarViewMode = _114[1];
369
- var _115 = (0, react_1.useState)(new Date()), calendarTabMonth = _115[0], setCalendarTabMonth = _115[1];
363
+ var _122 = (0, react_1.useState)("month"), newCalendarViewMode = _122[0], setNewCalendarViewMode = _122[1];
364
+ var _123 = (0, react_1.useState)(new Date()), calendarTabMonth = _123[0], setCalendarTabMonth = _123[1];
370
365
  // INFO: defaultViewSwitch picks the opening view only — the tab re-inits
371
366
  // whenever its settings change, and that must not undo the user's switch
372
367
  var calendarViewInitRef = (0, react_1.useRef)(false);
373
- var _116 = (0, react_1.useState)(true), kanbanDroppable = _116[0], setKanbanDroppable = _116[1];
374
- var _117 = (0, react_1.useState)([]), kanbanOptions = _117[0], setKanbanOptions = _117[1];
375
- var _118 = (0, react_1.useState)(false), queryForm = _118[0], setQueryForm = _118[1];
376
- var _119 = (0, react_1.useState)(false), batchUpdateModal = _119[0], setBatchUpdateModal = _119[1];
377
- var _120 = (0, react_1.useState)({
368
+ var _124 = (0, react_1.useState)(true), kanbanDroppable = _124[0], setKanbanDroppable = _124[1];
369
+ var _125 = (0, react_1.useState)([]), kanbanOptions = _125[0], setKanbanOptions = _125[1];
370
+ var _126 = (0, react_1.useState)(false), queryForm = _126[0], setQueryForm = _126[1];
371
+ var _127 = (0, react_1.useState)(false), batchUpdateModal = _127[0], setBatchUpdateModal = _127[1];
372
+ var _128 = (0, react_1.useState)({
378
373
  columnId: "",
379
374
  columnData: {},
380
- }), batchUpdateData = _120[0], setBatchUpdateData = _120[1];
381
- var _121 = (0, react_1.useState)(function () {
375
+ }), batchUpdateData = _128[0], setBatchUpdateData = _128[1];
376
+ var _129 = (0, react_1.useState)(function () {
382
377
  var baseModel = (props === null || props === void 0 ? void 0 : props.model) || [];
383
378
  if (!persistedState)
384
379
  return baseModel;
@@ -404,8 +399,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
404
399
  });
405
400
  }
406
401
  return model;
407
- }), structure = _121[0], setStructure = _121[1];
408
- var _122 = (0, react_1.useState)(((_m = props === null || props === void 0 ? void 0 : props.organise) === null || _m === void 0 ? void 0 : _m.additionalQuery) || []), additionalQuery = _122[0], setAdditionalQuery = _122[1];
402
+ }), structure = _129[0], setStructure = _129[1];
403
+ var _130 = (0, react_1.useState)(((_m = props === null || props === void 0 ? void 0 : props.organise) === null || _m === void 0 ? void 0 : _m.additionalQuery) || []), additionalQuery = _130[0], setAdditionalQuery = _130[1];
409
404
  // INFO: State for user-configurable flex filters (Monday.com-style)
410
405
  // INFO: Initialize with one empty row so users see inputs immediately without clicking "Add Filter"
411
406
  var defaultFlexFilterRow = [
@@ -416,9 +411,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
416
411
  value: undefined,
417
412
  },
418
413
  ];
419
- var _123 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
414
+ var _131 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
420
415
  ? persistedState.flexFilters
421
- : defaultFlexFilterRow), flexFilters = _123[0], setFlexFilters = _123[1];
416
+ : defaultFlexFilterRow), flexFilters = _131[0], setFlexFilters = _131[1];
422
417
  // INFO: always-current mirror of flexFilters, read by the imperative apply/
423
418
  // clear methods so chained calls in one tick aren't stale.
424
419
  var flexFiltersRef = (0, react_1.useRef)(flexFilters);
@@ -431,109 +426,110 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
431
426
  }, [flexFilters]);
432
427
  // INFO: Debounced version of flexFilters used by renderImpSearchFilterConditions
433
428
  // to prevent API calls on every keystroke when typing in value inputs
434
- var _124 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
429
+ var _132 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
435
430
  ? persistedState.flexFilters
436
- : defaultFlexFilterRow), flexFiltersDebounced = _124[0], setFlexFiltersDebounced = _124[1];
437
- var _125 = (0, react_1.useState)({}), flexFilterReferenceOptions = _125[0], setFlexFilterReferenceOptions = _125[1];
438
- var _126 = (0, react_1.useState)({}), flexFilterReferenceSearch = _126[0], setFlexFilterReferenceSearch = _126[1];
439
- var _127 = (0, react_1.useState)(false), flexFilterModalOpen = _127[0], setFlexFilterModalOpen = _127[1];
440
- var _128 = (0, react_1.useState)(false), viewSettingsModalOpen = _128[0], setViewSettingsModalOpen = _128[1];
431
+ : defaultFlexFilterRow), flexFiltersDebounced = _132[0], setFlexFiltersDebounced = _132[1];
432
+ var _133 = (0, react_1.useState)({}), flexFilterReferenceOptions = _133[0], setFlexFilterReferenceOptions = _133[1];
433
+ var _134 = (0, react_1.useState)({}), flexFilterReferenceSearch = _134[0], setFlexFilterReferenceSearch = _134[1];
434
+ var _135 = (0, react_1.useState)(false), flexFilterModalOpen = _135[0], setFlexFilterModalOpen = _135[1];
435
+ var _136 = (0, react_1.useState)(false), viewSettingsModalOpen = _136[0], setViewSettingsModalOpen = _136[1];
441
436
  // INFO: Columns the end user chose to hide (bareSettings.bareViewSettings).
442
437
  // Deliberately kept out of `structure`: the props-sync effect below resets
443
438
  // structure to props.model whenever props change, which would wipe the
444
439
  // choice, and the persist effect derives schema-level hiddenColumnIds from
445
440
  // structure — writing user hides there would blur the two concepts.
446
- var _129 = (0, react_1.useState)((_o = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _o !== void 0 ? _o : []), userHiddenColumnIds = _129[0], setUserHiddenColumnIds = _129[1];
447
- var _130 = (0, react_1.useState)(""), columnSearch = _130[0], setColumnSearch = _130[1];
448
- var _131 = (0, react_1.useState)([]), savedViews = _131[0], setSavedViews = _131[1];
449
- var _132 = (0, react_1.useState)(null), activeSavedViewId = _132[0], setActiveSavedViewId = _132[1];
441
+ var _137 = (0, react_1.useState)((_o = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _o !== void 0 ? _o : []), userHiddenColumnIds = _137[0], setUserHiddenColumnIds = _137[1];
442
+ var _138 = (0, react_1.useState)(""), columnSearch = _138[0], setColumnSearch = _138[1];
443
+ var _139 = (0, react_1.useState)([]), savedViews = _139[0], setSavedViews = _139[1];
444
+ var _140 = (0, react_1.useState)(null), activeSavedViewId = _140[0], setActiveSavedViewId = _140[1];
450
445
  // INFO: null while the name box is closed
451
- var _133 = (0, react_1.useState)(null), savedViewName = _133[0], setSavedViewName = _133[1];
452
- var _134 = (0, react_1.useState)(null), deletingSavedViewId = _134[0], setDeletingSavedViewId = _134[1];
453
- var _135 = (0, react_1.useState)(null), draggingColumnId = _135[0], setDraggingColumnId = _135[1];
446
+ var _141 = (0, react_1.useState)(null), savedViewName = _141[0], setSavedViewName = _141[1];
447
+ var _142 = (0, react_1.useState)(null), deletingSavedViewId = _142[0], setDeletingSavedViewId = _142[1];
448
+ var _143 = (0, react_1.useState)(null), draggingColumnId = _143[0], setDraggingColumnId = _143[1];
454
449
  var columnRowRefs = (0, react_1.useRef)({});
455
450
  //INFO : Used by Auth
456
- var _136 = (0, react_1.useState)({
451
+ var _144 = (0, react_1.useState)({
457
452
  email: "",
458
453
  google: "",
459
454
  phone: "",
460
455
  disabled: false,
461
456
  create: false,
462
- }), authMethods = _136[0], setAuthMethods = _136[1];
463
- var _137 = (0, react_1.useState)(""), selectedAuthMethod = _137[0], setSelectedAuthMethod = _137[1];
457
+ }), authMethods = _144[0], setAuthMethods = _144[1];
458
+ var _145 = (0, react_1.useState)(""), selectedAuthMethod = _145[0], setSelectedAuthMethod = _145[1];
464
459
  // INFO: Used by Activity Log
465
- var _138 = (0, react_1.useState)(false), activityModal = _138[0], setActivityModal = _138[1];
466
- var _139 = (0, react_1.useState)(""), activityId = _139[0], setActivityId = _139[1];
460
+ var _146 = (0, react_1.useState)(false), activityModal = _146[0], setActivityModal = _146[1];
461
+ var _147 = (0, react_1.useState)(""), activityId = _147[0], setActivityId = _147[1];
467
462
  //INFO : Used by Export
468
- var _140 = (0, react_1.useState)(null), csvFile = _140[0], setCSVFile = _140[1];
469
- var _141 = (0, react_1.useState)([]), csvFileData = _141[0], setCSVFileData = _141[1];
470
- var _142 = (0, react_1.useState)(0), stepCSVIndex = _142[0], setStepCSVIndex = _142[1];
471
- var _143 = (0, react_1.useState)({}), listCSVMapAttribute = _143[0], setListCSVMapAttribute = _143[1];
472
- var _144 = (0, react_1.useState)({}), listCSVObjAttribute = _144[0], setListCSVObjAttribute = _144[1];
473
- var _145 = (0, react_1.useState)([]), csvAPIAttribute = _145[0], setCSVAPIAttribute = _145[1];
474
- var _146 = (0, react_1.useState)(((_p = props.devSettings.currentUser) === null || _p === void 0 ? void 0 : _p.userEmail) || ""), exportCSVEmail = _146[0], setExportCSVEmail = _146[1];
475
- var _147 = (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 = _147[0], setExportPDFTitle = _147[1];
476
- var _148 = (0, react_1.useState)(false), exportPDFLoading = _148[0], setExportPDFLoading = _148[1];
477
- var _149 = (0, react_1.useState)(false), exportReadPDFLoading = _149[0], setExportReadPDFLoading = _149[1];
478
- var _150 = (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 = _150[0], setExportSumAttributeIds = _150[1];
479
- var _151 = (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 = _151[0], setHideSubItems = _151[1];
480
- var _152 = (0, react_1.useState)([]), importTableData = _152[0], setImportTableData = _152[1];
481
- var _153 = (0, react_1.useState)([]), queryList = _153[0], setQueryList = _153[1];
482
- var _154 = (0, react_1.useState)(undefined), allQueryList = _154[0], setAllQueryList = _154[1];
483
- var _155 = (0, react_1.useState)(-1), queryIndex = _155[0], setQueryIndex = _155[1];
484
- var _156 = (0, react_1.useState)((_y = props.organise) === null || _y === void 0 ? void 0 : _y.groupBy), groupId = _156[0], setGroupId = _156[1];
485
- var _157 = (0, react_1.useState)(""), readTabSection = _157[0], setReadTabSection = _157[1];
486
- var _158 = (0, react_1.useState)(false), readFloatingNav = _158[0], setReadFloatingNav = _158[1];
463
+ var _148 = (0, react_1.useState)(null), csvFile = _148[0], setCSVFile = _148[1];
464
+ var _149 = (0, react_1.useState)([]), csvFileData = _149[0], setCSVFileData = _149[1];
465
+ var _150 = (0, react_1.useState)(0), stepCSVIndex = _150[0], setStepCSVIndex = _150[1];
466
+ var _151 = (0, react_1.useState)({}), listCSVMapAttribute = _151[0], setListCSVMapAttribute = _151[1];
467
+ var _152 = (0, react_1.useState)({}), listCSVObjAttribute = _152[0], setListCSVObjAttribute = _152[1];
468
+ var _153 = (0, react_1.useState)([]), csvAPIAttribute = _153[0], setCSVAPIAttribute = _153[1];
469
+ var _154 = (0, react_1.useState)(((_p = props.devSettings.currentUser) === null || _p === void 0 ? void 0 : _p.userEmail) || ""), exportCSVEmail = _154[0], setExportCSVEmail = _154[1];
470
+ var _155 = (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 = _155[0], setExportPDFTitle = _155[1];
471
+ var _156 = (0, react_1.useState)(false), exportPDFLoading = _156[0], setExportPDFLoading = _156[1];
472
+ var _157 = (0, react_1.useState)(false), exportReadPDFLoading = _157[0], setExportReadPDFLoading = _157[1];
473
+ var _158 = (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 = _158[0], setExportSumAttributeIds = _158[1];
474
+ var _159 = (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 = _159[0], setHideSubItems = _159[1];
475
+ var _160 = (0, react_1.useState)([]), importTableData = _160[0], setImportTableData = _160[1];
476
+ var _161 = (0, react_1.useState)([]), queryList = _161[0], setQueryList = _161[1];
477
+ var _162 = (0, react_1.useState)(undefined), allQueryList = _162[0], setAllQueryList = _162[1];
478
+ var _163 = (0, react_1.useState)(-1), queryIndex = _163[0], setQueryIndex = _163[1];
479
+ var _164 = (0, react_1.useState)((_y = props.organise) === null || _y === void 0 ? void 0 : _y.groupBy), groupId = _164[0], setGroupId = _164[1];
480
+ var _165 = (0, react_1.useState)(""), readTabSection = _165[0], setReadTabSection = _165[1];
481
+ var _166 = (0, react_1.useState)(false), readFloatingNav = _166[0], setReadFloatingNav = _166[1];
487
482
  var readTabSectionRefs = (0, react_1.useRef)({});
488
483
  //INFO : Used by Read
489
484
  //INFO : Used by Update
490
- var _159 = (0, react_1.useState)(false), modalVisible = _159[0], setModalVisible = _159[1];
491
- var _160 = (0, react_1.useState)(false), deleteModal = _160[0], setDeleteModal = _160[1];
492
- var _161 = (0, react_1.useState)(false), excelModal = _161[0], setExcelModal = _161[1];
493
- var _162 = (0, react_1.useState)(false), exportExcel = _162[0], setExportExcel = _162[1];
494
- var _163 = (0, react_1.useState)(""), exportType = _163[0], setExportType = _163[1];
495
- var _164 = (0, react_1.useState)(false), exportQR = _164[0], setExportQR = _164[1];
496
- var _165 = (0, react_1.useState)(function () {
485
+ var _167 = (0, react_1.useState)(false), modalVisible = _167[0], setModalVisible = _167[1];
486
+ var _168 = (0, react_1.useState)(false), deleteModal = _168[0], setDeleteModal = _168[1];
487
+ var _169 = (0, react_1.useState)(false), excelModal = _169[0], setExcelModal = _169[1];
488
+ var _170 = (0, react_1.useState)(false), exportExcel = _170[0], setExportExcel = _170[1];
489
+ var _171 = (0, react_1.useState)(""), exportType = _171[0], setExportType = _171[1];
490
+ var _172 = (0, react_1.useState)(false), exportQR = _172[0], setExportQR = _172[1];
491
+ var _173 = (0, react_1.useState)(function () {
497
492
  var _a, _b;
498
493
  var firstTabId = (_b = (_a = structure.find(function (item) { return item.tabId; })) === null || _a === void 0 ? void 0 : _a.tabId) !== null && _b !== void 0 ? _b : "";
499
494
  return firstTabId;
500
- }), activeTab = _165[0], setActiveTab = _165[1];
501
- var _166 = (0, react_1.useState)(false), signatureSigning = _166[0], setSignatureSigning = _166[1];
502
- var _167 = (0, react_1.useState)({}), selectedData = _167[0], setSelectedData = _167[1];
503
- var _168 = (0, react_1.useState)(""), selectedObjectStructureId = _168[0], setSelectedObjectStructureId = _168[1];
504
- var _169 = (0, react_1.useState)(""), selectedObjectId = _169[0], setSelectedObjectId = _169[1];
505
- var _170 = (0, react_1.useState)(""), selectedListAddressId = _170[0], setSelectedListAddressId = _170[1];
506
- var _171 = (0, react_1.useState)(-1), selectedListAddressIndex = _171[0], setSelectedListAddressIndex = _171[1];
507
- var _172 = (0, react_1.useState)({
495
+ }), activeTab = _173[0], setActiveTab = _173[1];
496
+ var _174 = (0, react_1.useState)(false), signatureSigning = _174[0], setSignatureSigning = _174[1];
497
+ var _175 = (0, react_1.useState)({}), selectedData = _175[0], setSelectedData = _175[1];
498
+ var _176 = (0, react_1.useState)(""), selectedObjectStructureId = _176[0], setSelectedObjectStructureId = _176[1];
499
+ var _177 = (0, react_1.useState)(""), selectedObjectId = _177[0], setSelectedObjectId = _177[1];
500
+ var _178 = (0, react_1.useState)(""), selectedListAddressId = _178[0], setSelectedListAddressId = _178[1];
501
+ var _179 = (0, react_1.useState)(-1), selectedListAddressIndex = _179[0], setSelectedListAddressIndex = _179[1];
502
+ var _180 = (0, react_1.useState)({
508
503
  lat: 0,
509
504
  lng: 0,
510
505
  name: "",
511
- }), selectedListAddress = _172[0], setSelectedListAddress = _172[1];
512
- var _173 = (0, react_1.useState)({}), selectedObjectData = _173[0], setSelectedObjectData = _173[1];
513
- var _174 = (0, react_1.useState)(null), objectCellEdit = _174[0], setObjectCellEdit = _174[1];
514
- var _175 = (0, react_1.useState)(false), referenceLoading = _175[0], setReferenceLoading = _175[1];
515
- var _176 = (0, react_1.useState)({}), referencesOptions = _176[0], setReferencesOptions = _176[1];
516
- var _177 = (0, react_1.useState)({}), referencesDetails = _177[0], setReferencesDetails = _177[1];
517
- var _178 = (0, react_1.useState)({}), listReferencesOptions = _178[0], setListReferencesOptions = _178[1];
518
- var _179 = (0, react_1.useState)({}), referenceDeleteTableData = _179[0], setReferenceDeleteTableData = _179[1];
519
- var _180 = (0, react_1.useState)(0), referenceDeleteIndex = _180[0], setReferenceDeleteIndex = _180[1];
520
- var _181 = (0, react_1.useState)({
506
+ }), selectedListAddress = _180[0], setSelectedListAddress = _180[1];
507
+ var _181 = (0, react_1.useState)({}), selectedObjectData = _181[0], setSelectedObjectData = _181[1];
508
+ var _182 = (0, react_1.useState)(null), objectCellEdit = _182[0], setObjectCellEdit = _182[1];
509
+ var _183 = (0, react_1.useState)(false), referenceLoading = _183[0], setReferenceLoading = _183[1];
510
+ var _184 = (0, react_1.useState)({}), referencesOptions = _184[0], setReferencesOptions = _184[1];
511
+ var _185 = (0, react_1.useState)({}), referencesDetails = _185[0], setReferencesDetails = _185[1];
512
+ var _186 = (0, react_1.useState)({}), listReferencesOptions = _186[0], setListReferencesOptions = _186[1];
513
+ var _187 = (0, react_1.useState)({}), referenceDeleteTableData = _187[0], setReferenceDeleteTableData = _187[1];
514
+ var _188 = (0, react_1.useState)([]), relatedSections = _188[0], setRelatedSections = _188[1];
515
+ var _189 = (0, react_1.useState)(0), referenceDeleteIndex = _189[0], setReferenceDeleteIndex = _189[1];
516
+ var _190 = (0, react_1.useState)({
521
517
  id: "",
522
518
  name: "",
523
519
  type: "string",
524
- }), referenceCreationModal = _181[0], setReferenceCreationModal = _181[1];
525
- var _182 = (0, react_1.useState)({}), referenceModelSchema = _182[0], setReferenceSchema = _182[1];
526
- var _183 = (0, react_1.useState)([]), kanbanChecked = _183[0], setKanbanChecked = _183[1];
520
+ }), referenceCreationModal = _190[0], setReferenceCreationModal = _190[1];
521
+ var _191 = (0, react_1.useState)({}), referenceModelSchema = _191[0], setReferenceSchema = _191[1];
522
+ var _192 = (0, react_1.useState)([]), kanbanChecked = _192[0], setKanbanChecked = _192[1];
527
523
  //INFO : Offline
528
- var _184 = (0, react_1.useState)(0), offlineDataLength = _184[0], setOfflineDataLength = _184[1];
529
- var _185 = (0, react_1.useState)(false), offlineModal = _185[0], setOfflineModal = _185[1];
524
+ var _193 = (0, react_1.useState)(0), offlineDataLength = _193[0], setOfflineDataLength = _193[1];
525
+ var _194 = (0, react_1.useState)(false), offlineModal = _194[0], setOfflineModal = _194[1];
530
526
  // INFO: live-stream state — driven by socket connection and navigator.onLine
531
- var _186 = (0, react_1.useState)(false), isLive = _186[0], setIsLive = _186[1];
532
- var _187 = (0, react_1.useState)(false), isLiveOffline = _187[0], setIsLiveOffline = _187[1];
527
+ var _195 = (0, react_1.useState)(false), isLive = _195[0], setIsLive = _195[1];
528
+ var _196 = (0, react_1.useState)(false), isLiveOffline = _196[0], setIsLiveOffline = _196[1];
533
529
  // INFO: true when navigator is offline — used to switch ReadQueryHoc between
534
530
  // server reads (online, full pagination) and IndexedDB reads (offline, cached data).
535
531
  // Independent of SSE status so it works even when bareSocketName is not set.
536
- var _188 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _188[0], setIsNetworkOffline = _188[1];
532
+ var _197 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _197[0], setIsNetworkOffline = _197[1];
537
533
  var previousType = (0, react_1.useRef)(null);
538
534
  var previousSelectedData = (0, react_1.useRef)(null);
539
535
  var scrollSentinelRef = (0, react_1.useRef)(null);
@@ -654,23 +650,108 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
654
650
  var isFirebase = isFirebaseClient || devSettings.server === "fbServer";
655
651
  var dbModule = isFirebaseClient ? (_4 = props.lib) === null || _4 === void 0 ? void 0 : _4.firebase : (_5 = props.lib) === null || _5 === void 0 ? void 0 : _5.axios;
656
652
  var schemaPresent = props.devSettings.schemaEndpoint ? true : false;
653
+ var selectedRelated = resolvedType === "read"
654
+ ? relatedSections.find(function (eachSection) { return eachSection.id === viewType; })
655
+ : undefined;
656
+ // INFO: each other space whose rows point at this record becomes a tab of
657
+ // the read view, so the counts are taken with the record — one schema query
658
+ // plus one single-row query per referencing column. The rows themselves load
659
+ // when their tab opens.
660
+ (0, react_1.useEffect)(function () {
661
+ var _a;
662
+ var mounted = true;
663
+ if (resolvedType !== "read" ||
664
+ !props.id ||
665
+ !((_a = props.organise) === null || _a === void 0 ? void 0 : _a.showRelatedTab)) {
666
+ setRelatedSections([]);
667
+ return;
668
+ }
669
+ var handleLoadRelated = function () { return __awaiter(void 0, void 0, void 0, function () {
670
+ var sources, referenceSources, counts, handleIsShared;
671
+ var _a;
672
+ return __generator(this, function (_b) {
673
+ switch (_b.label) {
674
+ case 0: return [4 /*yield*/, (0, referenceScan_1.handleListReferenceSources)({
675
+ dbModule: dbModule,
676
+ devSettings: props.devSettings,
677
+ space: props.space,
678
+ bareReferenceDel: (_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareReferenceDel,
679
+ })];
680
+ case 1:
681
+ sources = _b.sent();
682
+ referenceSources = sources.filter(function (eachSource) {
683
+ return eachSource.column.type === "reference" ||
684
+ eachSource.column.type === "listReference";
685
+ });
686
+ return [4 /*yield*/, Promise.all(referenceSources.map(function (eachSource) {
687
+ var _a;
688
+ return (0, referenceScan_1.handleCountReferences)({
689
+ dbModule: dbModule,
690
+ devSettings: props.devSettings,
691
+ source: eachSource,
692
+ recordId: (_a = props.id) !== null && _a !== void 0 ? _a : "",
693
+ });
694
+ }))];
695
+ case 2:
696
+ counts = _b.sent();
697
+ handleIsShared = function (collectionId) {
698
+ return referenceSources.filter(function (eachSource) { return eachSource.collectionId === collectionId; }).length > 1;
699
+ };
700
+ return [2 /*return*/, referenceSources
701
+ .map(function (eachSource, index) { return ({
702
+ id: "blixify_related_".concat(eachSource.collectionId, "_").concat(eachSource.column.id),
703
+ label: handleIsShared(eachSource.collectionId)
704
+ ? "".concat(eachSource.collectionName, " \u00B7 ").concat(eachSource.column.name)
705
+ : eachSource.collectionName,
706
+ source: eachSource,
707
+ count: counts[index],
708
+ }); })
709
+ .filter(function (eachSection) { return eachSection.count > 0; })];
710
+ }
711
+ });
712
+ }); };
713
+ handleLoadRelated()
714
+ .then(function (sections) {
715
+ if (mounted)
716
+ setRelatedSections(sections);
717
+ })
718
+ .catch(function () {
719
+ if (mounted)
720
+ setRelatedSections([]);
721
+ });
722
+ return function () {
723
+ mounted = false;
724
+ };
725
+ /* eslint-disable */
726
+ }, [
727
+ resolvedType,
728
+ props.id,
729
+ (_6 = props.space) === null || _6 === void 0 ? void 0 : _6._id,
730
+ props.devSettings.schemaEndpoint,
731
+ (_7 = props.organise) === null || _7 === void 0 ? void 0 : _7.showRelatedTab,
732
+ ]);
733
+ /* eslint-enable */
657
734
  // INFO: the view settings panel (columns, sort, rows per page) is standard on
658
735
  // the new DTW; bareViewSettings stays the opt-in for legacy and bare DTWs
659
- var isViewSettingsEnabled = ((_6 = props.bareSettings) === null || _6 === void 0 ? void 0 : _6.bareViewSettings) || ((_7 = props.bareSettings) === null || _7 === void 0 ? void 0 : _7.bareNewDTW)
736
+ var isViewSettingsEnabled = ((_8 = props.bareSettings) === null || _8 === void 0 ? void 0 : _8.bareViewSettings) || ((_9 = props.bareSettings) === null || _9 === void 0 ? void 0 : _9.bareNewDTW)
660
737
  ? true
661
738
  : false;
662
739
  // INFO: a consumer that wires onChangeHide owns the hide at schema level
663
740
  // (shared by every user) — toggling writes to the model and calls back. Without it
664
741
  // the hide is this user's own and lives in userHiddenColumnIds.
665
- var isSchemaHideMode = ((_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.onChangeHide) ? true : false;
742
+ var isSchemaHideMode = ((_10 = props.organise) === null || _10 === void 0 ? void 0 : _10.onChangeHide) ? true : false;
666
743
  // INFO: rows per page is a view setting the user can change, so it starts from
667
744
  // the persisted value and falls back to the consumer's limit
668
- var _189 = (0, react_1.useState)((_10 = (_9 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _9 !== void 0 ? _9 : props.limit) !== null && _10 !== void 0 ? _10 : 10), pageLimit = _189[0], setPageLimit = _189[1];
745
+ var _198 = (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 = _198[0], setPageLimit = _198[1];
669
746
  var limit = pageLimit;
670
- var isSavedViewsEnabled = !!((_11 = props.organise) === null || _11 === void 0 ? void 0 : _11.savedViews) && resolvedType === "list";
747
+ var isSavedViewsEnabled = !!((_13 = props.organise) === null || _13 === void 0 ? void 0 : _13.savedViews) && resolvedType === "list";
748
+ // INFO: an app that stores views takes over from this browser's storage, so
749
+ // every view is the team's and nothing is kept locally
750
+ var isAppViews = ((_14 = props.organise) === null || _14 === void 0 ? void 0 : _14.sharedViews) !== undefined ||
751
+ !!((_15 = props.organise) === null || _15 === void 0 ? void 0 : _15.onChangeSharedViews);
671
752
  // INFO: a saved view carries its sort, so the sort is held here as with persistViewState
672
753
  var isInternalSort = isPersistEnabled || isSavedViewsEnabled;
673
- var activeSortId = (isInternalSort && persistedSort) || ((_12 = props.organise) === null || _12 === void 0 ? void 0 : _12.sort);
754
+ var activeSortId = (isInternalSort && persistedSort) || ((_16 = props.organise) === null || _16 === void 0 ? void 0 : _16.sort);
674
755
  var handleSortColumn = function (value) {
675
756
  var _a, _b, _c, _d;
676
757
  if (isInternalSort)
@@ -686,18 +767,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
686
767
  setCursor("");
687
768
  setLastCursor("");
688
769
  };
689
- var _190 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _190.canUpdateRecord, canInlineUpdate = _190.canInlineUpdate, canBatchUpdate = _190.canBatchUpdate, canDeleteRecord = _190.canDeleteRecord;
690
- var isEditor = ((_13 = props.edit) === null || _13 === void 0 ? void 0 : _13.allEditable) ? true : false;
691
- var isOffline = (_14 = props.bareSettings) === null || _14 === void 0 ? void 0 : _14.bareOffline;
770
+ var _199 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _199.canUpdateRecord, canInlineUpdate = _199.canInlineUpdate, canBatchUpdate = _199.canBatchUpdate, canDeleteRecord = _199.canDeleteRecord;
771
+ var isEditor = ((_17 = props.edit) === null || _17 === void 0 ? void 0 : _17.allEditable) ? true : false;
772
+ var isOffline = (_18 = props.bareSettings) === null || _18 === void 0 ? void 0 : _18.bareOffline;
692
773
  // INFO: when bareOfflineNetworkAware is true, the save path is also gated on
693
774
  // the live network state — online saves go to the server even if bareOffline
694
775
  // is true, offline saves go to IDB as normal.
695
- var isOfflineNetworkListener = isOffline && ((_15 = props.bareSettings) === null || _15 === void 0 ? void 0 : _15.bareOfflineNetworkListener);
696
- var showId = (_16 = props.space) === null || _16 === void 0 ? void 0 : _16.showId;
776
+ var isOfflineNetworkListener = isOffline && ((_19 = props.bareSettings) === null || _19 === void 0 ? void 0 : _19.bareOfflineNetworkListener);
777
+ var showId = (_20 = props.space) === null || _20 === void 0 ? void 0 : _20.showId;
697
778
  var remainId = showId || selectedObjectStructureId ? true : false;
698
- var idField = ((_17 = props.space) === null || _17 === void 0 ? void 0 : _17.idField) || ((_18 = props.organise) === null || _18 === void 0 ? void 0 : _18.idField);
699
- var pipeline = (_19 = props === null || props === void 0 ? void 0 : props.space) === null || _19 === void 0 ? void 0 : _19.pipeline;
700
- if ((_20 = props.bareSettings) === null || _20 === void 0 ? void 0 : _20.bareListPipeline) {
779
+ var idField = ((_21 = props.space) === null || _21 === void 0 ? void 0 : _21.idField) || ((_22 = props.organise) === null || _22 === void 0 ? void 0 : _22.idField);
780
+ var pipeline = (_23 = props === null || props === void 0 ? void 0 : props.space) === null || _23 === void 0 ? void 0 : _23.pipeline;
781
+ if ((_24 = props.bareSettings) === null || _24 === void 0 ? void 0 : _24.bareListPipeline) {
701
782
  pipeline = pipeline
702
783
  ? __spreadArray(__spreadArray([], pipeline, true), props.bareSettings.bareListPipeline, true) : props.bareSettings.bareListPipeline;
703
784
  }
@@ -710,24 +791,24 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
710
791
  * three records came back instead of five files, and each tile received the
711
792
  * whole array rather than one file, so every one of them read "Attachment".
712
793
  */
713
- var fileViewColumnId = (_24 = (_23 = ((_22 = (_21 = props.organise) === null || _21 === void 0 ? void 0 : _21.extendedTabs) !== null && _22 !== void 0 ? _22 : []).find(function (eachTab) {
794
+ var fileViewColumnId = (_28 = (_27 = ((_26 = (_25 = props.organise) === null || _25 === void 0 ? void 0 : _25.extendedTabs) !== null && _26 !== void 0 ? _26 : []).find(function (eachTab) {
714
795
  return eachTab.viewType === "file" &&
715
796
  (0, utils_1.lowercaseTextToId)(eachTab.name) === viewType;
716
- })) === null || _23 === void 0 ? void 0 : _23.fileSettings) === null || _24 === void 0 ? void 0 : _24.columnId;
717
- var hasNavigation = ((_25 = props.organise) === null || _25 === void 0 ? void 0 : _25.handleNavigate) ? true : false;
797
+ })) === null || _27 === void 0 ? void 0 : _27.fileSettings) === null || _28 === void 0 ? void 0 : _28.columnId;
798
+ var hasNavigation = ((_29 = props.organise) === null || _29 === void 0 ? void 0 : _29.handleNavigate) ? true : false;
718
799
  var formColumn = "grid-cols-12";
719
- var useMobileView = (_27 = (_26 = props.bareSettings) === null || _26 === void 0 ? void 0 : _26.bareUpdateMobileView) !== null && _27 !== void 0 ? _27 : false;
800
+ var useMobileView = (_31 = (_30 = props.bareSettings) === null || _30 === void 0 ? void 0 : _30.bareUpdateMobileView) !== null && _31 !== void 0 ? _31 : false;
720
801
  var gridGap = useMobileView ? "gap-x-6 gap-y-2 md:gap-y-6" : "gap-6";
721
- var isActivityLog = (((_29 = (_28 = props.edit) === null || _28 === void 0 ? void 0 : _28.activityLog) === null || _29 === void 0 ? void 0 : _29.enableComments) &&
722
- ((_30 = props.edit) === null || _30 === void 0 ? void 0 : _30.activityLog.commentCollectionId)) ||
723
- (((_32 = (_31 = props.edit) === null || _31 === void 0 ? void 0 : _31.activityLog) === null || _32 === void 0 ? void 0 : _32.enableLogs) &&
724
- ((_33 = props.edit) === null || _33 === void 0 ? void 0 : _33.activityLog.logsCollectionId));
725
- var customPaginationSize = ((_34 = props.organise) === null || _34 === void 0 ? void 0 : _34.customPaginationCount)
802
+ var isActivityLog = (((_33 = (_32 = props.edit) === null || _32 === void 0 ? void 0 : _32.activityLog) === null || _33 === void 0 ? void 0 : _33.enableComments) &&
803
+ ((_34 = props.edit) === null || _34 === void 0 ? void 0 : _34.activityLog.commentCollectionId)) ||
804
+ (((_36 = (_35 = props.edit) === null || _35 === void 0 ? void 0 : _35.activityLog) === null || _36 === void 0 ? void 0 : _36.enableLogs) &&
805
+ ((_37 = props.edit) === null || _37 === void 0 ? void 0 : _37.activityLog.logsCollectionId));
806
+ var customPaginationSize = ((_38 = props.organise) === null || _38 === void 0 ? void 0 : _38.customPaginationCount)
726
807
  ? props.organise.customPaginationCount(size)
727
808
  : undefined;
728
809
  //TODO : Code - Pass ...devSettings, search dbEndpoint:
729
810
  var writeServerQuery = new writeQuery_1.WriteQuery({
730
- dbModule: (_35 = props.lib) === null || _35 === void 0 ? void 0 : _35.axios,
811
+ dbModule: (_39 = props.lib) === null || _39 === void 0 ? void 0 : _39.axios,
731
812
  dbType: devSettings.server,
732
813
  dbCollection: props.collectionId,
733
814
  dbEndpoint: devSettings.dbEndpoint,
@@ -735,7 +816,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
735
816
  dbUserToken: devSettings.dbUserToken,
736
817
  });
737
818
  var readServerQuery = new readQuery_1.ReadQuery({
738
- dbModule: (_36 = props.lib) === null || _36 === void 0 ? void 0 : _36.axios,
819
+ dbModule: (_40 = props.lib) === null || _40 === void 0 ? void 0 : _40.axios,
739
820
  dbType: devSettings.server,
740
821
  dbCollection: props.collectionId,
741
822
  dbEndpoint: devSettings.dbEndpoint,
@@ -743,9 +824,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
743
824
  dbUserToken: devSettings.dbUserToken,
744
825
  });
745
826
  var moreButtonPopUp = [
746
- ((_37 = props.edit) === null || _37 === void 0 ? void 0 : _37.allEditable) &&
827
+ ((_41 = props.edit) === null || _41 === void 0 ? void 0 : _41.allEditable) &&
747
828
  !isFirebase &&
748
- !((_39 = (_38 = props.organise) === null || _38 === void 0 ? void 0 : _38.exportSettings) === null || _39 === void 0 ? void 0 : _39.hideImportCSV)
829
+ !((_43 = (_42 = props.organise) === null || _42 === void 0 ? void 0 : _42.exportSettings) === null || _43 === void 0 ? void 0 : _43.hideImportCSV)
749
830
  ? {
750
831
  text: "Import Excel",
751
832
  onClick: function () {
@@ -754,7 +835,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
754
835
  },
755
836
  }
756
837
  : null,
757
- !((_41 = (_40 = props.organise) === null || _40 === void 0 ? void 0 : _40.exportSettings) === null || _41 === void 0 ? void 0 : _41.hideExportCSV)
838
+ !((_45 = (_44 = props.organise) === null || _44 === void 0 ? void 0 : _44.exportSettings) === null || _45 === void 0 ? void 0 : _45.hideExportCSV)
758
839
  ? {
759
840
  text: "Export CSV",
760
841
  onClick: function () {
@@ -764,7 +845,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
764
845
  },
765
846
  }
766
847
  : null,
767
- !((_43 = (_42 = props.organise) === null || _42 === void 0 ? void 0 : _42.exportSettings) === null || _43 === void 0 ? void 0 : _43.hideExportExcel)
848
+ !((_47 = (_46 = props.organise) === null || _46 === void 0 ? void 0 : _46.exportSettings) === null || _47 === void 0 ? void 0 : _47.hideExportExcel)
768
849
  ? {
769
850
  text: "Export Excel",
770
851
  onClick: function () {
@@ -774,7 +855,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
774
855
  },
775
856
  }
776
857
  : null,
777
- !((_45 = (_44 = props.organise) === null || _44 === void 0 ? void 0 : _44.exportSettings) === null || _45 === void 0 ? void 0 : _45.hideExportPDF)
858
+ !((_49 = (_48 = props.organise) === null || _48 === void 0 ? void 0 : _48.exportSettings) === null || _49 === void 0 ? void 0 : _49.hideExportPDF)
778
859
  ? {
779
860
  text: "Export PDF",
780
861
  onClick: function () {
@@ -784,7 +865,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
784
865
  },
785
866
  }
786
867
  : null,
787
- !((_47 = (_46 = props.organise) === null || _46 === void 0 ? void 0 : _46.exportSettings) === null || _47 === void 0 ? void 0 : _47.hideExportQR)
868
+ !((_51 = (_50 = props.organise) === null || _50 === void 0 ? void 0 : _50.exportSettings) === null || _51 === void 0 ? void 0 : _51.hideExportQR)
788
869
  ? {
789
870
  text: "Export QR",
790
871
  onClick: function () {
@@ -794,7 +875,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
794
875
  },
795
876
  }
796
877
  : null,
797
- !((_49 = (_48 = props.organise) === null || _48 === void 0 ? void 0 : _48.exportSettings) === null || _49 === void 0 ? void 0 : _49.hideExportQR)
878
+ !((_53 = (_52 = props.organise) === null || _52 === void 0 ? void 0 : _52.exportSettings) === null || _53 === void 0 ? void 0 : _53.hideExportQR)
798
879
  ? {
799
880
  text: "Export QR(Data)",
800
881
  onClick: function () {
@@ -804,7 +885,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
804
885
  },
805
886
  }
806
887
  : null,
807
- !((_51 = (_50 = props.organise) === null || _50 === void 0 ? void 0 : _50.exportSettings) === null || _51 === void 0 ? void 0 : _51.hideExportPrint)
888
+ !((_55 = (_54 = props.organise) === null || _54 === void 0 ? void 0 : _54.exportSettings) === null || _55 === void 0 ? void 0 : _55.hideExportPrint)
808
889
  ? {
809
890
  text: "Print",
810
891
  onClick: function () {
@@ -814,7 +895,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
814
895
  },
815
896
  }
816
897
  : null,
817
- !((_53 = (_52 = props.organise) === null || _52 === void 0 ? void 0 : _52.exportSettings) === null || _53 === void 0 ? void 0 : _53.hideExportDraft)
898
+ !((_57 = (_56 = props.organise) === null || _56 === void 0 ? void 0 : _56.exportSettings) === null || _57 === void 0 ? void 0 : _57.hideExportDraft)
818
899
  ? {
819
900
  text: filterDraft ? "Show All Items" : "Filter Draft",
820
901
  onClick: function () {
@@ -823,7 +904,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
823
904
  }
824
905
  : null,
825
906
  ].filter(Boolean);
826
- if ((_54 = props.organise) === null || _54 === void 0 ? void 0 : _54.moreSettings)
907
+ if ((_58 = props.organise) === null || _58 === void 0 ? void 0 : _58.moreSettings)
827
908
  moreButtonPopUp = moreButtonPopUp.concat(props.organise.moreSettings);
828
909
  //=====================================================================================
829
910
  //SECTION: User Column Visibility Handlers
@@ -1134,11 +1215,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1134
1215
  //=====================================================================================
1135
1216
  //SECTION: Saved Views
1136
1217
  //=====================================================================================
1137
- var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_55 = props.organise) === null || _55 === void 0 ? void 0 : _55.persistKey, (_56 = devSettings.currentUser) === null || _56 === void 0 ? void 0 : _56.userEmail);
1218
+ 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);
1138
1219
  (0, react_1.useEffect)(function () {
1139
- if (isSavedViewsEnabled)
1220
+ if (isSavedViewsEnabled && !isAppViews)
1140
1221
  setSavedViews((0, viewStatePersistence_1.handleReadSavedViews)(savedViewsKey));
1141
- }, [isSavedViewsEnabled, savedViewsKey]);
1222
+ }, [isSavedViewsEnabled, isAppViews, savedViewsKey]);
1142
1223
  // INFO: views belong to a tab, so another tab starts with none selected
1143
1224
  (0, react_1.useEffect)(function () {
1144
1225
  setActiveSavedViewId(null);
@@ -1162,7 +1243,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1162
1243
  // INFO: fallback ids are numbered over the full list, before the tab filter,
1163
1244
  // so one default view keeps the same id on every tab it shows on
1164
1245
  var handleGetTabSavedViews = function () {
1165
- var _a, _b;
1246
+ var _a, _b, _c, _d;
1166
1247
  return __spreadArray(__spreadArray([], ((_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.defaultSavedViews) !== null && _b !== void 0 ? _b : [])
1167
1248
  .map(function (eachView, index) {
1168
1249
  var _a, _b;
@@ -1174,9 +1255,64 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1174
1255
  locked: true,
1175
1256
  });
1176
1257
  })
1177
- .filter(function (eachView) { return eachView.tabId === viewType; }), true), savedViews.filter(function (eachView) { return eachView.tabId === viewType; }), true);
1258
+ .filter(function (eachView) { return eachView.tabId === viewType; }), true), (isAppViews
1259
+ ? ((_d = (_c = props.organise) === null || _c === void 0 ? void 0 : _c.sharedViews) !== null && _d !== void 0 ? _d : [])
1260
+ .filter(function (eachView) { return eachView.tabId === viewType; })
1261
+ .map(function (eachView) {
1262
+ var _a;
1263
+ return (__assign(__assign({}, eachView), { locked: !((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeSharedViews) }));
1264
+ })
1265
+ : savedViews.filter(function (eachView) { return eachView.tabId === viewType; })), true);
1266
+ };
1267
+ // INFO: the app owns the list, so each change hands it the whole list to
1268
+ // store; nothing is written to this browser. A second change before the app
1269
+ // passes the list back builds on the one just sent, not the stale prop.
1270
+ var lastSentSharedViewsRef = (0, react_1.useRef)(null);
1271
+ (0, react_1.useEffect)(function () {
1272
+ lastSentSharedViewsRef.current = null;
1273
+ }, [(_61 = props.organise) === null || _61 === void 0 ? void 0 : _61.sharedViews]);
1274
+ var handleStoreSharedViews = function (update) {
1275
+ var _a, _b, _c;
1276
+ if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeSharedViews))
1277
+ return;
1278
+ var views = update((_c = (_b = lastSentSharedViewsRef.current) !== null && _b !== void 0 ? _b : props.organise.sharedViews) !== null && _c !== void 0 ? _c : []);
1279
+ lastSentSharedViewsRef.current = views;
1280
+ props.organise.onChangeSharedViews(views);
1178
1281
  };
1179
- var defaultSavedViewIds = ((_58 = (_57 = props.organise) === null || _57 === void 0 ? void 0 : _57.defaultSavedViews) !== null && _58 !== void 0 ? _58 : [])
1282
+ // INFO: the list opens on initialSavedViewId, or else on the ★ default
1283
+ // view. It settles once — when the view it names has arrived, so a default
1284
+ // the app loads after mount still applies — and is never applied over a
1285
+ // view already picked or a state persistViewState restored. A view that no
1286
+ // longer exists, or is on another tab, leaves the list on All.
1287
+ var openingViewSettledRef = (0, react_1.useRef)(false);
1288
+ (0, react_1.useEffect)(function () {
1289
+ var _a, _b, _c, _d;
1290
+ if (!isSavedViewsEnabled || openingViewSettledRef.current)
1291
+ return;
1292
+ if (activeSavedViewId !== null || (isPersistEnabled && rawPersistedState)) {
1293
+ openingViewSettledRef.current = true;
1294
+ return;
1295
+ }
1296
+ var wantedId = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.initialSavedViewId) !== null && _b !== void 0 ? _b : (_c = props.organise) === null || _c === void 0 ? void 0 : _c.defaultSavedViewId;
1297
+ if (!wantedId)
1298
+ return;
1299
+ // INFO: the app's views may still be loading
1300
+ if (isAppViews && ((_d = props.organise) === null || _d === void 0 ? void 0 : _d.sharedViews) === undefined)
1301
+ return;
1302
+ openingViewSettledRef.current = true;
1303
+ var view = handleGetTabSavedViews().find(function (eachView) { return eachView.id === wantedId; });
1304
+ if (view)
1305
+ handleApplySavedView(view, true);
1306
+ /* eslint-disable */
1307
+ }, [
1308
+ isSavedViewsEnabled,
1309
+ (_62 = props.organise) === null || _62 === void 0 ? void 0 : _62.initialSavedViewId,
1310
+ (_63 = props.organise) === null || _63 === void 0 ? void 0 : _63.defaultSavedViewId,
1311
+ (_64 = props.organise) === null || _64 === void 0 ? void 0 : _64.sharedViews,
1312
+ savedViews,
1313
+ ]);
1314
+ /* eslint-enable */
1315
+ var defaultSavedViewIds = ((_66 = (_65 = props.organise) === null || _65 === void 0 ? void 0 : _65.defaultSavedViews) !== null && _66 !== void 0 ? _66 : [])
1180
1316
  .map(function (eachView) { var _a; return (_a = eachView.id) !== null && _a !== void 0 ? _a : ""; })
1181
1317
  .join("|");
1182
1318
  // INFO: keyed on the ids, not the array, so an inline literal passed on every
@@ -1209,7 +1345,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1209
1345
  return (__assign(__assign({}, eachColumn), { hide: (_b = (_a = state.hiddenColumnIds) === null || _a === void 0 ? void 0 : _a.includes(eachColumn.id)) !== null && _b !== void 0 ? _b : false }));
1210
1346
  });
1211
1347
  };
1212
- var handleApplySavedView = function (view) {
1348
+ // INFO: isOpening — the list opening on a view tells the host nothing new,
1349
+ // so its sort is not handed back (a host saving sort would write it on
1350
+ // every open)
1351
+ var handleApplySavedView = function (view, isOpening) {
1213
1352
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
1214
1353
  var next = handleResolveViewState((_a = view === null || view === void 0 ? void 0 : view.state) !== null && _a !== void 0 ? _a : null);
1215
1354
  var isQueryChanged = !(0, viewStatePersistence_1.handleIsSameViewState)((0, viewStatePersistence_1.handlePickQueryState)(handleBuildViewSnapshot()), (0, viewStatePersistence_1.handlePickQueryState)(next));
@@ -1227,7 +1366,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1227
1366
  : initialFilterReferenceDate);
1228
1367
  handleCommitFlexFilters(((_f = next.flexFilters) === null || _f === void 0 ? void 0 : _f.length) ? next.flexFilters : defaultFlexFilterRow);
1229
1368
  setPersistedSort(next.sort);
1230
- if (next.sort && !(0, viewStatePersistence_1.handleIsSameViewState)(next.sort, activeSortId !== null && activeSortId !== void 0 ? activeSortId : {}))
1369
+ if (!isOpening &&
1370
+ next.sort &&
1371
+ !(0, viewStatePersistence_1.handleIsSameViewState)(next.sort, activeSortId !== null && activeSortId !== void 0 ? activeSortId : {}))
1231
1372
  (_h = (_g = props.organise) === null || _g === void 0 ? void 0 : _g.onChangeSort) === null || _h === void 0 ? void 0 : _h.call(_g, next.sort);
1232
1373
  if (next.pageLimit)
1233
1374
  setPageLimit(next.pageLimit);
@@ -1262,13 +1403,32 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1262
1403
  setSavedViews(views);
1263
1404
  (0, viewStatePersistence_1.handleWriteSavedViews)(savedViewsKey, views);
1264
1405
  };
1265
- // INFO: a name already used on this tab is overwritten
1406
+ // INFO: a name already used on this tab is overwritten, in the list the
1407
+ // view is saved to
1266
1408
  var handleSaveSavedView = function (name) {
1267
1409
  var trimmed = name.trim();
1268
1410
  if (!trimmed)
1269
1411
  return;
1270
1412
  var state = (0, viewStatePersistence_1.handlePickViewState)(handleBuildViewSnapshot());
1271
1413
  var savedId = "";
1414
+ if (isAppViews) {
1415
+ handleStoreSharedViews(function (views) {
1416
+ var existing = views.find(function (eachView) {
1417
+ return eachView.tabId === viewType && eachView.name === trimmed;
1418
+ });
1419
+ var saved = existing
1420
+ ? __assign(__assign({}, existing), { state: state }) : { id: (0, uuid_1.v4)(), name: trimmed, tabId: viewType, state: state };
1421
+ savedId = saved.id;
1422
+ return existing
1423
+ ? views.map(function (eachView) {
1424
+ return eachView.id === existing.id ? saved : eachView;
1425
+ })
1426
+ : __spreadArray(__spreadArray([], views, true), [saved], false);
1427
+ });
1428
+ setActiveSavedViewId(savedId);
1429
+ setSavedViewName(null);
1430
+ return;
1431
+ }
1272
1432
  handleStoreSavedViews(function (views) {
1273
1433
  var existing = views.find(function (eachView) { return eachView.tabId === viewType && eachView.name === trimmed; });
1274
1434
  var saved = existing
@@ -1285,6 +1445,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1285
1445
  };
1286
1446
  var handleUpdateSavedView = function (id) {
1287
1447
  var state = (0, viewStatePersistence_1.handlePickViewState)(handleBuildViewSnapshot());
1448
+ if (isAppViews) {
1449
+ handleStoreSharedViews(function (views) {
1450
+ return views.map(function (eachView) {
1451
+ return eachView.id === id ? __assign(__assign({}, eachView), { state: state }) : eachView;
1452
+ });
1453
+ });
1454
+ return;
1455
+ }
1288
1456
  handleStoreSavedViews(function (views) {
1289
1457
  return views.map(function (eachView) {
1290
1458
  return eachView.id === id ? __assign(__assign({}, eachView), { state: state }) : eachView;
@@ -1292,9 +1460,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1292
1460
  });
1293
1461
  };
1294
1462
  var handleDeleteSavedView = function (id) {
1295
- handleStoreSavedViews(function (views) {
1296
- return views.filter(function (eachView) { return eachView.id !== id; });
1297
- });
1463
+ var _a, _b, _c;
1464
+ // INFO: a deleted default leaves the list opening on All
1465
+ if (id === ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.defaultSavedViewId))
1466
+ (_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.onChangeDefaultSavedViewId) === null || _c === void 0 ? void 0 : _c.call(_b, null);
1467
+ if (isAppViews)
1468
+ handleStoreSharedViews(function (views) {
1469
+ return views.filter(function (eachView) { return eachView.id !== id; });
1470
+ });
1471
+ else
1472
+ handleStoreSavedViews(function (views) {
1473
+ return views.filter(function (eachView) { return eachView.id !== id; });
1474
+ });
1298
1475
  if (activeSavedViewId === id)
1299
1476
  setActiveSavedViewId(null);
1300
1477
  setDeletingSavedViewId(null);
@@ -1383,7 +1560,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1383
1560
  var isOtherListReturn = !(0, viewStatePersistence_1.handleIsLastDrill)(props.collectionId, (_c = props.organise) === null || _c === void 0 ? void 0 : _c.persistKey);
1384
1561
  scrollRestoredRef.current = isSwitch || isOtherListReturn;
1385
1562
  /* eslint-disable */
1386
- }, [props.collectionId, (_59 = props.organise) === null || _59 === void 0 ? void 0 : _59.persistKey]);
1563
+ }, [props.collectionId, (_67 = props.organise) === null || _67 === void 0 ? void 0 : _67.persistKey]);
1387
1564
  /* eslint-enable */
1388
1565
  // INFO: wait a frame — rows land in state one tick before layout
1389
1566
  (0, react_1.useEffect)(function () {
@@ -1418,7 +1595,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1418
1595
  (0, react_1.useEffect)(function () {
1419
1596
  handleOfflinePrefetch();
1420
1597
  /* eslint-disable */
1421
- }, [props.collectionId, (_60 = props.bareSettings) === null || _60 === void 0 ? void 0 : _60.bareOffline]);
1598
+ }, [props.collectionId, (_68 = props.bareSettings) === null || _68 === void 0 ? void 0 : _68.bareOffline]);
1422
1599
  /* eslint-enable */
1423
1600
  // INFO: MRQ polling — calls handleRefresh every N ms (e.g. 1500) as a fallback.
1424
1601
  // Calls through handleRefreshRef so the interval always dispatches the latest
@@ -1438,7 +1615,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1438
1615
  }, interval);
1439
1616
  return function () { return clearInterval(timer); };
1440
1617
  /* eslint-disable */
1441
- }, [(_61 = props.bareSettings) === null || _61 === void 0 ? void 0 : _61.barePollingInterval, isLive, isNetworkOffline]);
1618
+ }, [(_69 = props.bareSettings) === null || _69 === void 0 ? void 0 : _69.barePollingInterval, isLive, isNetworkOffline]);
1442
1619
  /* eslint-enable */
1443
1620
  // INFO: Pub/Sub → SSE live-stream — driven by bareSettings.bareSocketName
1444
1621
  // EventSource URL: {sseEndpoint}/{room}?bm_apiToken={token}
@@ -1480,7 +1657,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1480
1657
  };
1481
1658
  /* eslint-disable */
1482
1659
  }, [
1483
- (_62 = props.bareSettings) === null || _62 === void 0 ? void 0 : _62.bareSocketName,
1660
+ (_70 = props.bareSettings) === null || _70 === void 0 ? void 0 : _70.bareSocketName,
1484
1661
  props.collectionId,
1485
1662
  props.devSettings.sseEndpoint,
1486
1663
  props.devSettings.dbAPIToken,
@@ -1732,10 +1909,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1732
1909
  props.collectionId,
1733
1910
  props.model,
1734
1911
  props.localURLEndpoint,
1735
- (_63 = props.organise) === null || _63 === void 0 ? void 0 : _63.extendedTabs,
1736
- (_64 = props.organise) === null || _64 === void 0 ? void 0 : _64.viewId,
1737
- (_65 = props.organise) === null || _65 === void 0 ? void 0 : _65.additionalQuery,
1738
- (_66 = props.organise) === null || _66 === void 0 ? void 0 : _66.groupBy,
1912
+ (_71 = props.organise) === null || _71 === void 0 ? void 0 : _71.extendedTabs,
1913
+ (_72 = props.organise) === null || _72 === void 0 ? void 0 : _72.viewId,
1914
+ (_73 = props.organise) === null || _73 === void 0 ? void 0 : _73.additionalQuery,
1915
+ (_74 = props.organise) === null || _74 === void 0 ? void 0 : _74.groupBy,
1739
1916
  resolvedType,
1740
1917
  ]);
1741
1918
  /**
@@ -1876,7 +2053,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1876
2053
  };
1877
2054
  }, 100);
1878
2055
  return function () { return clearTimeout(timeoutId); };
1879
- }, [(_67 = props.organise) === null || _67 === void 0 ? void 0 : _67.showReadFloatingNav, resolvedType, props.id, loading]);
2056
+ }, [(_75 = props.organise) === null || _75 === void 0 ? void 0 : _75.showReadFloatingNav, resolvedType, props.id, loading]);
1880
2057
  (0, react_1.useEffect)(function () {
1881
2058
  if (resolvedType !== "read")
1882
2059
  return;
@@ -4181,16 +4358,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
4181
4358
  });
4182
4359
  }); };
4183
4360
  var handleCheckDeleteReference = function (selectedData, multipleDelete) { return __awaiter(void 0, void 0, void 0, function () {
4184
- var existDataIds, existsData, handleFindReference_1, collectionIdList_1, columnIdList_1, collectionNameList_1, refStructureList_1, schemaQuery, schemaRes, spaceList, err_14;
4185
- var _a, _b;
4186
- return __generator(this, function (_c) {
4187
- switch (_c.label) {
4361
+ var existDataIds, existsData, handleFindReference_1, referenceSources_1, err_14;
4362
+ var _a, _b, _c;
4363
+ return __generator(this, function (_d) {
4364
+ switch (_d.label) {
4188
4365
  case 0:
4189
4366
  existDataIds = [];
4190
4367
  existsData = {};
4191
- _c.label = 1;
4368
+ _d.label = 1;
4192
4369
  case 1:
4193
- _c.trys.push([1, 10, , 11]);
4370
+ _d.trys.push([1, 4, , 5]);
4194
4371
  handleFindReference_1 = function (data, referenceStructure, space, spaceId, spaceName) { return __awaiter(void 0, void 0, void 0, function () {
4195
4372
  var referenceRQ, currentReferenceSelectedList;
4196
4373
  var _a, _b, _c, _d, _e, _f;
@@ -4208,13 +4385,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
4208
4385
  return [4 /*yield*/, referenceRQ.call({
4209
4386
  type: "list",
4210
4387
  query: [
4211
- {
4212
- type: (referenceStructure === null || referenceStructure === void 0 ? void 0 : referenceStructure.type) === "listReference" ? "in" : "=",
4213
- value: (referenceStructure === null || referenceStructure === void 0 ? void 0 : referenceStructure.type) === "listReference"
4214
- ? [data[serverId]]
4215
- : data[serverId],
4216
- queryId: referenceStructure === null || referenceStructure === void 0 ? void 0 : referenceStructure.id,
4217
- },
4388
+ (0, referenceScan_1.handleBuildReferenceQuery)(referenceStructure, data[serverId]),
4218
4389
  ],
4219
4390
  })];
4220
4391
  case 1:
@@ -4236,159 +4407,44 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
4236
4407
  }
4237
4408
  });
4238
4409
  }); };
4239
- if (!!schemaPresent) return [3 /*break*/, 6];
4240
- if (!(((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareReferenceDel) &&
4241
- props.bareSettings.bareReferenceDel.length > 0)) return [3 /*break*/, 4];
4242
- collectionIdList_1 = [];
4243
- columnIdList_1 = [];
4244
- collectionNameList_1 = [];
4245
- refStructureList_1 = [];
4246
- props.bareSettings.bareReferenceDel.map(function (eachRef) {
4247
- collectionIdList_1.push(eachRef.collectionId);
4248
- columnIdList_1.push(eachRef.columnId);
4249
- collectionNameList_1.push(eachRef.collectionName);
4250
- refStructureList_1.push(eachRef.schema);
4251
- return null;
4252
- });
4253
- if (!(collectionIdList_1.length > 0 && columnIdList_1.length > 0)) return [3 /*break*/, 3];
4410
+ if (!schemaPresent && !((_b = (_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareReferenceDel) === null || _b === void 0 ? void 0 : _b.length)) {
4411
+ if (multipleDelete) {
4412
+ return [2 /*return*/, selectedData
4413
+ .filter(function (eachData) {
4414
+ return !existDataIds.includes(eachData[serverId]);
4415
+ })
4416
+ .map(function (eachData) { return eachData[serverId]; })];
4417
+ }
4418
+ else
4419
+ return [2 /*return*/, selectedData];
4420
+ }
4421
+ return [4 /*yield*/, (0, referenceScan_1.handleListReferenceSources)({
4422
+ dbModule: dbModule,
4423
+ devSettings: props.devSettings,
4424
+ space: props.space,
4425
+ bareReferenceDel: (_c = props.bareSettings) === null || _c === void 0 ? void 0 : _c.bareReferenceDel,
4426
+ })];
4427
+ case 2:
4428
+ referenceSources_1 = _d.sent();
4254
4429
  return [4 /*yield*/, Promise.all(selectedData.map(function (eachData) { return __awaiter(void 0, void 0, void 0, function () {
4255
4430
  return __generator(this, function (_a) {
4256
4431
  switch (_a.label) {
4257
- case 0: return [4 /*yield*/, Promise.all(collectionIdList_1.map(function (eachCollectionId, index) { return __awaiter(void 0, void 0, void 0, function () {
4258
- var selectedRefStructure, selectedColumn;
4259
- return __generator(this, function (_a) {
4260
- switch (_a.label) {
4261
- case 0:
4262
- selectedRefStructure = refStructureList_1[index];
4263
- if (!(selectedRefStructure &&
4264
- selectedRefStructure.length > 0)) return [3 /*break*/, 2];
4265
- selectedColumn = selectedRefStructure.find(function (eachField) { return eachField.id === columnIdList_1[index]; });
4266
- if (!selectedColumn) return [3 /*break*/, 2];
4267
- return [4 /*yield*/, handleFindReference_1(eachData, selectedColumn, undefined, eachCollectionId, collectionNameList_1[index])];
4268
- case 1:
4269
- _a.sent();
4270
- _a.label = 2;
4271
- case 2: return [2 /*return*/];
4272
- }
4273
- });
4274
- }); }))];
4432
+ case 0: return [4 /*yield*/, Promise.all(referenceSources_1.map(function (eachSource) {
4433
+ return handleFindReference_1(eachData, eachSource.column, undefined, eachSource.collectionId, eachSource.collectionName);
4434
+ }))];
4275
4435
  case 1:
4276
4436
  _a.sent();
4277
4437
  return [2 /*return*/];
4278
4438
  }
4279
4439
  });
4280
4440
  }); }))];
4281
- case 2:
4282
- _c.sent();
4283
- _c.label = 3;
4284
- case 3: return [3 /*break*/, 5];
4441
+ case 3:
4442
+ _d.sent();
4443
+ return [3 /*break*/, 5];
4285
4444
  case 4:
4286
- if (multipleDelete) {
4287
- return [2 /*return*/, selectedData
4288
- .filter(function (eachData) {
4289
- return !existDataIds.includes(eachData[serverId]);
4290
- })
4291
- .map(function (eachData) { return eachData[serverId]; })];
4292
- }
4293
- else
4294
- return [2 /*return*/, selectedData];
4295
- _c.label = 5;
4296
- case 5: return [3 /*break*/, 9];
4297
- case 6:
4298
- schemaQuery = new readQuery_1.ReadQuery({
4299
- dbModule: dbModule,
4300
- dbType: props.devSettings.server,
4301
- dbCollection: "spaces",
4302
- dbEndpoint: props.devSettings.schemaEndpoint,
4303
- dbAPIToken: props.devSettings.schemaEndpointToken,
4304
- });
4305
- return [4 /*yield*/, schemaQuery.call({
4306
- query: [
4307
- {
4308
- type: "=",
4309
- queryId: "workspaceId",
4310
- value: (_b = props.space) === null || _b === void 0 ? void 0 : _b.workspaceId,
4311
- },
4312
- {
4313
- type: "=",
4314
- queryId: "type",
4315
- value: "datasheet",
4316
- },
4317
- ],
4318
- type: "list",
4319
- })];
4320
- case 7:
4321
- schemaRes = _c.sent();
4322
- spaceList = schemaRes === null || schemaRes === void 0 ? void 0 : schemaRes.data;
4323
- return [4 /*yield*/, Promise.all(spaceList.map(function (eachSpace) { return __awaiter(void 0, void 0, void 0, function () {
4324
- var reference;
4325
- var _a;
4326
- return __generator(this, function (_b) {
4327
- switch (_b.label) {
4328
- case 0:
4329
- reference = (_a = eachSpace.structure) === null || _a === void 0 ? void 0 : _a.filter(function (eacStructure) {
4330
- var _a;
4331
- return eacStructure.referenceSpaceId === ((_a = props.space) === null || _a === void 0 ? void 0 : _a._id);
4332
- });
4333
- if (!(reference && reference.length > 0)) return [3 /*break*/, 2];
4334
- return [4 /*yield*/, Promise.all(selectedData.map(function (eachData) { return __awaiter(void 0, void 0, void 0, function () {
4335
- var _a, reference_1, reference_1_1, eachReferenceStructure, e_1_1;
4336
- var _b, e_1, _c, _d;
4337
- return __generator(this, function (_e) {
4338
- switch (_e.label) {
4339
- case 0:
4340
- _e.trys.push([0, 6, 7, 12]);
4341
- _a = true, reference_1 = __asyncValues(reference);
4342
- _e.label = 1;
4343
- case 1: return [4 /*yield*/, reference_1.next()];
4344
- case 2:
4345
- if (!(reference_1_1 = _e.sent(), _b = reference_1_1.done, !_b)) return [3 /*break*/, 5];
4346
- _d = reference_1_1.value;
4347
- _a = false;
4348
- eachReferenceStructure = _d;
4349
- return [4 /*yield*/, handleFindReference_1(eachData, eachReferenceStructure, eachSpace)];
4350
- case 3:
4351
- _e.sent();
4352
- _e.label = 4;
4353
- case 4:
4354
- _a = true;
4355
- return [3 /*break*/, 1];
4356
- case 5: return [3 /*break*/, 12];
4357
- case 6:
4358
- e_1_1 = _e.sent();
4359
- e_1 = { error: e_1_1 };
4360
- return [3 /*break*/, 12];
4361
- case 7:
4362
- _e.trys.push([7, , 10, 11]);
4363
- if (!(!_a && !_b && (_c = reference_1.return))) return [3 /*break*/, 9];
4364
- return [4 /*yield*/, _c.call(reference_1)];
4365
- case 8:
4366
- _e.sent();
4367
- _e.label = 9;
4368
- case 9: return [3 /*break*/, 11];
4369
- case 10:
4370
- if (e_1) throw e_1.error;
4371
- return [7 /*endfinally*/];
4372
- case 11: return [7 /*endfinally*/];
4373
- case 12: return [2 /*return*/];
4374
- }
4375
- });
4376
- }); }))];
4377
- case 1:
4378
- _b.sent();
4379
- _b.label = 2;
4380
- case 2: return [2 /*return*/];
4381
- }
4382
- });
4383
- }); }))];
4384
- case 8:
4385
- _c.sent();
4386
- _c.label = 9;
4387
- case 9: return [3 /*break*/, 11];
4388
- case 10:
4389
- err_14 = _c.sent();
4390
- return [3 /*break*/, 11];
4391
- case 11:
4445
+ err_14 = _d.sent();
4446
+ return [3 /*break*/, 5];
4447
+ case 5:
4392
4448
  setReferenceDeleteTableData(existsData);
4393
4449
  return [2 /*return*/, selectedData
4394
4450
  .filter(function (eachData) {
@@ -7607,7 +7663,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7607
7663
  })) })) }));
7608
7664
  };
7609
7665
  var renderContent = function () {
7610
- 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;
7666
+ 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;
7611
7667
  var isBottom = ((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareUpdateActionBottom) ? true : false;
7612
7668
  var tabs = renderTabs();
7613
7669
  var pages = [
@@ -7647,16 +7703,22 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7647
7703
  props.title && (react_1.default.createElement("p", { className: "text-xl font-medium ".concat(((_h = props.organise) === null || _h === void 0 ? void 0 : _h.darkMode) ? "text-white" : "") }, props.title)),
7648
7704
  props.description && (react_1.default.createElement("span", { className: "text-sm text-gray-500" }, props.description)))),
7649
7705
  renderActionButtons(resolvedType))),
7650
- (schemaPresent || ((_j = props.bareSettings) === null || _j === void 0 ? void 0 : _j.bareReadListTabs)) && (react_1.default.createElement(tabs_1.Tabs, { tabs: tabs, selectedId: viewType, linkType: props.linkType, custom: props.custom, onClick: function (id) { return handleSelectTab(id); }, darkMode: (_k = props.organise) === null || _k === void 0 ? void 0 : _k.darkMode })),
7706
+ (schemaPresent ||
7707
+ ((_j = props.bareSettings) === null || _j === void 0 ? void 0 : _j.bareReadListTabs) ||
7708
+ relatedSections.length > 0) && (react_1.default.createElement(tabs_1.Tabs, { tabs: tabs, selectedId: viewType, linkType: props.linkType, custom: props.custom, onClick: function (id) { return handleSelectTab(id); }, darkMode: (_k = props.organise) === null || _k === void 0 ? void 0 : _k.darkMode })),
7651
7709
  ((_l = props.bareSettings) === null || _l === void 0 ? void 0 : _l.bareReadComponentPos) === "top" &&
7652
7710
  renderBareReadComp(),
7653
- ((_m = props.bareSettings) === null || _m === void 0 ? void 0 : _m.bareUpdateActionTop) && renderReadBar(),
7711
+ ((_m = props.bareSettings) === null || _m === void 0 ? void 0 : _m.bareUpdateActionTop) &&
7712
+ !selectedRelated &&
7713
+ renderReadBar(),
7654
7714
  anyAuthMethod && (react_1.default.createElement("div", { className: "bg-primary-100 text-gray-700 mt-3 px-5 py-3 rounded" }, renderAuthContent())),
7655
7715
  react_1.default.createElement("div", { ref: exportReadPDFRef },
7656
- !((_o = props.bareSettings) === null || _o === void 0 ? void 0 : _o.bareReadComponentHide) && (react_1.default.createElement("div", null, renderTabContent(tabs, resolvedType, viewType))),
7657
- ((_p = props.bareSettings) === null || _p === void 0 ? void 0 : _p.bareReadComponentPos) !== "top" &&
7716
+ selectedRelated ? (react_1.default.createElement(relatedRecords_1.RelatedRecords, { key: "".concat(props.id, "-").concat(selectedRelated.id), source: selectedRelated.source, recordId: (_o = props.id) !== null && _o !== void 0 ? _o : "", renderList: renderRelatedList })) : (!((_p = props.bareSettings) === null || _p === void 0 ? void 0 : _p.bareReadComponentHide) && (react_1.default.createElement("div", null, renderTabContent(tabs, resolvedType, viewType)))),
7717
+ ((_q = props.bareSettings) === null || _q === void 0 ? void 0 : _q.bareReadComponentPos) !== "top" &&
7658
7718
  renderBareReadComp()),
7659
- !((_q = props.bareSettings) === null || _q === void 0 ? void 0 : _q.bareUpdateActionTop) && renderReadBar()))));
7719
+ !((_r = props.bareSettings) === null || _r === void 0 ? void 0 : _r.bareUpdateActionTop) &&
7720
+ !selectedRelated &&
7721
+ renderReadBar()))));
7660
7722
  case "update":
7661
7723
  if (props.id !== "new") {
7662
7724
  pages.push({
@@ -7666,12 +7728,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7666
7728
  });
7667
7729
  }
7668
7730
  pages.push({
7669
- name: (_t = selectedData === null || selectedData === void 0 ? void 0 : selectedData[(_s = (_r = props.organise) === null || _r === void 0 ? void 0 : _r.breadcrumbAttributeId) !== null && _s !== void 0 ? _s : serverId]) !== null && _t !== void 0 ? _t : (props.id ? props.id : "new"),
7731
+ name: (_u = selectedData === null || selectedData === void 0 ? void 0 : selectedData[(_t = (_s = props.organise) === null || _s === void 0 ? void 0 : _s.breadcrumbAttributeId) !== null && _t !== void 0 ? _t : serverId]) !== null && _u !== void 0 ? _u : (props.id ? props.id : "new"),
7670
7732
  href: "#",
7671
7733
  current: true,
7672
7734
  });
7673
7735
  var filterModel_1 = [];
7674
- var disabledOnEnter_1 = (_v = (_u = props.organise) === null || _u === void 0 ? void 0 : _u.disabledOnEnter) !== null && _v !== void 0 ? _v : false;
7736
+ var disabledOnEnter_1 = (_w = (_v = props.organise) === null || _v === void 0 ? void 0 : _v.disabledOnEnter) !== null && _w !== void 0 ? _w : false;
7675
7737
  structure.map(function (eachModel) {
7676
7738
  var _a;
7677
7739
  var present = false;
@@ -7784,12 +7846,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7784
7846
  }
7785
7847
  }
7786
7848
  };
7787
- var hasTabAlign_1 = ((_w = props.organise) === null || _w === void 0 ? void 0 : _w.tabAlign) || ((_x = props.space) === null || _x === void 0 ? void 0 : _x.tabAlign);
7788
- var leftTabAlign = ((_y = props.organise) === null || _y === void 0 ? void 0 : _y.tabAlign) === "left" ||
7789
- ((_z = props.space) === null || _z === void 0 ? void 0 : _z.tabAlign) === "left";
7790
- var topTabAlign = ((_0 = props.organise) === null || _0 === void 0 ? void 0 : _0.tabAlign) === "top" || ((_1 = props.space) === null || _1 === void 0 ? void 0 : _1.tabAlign) === "top";
7791
- var stepperTabAlign = ((_2 = props.organise) === null || _2 === void 0 ? void 0 : _2.tabAlign) === "stepper" ||
7792
- ((_3 = props.space) === null || _3 === void 0 ? void 0 : _3.tabAlign) === "stepper";
7849
+ var hasTabAlign_1 = ((_x = props.organise) === null || _x === void 0 ? void 0 : _x.tabAlign) || ((_y = props.space) === null || _y === void 0 ? void 0 : _y.tabAlign);
7850
+ var leftTabAlign = ((_z = props.organise) === null || _z === void 0 ? void 0 : _z.tabAlign) === "left" ||
7851
+ ((_0 = props.space) === null || _0 === void 0 ? void 0 : _0.tabAlign) === "left";
7852
+ var topTabAlign = ((_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.tabAlign) === "top" || ((_2 = props.space) === null || _2 === void 0 ? void 0 : _2.tabAlign) === "top";
7853
+ var stepperTabAlign = ((_3 = props.organise) === null || _3 === void 0 ? void 0 : _3.tabAlign) === "stepper" ||
7854
+ ((_4 = props.space) === null || _4 === void 0 ? void 0 : _4.tabAlign) === "stepper";
7793
7855
  var uniqueTabIds_2 = Array.from(new Set(filterModel_1
7794
7856
  .map(function (item) { return item.tabId; })
7795
7857
  .filter(function (id) { return id !== undefined; })));
@@ -7798,7 +7860,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7798
7860
  if (shouldIncludeOthers) {
7799
7861
  uniqueTabIds_2.push("");
7800
7862
  }
7801
- var customTabComponent_1 = (_6 = (_5 = (_4 = props.bareSettings) === null || _4 === void 0 ? void 0 : _4.bareUpdateTabComponent) === null || _5 === void 0 ? void 0 : _5.call(_4, uniqueTabIds_2)) !== null && _6 !== void 0 ? _6 : [];
7863
+ var customTabComponent_1 = (_7 = (_6 = (_5 = props.bareSettings) === null || _5 === void 0 ? void 0 : _5.bareUpdateTabComponent) === null || _6 === void 0 ? void 0 : _6.call(_5, uniqueTabIds_2)) !== null && _7 !== void 0 ? _7 : [];
7802
7864
  var stepperSteps = uniqueTabIds_2.map(function (eachTabId) {
7803
7865
  var _a, _b;
7804
7866
  var customTabMatch = customTabComponent_1.find(function (eachTab) { return eachTab.tabId === eachTabId; });
@@ -7833,7 +7895,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7833
7895
  props.id && props.id !== "new" && structure.length >= 1 && (react_1.default.createElement(readQueryHoc_1.ReadQueryHoc, { ref: readQueryHocRef, database: {
7834
7896
  dbModule: dbModule,
7835
7897
  dbType: devSettings.server,
7836
- dbCollection: (_8 = (_7 = props === null || props === void 0 ? void 0 : props.space) === null || _7 === void 0 ? void 0 : _7.pipelineDefaultSpaceId) !== null && _8 !== void 0 ? _8 : props.collectionId,
7898
+ dbCollection: (_9 = (_8 = props === null || props === void 0 ? void 0 : props.space) === null || _8 === void 0 ? void 0 : _8.pipelineDefaultSpaceId) !== null && _9 !== void 0 ? _9 : props.collectionId,
7837
7899
  dbEndpoint: devSettings.dbEndpoint,
7838
7900
  dbAPIToken: devSettings.dbAPIToken,
7839
7901
  dbUserToken: devSettings.dbUserToken,
@@ -7841,11 +7903,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7841
7903
  type: "get",
7842
7904
  id: props.id,
7843
7905
  pipeline: pipeline,
7844
- }, offline: ((_9 = props.bareSettings) === null || _9 === void 0 ? void 0 : _9.bareOffline) && isNetworkOffline, onChangeData: handleRetrieveSelectedData, onError: handleGetItemError })),
7906
+ }, offline: ((_10 = props.bareSettings) === null || _10 === void 0 ? void 0 : _10.bareOffline) && isNetworkOffline, onChangeData: handleRetrieveSelectedData, onError: handleGetItemError })),
7845
7907
  renderBreadcrumb(pages),
7846
7908
  react_1.default.createElement("div", { className: "flex flex-col py-2 sm:items-center sm:flex-row" },
7847
7909
  (props.title || props.description) && (react_1.default.createElement("div", { className: "flex flex-col w-full" },
7848
- props.title && (react_1.default.createElement("p", { className: "text-xl font-medium ".concat(((_10 = props.organise) === null || _10 === void 0 ? void 0 : _10.darkMode) ? "text-white" : "") }, props.title)),
7910
+ props.title && (react_1.default.createElement("p", { className: "text-xl font-medium ".concat(((_11 = props.organise) === null || _11 === void 0 ? void 0 : _11.darkMode) ? "text-white" : "") }, props.title)),
7849
7911
  props.description && (react_1.default.createElement("span", { className: "text-sm text-gray-500" }, props.description)))),
7850
7912
  (!isBottom || hasTabAlign_1 || resolvedType === "update") &&
7851
7913
  renderActionButtons(resolvedType, hasTabAlign_1, uniqueTabIds_2)),
@@ -7864,10 +7926,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7864
7926
  var tabId = uniqueTabIds_2[stepIndex];
7865
7927
  handleUpdateTabId(tabId);
7866
7928
  } })),
7867
- ((_11 = props.bareSettings) === null || _11 === void 0 ? void 0 : _11.bareUpdateComponentAbove) &&
7868
- ((_12 = props.bareSettings) === null || _12 === void 0 ? void 0 : _12.bareUpdateComponent) &&
7869
- ((_13 = props.bareSettings) === null || _13 === void 0 ? void 0 : _13.bareUpdateComponent(selectedData, handleResolveRawData())),
7870
- ((_14 = props.bareSettings) === null || _14 === void 0 ? void 0 : _14.bareUpdateActionTop) &&
7929
+ ((_12 = props.bareSettings) === null || _12 === void 0 ? void 0 : _12.bareUpdateComponentAbove) &&
7930
+ ((_13 = props.bareSettings) === null || _13 === void 0 ? void 0 : _13.bareUpdateComponent) &&
7931
+ ((_14 = props.bareSettings) === null || _14 === void 0 ? void 0 : _14.bareUpdateComponent(selectedData, handleResolveRawData())),
7932
+ ((_15 = props.bareSettings) === null || _15 === void 0 ? void 0 : _15.bareUpdateActionTop) &&
7871
7933
  renderStepBar(uniqueTabIds_2),
7872
7934
  react_1.default.createElement(form_1.Form, { className: "mt-6", ref: formRef, refList: __spreadArray(__spreadArray([], modalFormInputRefs, true), flexTableRefs, true), handleComplete: handleSubmit, disabledOnEnter: disabledOnEnter_1, handleOnFailValidation: handleOnFailValidation },
7873
7935
  uniqueTabIds_2.map(function (tabId) {
@@ -7889,8 +7951,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7889
7951
  ((_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.tabDescriptions) === null || _c === void 0 ? void 0 : _c[tabId]) && (react_1.default.createElement("p", { className: "text-sm mt-0.5 ".concat(((_d = props.organise) === null || _d === void 0 ? void 0 : _d.darkMode) ? "text-gray-400" : "text-gray-500") }, props.organise.tabDescriptions[tabId])))),
7890
7952
  renderDataTemplateFormContent(selectedData, filterByTab, modalFormInputRefs, false, false, undefined, undefined)));
7891
7953
  }),
7892
- !((_15 = props.bareSettings) === null || _15 === void 0 ? void 0 : _15.bareUpdateComponentAbove) &&
7893
- ((_16 = props.bareSettings) === null || _16 === void 0 ? void 0 : _16.bareUpdateComponent) && (
7954
+ !((_16 = props.bareSettings) === null || _16 === void 0 ? void 0 : _16.bareUpdateComponentAbove) &&
7955
+ ((_17 = props.bareSettings) === null || _17 === void 0 ? void 0 : _17.bareUpdateComponent) && (
7894
7956
  // INFO: the form is a grid-cols-12. A child with no column span is one
7895
7957
  // column, and a grid item cannot shrink below its longest word, so on a
7896
7958
  // phone it wraps one word per line. `contents` takes this wrapper out of
@@ -7900,20 +7962,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7900
7962
  react_1.default.createElement("div", { className: "contents [&>*:not([class*=col-span])]:col-span-12" }, props.bareSettings.bareUpdateComponent(selectedData, handleResolveRawData())))),
7901
7963
  react_1.default.createElement("div", { className: "mt-8" }, renderListAddress(resolvedType)),
7902
7964
  react_1.default.createElement("div", { className: "mt-8" }, renderListObject(resolvedType)),
7903
- !((_17 = props.bareSettings) === null || _17 === void 0 ? void 0 : _17.bareUpdateActionTop) &&
7965
+ !((_18 = props.bareSettings) === null || _18 === void 0 ? void 0 : _18.bareUpdateActionTop) &&
7904
7966
  renderStepBar(uniqueTabIds_2),
7905
7967
  isBottom &&
7906
7968
  resolvedType !== "update" &&
7907
7969
  renderActionButtons(resolvedType, hasTabAlign_1, uniqueTabIds_2)))) : (react_1.default.createElement("div", null,
7908
- ((_18 = props.bareSettings) === null || _18 === void 0 ? void 0 : _18.bareUpdateComponentAbove) &&
7909
- ((_19 = props.bareSettings) === null || _19 === void 0 ? void 0 : _19.bareUpdateComponent) &&
7910
- ((_20 = props.bareSettings) === null || _20 === void 0 ? void 0 : _20.bareUpdateComponent(selectedData, handleResolveRawData())),
7911
- ((_21 = props.bareSettings) === null || _21 === void 0 ? void 0 : _21.bareUpdateActionTop) &&
7970
+ ((_19 = props.bareSettings) === null || _19 === void 0 ? void 0 : _19.bareUpdateComponentAbove) &&
7971
+ ((_20 = props.bareSettings) === null || _20 === void 0 ? void 0 : _20.bareUpdateComponent) &&
7972
+ ((_21 = props.bareSettings) === null || _21 === void 0 ? void 0 : _21.bareUpdateComponent(selectedData, handleResolveRawData())),
7973
+ ((_22 = props.bareSettings) === null || _22 === void 0 ? void 0 : _22.bareUpdateActionTop) &&
7912
7974
  renderStepBar(uniqueTabIds_2),
7913
7975
  react_1.default.createElement(form_1.Form, { className: "grid ".concat(formColumn, " ").concat(gridGap, " mt-6"), ref: formRef, refList: __spreadArray(__spreadArray([], modalFormInputRefs, true), flexTableRefs, true), handleComplete: handleSubmit, disabledOnEnter: disabledOnEnter_1, handleOnFailValidation: handleOnFailValidation },
7914
7976
  renderDataTemplateFormContent(selectedData, filterModel_1, modalFormInputRefs, false, false),
7915
- !((_22 = props.bareSettings) === null || _22 === void 0 ? void 0 : _22.bareUpdateComponentAbove) &&
7916
- ((_23 = props.bareSettings) === null || _23 === void 0 ? void 0 : _23.bareUpdateComponent) && (
7977
+ !((_23 = props.bareSettings) === null || _23 === void 0 ? void 0 : _23.bareUpdateComponentAbove) &&
7978
+ ((_24 = props.bareSettings) === null || _24 === void 0 ? void 0 : _24.bareUpdateComponent) && (
7917
7979
  // INFO: the form is a grid-cols-12. A child with no column span is one
7918
7980
  // column, and a grid item cannot shrink below its longest word, so on a
7919
7981
  // phone it wraps one word per line. `contents` takes this wrapper out of
@@ -7923,7 +7985,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7923
7985
  react_1.default.createElement("div", { className: "contents [&>*:not([class*=col-span])]:col-span-12" }, props.bareSettings.bareUpdateComponent(selectedData, handleResolveRawData())))),
7924
7986
  react_1.default.createElement("div", { className: "mt-8" }, renderListAddress(resolvedType)),
7925
7987
  react_1.default.createElement("div", { className: "mt-8" }, renderListObject(resolvedType)),
7926
- !((_24 = props.bareSettings) === null || _24 === void 0 ? void 0 : _24.bareUpdateActionTop) &&
7988
+ !((_25 = props.bareSettings) === null || _25 === void 0 ? void 0 : _25.bareUpdateActionTop) &&
7927
7989
  renderStepBar(uniqueTabIds_2)))));
7928
7990
  case "list":
7929
7991
  case "union":
@@ -7932,20 +7994,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7932
7994
  var actionComponent = renderActionButtons(resolvedType);
7933
7995
  // INFO: active flex filter count for the icon badge + floating search.
7934
7996
  // Counts query output so the badge matches what's actually filtered.
7935
- var activeFlexFilterCount_1 = ((_25 = props.bareSettings) === null || _25 === void 0 ? void 0 : _25.bareFlexFilters)
7997
+ var activeFlexFilterCount_1 = ((_26 = props.bareSettings) === null || _26 === void 0 ? void 0 : _26.bareFlexFilters)
7936
7998
  ? (0, listModule_1.renderFlexFilterConditions)(flexFilters, structure).length
7937
7999
  : 0;
7938
8000
  var listReadQueryHOC = (react_1.default.createElement(readQueryHoc_1.ReadQueryHoc, { ref: listRQueryHocRef, database: {
7939
8001
  dbModule: dbModule,
7940
8002
  dbType: devSettings.server,
7941
- dbCollection: (_27 = (_26 = props === null || props === void 0 ? void 0 : props.space) === null || _26 === void 0 ? void 0 : _26.pipelineDefaultSpaceId) !== null && _27 !== void 0 ? _27 : props.collectionId,
8003
+ dbCollection: (_28 = (_27 = props === null || props === void 0 ? void 0 : props.space) === null || _27 === void 0 ? void 0 : _27.pipelineDefaultSpaceId) !== null && _28 !== void 0 ? _28 : props.collectionId,
7942
8004
  dbEndpoint: devSettings.dbEndpoint,
7943
8005
  dbAPIToken: devSettings.dbAPIToken,
7944
8006
  dbUserToken: devSettings.dbUserToken,
7945
- }, cond: handleReadQueryHocCond(), offline: ((_28 = props.bareSettings) === null || _28 === void 0 ? void 0 : _28.bareOffline) && isNetworkOffline, onChangeData: function (data, cond) {
8007
+ }, cond: handleReadQueryHocCond(), offline: ((_29 = props.bareSettings) === null || _29 === void 0 ? void 0 : _29.bareOffline) && isNetworkOffline, onChangeData: function (data, cond) {
7946
8008
  handleGetListData(data, "", "", cond);
7947
8009
  }, onError: handleGetItemError }));
7948
- if ((_29 = props.renderSettings) === null || _29 === void 0 ? void 0 : _29.renderListUI) {
8010
+ if ((_30 = props.renderSettings) === null || _30 === void 0 ? void 0 : _30.renderListUI) {
7949
8011
  return (react_1.default.createElement(react_1.default.Fragment, null,
7950
8012
  listReadQueryHOC,
7951
8013
  props.renderSettings.renderListUI(actionComponent, filterComponent_1, dataComponent)));
@@ -8157,47 +8219,47 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8157
8219
  };
8158
8220
  return (react_1.default.createElement(react_1.default.Fragment, null,
8159
8221
  listReadQueryHOC,
8160
- react_1.default.createElement("div", { className: "flex py-2 ".concat(((_30 = props.bareSettings) === null || _30 === void 0 ? void 0 : _30.bareCompactMode)
8222
+ react_1.default.createElement("div", { className: "flex py-2 ".concat(((_31 = props.bareSettings) === null || _31 === void 0 ? void 0 : _31.bareCompactMode)
8161
8223
  ? // INFO: the grow spacer is hidden on phones (search lives in
8162
8224
  // the floating bar), so the row itself pushes the actions right
8163
8225
  "w-full flex-row flex-wrap sm:flex-nowrap items-end justify-between sm:justify-start"
8164
8226
  : "flex-col md:items-end md:flex-row") },
8165
8227
  (props.title || props.description) && (react_1.default.createElement("div", { className: "flex flex-col" },
8166
8228
  props.title && (react_1.default.createElement("div", { className: "flex items-center gap-2" },
8167
- react_1.default.createElement("p", { className: "text-xl font-medium ".concat(((_31 = props.organise) === null || _31 === void 0 ? void 0 : _31.darkMode) ? "text-white" : "") }, props.title),
8168
- ((_32 = props.bareSettings) === null || _32 === void 0 ? void 0 : _32.bareSocketName) &&
8229
+ react_1.default.createElement("p", { className: "text-xl font-medium ".concat(((_32 = props.organise) === null || _32 === void 0 ? void 0 : _32.darkMode) ? "text-white" : "") }, props.title),
8230
+ ((_33 = props.bareSettings) === null || _33 === void 0 ? void 0 : _33.bareSocketName) &&
8169
8231
  isLive &&
8170
8232
  !isLiveOffline && (react_1.default.createElement("span", { className: "inline-flex items-center gap-1 rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700" },
8171
8233
  react_1.default.createElement("span", { className: "h-1.5 w-1.5 rounded-full bg-green-500" }),
8172
8234
  "LIVE")),
8173
- ((_33 = props.bareSettings) === null || _33 === void 0 ? void 0 : _33.bareSocketName) && isLiveOffline && (react_1.default.createElement("span", { className: "inline-flex items-center gap-1 rounded-full bg-orange-100 px-2 py-0.5 text-xs font-medium text-orange-700" },
8235
+ ((_34 = props.bareSettings) === null || _34 === void 0 ? void 0 : _34.bareSocketName) && isLiveOffline && (react_1.default.createElement("span", { className: "inline-flex items-center gap-1 rounded-full bg-orange-100 px-2 py-0.5 text-xs font-medium text-orange-700" },
8174
8236
  react_1.default.createElement("span", { className: "h-1.5 w-1.5 rounded-full bg-orange-400" }),
8175
8237
  "OFFLINE")))),
8176
8238
  props.description && (react_1.default.createElement("span", { className: "text-sm text-gray-500" }, props.description)))),
8177
- react_1.default.createElement("div", { className: ((_34 = props.bareSettings) === null || _34 === void 0 ? void 0 : _34.bareCompactMode)
8239
+ react_1.default.createElement("div", { className: ((_35 = props.bareSettings) === null || _35 === void 0 ? void 0 : _35.bareCompactMode)
8178
8240
  ? "hidden sm:block grow"
8179
8241
  : "grow" }),
8180
8242
  react_1.default.createElement("div", { className: "ml-auto flex flex-row items-end" },
8181
8243
  renderListFilterElements(),
8182
8244
  renderListActionElements())),
8183
8245
  renderListNewRowFilterElements(),
8184
- (schemaPresent || ((_35 = props.bareSettings) === null || _35 === void 0 ? void 0 : _35.bareReadListTabs)) && (react_1.default.createElement(tabs_1.Tabs, { tabs: tabs, selectedId: viewType, linkType: props.linkType, custom: props.custom, onClick: function (id) { return handleSelectTab(id); }, darkMode: (_36 = props.organise) === null || _36 === void 0 ? void 0 : _36.darkMode })),
8246
+ (schemaPresent || ((_36 = props.bareSettings) === null || _36 === void 0 ? void 0 : _36.bareReadListTabs)) && (react_1.default.createElement(tabs_1.Tabs, { tabs: tabs, selectedId: viewType, linkType: props.linkType, custom: props.custom, onClick: function (id) { return handleSelectTab(id); }, darkMode: (_37 = props.organise) === null || _37 === void 0 ? void 0 : _37.darkMode })),
8185
8247
  renderScopedTabContent(tabs, resolvedType, viewType),
8186
- ((_37 = props.bareSettings) === null || _37 === void 0 ? void 0 : _37.bareListMobileFloatingSearch) && (react_1.default.createElement("div", { className: "h-28 md:hidden", "aria-hidden": "true" })),
8187
- ((_38 = props.bareSettings) === null || _38 === void 0 ? void 0 : _38.bareListMobileFloatingSearch) &&
8248
+ ((_38 = props.bareSettings) === null || _38 === void 0 ? void 0 : _38.bareListMobileFloatingSearch) && (react_1.default.createElement("div", { className: "h-28 md:hidden", "aria-hidden": "true" })),
8249
+ ((_39 = props.bareSettings) === null || _39 === void 0 ? void 0 : _39.bareListMobileFloatingSearch) &&
8188
8250
  (0, listModule_1.renderFloatingMobileSearch)({
8189
8251
  filterSearch: filterSearch,
8190
8252
  handleNameSearch: handleNameSearch,
8191
8253
  onFilterClick: function () { return setFlexFilterModalOpen(true); },
8192
- hideSearch: (_39 = props.organise) === null || _39 === void 0 ? void 0 : _39.hideSearch,
8193
- darkMode: (_40 = props.organise) === null || _40 === void 0 ? void 0 : _40.darkMode,
8194
- floatingOffset: (_41 = props.bareSettings) === null || _41 === void 0 ? void 0 : _41.bareListFloatingActionOffset,
8195
- hideFilter: !((_42 = props.bareSettings) === null || _42 === void 0 ? void 0 : _42.bareFlexFilters),
8196
- activeFilterCount: ((_43 = props.bareSettings) === null || _43 === void 0 ? void 0 : _43.bareFlexFilters)
8254
+ hideSearch: (_40 = props.organise) === null || _40 === void 0 ? void 0 : _40.hideSearch,
8255
+ darkMode: (_41 = props.organise) === null || _41 === void 0 ? void 0 : _41.darkMode,
8256
+ floatingOffset: (_42 = props.bareSettings) === null || _42 === void 0 ? void 0 : _42.bareListFloatingActionOffset,
8257
+ hideFilter: !((_43 = props.bareSettings) === null || _43 === void 0 ? void 0 : _43.bareFlexFilters),
8258
+ activeFilterCount: ((_44 = props.bareSettings) === null || _44 === void 0 ? void 0 : _44.bareFlexFilters)
8197
8259
  ? activeFlexFilterCount_1
8198
8260
  : undefined,
8199
8261
  // INFO: Hides when items are selected so NewTable's multi-action bar takes over.
8200
- hidden: selectAll || ((_44 = selectedIds === null || selectedIds === void 0 ? void 0 : selectedIds.length) !== null && _44 !== void 0 ? _44 : 0) > 0,
8262
+ hidden: selectAll || ((_45 = selectedIds === null || selectedIds === void 0 ? void 0 : selectedIds.length) !== null && _45 !== void 0 ? _45 : 0) > 0,
8201
8263
  })));
8202
8264
  default:
8203
8265
  return react_1.default.createElement(react_1.default.Fragment, null);
@@ -8571,6 +8633,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8571
8633
  return null;
8572
8634
  });
8573
8635
  }
8636
+ if (resolvedType === "read")
8637
+ relatedSections.forEach(function (eachSection) {
8638
+ return tabs.push({
8639
+ id: eachSection.id,
8640
+ name: "".concat(eachSection.label, " (").concat(eachSection.count, ")"),
8641
+ href: "".concat(props.localURLEndpoint, "?data=").concat(props.id, "&type=read&collection=").concat(props.collectionId, "&view=").concat(eachSection.id),
8642
+ });
8643
+ });
8574
8644
  if (isEditor)
8575
8645
  if (!((_d = props.organise) === null || _d === void 0 ? void 0 : _d.hideNewTabs) && !((_e = props.bareSettings) === null || _e === void 0 ? void 0 : _e.bareReadListTabs))
8576
8646
  tabs.push({
@@ -8598,6 +8668,23 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8598
8668
  }
8599
8669
  (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onAddColumns) === null || _b === void 0 ? void 0 : _b.call(_a, __spreadArray(__spreadArray([], structure, true), [newColumn], false));
8600
8670
  };
8671
+ // INFO: a changed column replaces itself in place, under the same id, and
8672
+ // goes out through onAddColumns like adding and removing do. A column now
8673
+ // holding files is filed against this table, as a new one is.
8674
+ var handleEditPlainColumn = function (column) {
8675
+ var _a, _b, _c, _d;
8676
+ var edited = __assign({}, column);
8677
+ if (["image", "file", "multipleImage", "multipleFile"].includes(column.type)) {
8678
+ edited.imageCollectionName =
8679
+ (_a = edited.imageCollectionName) !== null && _a !== void 0 ? _a : props.collectionId;
8680
+ edited.imageFileName = (_b = edited.imageFileName) !== null && _b !== void 0 ? _b : "".concat(column.id, ".png");
8681
+ if (devSettings.uploadEndpoint && !edited.uploadEndpoint)
8682
+ edited.uploadEndpoint = devSettings.uploadEndpoint;
8683
+ }
8684
+ (_d = (_c = props.organise) === null || _c === void 0 ? void 0 : _c.onAddColumns) === null || _d === void 0 ? void 0 : _d.call(_c, structure.map(function (eachColumn) {
8685
+ return eachColumn.id === column.id ? edited : eachColumn;
8686
+ }));
8687
+ };
8601
8688
  // INFO: reported through the same onAddColumns callback as adding one — the
8602
8689
  // consumer receives the whole model either way, so the schema has one
8603
8690
  // destination rather than a second place to be written.
@@ -8623,6 +8710,24 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8623
8710
  });
8624
8711
  (_d = (_c = props.organise) === null || _c === void 0 ? void 0 : _c.onChangeTabs) === null || _d === void 0 ? void 0 : _d.call(_c, nextTabs);
8625
8712
  };
8713
+ // INFO: the other space's own Data Template, narrowed to the rows that point
8714
+ // at this record and read-only. Without a schema endpoint it carries no tabs
8715
+ // of its own, and a picked row opens in place instead of navigating away, so
8716
+ // this record's tabs stay put.
8717
+ var renderRelatedList = function (source, query, openId, onOpen) {
8718
+ var _a, _b, _c;
8719
+ return (react_1.default.createElement(exports.DataTemplate, { title: "", description: "", type: openId ? "read" : "list", id: openId, collectionId: source.collectionId, model: source.schema, localURLEndpoint: props.localURLEndpoint, devSettings: __assign(__assign({}, props.devSettings), { schemaEndpoint: "" }), lib: props.lib, organise: {
8720
+ darkMode: (_a = props.organise) === null || _a === void 0 ? void 0 : _a.darkMode,
8721
+ darkModeBg: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.darkModeBg,
8722
+ breadcrumbType: "hidden",
8723
+ handleNavigate: function (type, selectedId) {
8724
+ return onOpen(type === "read" && selectedId ? selectedId : "");
8725
+ },
8726
+ }, bareSettings: {
8727
+ bareListFilterQuery: query,
8728
+ bareNewDTW: (_c = props.bareSettings) === null || _c === void 0 ? void 0 : _c.bareNewDTW,
8729
+ } }));
8730
+ };
8626
8731
  var renderAddMathColumn = function (id, onClose) {
8627
8732
  var _a, _b, _c;
8628
8733
  return (react_1.default.createElement(settingsModal_1.ExpressionModal, { selectedId: id, model: structure, renderReferenceLabelOptions: (_a = props.organise) === null || _a === void 0 ? void 0 : _a.renderReferenceLabelOptions, renderReferenceSpaceOptions: (_b = props.organise) === null || _b === void 0 ? void 0 : _b.renderReferenceSpaceOptions, onAddModelSchema: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.onAddColumns, onClose: onClose }));
@@ -8673,7 +8778,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8673
8778
  return groups;
8674
8779
  };
8675
8780
  var renderGroupTable = function (multipleSelect) {
8676
- 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;
8781
+ 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;
8677
8782
  if (groupId && !((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareNewDTW)) {
8678
8783
  var groupAttributeDS_1 = structure.find(function (eachDS) { return eachDS.id === groupId; });
8679
8784
  var groupedSpaceTableData = spaceTableData.reduce(function (acc, eachData) {
@@ -8873,20 +8978,28 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8873
8978
  onDeleteColumn: ((_w = props.bareSettings) === null || _w === void 0 ? void 0 : _w.bareAddColumns)
8874
8979
  ? handleDeletePlainColumn
8875
8980
  : undefined,
8876
- renderAddColumnElements: ((_x = props.bareSettings) === null || _x === void 0 ? void 0 : _x.bareAddColumns)
8981
+ onEditColumn: ((_x = props.bareSettings) === null || _x === void 0 ? void 0 : _x.bareAddColumns)
8982
+ ? handleEditPlainColumn
8983
+ : undefined,
8984
+ getColumnSchema: ((_y = props.bareSettings) === null || _y === void 0 ? void 0 : _y.bareAddColumns)
8985
+ ? function (columnId) {
8986
+ return structure.find(function (eachColumn) { return eachColumn.id === columnId; });
8987
+ }
8988
+ : undefined,
8989
+ renderAddColumnElements: ((_z = props.bareSettings) === null || _z === void 0 ? void 0 : _z.bareAddColumns)
8877
8990
  ? undefined
8878
8991
  : renderAddMathColumn,
8879
8992
  // INFO: the popup's reference pickers read from the same providers
8880
8993
  // the schema editor uses — without them a reference column would be
8881
8994
  // created with no target and resolve nothing
8882
- renderReferenceSpaceOptions: (_y = props.organise) === null || _y === void 0 ? void 0 : _y.renderReferenceSpaceOptions,
8883
- renderReferenceLabelOptions: (_z = props.organise) === null || _z === void 0 ? void 0 : _z.renderReferenceLabelOptions,
8995
+ renderReferenceSpaceOptions: (_0 = props.organise) === null || _0 === void 0 ? void 0 : _0.renderReferenceSpaceOptions,
8996
+ renderReferenceLabelOptions: (_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.renderReferenceLabelOptions,
8884
8997
  dragEnabled: isViewSettingsEnabled,
8885
8998
  sortEnabled: isViewSettingsEnabled,
8886
8999
  // INFO: per-column header filter is replaced by the flex filters
8887
9000
  filterEnabled: false,
8888
9001
  sortId: activeSortId,
8889
- sortOptions: (_2 = (_1 = (_0 = props.organise) === null || _0 === void 0 ? void 0 : _0.renderReferenceLabelOptions) === null || _1 === void 0 ? void 0 : _1.call(_0)) !== null && _2 !== void 0 ? _2 : (isViewSettingsEnabled
9002
+ 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
8890
9003
  ? getViewSettingsColumns().map(function (eachColumn) {
8891
9004
  var _a;
8892
9005
  return ({
@@ -8933,7 +9046,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8933
9046
  });
8934
9047
  }); },
8935
9048
  }, onObjectEdit: handleObjectCellEdit, addable: {
8936
- active: ((_3 = props.edit) === null || _3 === void 0 ? void 0 : _3.listAddable) ? true : false,
9049
+ active: ((_5 = props.edit) === null || _5 === void 0 ? void 0 : _5.listAddable) ? true : false,
8937
9050
  onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
8938
9051
  return __generator(this, function (_a) {
8939
9052
  switch (_a.label) {
@@ -8944,12 +9057,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8944
9057
  }
8945
9058
  });
8946
9059
  }); },
8947
- }, darkMode: (_4 = props.organise) === null || _4 === void 0 ? void 0 : _4.darkMode, hidePagination: (_5 = props.organise) === null || _5 === void 0 ? void 0 : _5.hidePagination, 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 }));
9060
+ }, darkMode: (_6 = props.organise) === null || _6 === void 0 ? void 0 : _6.darkMode, hidePagination: (_7 = props.organise) === null || _7 === void 0 ? void 0 : _7.hidePagination, 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 }));
8948
9061
  }
8949
- 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, multiActionButton: react_1.default.createElement("div", { className: "flex flex-row space-x-3" },
9062
+ 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" },
8950
9063
  selectedIds.length > 0 &&
8951
9064
  canBatchUpdate &&
8952
- !((_10 = props.bareSettings) === null || _10 === void 0 ? void 0 : _10.bareHideTableExtraMultipleAction) && (react_1.default.createElement(react_1.default.Fragment, null,
9065
+ !((_12 = props.bareSettings) === null || _12 === void 0 ? void 0 : _12.bareHideTableExtraMultipleAction) && (react_1.default.createElement(react_1.default.Fragment, null,
8953
9066
  react_1.default.createElement(textButton_1.TextButton, { className: "text-sm", text: "Change to Draft", disable: loading, onClick: function () {
8954
9067
  handleBatchDraftData();
8955
9068
  } }),
@@ -8963,8 +9076,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8963
9076
  !isFirebase && canBatchUpdate && (react_1.default.createElement(textButton_1.TextButton, { className: "text-sm", text: "Update", onClick: function () {
8964
9077
  setBatchUpdateModal(true);
8965
9078
  } })),
8966
- ((_11 = props.bareSettings) === null || _11 === void 0 ? void 0 : _11.bareListMultipleSelectAddtionalActions) &&
8967
- ((_13 = (_12 = props.bareSettings) === null || _12 === void 0 ? void 0 : _12.bareListMultipleSelectAddtionalActions) === null || _13 === void 0 ? void 0 : _13.map(function (eachButton) {
9079
+ ((_13 = props.bareSettings) === null || _13 === void 0 ? void 0 : _13.bareListMultipleSelectAddtionalActions) &&
9080
+ ((_15 = (_14 = props.bareSettings) === null || _14 === void 0 ? void 0 : _14.bareListMultipleSelectAddtionalActions) === null || _15 === void 0 ? void 0 : _15.map(function (eachButton) {
8968
9081
  return (react_1.default.createElement(textButton_1.TextButton, { className: "text-sm ".concat(eachButton.className), text: eachButton.text, onClick: function () {
8969
9082
  var _a, _b;
8970
9083
  (_a = eachButton.onClick) === null || _a === void 0 ? void 0 : _a.call(eachButton, selectedIds, selectAll, (_b = renderImpSearchFilterConditions()) !== null && _b !== void 0 ? _b : []);
@@ -8973,17 +9086,17 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8973
9086
  var _a, _b;
8974
9087
  handleCaptureListScroll(id);
8975
9088
  (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", id, "general");
8976
- }, 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) {
9089
+ }, 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) {
8977
9090
  handlePagination(value);
8978
- }, 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: {
8979
- addColumnEnabled: (_20 = props.organise) === null || _20 === void 0 ? void 0 : _20.addColumnEnabled,
9091
+ }, 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: {
9092
+ addColumnEnabled: (_22 = props.organise) === null || _22 === void 0 ? void 0 : _22.addColumnEnabled,
8980
9093
  renderAddColumnElements: renderAddMathColumn,
8981
9094
  dragEnabled: isViewSettingsEnabled,
8982
9095
  sortEnabled: isViewSettingsEnabled,
8983
9096
  // INFO: per-column header filter is replaced by the flex filters
8984
9097
  filterEnabled: false,
8985
9098
  sortId: activeSortId,
8986
- sortOptions: (_23 = (_22 = (_21 = props.organise) === null || _21 === void 0 ? void 0 : _21.renderReferenceLabelOptions) === null || _22 === void 0 ? void 0 : _22.call(_21)) !== null && _23 !== void 0 ? _23 : (isViewSettingsEnabled
9099
+ 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
8987
9100
  ? getViewSettingsColumns().map(function (eachColumn) {
8988
9101
  var _a;
8989
9102
  return ({
@@ -9027,7 +9140,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9027
9140
  });
9028
9141
  }); },
9029
9142
  }, onObjectEdit: handleObjectCellEdit, addable: {
9030
- active: ((_24 = props.edit) === null || _24 === void 0 ? void 0 : _24.listAddable) ? true : false,
9143
+ active: ((_26 = props.edit) === null || _26 === void 0 ? void 0 : _26.listAddable) ? true : false,
9031
9144
  onAddData: function (data) { return __awaiter(void 0, void 0, void 0, function () {
9032
9145
  return __generator(this, function (_a) {
9033
9146
  switch (_a.label) {
@@ -9038,19 +9151,36 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9038
9151
  }
9039
9152
  });
9040
9153
  }); },
9041
- }, darkMode: (_25 = props.organise) === null || _25 === void 0 ? void 0 : _25.darkMode, hidePagination: (_26 = props.organise) === null || _26 === void 0 ? void 0 : _26.hidePagination, customPaginationSize: customPaginationSize, disableEllipsisOnLongWord: (_27 = props.organise) === null || _27 === void 0 ? void 0 : _27.disableEllipsisOnLongWord }));
9154
+ }, 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 }));
9042
9155
  }
9043
9156
  };
9044
9157
  // INFO: `hidden` keeps the markers out of space-y spacing
9045
9158
  var renderSavedViews = function () {
9046
- var _a;
9159
+ var _a, _b, _c, _d, _e, _f;
9047
9160
  if (!isSavedViewsEnabled)
9048
9161
  return null;
9049
9162
  var views = handleGetTabSavedViews();
9050
9163
  var activeView = views.find(function (eachView) { return eachView.id === activeSavedViewId; });
9051
- var isModified = !!activeView &&
9052
- !(0, viewStatePersistence_1.handleIsSameViewState)((0, viewStatePersistence_1.handlePickViewState)(handleBuildViewSnapshot()), (0, viewStatePersistence_1.handlePickViewState)(handleResolveViewState(activeView.state)));
9053
- var darkMode = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.darkMode;
9164
+ var currentState = (0, viewStatePersistence_1.handlePickViewState)(handleBuildViewSnapshot());
9165
+ // INFO: compared in a shape both sides share — a stored order is kept to
9166
+ // the columns that still exist, with new ones after in model order, and
9167
+ // hides only count where a view can apply them (schema-hide mode)
9168
+ var modelIds = ((_a = props.model) !== null && _a !== void 0 ? _a : []).map(function (eachColumn) { return eachColumn.id; });
9169
+ var handleComparable = function (state) {
9170
+ var _a;
9171
+ var kept = ((_a = state.columnOrder) !== null && _a !== void 0 ? _a : []).filter(function (eachId) {
9172
+ return modelIds.includes(eachId);
9173
+ });
9174
+ return __assign(__assign({}, state), { columnOrder: __spreadArray(__spreadArray([], kept, true), modelIds.filter(function (eachId) { return !kept.includes(eachId); }), true), hiddenColumnIds: isSchemaHideMode ? state.hiddenColumnIds : undefined });
9175
+ };
9176
+ var handleIsOnState = function (state) {
9177
+ return (0, viewStatePersistence_1.handleIsSameViewState)(handleComparable(currentState), handleComparable((0, viewStatePersistence_1.handlePickViewState)(handleResolveViewState(state))));
9178
+ };
9179
+ var isModified = !!activeView && !handleIsOnState(activeView.state);
9180
+ var defaultViewId = (_c = (_b = props.organise) === null || _b === void 0 ? void 0 : _b.defaultSavedViewId) !== null && _c !== void 0 ? _c : null;
9181
+ var canStarViews = !!((_d = props.organise) === null || _d === void 0 ? void 0 : _d.onChangeDefaultSavedViewId);
9182
+ var canSaveViews = !isAppViews || !!((_e = props.organise) === null || _e === void 0 ? void 0 : _e.onChangeSharedViews);
9183
+ var darkMode = (_f = props.organise) === null || _f === void 0 ? void 0 : _f.darkMode;
9054
9184
  var renderChipClass = function (active) {
9055
9185
  return "inline-flex items-center gap-1 rounded-full border px-3 py-1 text-xs font-medium ".concat(active
9056
9186
  ? "border-primary-500 bg-primary-50 text-primary-700"
@@ -9072,8 +9202,17 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9072
9202
  react_1.default.createElement("button", { type: "button", "data-testid": "dtw-saved-view-".concat(eachView.id), title: eachView.id === (activeView === null || activeView === void 0 ? void 0 : activeView.id) && isModified
9073
9203
  ? "Changed since saved"
9074
9204
  : undefined, onClick: function () { return handleApplySavedView(eachView); } },
9205
+ eachView.id === defaultViewId && !canStarViews ? "★ " : "",
9075
9206
  eachView.name,
9076
9207
  eachView.id === (activeView === null || activeView === void 0 ? void 0 : activeView.id) && isModified ? " •" : ""),
9208
+ canStarViews && (react_1.default.createElement("button", { type: "button", "aria-label": eachView.id === defaultViewId
9209
+ ? "Stop opening on ".concat(eachView.name)
9210
+ : "Open on ".concat(eachView.name, " for everyone"), "data-testid": "dtw-saved-view-star-".concat(eachView.id), className: eachView.id === defaultViewId
9211
+ ? "text-yellow-500"
9212
+ : "text-gray-400 hover:text-yellow-500", onClick: function () {
9213
+ var _a, _b;
9214
+ return (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeDefaultSavedViewId) === null || _b === void 0 ? void 0 : _b.call(_a, eachView.id === defaultViewId ? null : eachView.id);
9215
+ } }, eachView.id === defaultViewId ? "★" : "☆")),
9077
9216
  !eachView.locked && (react_1.default.createElement("button", { type: "button", "aria-label": "Delete ".concat(eachView.name), "data-testid": "dtw-saved-view-delete-".concat(eachView.id), onClick: function () { return setDeletingSavedViewId(eachView.id); } },
9078
9217
  react_1.default.createElement(outline_1.XMarkIcon, { className: "h-3.5 w-3.5" })))));
9079
9218
  }),
@@ -9081,7 +9220,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9081
9220
  "Update \u201C",
9082
9221
  activeView.name,
9083
9222
  "\u201D")),
9084
- savedViewName === null ? (react_1.default.createElement("button", { type: "button", "data-testid": "dtw-saved-view-new", className: actionClass, onClick: function () { return setSavedViewName(""); } }, "+ Save view")) : (
9223
+ !canSaveViews ? null : savedViewName === null ? (react_1.default.createElement("button", { type: "button", "data-testid": "dtw-saved-view-new", className: actionClass, onClick: function () { return setSavedViewName(""); } }, "+ Save view")) : (
9085
9224
  // INFO: a form, so a mobile keyboard's Done saves the view; stopPropagation
9086
9225
  // keeps the submit from reaching any form around the template
9087
9226
  react_1.default.createElement("form", { "data-testid": "dtw-saved-view-form", className: "flex items-center gap-1", onSubmit: function (event) {
@@ -10514,7 +10653,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
10514
10653
  };
10515
10654
  return (react_1.default.createElement(react_1.default.Fragment, null,
10516
10655
  renderNotification("root"),
10517
- ((_69 = (_68 = props.renderSettings) === null || _68 === void 0 ? void 0 : _68.renderLoadingUI) === null || _69 === void 0 ? void 0 : _69.call(_68)) && loading ? ((_70 = props.renderSettings) === null || _70 === void 0 ? void 0 : _70.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_71 = props.organise) === null || _71 === void 0 ? void 0 : _71.darkMode, darkModeBg: (_72 = props.organise) === null || _72 === void 0 ? void 0 : _72.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
10656
+ ((_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 () {
10518
10657
  var _a, _b;
10519
10658
  if (loading)
10520
10659
  return;
@@ -10525,7 +10664,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
10525
10664
  setExportCSVEmail((_b = (_a = props.devSettings.currentUser) === null || _a === void 0 ? void 0 : _a.userEmail) !== null && _b !== void 0 ? _b : "");
10526
10665
  }
10527
10666
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) })),
10528
- react_1.default.createElement(modal_1.Modal, { darkMode: (_73 = props.organise) === null || _73 === void 0 ? void 0 : _73.darkMode, darkModeBg: (_74 = props.organise) === null || _74 === void 0 ? void 0 : _74.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
10667
+ 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 () {
10529
10668
  return (react_1.default.createElement(referenceModal_1.ReferenceModal, { referenceModelSchema: referenceModelSchema, referenceDataStructure: referenceCreationModal, devSettings: props.devSettings, handleCreateRefId: function (dataId) {
10530
10669
  if (dataId) {
10531
10670
  var currentValue = selectedData[referenceCreationModal.id];
@@ -10541,19 +10680,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
10541
10680
  }, onClose: function () {
10542
10681
  setReferenceCreationModal({ id: "", name: "", type: "string" });
10543
10682
  } }),
10544
- react_1.default.createElement(modal_1.Modal, { darkMode: (_75 = props.organise) === null || _75 === void 0 ? void 0 : _75.darkMode, darkModeBg: (_76 = props.organise) === null || _76 === void 0 ? void 0 : _76.darkModeBg, maxWidth: "2xl", open: Object.keys(referenceDeleteTableData).length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
10683
+ 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 () {
10545
10684
  setReferenceDeleteTableData({});
10546
10685
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
10547
- react_1.default.createElement(modal_1.Modal, { darkMode: (_77 = props.organise) === null || _77 === void 0 ? void 0 : _77.darkMode, darkModeBg: (_78 = props.organise) === null || _78 === void 0 ? void 0 : _78.darkModeBg, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
10686
+ 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 () {
10548
10687
  setDeletePasscodeInput("");
10549
10688
  setDeleteModal(!deleteModal);
10550
10689
  setDeleteFeedId("");
10551
10690
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
10552
- 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, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
10691
+ 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 () {
10553
10692
  setBatchUpdateData({ columnId: "", columnData: {} });
10554
10693
  setBatchUpdateModal(false);
10555
10694
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
10556
- 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, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
10695
+ 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 () {
10557
10696
  var _a, _b;
10558
10697
  if (props.space)
10559
10698
  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 }));
@@ -10561,7 +10700,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
10561
10700
  }, onClose: function () {
10562
10701
  setSelectedAuthMethod("");
10563
10702
  } }),
10564
- isActivityLog && (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, open: activityModal, title: "Activity Log", renderContent: function () {
10703
+ 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 () {
10565
10704
  var _a, _b;
10566
10705
  return (react_1.default.createElement(activityModal_1.ActivityModal, { title: props.title && typeof props.title === "string"
10567
10706
  ? props.title