blixify-ui-web 1.2.211 → 1.2.213

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.
@@ -221,6 +221,7 @@ var handleGetCalendarSwitchRange = function (date, view) {
221
221
  end: (0, dayjs_1.default)(date).endOf(unit).toDate(),
222
222
  };
223
223
  };
224
+ var RELATED_VIEW_PREFIX = "blixify_related_";
224
225
  // INFO: " - " is what the list prints for a lookup it could not resolve, an
225
226
  // empty reference list included
226
227
  var handleCheckEmptyCardValue = function (value) {
@@ -248,10 +249,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
248
249
  // Every read of the view type below uses resolvedType. The distinction matters
249
250
  // most in effect dependency arrays — following props.type there would leave
250
251
  // the list never refetching while the panel is open, which fails silently.
251
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114;
252
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115;
252
253
  // INFO: the panel cannot navigate its way out — handleNavigate("read") is
253
254
  // routed straight back into it — so expand-to-full-page is local state.
254
- var _115 = (0, react_1.useState)(false), drawerPageView = _115[0], setDrawerPageView = _115[1];
255
+ var _116 = (0, react_1.useState)(false), drawerPageView = _116[0], setDrawerPageView = _116[1];
255
256
  // INFO: the panel keeps rendering the record it was opened with rather than
256
257
  // live props. Without this, navigating back to the list would re-render the
257
258
  // still-mounted panel as a second list behind the overlay.
@@ -264,12 +265,50 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
264
265
  props.type === "update" &&
265
266
  !!props.id;
266
267
  var isDrawerRecord = isDrawerRead || isDrawerForm;
268
+ // INFO: the panel stays on the page while closed so it has a closed position
269
+ // to slide from and back to; its record is only mounted while it is showing
270
+ var canHostDrawer = !!((_c = props.viewSettings) === null || _c === void 0 ? void 0 : _c.readDrawer) || !!((_d = props.bareSettings) === null || _d === void 0 ? void 0 : _d.bareFormDrawer);
267
271
  // INFO: while the escape is active the record takes the page normally and the
268
272
  // panel stays closed behind it.
269
273
  var isDrawerHost = isDrawerRecord && !drawerPageView;
270
274
  var resolvedType = isDrawerHost ? "list" : props.type;
271
275
  if (isDrawerRecord)
272
276
  drawerReadIdRef.current = props.id;
277
+ // INFO: the view in the url belongs to the record while its panel is open. A
278
+ // list following it through the record's tabs cleared its rows and page and
279
+ // read them again behind the panel, so it keeps the view it was opened on.
280
+ var handleResolveListViewId = function () {
281
+ var _a, _b, _c;
282
+ return ((_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.viewId) === null || _b === void 0 ? void 0 : _b.startsWith(RELATED_VIEW_PREFIX))
283
+ ? undefined
284
+ : (_c = props.organise) === null || _c === void 0 ? void 0 : _c.viewId;
285
+ };
286
+ var hostedListViewIdRef = (0, react_1.useRef)(handleResolveListViewId());
287
+ if (!isDrawerHost)
288
+ hostedListViewIdRef.current = (_e = props.organise) === null || _e === void 0 ? void 0 : _e.viewId;
289
+ var listViewId = isDrawerHost
290
+ ? hostedListViewIdRef.current
291
+ : (_f = props.organise) === null || _f === void 0 ? void 0 : _f.viewId;
292
+ // INFO: the route has already gone back to the list while the panel slides out,
293
+ // so it keeps drawing what it was opened as until it is gone
294
+ var drawerFormRef = (0, react_1.useRef)(false);
295
+ var drawerFormEditedRef = (0, react_1.useRef)(false);
296
+ if (isDrawerRecord) {
297
+ // INFO: moving from the record to its form starts with nothing edited
298
+ if (isDrawerForm && !drawerFormRef.current)
299
+ drawerFormEditedRef.current = false;
300
+ drawerFormRef.current = isDrawerForm;
301
+ }
302
+ // INFO: each opening gets its own record instance, so reopening inside the
303
+ // slide-out does not carry over what the last one held
304
+ var drawerOpenRef = (0, react_1.useRef)(false);
305
+ var drawerSessionRef = (0, react_1.useRef)(0);
306
+ if (isDrawerHost && !drawerOpenRef.current) {
307
+ drawerSessionRef.current += 1;
308
+ drawerFormEditedRef.current = false;
309
+ }
310
+ drawerOpenRef.current = isDrawerHost;
311
+ var _117 = (0, react_1.useState)(false), drawerDiscardModal = _117[0], setDrawerDiscardModal = _117[1];
273
312
  // INFO: leaving the record ends the escape, so the next row opened from the
274
313
  // list peeks in the panel again rather than inheriting a full page the user
275
314
  // asked for once. Saving a form on the full page lands on its read view, which
@@ -348,14 +387,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
348
387
  initialFilterReferenceDate: initialFilterReferenceDate,
349
388
  };
350
389
  };
351
- var _116 = intialiseDefaultFilterValues(), initialFilterSearch = _116.initialFilterSearch, initialFilterSearchParams = _116.initialFilterSearchParams, initialFilterSelection = _116.initialFilterSelection, initialFilterReference = _116.initialFilterReference, initialFilterReferenceDate = _116.initialFilterReferenceDate;
390
+ var _118 = intialiseDefaultFilterValues(), initialFilterSearch = _118.initialFilterSearch, initialFilterSearchParams = _118.initialFilterSearchParams, initialFilterSelection = _118.initialFilterSelection, initialFilterReference = _118.initialFilterReference, initialFilterReferenceDate = _118.initialFilterReferenceDate;
352
391
  // INFO: Persist view state hook — handles storage read/write for filter/sort/column state
353
- var _117 = (0, viewStatePersistence_1.usePersistedViewState)({
354
- mode: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.persistViewState,
392
+ var _119 = (0, viewStatePersistence_1.usePersistedViewState)({
393
+ mode: (_g = props.organise) === null || _g === void 0 ? void 0 : _g.persistViewState,
355
394
  collectionId: props.collectionId,
356
- persistKey: (_d = props.organise) === null || _d === void 0 ? void 0 : _d.persistKey,
395
+ persistKey: (_h = props.organise) === null || _h === void 0 ? void 0 : _h.persistKey,
357
396
  type: resolvedType,
358
- }), rawPersistedState = _117.persistedState, isPersistEnabled = _117.isEnabled, handleSaveView = _117.handleSaveView, handleRegisterViewSnapshot = _117.handleRegisterViewSnapshot;
397
+ }), rawPersistedState = _119.persistedState, isPersistEnabled = _119.isEnabled, handleSaveView = _119.handleSaveView, handleRegisterViewSnapshot = _119.handleRegisterViewSnapshot;
359
398
  // INFO: drop stored filters/sort on removed columns — they would empty the table
360
399
  var persistedState = (0, react_1.useMemo)(function () {
361
400
  var _a, _b, _c;
@@ -366,11 +405,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
366
405
  }, [
367
406
  rawPersistedState,
368
407
  props.model,
369
- (_e = props.bareSettings) === null || _e === void 0 ? void 0 : _e.bareFlexFilterReferences,
370
- (_f = props.bareSettings) === null || _f === void 0 ? void 0 : _f.bareFlexFilterListObjects,
408
+ (_j = props.bareSettings) === null || _j === void 0 ? void 0 : _j.bareFlexFilterReferences,
409
+ (_k = props.bareSettings) === null || _k === void 0 ? void 0 : _k.bareFlexFilterListObjects,
371
410
  ]);
372
- var _118 = (0, react_1.useState)(false), loading = _118[0], setLoading = _118[1];
373
- var _119 = (0, react_1.useState)(), notification = _119[0], setNotification = _119[1];
411
+ var _120 = (0, react_1.useState)(false), loading = _120[0], setLoading = _120[1];
412
+ var _121 = (0, react_1.useState)(), notification = _121[0], setNotification = _121[1];
374
413
  // INFO: a success toast is confirmation, not a decision — it clears itself so
375
414
  // it never sits on the floating step bar; errors stay until dismissed
376
415
  (0, react_1.useEffect)(function () {
@@ -380,80 +419,80 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
380
419
  return function () { return clearTimeout(timer); };
381
420
  }, [notification]);
382
421
  //INFO : Used by List
383
- var _120 = (0, react_1.useState)((_g = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _g !== void 0 ? _g : initialFilterSearch), filterSearch = _120[0], setFilterSearch = _120[1];
384
- var _121 = (0, react_1.useState)((_h = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _h !== void 0 ? _h : initialFilterSearchParams), filterSearchParams = _121[0], setFilterSearchParams = _121[1];
385
- var _122 = (0, react_1.useState)((_j = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _j !== void 0 ? _j : initialFilterSelection), filterSelection = _122[0], setFilterSelection = _122[1];
386
- var _123 = (0, react_1.useState)((_k = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _k !== void 0 ? _k : initialFilterReference), filterReference = _123[0], setFilterReference = _123[1];
387
- var _124 = (0, react_1.useState)({}), filterReferenceSearch = _124[0], setFilterReferenceSearch = _124[1];
388
- var _125 = (0, react_1.useState)({}), filterReferenceList = _125[0], setFilterReferenceList = _125[1];
389
- var _126 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
422
+ var _122 = (0, react_1.useState)((_l = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _l !== void 0 ? _l : initialFilterSearch), filterSearch = _122[0], setFilterSearch = _122[1];
423
+ var _123 = (0, react_1.useState)((_m = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSearchParams) !== null && _m !== void 0 ? _m : initialFilterSearchParams), filterSearchParams = _123[0], setFilterSearchParams = _123[1];
424
+ var _124 = (0, react_1.useState)((_o = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterSelection) !== null && _o !== void 0 ? _o : initialFilterSelection), filterSelection = _124[0], setFilterSelection = _124[1];
425
+ var _125 = (0, react_1.useState)((_p = persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReference) !== null && _p !== void 0 ? _p : initialFilterReference), filterReference = _125[0], setFilterReference = _125[1];
426
+ var _126 = (0, react_1.useState)({}), filterReferenceSearch = _126[0], setFilterReferenceSearch = _126[1];
427
+ var _127 = (0, react_1.useState)({}), filterReferenceList = _127[0], setFilterReferenceList = _127[1];
428
+ var _128 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.filterReferenceDate)
390
429
  ? (0, viewStatePersistence_1.parseDateFilterState)(persistedState.filterReferenceDate)
391
- : initialFilterReferenceDate), filterReferenceDate = _126[0], setFilterReferenceDate = _126[1];
392
- var _127 = (0, react_1.useState)(true), tableLoading = _127[0], setTableLoading = _127[1];
393
- var _128 = (0, react_1.useState)(""), cursor = _128[0], setCursor = _128[1];
394
- var _129 = (0, react_1.useState)(""), lastCursor = _129[0], setLastCursor = _129[1];
395
- var _130 = (0, react_1.useState)([]), tableData = _130[0], setTableData = _130[1];
396
- var _131 = (0, react_1.useState)([]), spaceTableData = _131[0], setSpaceTableData = _131[1];
430
+ : initialFilterReferenceDate), filterReferenceDate = _128[0], setFilterReferenceDate = _128[1];
431
+ var _129 = (0, react_1.useState)(true), tableLoading = _129[0], setTableLoading = _129[1];
432
+ var _130 = (0, react_1.useState)(""), cursor = _130[0], setCursor = _130[1];
433
+ var _131 = (0, react_1.useState)(""), lastCursor = _131[0], setLastCursor = _131[1];
434
+ var _132 = (0, react_1.useState)([]), tableData = _132[0], setTableData = _132[1];
435
+ var _133 = (0, react_1.useState)([]), spaceTableData = _133[0], setSpaceTableData = _133[1];
397
436
  // INFO: a save resolves after later renders, so it reads the table from here —
398
437
  // the state it closed over can predate an earlier save on the same row
399
438
  var tableDataRef = (0, react_1.useRef)([]);
400
439
  var spaceTableDataRef = (0, react_1.useRef)([]);
401
440
  tableDataRef.current = tableData;
402
441
  spaceTableDataRef.current = spaceTableData;
403
- var _132 = (0, react_1.useState)(0), size = _132[0], setSize = _132[1];
404
- var _133 = (0, react_1.useState)((_o = (_l = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _l !== void 0 ? _l : (_m = props.organise) === null || _m === void 0 ? void 0 : _m.pageIndex) !== null && _o !== void 0 ? _o : 0), pageIndex = _133[0], setPageIndex = _133[1];
442
+ var _134 = (0, react_1.useState)(0), size = _134[0], setSize = _134[1];
443
+ var _135 = (0, react_1.useState)((_s = (_q = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _q !== void 0 ? _q : (_r = props.organise) === null || _r === void 0 ? void 0 : _r.pageIndex) !== null && _s !== void 0 ? _s : 0), pageIndex = _135[0], setPageIndex = _135[1];
405
444
  // INFO: every change of page, including the return to the first page when a
406
445
  // filter or search changes, which onChangePagination does not always report
407
446
  (0, react_1.useEffect)(function () {
408
447
  var _a, _b;
409
448
  (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangePageIndex) === null || _b === void 0 ? void 0 : _b.call(_a, pageIndex);
410
449
  }, [pageIndex]);
411
- var _134 = (0, react_1.useState)([]), selectedIds = _134[0], setSelectedIds = _134[1];
412
- var _135 = (0, react_1.useState)(false), selectAll = _135[0], setSelectAll = _135[1];
413
- var _136 = (0, react_1.useState)(""), deletePasscode = _136[0], setDeletePasscode = _136[1];
414
- var _137 = (0, react_1.useState)(""), deletePasscodeInput = _137[0], setDeletePasscodeInput = _137[1];
415
- var _138 = (0, react_1.useState)(""), deleteFeedId = _138[0], setDeleteFeedId = _138[1];
450
+ var _136 = (0, react_1.useState)([]), selectedIds = _136[0], setSelectedIds = _136[1];
451
+ var _137 = (0, react_1.useState)(false), selectAll = _137[0], setSelectAll = _137[1];
452
+ var _138 = (0, react_1.useState)(""), deletePasscode = _138[0], setDeletePasscode = _138[1];
453
+ var _139 = (0, react_1.useState)(""), deletePasscodeInput = _139[0], setDeletePasscodeInput = _139[1];
454
+ var _140 = (0, react_1.useState)(""), deleteFeedId = _140[0], setDeleteFeedId = _140[1];
416
455
  //INFO : Used by List Organise
417
456
  // INFO: Internal sort state that overrides props.organise?.sort when
418
457
  // persistViewState is enabled and a persisted sort exists
419
- var _139 = (0, react_1.useState)((_p = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _p !== void 0 ? _p : undefined), persistedSort = _139[0], setPersistedSort = _139[1];
420
- var _140 = (0, react_1.useState)(false), filterDraft = _140[0], setFilterDraft = _140[1];
421
- var _141 = (0, react_1.useState)(false), addTabModal = _141[0], setAddTabModal = _141[1];
422
- var _142 = (0, react_1.useState)(-1), editTabIndex = _142[0], setEditTabIndex = _142[1];
458
+ var _141 = (0, react_1.useState)((_t = persistedState === null || persistedState === void 0 ? void 0 : persistedState.sort) !== null && _t !== void 0 ? _t : undefined), persistedSort = _141[0], setPersistedSort = _141[1];
459
+ var _142 = (0, react_1.useState)(false), filterDraft = _142[0], setFilterDraft = _142[1];
460
+ var _143 = (0, react_1.useState)(false), addTabModal = _143[0], setAddTabModal = _143[1];
461
+ var _144 = (0, react_1.useState)(-1), editTabIndex = _144[0], setEditTabIndex = _144[1];
423
462
  //INFO : resolve the initial tab synchronously so the mount cond is already
424
463
  // tab-scoped — an empty initial tab caused a second wasted list fetch
425
- var _143 = (0, react_1.useState)(function () {
426
- var _a, _b;
427
- 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);
428
- }), selectedTab = _143[0], setSelectedTab = _143[1];
429
- var _144 = (0, react_1.useState)("dayGridMonth"), calendarView = _144[0], setCalendarView = _144[1];
464
+ var _145 = (0, react_1.useState)(function () {
465
+ var _a;
466
+ return (0, listModule_1.renderSelectedRefreshTab)(props.localURLEndpoint, resolvedType, props.collectionId, props.id, (_a = props.organise) === null || _a === void 0 ? void 0 : _a.extendedTabs, listViewId);
467
+ }), selectedTab = _145[0], setSelectedTab = _145[1];
468
+ var _146 = (0, react_1.useState)("dayGridMonth"), calendarView = _146[0], setCalendarView = _146[1];
430
469
  // INFO: bareNewDTW calendar viewSwitch mode — drives the NewCalendar variant
431
470
  // (calendarView above drives the matching range query)
432
- var _145 = (0, react_1.useState)("month"), newCalendarViewMode = _145[0], setNewCalendarViewMode = _145[1];
433
- var _146 = (0, react_1.useState)(new Date()), calendarTabMonth = _146[0], setCalendarTabMonth = _146[1];
471
+ var _147 = (0, react_1.useState)("month"), newCalendarViewMode = _147[0], setNewCalendarViewMode = _147[1];
472
+ var _148 = (0, react_1.useState)(new Date()), calendarTabMonth = _148[0], setCalendarTabMonth = _148[1];
434
473
  // INFO: defaultViewSwitch picks the opening view only — the tab re-inits
435
474
  // whenever its settings change, and that must not undo the user's switch
436
475
  var calendarViewInitRef = (0, react_1.useRef)(false);
437
- var _147 = (0, react_1.useState)(true), kanbanDroppable = _147[0], setKanbanDroppable = _147[1];
438
- var _148 = (0, react_1.useState)([]), kanbanOptions = _148[0], setKanbanOptions = _148[1];
439
- var _149 = (0, react_1.useState)(false), batchUpdateModal = _149[0], setBatchUpdateModal = _149[1];
440
- var _150 = (0, react_1.useState)({
476
+ var _149 = (0, react_1.useState)(true), kanbanDroppable = _149[0], setKanbanDroppable = _149[1];
477
+ var _150 = (0, react_1.useState)([]), kanbanOptions = _150[0], setKanbanOptions = _150[1];
478
+ var _151 = (0, react_1.useState)(false), batchUpdateModal = _151[0], setBatchUpdateModal = _151[1];
479
+ var _152 = (0, react_1.useState)({
441
480
  columnId: "",
442
481
  columnData: {},
443
- }), batchUpdateData = _150[0], setBatchUpdateData = _150[1];
482
+ }), batchUpdateData = _152[0], setBatchUpdateData = _152[1];
444
483
  // INFO: system columns (created / updated at and by, record id, number)
445
484
  // join the structure hidden; the ones a user shows are kept per view
446
- var isSystemColumnsEnabled = !!((_q = props.bareSettings) === null || _q === void 0 ? void 0 : _q.bareSystemColumns);
447
- var isSystemColumnsLocked = !!((_r = props.bareSettings) === null || _r === void 0 ? void 0 : _r.bareSystemColumnsLocked);
485
+ var isSystemColumnsEnabled = !!((_u = props.bareSettings) === null || _u === void 0 ? void 0 : _u.bareSystemColumns);
486
+ var isSystemColumnsLocked = !!((_v = props.bareSettings) === null || _v === void 0 ? void 0 : _v.bareSystemColumnsLocked);
448
487
  var appendedSystemColumnIds = isSystemColumnsEnabled
449
488
  ? systemColumns_1.SYSTEM_COLUMN_IDS.filter(function (eachId) { var _a; return !((_a = props.model) !== null && _a !== void 0 ? _a : []).some(function (each) { return each.id === eachId; }); })
450
489
  : [];
451
- var _151 = (0, react_1.useState)((_s = persistedState === null || persistedState === void 0 ? void 0 : persistedState.shownSystemColumnIds) !== null && _s !== void 0 ? _s : []), shownSystemColumnIds = _151[0], setShownSystemColumnIds = _151[1];
490
+ var _153 = (0, react_1.useState)((_w = persistedState === null || persistedState === void 0 ? void 0 : persistedState.shownSystemColumnIds) !== null && _w !== void 0 ? _w : []), shownSystemColumnIds = _153[0], setShownSystemColumnIds = _153[1];
452
491
  var handleWithSystemColumns = function (model, shownIds) {
453
492
  if (shownIds === void 0) { shownIds = shownSystemColumnIds; }
454
493
  return isSystemColumnsEnabled ? (0, systemColumns_1.handleAppendSystemColumns)(model, shownIds) : model;
455
494
  };
456
- var _152 = (0, react_1.useState)(function () {
495
+ var _154 = (0, react_1.useState)(function () {
457
496
  var _a;
458
497
  var baseModel = handleWithSystemColumns((props === null || props === void 0 ? void 0 : props.model) || [], (_a = persistedState === null || persistedState === void 0 ? void 0 : persistedState.shownSystemColumnIds) !== null && _a !== void 0 ? _a : []);
459
498
  if (!persistedState)
@@ -480,8 +519,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
480
519
  });
481
520
  }
482
521
  return model;
483
- }), structure = _152[0], setStructure = _152[1];
484
- var _153 = (0, react_1.useState)(((_t = props === null || props === void 0 ? void 0 : props.organise) === null || _t === void 0 ? void 0 : _t.additionalQuery) || []), additionalQuery = _153[0], setAdditionalQuery = _153[1];
522
+ }), structure = _154[0], setStructure = _154[1];
523
+ var _155 = (0, react_1.useState)(((_x = props === null || props === void 0 ? void 0 : props.organise) === null || _x === void 0 ? void 0 : _x.additionalQuery) || []), additionalQuery = _155[0], setAdditionalQuery = _155[1];
485
524
  // INFO: State for user-configurable flex filters (Monday.com-style)
486
525
  // INFO: Initialize with one empty row so users see inputs immediately without clicking "Add Filter"
487
526
  var defaultFlexFilterRow = [
@@ -492,9 +531,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
492
531
  value: undefined,
493
532
  },
494
533
  ];
495
- var _154 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
534
+ var _156 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
496
535
  ? persistedState.flexFilters
497
- : defaultFlexFilterRow), flexFilters = _154[0], setFlexFilters = _154[1];
536
+ : defaultFlexFilterRow), flexFilters = _156[0], setFlexFilters = _156[1];
498
537
  // INFO: always-current mirror of flexFilters, read by the imperative apply/
499
538
  // clear methods so chained calls in one tick aren't stale.
500
539
  var flexFiltersRef = (0, react_1.useRef)(flexFilters);
@@ -507,81 +546,81 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
507
546
  }, [flexFilters]);
508
547
  // INFO: Debounced version of flexFilters used by renderImpSearchFilterConditions
509
548
  // to prevent API calls on every keystroke when typing in value inputs
510
- var _155 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
549
+ var _157 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.flexFilters) && persistedState.flexFilters.length > 0
511
550
  ? persistedState.flexFilters
512
- : defaultFlexFilterRow), flexFiltersDebounced = _155[0], setFlexFiltersDebounced = _155[1];
551
+ : defaultFlexFilterRow), flexFiltersDebounced = _157[0], setFlexFiltersDebounced = _157[1];
513
552
  // INFO: the filter rows of the export being set up — started from the
514
553
  // list's own when the export opens, so changing them leaves the list as it is
515
- var _156 = (0, react_1.useState)(defaultFlexFilterRow), exportFlexFilters = _156[0], setExportFlexFilters = _156[1];
516
- var _157 = (0, react_1.useState)({}), flexFilterReferenceOptions = _157[0], setFlexFilterReferenceOptions = _157[1];
517
- var _158 = (0, react_1.useState)({}), flexFilterReferenceSearch = _158[0], setFlexFilterReferenceSearch = _158[1];
518
- var _159 = (0, react_1.useState)(false), flexFilterModalOpen = _159[0], setFlexFilterModalOpen = _159[1];
519
- var _160 = (0, react_1.useState)(false), viewSettingsModalOpen = _160[0], setViewSettingsModalOpen = _160[1];
554
+ var _158 = (0, react_1.useState)(defaultFlexFilterRow), exportFlexFilters = _158[0], setExportFlexFilters = _158[1];
555
+ var _159 = (0, react_1.useState)({}), flexFilterReferenceOptions = _159[0], setFlexFilterReferenceOptions = _159[1];
556
+ var _160 = (0, react_1.useState)({}), flexFilterReferenceSearch = _160[0], setFlexFilterReferenceSearch = _160[1];
557
+ var _161 = (0, react_1.useState)(false), flexFilterModalOpen = _161[0], setFlexFilterModalOpen = _161[1];
558
+ var _162 = (0, react_1.useState)(false), viewSettingsModalOpen = _162[0], setViewSettingsModalOpen = _162[1];
520
559
  // INFO: Columns the end user chose to hide (bareSettings.bareViewSettings).
521
560
  // Deliberately kept out of `structure`: the props-sync effect below resets
522
561
  // structure to props.model whenever props change, which would wipe the
523
562
  // choice, and the persist effect derives schema-level hiddenColumnIds from
524
563
  // structure — writing user hides there would blur the two concepts.
525
- var _161 = (0, react_1.useState)((_u = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _u !== void 0 ? _u : []), userHiddenColumnIds = _161[0], setUserHiddenColumnIds = _161[1];
526
- var _162 = (0, react_1.useState)(""), columnSearch = _162[0], setColumnSearch = _162[1];
527
- var _163 = (0, react_1.useState)([]), savedViews = _163[0], setSavedViews = _163[1];
528
- var _164 = (0, react_1.useState)(null), activeSavedViewId = _164[0], setActiveSavedViewId = _164[1];
564
+ var _163 = (0, react_1.useState)((_y = persistedState === null || persistedState === void 0 ? void 0 : persistedState.userHiddenColumnIds) !== null && _y !== void 0 ? _y : []), userHiddenColumnIds = _163[0], setUserHiddenColumnIds = _163[1];
565
+ var _164 = (0, react_1.useState)(""), columnSearch = _164[0], setColumnSearch = _164[1];
566
+ var _165 = (0, react_1.useState)([]), savedViews = _165[0], setSavedViews = _165[1];
567
+ var _166 = (0, react_1.useState)(null), activeSavedViewId = _166[0], setActiveSavedViewId = _166[1];
529
568
  // INFO: the widths of the view on screen, by column id ("180px")
530
- var _165 = (0, react_1.useState)(function () { var _a, _b, _c; return (_c = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.columnWidths) !== null && _c !== void 0 ? _c : {}; }), columnWidths = _165[0], setColumnWidths = _165[1];
569
+ var _167 = (0, react_1.useState)(function () { var _a, _b, _c; return (_c = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.allView) === null || _b === void 0 ? void 0 : _b.columnWidths) !== null && _c !== void 0 ? _c : {}; }), columnWidths = _167[0], setColumnWidths = _167[1];
531
570
  // INFO: unsaved changes are kept only once the opening view is on screen,
532
571
  // so the defaults drawn before it never overwrite a person's own
533
- var _166 = (0, react_1.useState)(false), isViewDraftReady = _166[0], setIsViewDraftReady = _166[1];
572
+ var _168 = (0, react_1.useState)(false), isViewDraftReady = _168[0], setIsViewDraftReady = _168[1];
534
573
  // INFO: null while the name box is closed
535
- var _167 = (0, react_1.useState)(null), savedViewName = _167[0], setSavedViewName = _167[1];
536
- var _168 = (0, react_1.useState)(null), deletingSavedViewId = _168[0], setDeletingSavedViewId = _168[1];
537
- var _169 = (0, react_1.useState)(null), draggingColumnId = _169[0], setDraggingColumnId = _169[1];
574
+ var _169 = (0, react_1.useState)(null), savedViewName = _169[0], setSavedViewName = _169[1];
575
+ var _170 = (0, react_1.useState)(null), deletingSavedViewId = _170[0], setDeletingSavedViewId = _170[1];
576
+ var _171 = (0, react_1.useState)(null), draggingColumnId = _171[0], setDraggingColumnId = _171[1];
538
577
  var columnRowRefs = (0, react_1.useRef)({});
539
578
  //INFO : Used by Auth
540
- var _170 = (0, react_1.useState)({
579
+ var _172 = (0, react_1.useState)({
541
580
  email: "",
542
581
  google: "",
543
582
  phone: "",
544
583
  disabled: false,
545
584
  create: false,
546
- }), authMethods = _170[0], setAuthMethods = _170[1];
547
- var _171 = (0, react_1.useState)(""), selectedAuthMethod = _171[0], setSelectedAuthMethod = _171[1];
585
+ }), authMethods = _172[0], setAuthMethods = _172[1];
586
+ var _173 = (0, react_1.useState)(""), selectedAuthMethod = _173[0], setSelectedAuthMethod = _173[1];
548
587
  // INFO: the sign-in check of a users datasheet's record is running; the
549
588
  // panel shows a spinner rather than nothing, which read as "no login"
550
- var _172 = (0, react_1.useState)(false), authLoading = _172[0], setAuthLoading = _172[1];
589
+ var _174 = (0, react_1.useState)(false), authLoading = _174[0], setAuthLoading = _174[1];
551
590
  // INFO: a delete is running — the ref answers a second tap at once, before
552
591
  // the state has rendered, and the state disables the confirm button
553
592
  var deletingRef = (0, react_1.useRef)(false);
554
- var _173 = (0, react_1.useState)(false), deleting = _173[0], setDeleting = _173[1];
593
+ var _175 = (0, react_1.useState)(false), deleting = _175[0], setDeleting = _175[1];
555
594
  // INFO: Used by Activity Log
556
- var _174 = (0, react_1.useState)(false), activityModal = _174[0], setActivityModal = _174[1];
557
- var _175 = (0, react_1.useState)(""), activityId = _175[0], setActivityId = _175[1];
595
+ var _176 = (0, react_1.useState)(false), activityModal = _176[0], setActivityModal = _176[1];
596
+ var _177 = (0, react_1.useState)(""), activityId = _177[0], setActivityId = _177[1];
558
597
  //INFO : Used by Export
559
- var _176 = (0, react_1.useState)(null), csvFile = _176[0], setCSVFile = _176[1];
560
- var _177 = (0, react_1.useState)([]), csvFileData = _177[0], setCSVFileData = _177[1];
561
- var _178 = (0, react_1.useState)(0), stepCSVIndex = _178[0], setStepCSVIndex = _178[1];
562
- var _179 = (0, react_1.useState)({}), listCSVMapAttribute = _179[0], setListCSVMapAttribute = _179[1];
563
- var _180 = (0, react_1.useState)({}), listCSVObjAttribute = _180[0], setListCSVObjAttribute = _180[1];
564
- var _181 = (0, react_1.useState)([]), csvAPIAttribute = _181[0], setCSVAPIAttribute = _181[1];
565
- var _182 = (0, react_1.useState)(((_v = props.devSettings.currentUser) === null || _v === void 0 ? void 0 : _v.userEmail) || ""), exportCSVEmail = _182[0], setExportCSVEmail = _182[1];
566
- var _183 = (0, react_1.useState)(((_x = (_w = props.organise) === null || _w === void 0 ? void 0 : _w.exportSettings) === null || _x === void 0 ? void 0 : _x.defaultExportPDFName) || ""), exportPDFTitle = _183[0], setExportPDFTitle = _183[1];
567
- var _184 = (0, react_1.useState)(false), exportPDFLoading = _184[0], setExportPDFLoading = _184[1];
568
- var _185 = (0, react_1.useState)(false), exportReadPDFLoading = _185[0], setExportReadPDFLoading = _185[1];
569
- var _186 = (0, react_1.useState)((_0 = (_z = (_y = props.organise) === null || _y === void 0 ? void 0 : _y.exportSettings) === null || _z === void 0 ? void 0 : _z.sumColumnId) !== null && _0 !== void 0 ? _0 : []), exportSumAttributeIds = _186[0], setExportSumAttributeIds = _186[1];
570
- var _187 = (0, react_1.useState)((_3 = (_2 = (_1 = props.organise) === null || _1 === void 0 ? void 0 : _1.exportSettings) === null || _2 === void 0 ? void 0 : _2.hideSubItems) !== null && _3 !== void 0 ? _3 : false), hideSubItems = _187[0], setHideSubItems = _187[1];
571
- var _188 = (0, react_1.useState)([]), importTableData = _188[0], setImportTableData = _188[1];
572
- var _189 = (0, react_1.useState)([]), queryList = _189[0], setQueryList = _189[1];
573
- var _190 = (0, react_1.useState)(undefined), allQueryList = _190[0], setAllQueryList = _190[1];
598
+ var _178 = (0, react_1.useState)(null), csvFile = _178[0], setCSVFile = _178[1];
599
+ var _179 = (0, react_1.useState)([]), csvFileData = _179[0], setCSVFileData = _179[1];
600
+ var _180 = (0, react_1.useState)(0), stepCSVIndex = _180[0], setStepCSVIndex = _180[1];
601
+ var _181 = (0, react_1.useState)({}), listCSVMapAttribute = _181[0], setListCSVMapAttribute = _181[1];
602
+ var _182 = (0, react_1.useState)({}), listCSVObjAttribute = _182[0], setListCSVObjAttribute = _182[1];
603
+ var _183 = (0, react_1.useState)([]), csvAPIAttribute = _183[0], setCSVAPIAttribute = _183[1];
604
+ var _184 = (0, react_1.useState)(((_z = props.devSettings.currentUser) === null || _z === void 0 ? void 0 : _z.userEmail) || ""), exportCSVEmail = _184[0], setExportCSVEmail = _184[1];
605
+ var _185 = (0, react_1.useState)(((_1 = (_0 = props.organise) === null || _0 === void 0 ? void 0 : _0.exportSettings) === null || _1 === void 0 ? void 0 : _1.defaultExportPDFName) || ""), exportPDFTitle = _185[0], setExportPDFTitle = _185[1];
606
+ var _186 = (0, react_1.useState)(false), exportPDFLoading = _186[0], setExportPDFLoading = _186[1];
607
+ var _187 = (0, react_1.useState)(false), exportReadPDFLoading = _187[0], setExportReadPDFLoading = _187[1];
608
+ var _188 = (0, react_1.useState)((_4 = (_3 = (_2 = props.organise) === null || _2 === void 0 ? void 0 : _2.exportSettings) === null || _3 === void 0 ? void 0 : _3.sumColumnId) !== null && _4 !== void 0 ? _4 : []), exportSumAttributeIds = _188[0], setExportSumAttributeIds = _188[1];
609
+ var _189 = (0, react_1.useState)((_7 = (_6 = (_5 = props.organise) === null || _5 === void 0 ? void 0 : _5.exportSettings) === null || _6 === void 0 ? void 0 : _6.hideSubItems) !== null && _7 !== void 0 ? _7 : false), hideSubItems = _189[0], setHideSubItems = _189[1];
610
+ var _190 = (0, react_1.useState)([]), importTableData = _190[0], setImportTableData = _190[1];
611
+ var _191 = (0, react_1.useState)([]), queryList = _191[0], setQueryList = _191[1];
612
+ var _192 = (0, react_1.useState)(undefined), allQueryList = _192[0], setAllQueryList = _192[1];
574
613
  // INFO: a restored state wins over the prop; its "" is a list the user
575
614
  // ungrouped, so it opens ungrouped
576
- var _191 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupBy) !== undefined
615
+ var _193 = (0, react_1.useState)((persistedState === null || persistedState === void 0 ? void 0 : persistedState.groupBy) !== undefined
577
616
  ? persistedState.groupBy || undefined
578
- : (_4 = props.organise) === null || _4 === void 0 ? void 0 : _4.groupBy), groupId = _191[0], setGroupId = _191[1];
617
+ : (_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.groupBy), groupId = _193[0], setGroupId = _193[1];
579
618
  // INFO: Monday-board per-group paging. Keyed by the group key that
580
619
  // handleBuildNewTableGroups() produces (an option, Unknown or No Value).
581
620
  // Each group tracks its own loaded cursor + total so it can lazily load its
582
621
  // next page as the user scrolls inside that band, independent of every other
583
622
  // group. Only used when renderCheckGroupPaging() is true.
584
- var _192 = (0, react_1.useState)({}), groupPageState = _192[0], setGroupPageState = _192[1];
623
+ var _194 = (0, react_1.useState)({}), groupPageState = _194[0], setGroupPageState = _194[1];
585
624
  // INFO: read fresh inside the async per-group fetch so chained scroll fires
586
625
  // in one tick do not re-fetch an already in-flight page.
587
626
  var groupPageStateRef = (0, react_1.useRef)({});
@@ -590,59 +629,59 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
590
629
  // list was re-read (new search, filter, sort or grouping) is dropped on
591
630
  // arrival instead of appending rows that belong to the old list
592
631
  var groupPagingGenRef = (0, react_1.useRef)(0);
593
- var _193 = (0, react_1.useState)(""), readTabSection = _193[0], setReadTabSection = _193[1];
594
- var _194 = (0, react_1.useState)(false), readFloatingNav = _194[0], setReadFloatingNav = _194[1];
632
+ var _195 = (0, react_1.useState)(""), readTabSection = _195[0], setReadTabSection = _195[1];
633
+ var _196 = (0, react_1.useState)(false), readFloatingNav = _196[0], setReadFloatingNav = _196[1];
595
634
  var readTabSectionRefs = (0, react_1.useRef)({});
596
635
  //INFO : Used by Read
597
636
  //INFO : Used by Update
598
- var _195 = (0, react_1.useState)(false), modalVisible = _195[0], setModalVisible = _195[1];
599
- var _196 = (0, react_1.useState)(false), deleteModal = _196[0], setDeleteModal = _196[1];
600
- var _197 = (0, react_1.useState)(false), excelModal = _197[0], setExcelModal = _197[1];
601
- var _198 = (0, react_1.useState)(false), exportExcel = _198[0], setExportExcel = _198[1];
602
- var _199 = (0, react_1.useState)(""), exportType = _199[0], setExportType = _199[1];
603
- var _200 = (0, react_1.useState)(false), exportQR = _200[0], setExportQR = _200[1];
604
- var _201 = (0, react_1.useState)(function () {
637
+ var _197 = (0, react_1.useState)(false), modalVisible = _197[0], setModalVisible = _197[1];
638
+ var _198 = (0, react_1.useState)(false), deleteModal = _198[0], setDeleteModal = _198[1];
639
+ var _199 = (0, react_1.useState)(false), excelModal = _199[0], setExcelModal = _199[1];
640
+ var _200 = (0, react_1.useState)(false), exportExcel = _200[0], setExportExcel = _200[1];
641
+ var _201 = (0, react_1.useState)(""), exportType = _201[0], setExportType = _201[1];
642
+ var _202 = (0, react_1.useState)(false), exportQR = _202[0], setExportQR = _202[1];
643
+ var _203 = (0, react_1.useState)(function () {
605
644
  var _a, _b;
606
645
  var firstTabId = (_b = (_a = structure.find(function (item) { return item.tabId; })) === null || _a === void 0 ? void 0 : _a.tabId) !== null && _b !== void 0 ? _b : "";
607
646
  return firstTabId;
608
- }), activeTab = _201[0], setActiveTab = _201[1];
609
- var _202 = (0, react_1.useState)(false), signatureSigning = _202[0], setSignatureSigning = _202[1];
610
- var _203 = (0, react_1.useState)({}), selectedData = _203[0], setSelectedData = _203[1];
611
- var _204 = (0, react_1.useState)(""), selectedObjectStructureId = _204[0], setSelectedObjectStructureId = _204[1];
612
- var _205 = (0, react_1.useState)(""), selectedObjectId = _205[0], setSelectedObjectId = _205[1];
613
- var _206 = (0, react_1.useState)(""), selectedListAddressId = _206[0], setSelectedListAddressId = _206[1];
614
- var _207 = (0, react_1.useState)(-1), selectedListAddressIndex = _207[0], setSelectedListAddressIndex = _207[1];
615
- var _208 = (0, react_1.useState)({
647
+ }), activeTab = _203[0], setActiveTab = _203[1];
648
+ var _204 = (0, react_1.useState)(false), signatureSigning = _204[0], setSignatureSigning = _204[1];
649
+ var _205 = (0, react_1.useState)({}), selectedData = _205[0], setSelectedData = _205[1];
650
+ var _206 = (0, react_1.useState)(""), selectedObjectStructureId = _206[0], setSelectedObjectStructureId = _206[1];
651
+ var _207 = (0, react_1.useState)(""), selectedObjectId = _207[0], setSelectedObjectId = _207[1];
652
+ var _208 = (0, react_1.useState)(""), selectedListAddressId = _208[0], setSelectedListAddressId = _208[1];
653
+ var _209 = (0, react_1.useState)(-1), selectedListAddressIndex = _209[0], setSelectedListAddressIndex = _209[1];
654
+ var _210 = (0, react_1.useState)({
616
655
  lat: 0,
617
656
  lng: 0,
618
657
  name: "",
619
- }), selectedListAddress = _208[0], setSelectedListAddress = _208[1];
620
- var _209 = (0, react_1.useState)({}), selectedObjectData = _209[0], setSelectedObjectData = _209[1];
621
- var _210 = (0, react_1.useState)(null), objectCellEdit = _210[0], setObjectCellEdit = _210[1];
622
- var _211 = (0, react_1.useState)(false), referenceLoading = _211[0], setReferenceLoading = _211[1];
623
- var _212 = (0, react_1.useState)({}), referencesOptions = _212[0], setReferencesOptions = _212[1];
624
- var _213 = (0, react_1.useState)({}), referencesDetails = _213[0], setReferencesDetails = _213[1];
625
- var _214 = (0, react_1.useState)({}), listReferencesOptions = _214[0], setListReferencesOptions = _214[1];
626
- var _215 = (0, react_1.useState)({}), referenceDeleteTableData = _215[0], setReferenceDeleteTableData = _215[1];
627
- var _216 = (0, react_1.useState)([]), relatedSections = _216[0], setRelatedSections = _216[1];
628
- var _217 = (0, react_1.useState)(0), referenceDeleteIndex = _217[0], setReferenceDeleteIndex = _217[1];
629
- var _218 = (0, react_1.useState)({
658
+ }), selectedListAddress = _210[0], setSelectedListAddress = _210[1];
659
+ var _211 = (0, react_1.useState)({}), selectedObjectData = _211[0], setSelectedObjectData = _211[1];
660
+ var _212 = (0, react_1.useState)(null), objectCellEdit = _212[0], setObjectCellEdit = _212[1];
661
+ var _213 = (0, react_1.useState)(false), referenceLoading = _213[0], setReferenceLoading = _213[1];
662
+ var _214 = (0, react_1.useState)({}), referencesOptions = _214[0], setReferencesOptions = _214[1];
663
+ var _215 = (0, react_1.useState)({}), referencesDetails = _215[0], setReferencesDetails = _215[1];
664
+ var _216 = (0, react_1.useState)({}), listReferencesOptions = _216[0], setListReferencesOptions = _216[1];
665
+ var _217 = (0, react_1.useState)({}), referenceDeleteTableData = _217[0], setReferenceDeleteTableData = _217[1];
666
+ var _218 = (0, react_1.useState)([]), relatedSections = _218[0], setRelatedSections = _218[1];
667
+ var _219 = (0, react_1.useState)(0), referenceDeleteIndex = _219[0], setReferenceDeleteIndex = _219[1];
668
+ var _220 = (0, react_1.useState)({
630
669
  id: "",
631
670
  name: "",
632
671
  type: "string",
633
- }), referenceCreationModal = _218[0], setReferenceCreationModal = _218[1];
634
- var _219 = (0, react_1.useState)({}), referenceModelSchema = _219[0], setReferenceSchema = _219[1];
635
- var _220 = (0, react_1.useState)([]), kanbanChecked = _220[0], setKanbanChecked = _220[1];
672
+ }), referenceCreationModal = _220[0], setReferenceCreationModal = _220[1];
673
+ var _221 = (0, react_1.useState)({}), referenceModelSchema = _221[0], setReferenceSchema = _221[1];
674
+ var _222 = (0, react_1.useState)([]), kanbanChecked = _222[0], setKanbanChecked = _222[1];
636
675
  //INFO : Offline
637
- var _221 = (0, react_1.useState)(0), offlineDataLength = _221[0], setOfflineDataLength = _221[1];
638
- var _222 = (0, react_1.useState)(false), offlineModal = _222[0], setOfflineModal = _222[1];
676
+ var _223 = (0, react_1.useState)(0), offlineDataLength = _223[0], setOfflineDataLength = _223[1];
677
+ var _224 = (0, react_1.useState)(false), offlineModal = _224[0], setOfflineModal = _224[1];
639
678
  // INFO: live-stream state — driven by socket connection and navigator.onLine
640
- var _223 = (0, react_1.useState)(false), isLive = _223[0], setIsLive = _223[1];
641
- var _224 = (0, react_1.useState)(false), isLiveOffline = _224[0], setIsLiveOffline = _224[1];
679
+ var _225 = (0, react_1.useState)(false), isLive = _225[0], setIsLive = _225[1];
680
+ var _226 = (0, react_1.useState)(false), isLiveOffline = _226[0], setIsLiveOffline = _226[1];
642
681
  // INFO: true when navigator is offline — used to switch ReadQueryHoc between
643
682
  // server reads (online, full pagination) and IndexedDB reads (offline, cached data).
644
683
  // Independent of SSE status so it works even when bareSocketName is not set.
645
- var _225 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _225[0], setIsNetworkOffline = _225[1];
684
+ var _227 = (0, react_1.useState)(typeof navigator !== "undefined" ? !navigator.onLine : false), isNetworkOffline = _227[0], setIsNetworkOffline = _227[1];
646
685
  var previousType = (0, react_1.useRef)(null);
647
686
  var previousSelectedData = (0, react_1.useRef)(null);
648
687
  var scrollSentinelRef = (0, react_1.useRef)(null);
@@ -759,16 +798,16 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
759
798
  * viewId still wins when present: it is a deliberate destination, from a
760
799
  * shared link or a back button.
761
800
  */
762
- var defaultTabName = (_7 = (_6 = (_5 = props.organise) === null || _5 === void 0 ? void 0 : _5.extendedTabs) === null || _6 === void 0 ? void 0 : _6.find(function (eachTab) { return eachTab.defaultTab; })) === null || _7 === void 0 ? void 0 : _7.name;
801
+ var defaultTabName = (_11 = (_10 = (_9 = props.organise) === null || _9 === void 0 ? void 0 : _9.extendedTabs) === null || _10 === void 0 ? void 0 : _10.find(function (eachTab) { return eachTab.defaultTab; })) === null || _11 === void 0 ? void 0 : _11.name;
763
802
  // INFO: the pinned tab is a LIST destination. Falling back to it while a
764
803
  // record is open resolved the read view to a list tab, which renderTabContent
765
804
  // refuses — so General Details rendered nothing. Only a list falls back.
766
- var viewType = (_9 = (_8 = props.organise) === null || _8 === void 0 ? void 0 : _8.viewId) !== null && _9 !== void 0 ? _9 : (resolvedType === "list" && defaultTabName
805
+ var viewType = listViewId !== null && listViewId !== void 0 ? listViewId : (resolvedType === "list" && defaultTabName
767
806
  ? (0, utils_1.lowercaseTextToId)(defaultTabName)
768
807
  : "general");
769
808
  var isFirebaseClient = devSettings.server === "firebase";
770
809
  var isFirebase = isFirebaseClient || devSettings.server === "fbServer";
771
- var dbModule = isFirebaseClient ? (_10 = props.lib) === null || _10 === void 0 ? void 0 : _10.firebase : (_11 = props.lib) === null || _11 === void 0 ? void 0 : _11.axios;
810
+ var dbModule = isFirebaseClient ? (_12 = props.lib) === null || _12 === void 0 ? void 0 : _12.firebase : (_13 = props.lib) === null || _13 === void 0 ? void 0 : _13.axios;
772
811
  var schemaPresent = props.devSettings.schemaEndpoint ? true : false;
773
812
  var selectedRelated = resolvedType === "read"
774
813
  ? relatedSections.find(function (eachSection) { return eachSection.id === viewType; })
@@ -823,7 +862,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
823
862
  };
824
863
  return [2 /*return*/, referenceSources
825
864
  .map(function (eachSource, index) { return ({
826
- id: "blixify_related_".concat(eachSource.collectionId, "_").concat(eachSource.column.id),
865
+ id: "".concat(RELATED_VIEW_PREFIX).concat(eachSource.collectionId, "_").concat(eachSource.column.id),
827
866
  label: handleIsShared(eachSource.collectionId)
828
867
  ? "".concat(eachSource.collectionName, " \u00B7 ").concat(eachSource.column.name)
829
868
  : eachSource.collectionName,
@@ -850,32 +889,32 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
850
889
  }, [
851
890
  resolvedType,
852
891
  props.id,
853
- (_12 = props.space) === null || _12 === void 0 ? void 0 : _12._id,
892
+ (_14 = props.space) === null || _14 === void 0 ? void 0 : _14._id,
854
893
  props.devSettings.schemaEndpoint,
855
- (_13 = props.organise) === null || _13 === void 0 ? void 0 : _13.showRelatedTab,
894
+ (_15 = props.organise) === null || _15 === void 0 ? void 0 : _15.showRelatedTab,
856
895
  ]);
857
896
  /* eslint-enable */
858
897
  // INFO: the view settings panel (columns, sort, rows per page) is standard on
859
898
  // the new DTW; bareViewSettings stays the opt-in for legacy and bare DTWs
860
- var isViewSettingsEnabled = ((_14 = props.bareSettings) === null || _14 === void 0 ? void 0 : _14.bareViewSettings) || ((_15 = props.bareSettings) === null || _15 === void 0 ? void 0 : _15.bareNewDTW)
899
+ var isViewSettingsEnabled = ((_16 = props.bareSettings) === null || _16 === void 0 ? void 0 : _16.bareViewSettings) || ((_17 = props.bareSettings) === null || _17 === void 0 ? void 0 : _17.bareNewDTW)
861
900
  ? true
862
901
  : false;
863
902
  // INFO: a consumer that wires onChangeHide owns the hide at schema level
864
903
  // (shared by every user) — toggling writes to the model and calls back. Without it
865
904
  // the hide is this user's own and lives in userHiddenColumnIds.
866
- var isSchemaHideMode = ((_16 = props.organise) === null || _16 === void 0 ? void 0 : _16.onChangeHide) ? true : false;
905
+ var isSchemaHideMode = ((_18 = props.organise) === null || _18 === void 0 ? void 0 : _18.onChangeHide) ? true : false;
867
906
  // INFO: rows per page is a view setting the user can change, so it starts from
868
907
  // the persisted value and falls back to the consumer's limit
869
- var _226 = (0, react_1.useState)((_18 = (_17 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _17 !== void 0 ? _17 : props.limit) !== null && _18 !== void 0 ? _18 : 10), pageLimit = _226[0], setPageLimit = _226[1];
908
+ var _228 = (0, react_1.useState)((_20 = (_19 = (isPersistEnabled ? persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageLimit : undefined)) !== null && _19 !== void 0 ? _19 : props.limit) !== null && _20 !== void 0 ? _20 : 10), pageLimit = _228[0], setPageLimit = _228[1];
870
909
  var limit = pageLimit;
871
- var isSavedViewsEnabled = !!((_19 = props.organise) === null || _19 === void 0 ? void 0 : _19.savedViews) && resolvedType === "list";
910
+ var isSavedViewsEnabled = !!((_21 = props.organise) === null || _21 === void 0 ? void 0 : _21.savedViews) && resolvedType === "list";
872
911
  // INFO: an app that stores views takes over from this browser's storage, so
873
912
  // every view is the team's and nothing is kept locally
874
- var isAppViews = ((_20 = props.organise) === null || _20 === void 0 ? void 0 : _20.sharedViews) !== undefined ||
875
- !!((_21 = props.organise) === null || _21 === void 0 ? void 0 : _21.onChangeSharedViews);
913
+ var isAppViews = ((_22 = props.organise) === null || _22 === void 0 ? void 0 : _22.sharedViews) !== undefined ||
914
+ !!((_23 = props.organise) === null || _23 === void 0 ? void 0 : _23.onChangeSharedViews);
876
915
  // INFO: a saved view carries its sort, so the sort is held here as with persistViewState
877
916
  var isInternalSort = isPersistEnabled || isSavedViewsEnabled;
878
- var activeSortId = (isInternalSort && persistedSort) || ((_22 = props.organise) === null || _22 === void 0 ? void 0 : _22.sort);
917
+ var activeSortId = (isInternalSort && persistedSort) || ((_24 = props.organise) === null || _24 === void 0 ? void 0 : _24.sort);
879
918
  var handleSortColumn = function (value) {
880
919
  var _a, _b, _c, _d;
881
920
  if (isInternalSort)
@@ -905,7 +944,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
905
944
  // INFO: Firebase pages by document cursor and a union by skip, so neither
906
945
  // can hand over the whole set — there formula columns are not offered for
907
946
  // sorting or filtering, rather than ordering one page
908
- var isFormulaViewSupported = !isFirebase && !((_24 = (_23 = props.organise) === null || _23 === void 0 ? void 0 : _23.unionCollections) === null || _24 === void 0 ? void 0 : _24.length);
947
+ var isFormulaViewSupported = !isFirebase && !((_26 = (_25 = props.organise) === null || _25 === void 0 ? void 0 : _25.unionCollections) === null || _26 === void 0 ? void 0 : _26.length);
909
948
  var formulaSort = isFormulaViewSupported &&
910
949
  (activeSortId === null || activeSortId === void 0 ? void 0 : activeSortId.sortId) &&
911
950
  formulaColumnIds.includes(activeSortId.sortId)
@@ -914,10 +953,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
914
953
  // INFO: a referenced record is joined by MongoWrapper's lookup and a list
915
954
  // row is matched by its Mongo path — neither Firebase nor a union read runs
916
955
  // them
917
- var flexFilterExtras = !isFirebase && !((_26 = (_25 = props.organise) === null || _25 === void 0 ? void 0 : _25.unionCollections) === null || _26 === void 0 ? void 0 : _26.length)
956
+ var flexFilterExtras = !isFirebase && !((_28 = (_27 = props.organise) === null || _27 === void 0 ? void 0 : _27.unionCollections) === null || _28 === void 0 ? void 0 : _28.length)
918
957
  ? {
919
- references: (_27 = props.bareSettings) === null || _27 === void 0 ? void 0 : _27.bareFlexFilterReferences,
920
- listObjects: (_28 = props.bareSettings) === null || _28 === void 0 ? void 0 : _28.bareFlexFilterListObjects,
958
+ references: (_29 = props.bareSettings) === null || _29 === void 0 ? void 0 : _29.bareFlexFilterReferences,
959
+ listObjects: (_30 = props.bareSettings) === null || _30 === void 0 ? void 0 : _30.bareFlexFilterListObjects,
921
960
  }
922
961
  : undefined;
923
962
  var formulaFlexQueries = isFormulaViewSupported && formulaColumnIds.length > 0
@@ -978,18 +1017,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
978
1017
  displayRows: filtered.map(function (eachEntry) { return eachEntry.displayRow; }),
979
1018
  };
980
1019
  };
981
- var _227 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _227.canUpdateRecord, canInlineUpdate = _227.canInlineUpdate, canBatchUpdate = _227.canBatchUpdate, canDeleteRecord = _227.canDeleteRecord;
982
- var isEditor = ((_29 = props.edit) === null || _29 === void 0 ? void 0 : _29.allEditable) ? true : false;
983
- var isOffline = (_30 = props.bareSettings) === null || _30 === void 0 ? void 0 : _30.bareOffline;
1020
+ var _229 = (0, permissions_1.handleResolveDataTemplateWritePermissions)(props.edit), canUpdateRecord = _229.canUpdateRecord, canInlineUpdate = _229.canInlineUpdate, canBatchUpdate = _229.canBatchUpdate, canDeleteRecord = _229.canDeleteRecord;
1021
+ var isEditor = ((_31 = props.edit) === null || _31 === void 0 ? void 0 : _31.allEditable) ? true : false;
1022
+ var isOffline = (_32 = props.bareSettings) === null || _32 === void 0 ? void 0 : _32.bareOffline;
984
1023
  // INFO: when bareOfflineNetworkAware is true, the save path is also gated on
985
1024
  // the live network state — online saves go to the server even if bareOffline
986
1025
  // is true, offline saves go to IDB as normal.
987
- var isOfflineNetworkListener = isOffline && ((_31 = props.bareSettings) === null || _31 === void 0 ? void 0 : _31.bareOfflineNetworkListener);
988
- var showId = (_32 = props.space) === null || _32 === void 0 ? void 0 : _32.showId;
1026
+ var isOfflineNetworkListener = isOffline && ((_33 = props.bareSettings) === null || _33 === void 0 ? void 0 : _33.bareOfflineNetworkListener);
1027
+ var showId = (_34 = props.space) === null || _34 === void 0 ? void 0 : _34.showId;
989
1028
  var remainId = showId || selectedObjectStructureId ? true : false;
990
- var idField = ((_33 = props.space) === null || _33 === void 0 ? void 0 : _33.idField) || ((_34 = props.organise) === null || _34 === void 0 ? void 0 : _34.idField);
991
- var pipeline = (_35 = props === null || props === void 0 ? void 0 : props.space) === null || _35 === void 0 ? void 0 : _35.pipeline;
992
- if ((_36 = props.bareSettings) === null || _36 === void 0 ? void 0 : _36.bareListPipeline) {
1029
+ var idField = ((_35 = props.space) === null || _35 === void 0 ? void 0 : _35.idField) || ((_36 = props.organise) === null || _36 === void 0 ? void 0 : _36.idField);
1030
+ var pipeline = (_37 = props === null || props === void 0 ? void 0 : props.space) === null || _37 === void 0 ? void 0 : _37.pipeline;
1031
+ if ((_38 = props.bareSettings) === null || _38 === void 0 ? void 0 : _38.bareListPipeline) {
993
1032
  pipeline = pipeline
994
1033
  ? __spreadArray(__spreadArray([], pipeline, true), props.bareSettings.bareListPipeline, true) : props.bareSettings.bareListPipeline;
995
1034
  }
@@ -1002,24 +1041,24 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1002
1041
  * three records came back instead of five files, and each tile received the
1003
1042
  * whole array rather than one file, so every one of them read "Attachment".
1004
1043
  */
1005
- var fileViewColumnId = (_40 = (_39 = ((_38 = (_37 = props.organise) === null || _37 === void 0 ? void 0 : _37.extendedTabs) !== null && _38 !== void 0 ? _38 : []).find(function (eachTab) {
1044
+ var fileViewColumnId = (_42 = (_41 = ((_40 = (_39 = props.organise) === null || _39 === void 0 ? void 0 : _39.extendedTabs) !== null && _40 !== void 0 ? _40 : []).find(function (eachTab) {
1006
1045
  return eachTab.viewType === "file" &&
1007
1046
  (0, utils_1.lowercaseTextToId)(eachTab.name) === viewType;
1008
- })) === null || _39 === void 0 ? void 0 : _39.fileSettings) === null || _40 === void 0 ? void 0 : _40.columnId;
1009
- var hasNavigation = ((_41 = props.organise) === null || _41 === void 0 ? void 0 : _41.handleNavigate) ? true : false;
1047
+ })) === null || _41 === void 0 ? void 0 : _41.fileSettings) === null || _42 === void 0 ? void 0 : _42.columnId;
1048
+ var hasNavigation = ((_43 = props.organise) === null || _43 === void 0 ? void 0 : _43.handleNavigate) ? true : false;
1010
1049
  var formColumn = "grid-cols-12";
1011
- var useMobileView = (_43 = (_42 = props.bareSettings) === null || _42 === void 0 ? void 0 : _42.bareUpdateMobileView) !== null && _43 !== void 0 ? _43 : false;
1050
+ var useMobileView = (_45 = (_44 = props.bareSettings) === null || _44 === void 0 ? void 0 : _44.bareUpdateMobileView) !== null && _45 !== void 0 ? _45 : false;
1012
1051
  var gridGap = useMobileView ? "gap-x-6 gap-y-2 md:gap-y-6" : "gap-6";
1013
- var isActivityLog = (((_45 = (_44 = props.edit) === null || _44 === void 0 ? void 0 : _44.activityLog) === null || _45 === void 0 ? void 0 : _45.enableComments) &&
1014
- ((_46 = props.edit) === null || _46 === void 0 ? void 0 : _46.activityLog.commentCollectionId)) ||
1015
- (((_48 = (_47 = props.edit) === null || _47 === void 0 ? void 0 : _47.activityLog) === null || _48 === void 0 ? void 0 : _48.enableLogs) &&
1016
- ((_49 = props.edit) === null || _49 === void 0 ? void 0 : _49.activityLog.logsCollectionId));
1017
- var customPaginationSize = ((_50 = props.organise) === null || _50 === void 0 ? void 0 : _50.customPaginationCount)
1052
+ var isActivityLog = (((_47 = (_46 = props.edit) === null || _46 === void 0 ? void 0 : _46.activityLog) === null || _47 === void 0 ? void 0 : _47.enableComments) &&
1053
+ ((_48 = props.edit) === null || _48 === void 0 ? void 0 : _48.activityLog.commentCollectionId)) ||
1054
+ (((_50 = (_49 = props.edit) === null || _49 === void 0 ? void 0 : _49.activityLog) === null || _50 === void 0 ? void 0 : _50.enableLogs) &&
1055
+ ((_51 = props.edit) === null || _51 === void 0 ? void 0 : _51.activityLog.logsCollectionId));
1056
+ var customPaginationSize = ((_52 = props.organise) === null || _52 === void 0 ? void 0 : _52.customPaginationCount)
1018
1057
  ? props.organise.customPaginationCount(size)
1019
1058
  : undefined;
1020
1059
  //TODO : Code - Pass ...devSettings, search dbEndpoint:
1021
1060
  var writeServerQuery = new writeQuery_1.WriteQuery({
1022
- dbModule: (_51 = props.lib) === null || _51 === void 0 ? void 0 : _51.axios,
1061
+ dbModule: (_53 = props.lib) === null || _53 === void 0 ? void 0 : _53.axios,
1023
1062
  dbType: devSettings.server,
1024
1063
  dbCollection: props.collectionId,
1025
1064
  dbEndpoint: devSettings.dbEndpoint,
@@ -1027,7 +1066,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1027
1066
  dbUserToken: devSettings.dbUserToken,
1028
1067
  });
1029
1068
  var readServerQuery = new readQuery_1.ReadQuery({
1030
- dbModule: (_52 = props.lib) === null || _52 === void 0 ? void 0 : _52.axios,
1069
+ dbModule: (_54 = props.lib) === null || _54 === void 0 ? void 0 : _54.axios,
1031
1070
  dbType: devSettings.server,
1032
1071
  dbCollection: props.collectionId,
1033
1072
  dbEndpoint: devSettings.dbEndpoint,
@@ -1035,12 +1074,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1035
1074
  dbUserToken: devSettings.dbUserToken,
1036
1075
  });
1037
1076
  var moreButtonPopUp = [
1038
- ((_53 = props.edit) === null || _53 === void 0 ? void 0 : _53.allEditable) &&
1077
+ ((_55 = props.edit) === null || _55 === void 0 ? void 0 : _55.allEditable) &&
1039
1078
  // INFO: the import runs on the server (importEndpoint), so a Firestore
1040
1079
  // datasheet served through one can import; only the browser-direct
1041
1080
  // Firebase client has no server to import through
1042
1081
  !isFirebaseClient &&
1043
- !((_55 = (_54 = props.organise) === null || _54 === void 0 ? void 0 : _54.exportSettings) === null || _55 === void 0 ? void 0 : _55.hideImportCSV)
1082
+ !((_57 = (_56 = props.organise) === null || _56 === void 0 ? void 0 : _56.exportSettings) === null || _57 === void 0 ? void 0 : _57.hideImportCSV)
1044
1083
  ? {
1045
1084
  text: "Import Excel",
1046
1085
  onClick: function () {
@@ -1049,7 +1088,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1049
1088
  },
1050
1089
  }
1051
1090
  : null,
1052
- !((_57 = (_56 = props.organise) === null || _56 === void 0 ? void 0 : _56.exportSettings) === null || _57 === void 0 ? void 0 : _57.hideExportCSV)
1091
+ !((_59 = (_58 = props.organise) === null || _58 === void 0 ? void 0 : _58.exportSettings) === null || _59 === void 0 ? void 0 : _59.hideExportCSV)
1053
1092
  ? {
1054
1093
  text: "Export CSV",
1055
1094
  onClick: function () {
@@ -1059,7 +1098,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1059
1098
  },
1060
1099
  }
1061
1100
  : null,
1062
- !((_59 = (_58 = props.organise) === null || _58 === void 0 ? void 0 : _58.exportSettings) === null || _59 === void 0 ? void 0 : _59.hideExportExcel)
1101
+ !((_61 = (_60 = props.organise) === null || _60 === void 0 ? void 0 : _60.exportSettings) === null || _61 === void 0 ? void 0 : _61.hideExportExcel)
1063
1102
  ? {
1064
1103
  text: "Export Excel",
1065
1104
  onClick: function () {
@@ -1069,7 +1108,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1069
1108
  },
1070
1109
  }
1071
1110
  : null,
1072
- !((_61 = (_60 = props.organise) === null || _60 === void 0 ? void 0 : _60.exportSettings) === null || _61 === void 0 ? void 0 : _61.hideExportPDF)
1111
+ !((_63 = (_62 = props.organise) === null || _62 === void 0 ? void 0 : _62.exportSettings) === null || _63 === void 0 ? void 0 : _63.hideExportPDF)
1073
1112
  ? {
1074
1113
  text: "Export PDF",
1075
1114
  onClick: function () {
@@ -1079,7 +1118,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1079
1118
  },
1080
1119
  }
1081
1120
  : null,
1082
- !((_63 = (_62 = props.organise) === null || _62 === void 0 ? void 0 : _62.exportSettings) === null || _63 === void 0 ? void 0 : _63.hideExportQR)
1121
+ !((_65 = (_64 = props.organise) === null || _64 === void 0 ? void 0 : _64.exportSettings) === null || _65 === void 0 ? void 0 : _65.hideExportQR)
1083
1122
  ? {
1084
1123
  text: "Export QR",
1085
1124
  onClick: function () {
@@ -1089,7 +1128,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1089
1128
  },
1090
1129
  }
1091
1130
  : null,
1092
- !((_65 = (_64 = props.organise) === null || _64 === void 0 ? void 0 : _64.exportSettings) === null || _65 === void 0 ? void 0 : _65.hideExportQR)
1131
+ !((_67 = (_66 = props.organise) === null || _66 === void 0 ? void 0 : _66.exportSettings) === null || _67 === void 0 ? void 0 : _67.hideExportQR)
1093
1132
  ? {
1094
1133
  text: "Export QR(Data)",
1095
1134
  onClick: function () {
@@ -1099,7 +1138,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1099
1138
  },
1100
1139
  }
1101
1140
  : null,
1102
- !((_67 = (_66 = props.organise) === null || _66 === void 0 ? void 0 : _66.exportSettings) === null || _67 === void 0 ? void 0 : _67.hideExportPrint)
1141
+ !((_69 = (_68 = props.organise) === null || _68 === void 0 ? void 0 : _68.exportSettings) === null || _69 === void 0 ? void 0 : _69.hideExportPrint)
1103
1142
  ? {
1104
1143
  text: "Print",
1105
1144
  onClick: function () {
@@ -1111,8 +1150,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1111
1150
  : null,
1112
1151
  // INFO: drafts only exist where the form can save one, so the filter has
1113
1152
  // nothing to find on any other page
1114
- ((_68 = props.edit) === null || _68 === void 0 ? void 0 : _68.enableUpdateDraft) &&
1115
- !((_70 = (_69 = props.organise) === null || _69 === void 0 ? void 0 : _69.exportSettings) === null || _70 === void 0 ? void 0 : _70.hideExportDraft)
1153
+ ((_70 = props.edit) === null || _70 === void 0 ? void 0 : _70.enableUpdateDraft) &&
1154
+ !((_72 = (_71 = props.organise) === null || _71 === void 0 ? void 0 : _71.exportSettings) === null || _72 === void 0 ? void 0 : _72.hideExportDraft)
1116
1155
  ? {
1117
1156
  text: filterDraft ? "Show All Items" : "Filter Draft",
1118
1157
  onClick: function () {
@@ -1121,7 +1160,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1121
1160
  }
1122
1161
  : null,
1123
1162
  ].filter(Boolean);
1124
- if ((_71 = props.organise) === null || _71 === void 0 ? void 0 : _71.moreSettings)
1163
+ if ((_73 = props.organise) === null || _73 === void 0 ? void 0 : _73.moreSettings)
1125
1164
  moreButtonPopUp = moreButtonPopUp.concat(props.organise.moreSettings);
1126
1165
  //=====================================================================================
1127
1166
  //SECTION: User Column Visibility Handlers
@@ -1515,14 +1554,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1515
1554
  //=====================================================================================
1516
1555
  //SECTION: Saved Views
1517
1556
  //=====================================================================================
1518
- var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_72 = props.organise) === null || _72 === void 0 ? void 0 : _72.persistKey, (_73 = devSettings.currentUser) === null || _73 === void 0 ? void 0 : _73.userEmail);
1557
+ var savedViewsKey = (0, viewStatePersistence_1.buildSavedViewsKey)(props.collectionId, (_74 = props.organise) === null || _74 === void 0 ? void 0 : _74.persistKey, (_75 = devSettings.currentUser) === null || _75 === void 0 ? void 0 : _75.userEmail);
1519
1558
  (0, react_1.useEffect)(function () {
1520
1559
  if (isSavedViewsEnabled && !isAppViews)
1521
1560
  setSavedViews((0, viewStatePersistence_1.handleReadSavedViews)(savedViewsKey));
1522
1561
  }, [isSavedViewsEnabled, isAppViews, savedViewsKey]);
1523
1562
  // INFO: the app keeps All's settings, so every change is kept in this
1524
1563
  // browser until the person updates the view for everyone or resets it
1525
- var isViewDraftsEnabled = isSavedViewsEnabled && ((_74 = props.organise) === null || _74 === void 0 ? void 0 : _74.allView) !== undefined;
1564
+ var isViewDraftsEnabled = isSavedViewsEnabled && ((_76 = props.organise) === null || _76 === void 0 ? void 0 : _76.allView) !== undefined;
1526
1565
  var handleGetViewDraftKey = function (viewId) {
1527
1566
  var _a, _b;
1528
1567
  return (0, viewStatePersistence_1.buildViewDraftKey)(props.collectionId, viewId !== null && viewId !== void 0 ? viewId : "all", (_a = props.organise) === null || _a === void 0 ? void 0 : _a.persistKey, (_b = devSettings.currentUser) === null || _b === void 0 ? void 0 : _b.userEmail);
@@ -1599,7 +1638,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1599
1638
  var lastSentSharedViewsRef = (0, react_1.useRef)(null);
1600
1639
  (0, react_1.useEffect)(function () {
1601
1640
  lastSentSharedViewsRef.current = null;
1602
- }, [(_75 = props.organise) === null || _75 === void 0 ? void 0 : _75.sharedViews]);
1641
+ }, [(_77 = props.organise) === null || _77 === void 0 ? void 0 : _77.sharedViews]);
1603
1642
  var handleStoreSharedViews = function (update) {
1604
1643
  var _a, _b, _c;
1605
1644
  if (!((_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangeSharedViews))
@@ -1644,13 +1683,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1644
1683
  /* eslint-disable */
1645
1684
  }, [
1646
1685
  isSavedViewsEnabled,
1647
- (_76 = props.organise) === null || _76 === void 0 ? void 0 : _76.initialSavedViewId,
1648
- (_77 = props.organise) === null || _77 === void 0 ? void 0 : _77.defaultSavedViewId,
1649
- (_78 = props.organise) === null || _78 === void 0 ? void 0 : _78.sharedViews,
1686
+ (_78 = props.organise) === null || _78 === void 0 ? void 0 : _78.initialSavedViewId,
1687
+ (_79 = props.organise) === null || _79 === void 0 ? void 0 : _79.defaultSavedViewId,
1688
+ (_80 = props.organise) === null || _80 === void 0 ? void 0 : _80.sharedViews,
1650
1689
  savedViews,
1651
1690
  ]);
1652
1691
  /* eslint-enable */
1653
- var defaultSavedViewIds = ((_80 = (_79 = props.organise) === null || _79 === void 0 ? void 0 : _79.defaultSavedViews) !== null && _80 !== void 0 ? _80 : [])
1692
+ var defaultSavedViewIds = ((_82 = (_81 = props.organise) === null || _81 === void 0 ? void 0 : _81.defaultSavedViews) !== null && _82 !== void 0 ? _82 : [])
1654
1693
  .map(function (eachView) { var _a; return (_a = eachView.id) !== null && _a !== void 0 ? _a : ""; })
1655
1694
  .join("|");
1656
1695
  // INFO: keyed on the ids, not the array, so an inline literal passed on every
@@ -1952,8 +1991,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1952
1991
  pageLimit,
1953
1992
  groupId,
1954
1993
  columnWidths,
1955
- (_81 = props.organise) === null || _81 === void 0 ? void 0 : _81.allView,
1956
- (_82 = props.organise) === null || _82 === void 0 ? void 0 : _82.sharedViews,
1994
+ (_83 = props.organise) === null || _83 === void 0 ? void 0 : _83.allView,
1995
+ (_84 = props.organise) === null || _84 === void 0 ? void 0 : _84.sharedViews,
1957
1996
  savedViews,
1958
1997
  ]);
1959
1998
  /* eslint-enable */
@@ -1993,7 +2032,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1993
2032
  var isOtherListReturn = !(0, viewStatePersistence_1.handleIsLastDrill)(props.collectionId, (_c = props.organise) === null || _c === void 0 ? void 0 : _c.persistKey);
1994
2033
  scrollRestoredRef.current = isSwitch || isOtherListReturn;
1995
2034
  /* eslint-disable */
1996
- }, [props.collectionId, (_83 = props.organise) === null || _83 === void 0 ? void 0 : _83.persistKey]);
2035
+ }, [props.collectionId, (_85 = props.organise) === null || _85 === void 0 ? void 0 : _85.persistKey]);
1997
2036
  /* eslint-enable */
1998
2037
  // INFO: wait a frame — rows land in state one tick before layout
1999
2038
  (0, react_1.useEffect)(function () {
@@ -2028,7 +2067,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2028
2067
  (0, react_1.useEffect)(function () {
2029
2068
  handleOfflinePrefetch();
2030
2069
  /* eslint-disable */
2031
- }, [props.collectionId, (_84 = props.bareSettings) === null || _84 === void 0 ? void 0 : _84.bareOffline]);
2070
+ }, [props.collectionId, (_86 = props.bareSettings) === null || _86 === void 0 ? void 0 : _86.bareOffline]);
2032
2071
  /* eslint-enable */
2033
2072
  // INFO: MRQ polling — calls handleRefresh every N ms (e.g. 1500) as a fallback.
2034
2073
  // Calls through handleRefreshRef so the interval always dispatches the latest
@@ -2048,7 +2087,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2048
2087
  }, interval);
2049
2088
  return function () { return clearInterval(timer); };
2050
2089
  /* eslint-disable */
2051
- }, [(_85 = props.bareSettings) === null || _85 === void 0 ? void 0 : _85.barePollingInterval, isLive, isNetworkOffline]);
2090
+ }, [(_87 = props.bareSettings) === null || _87 === void 0 ? void 0 : _87.barePollingInterval, isLive, isNetworkOffline]);
2052
2091
  /* eslint-enable */
2053
2092
  // INFO: Pub/Sub → SSE live-stream — driven by bareSettings.bareSocketName
2054
2093
  // EventSource URL: {sseEndpoint}/{room}?bm_apiToken={token}
@@ -2090,7 +2129,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2090
2129
  };
2091
2130
  /* eslint-disable */
2092
2131
  }, [
2093
- (_86 = props.bareSettings) === null || _86 === void 0 ? void 0 : _86.bareSocketName,
2132
+ (_88 = props.bareSettings) === null || _88 === void 0 ? void 0 : _88.bareSocketName,
2094
2133
  props.collectionId,
2095
2134
  props.devSettings.sseEndpoint,
2096
2135
  props.devSettings.dbAPIToken,
@@ -2213,21 +2252,21 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2213
2252
  previousType.current = resolvedType;
2214
2253
  }, [resolvedType, props.id]);
2215
2254
  (0, react_1.useEffect)(function () {
2216
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
2255
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2217
2256
  var handleInitTab = function () { return __awaiter(void 0, void 0, void 0, function () {
2218
2257
  var currentTab, defaultViewSwitch, kanbanSettings, kanbanTitle_1, kanbanRefRQ_1, kanbanRefOption_1, kanbanRefLabel_1, kanbanRefQuery;
2219
- var _a, _b, _c, _d, _e, _f, _g, _h;
2220
- return __generator(this, function (_j) {
2221
- switch (_j.label) {
2258
+ var _a, _b, _c, _d, _e, _f, _g;
2259
+ return __generator(this, function (_h) {
2260
+ switch (_h.label) {
2222
2261
  case 0:
2223
- currentTab = (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);
2262
+ currentTab = (0, listModule_1.renderSelectedRefreshTab)(props.localURLEndpoint, resolvedType, props.collectionId, props.id, (_a = props.organise) === null || _a === void 0 ? void 0 : _a.extendedTabs, listViewId);
2224
2263
  if (!(resolvedType === "list")) return [3 /*break*/, 5];
2225
2264
  setSelectedTab(currentTab);
2226
2265
  if (!((currentTab === null || currentTab === void 0 ? void 0 : currentTab.viewType) === "calendar")) return [3 /*break*/, 1];
2227
- if ((_c = currentTab === null || currentTab === void 0 ? void 0 : currentTab.calendarSettings) === null || _c === void 0 ? void 0 : _c.defaultStartDate) {
2266
+ if ((_b = currentTab === null || currentTab === void 0 ? void 0 : currentTab.calendarSettings) === null || _b === void 0 ? void 0 : _b.defaultStartDate) {
2228
2267
  setCalendarTabMonth((0, dayjs_1.default)(currentTab.calendarSettings.defaultStartDate).toDate());
2229
2268
  }
2230
- defaultViewSwitch = (_d = currentTab === null || currentTab === void 0 ? void 0 : currentTab.calendarSettings) === null || _d === void 0 ? void 0 : _d.defaultViewSwitch;
2269
+ defaultViewSwitch = (_c = currentTab === null || currentTab === void 0 ? void 0 : currentTab.calendarSettings) === null || _c === void 0 ? void 0 : _c.defaultViewSwitch;
2231
2270
  if (defaultViewSwitch && !calendarViewInitRef.current) {
2232
2271
  setNewCalendarViewMode(defaultViewSwitch);
2233
2272
  setCalendarView(CALENDAR_VIEW_BY_SWITCH[defaultViewSwitch]);
@@ -2239,7 +2278,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2239
2278
  case 1:
2240
2279
  if (!((currentTab === null || currentTab === void 0 ? void 0 : currentTab.viewType) === "kanban")) return [3 /*break*/, 4];
2241
2280
  kanbanSettings = currentTab === null || currentTab === void 0 ? void 0 : currentTab.kanbanSettings;
2242
- kanbanTitle_1 = (_e = kanbanSettings === null || kanbanSettings === void 0 ? void 0 : kanbanSettings.title) !== null && _e !== void 0 ? _e : "";
2281
+ kanbanTitle_1 = (_d = kanbanSettings === null || kanbanSettings === void 0 ? void 0 : kanbanSettings.title) !== null && _d !== void 0 ? _d : "";
2243
2282
  kanbanRefRQ_1 = null;
2244
2283
  kanbanRefOption_1 = [];
2245
2284
  kanbanRefLabel_1 = "";
@@ -2264,10 +2303,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2264
2303
  return [4 /*yield*/, kanbanRefRQ_1.call({
2265
2304
  type: "list",
2266
2305
  limit: limit,
2267
- query: ((_f = currentTab === null || currentTab === void 0 ? void 0 : currentTab.kanbanSettings) === null || _f === void 0 ? void 0 : _f.query) || undefined,
2306
+ query: ((_e = currentTab === null || currentTab === void 0 ? void 0 : currentTab.kanbanSettings) === null || _e === void 0 ? void 0 : _e.query) || undefined,
2268
2307
  })];
2269
2308
  case 2:
2270
- kanbanRefQuery = _j.sent();
2309
+ kanbanRefQuery = _h.sent();
2271
2310
  if (kanbanRefQuery.data) {
2272
2311
  kanbanRefQuery.data.map(function (eachData) {
2273
2312
  kanbanRefOption_1.push({
@@ -2277,7 +2316,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2277
2316
  return null;
2278
2317
  });
2279
2318
  }
2280
- _j.label = 3;
2319
+ _h.label = 3;
2281
2320
  case 3:
2282
2321
  setKanbanOptions(kanbanRefOption_1);
2283
2322
  return [3 /*break*/, 5];
@@ -2290,14 +2329,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2290
2329
  setFilterSearch({});
2291
2330
  setFilterSearchParams({});
2292
2331
  if (currentTab.structure)
2293
- setStructure((_g = currentTab.structure) !== null && _g !== void 0 ? _g : []);
2332
+ setStructure((_f = currentTab.structure) !== null && _f !== void 0 ? _f : []);
2294
2333
  if (currentTab.additionalQuery)
2295
- setAdditionalQuery((_h = currentTab.additionalQuery) !== null && _h !== void 0 ? _h : []);
2334
+ setAdditionalQuery((_g = currentTab.additionalQuery) !== null && _g !== void 0 ? _g : []);
2296
2335
  if (currentTab.groupBy)
2297
2336
  setGroupId(currentTab.groupBy);
2298
2337
  setExportPDFTitle(currentTab === null || currentTab === void 0 ? void 0 : currentTab.name);
2299
2338
  }
2300
- _j.label = 5;
2339
+ _h.label = 5;
2301
2340
  case 5: return [2 /*return*/];
2302
2341
  }
2303
2342
  });
@@ -2336,9 +2375,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2336
2375
  model: props.model,
2337
2376
  localURLEndpoint: props.localURLEndpoint,
2338
2377
  extendedTabs: (_h = props.organise) === null || _h === void 0 ? void 0 : _h.extendedTabs,
2339
- viewId: (_j = props.organise) === null || _j === void 0 ? void 0 : _j.viewId,
2340
- additionalQuery: (_k = props.organise) === null || _k === void 0 ? void 0 : _k.additionalQuery,
2341
- groupBy: (_l = props.organise) === null || _l === void 0 ? void 0 : _l.groupBy,
2378
+ viewId: listViewId,
2379
+ additionalQuery: (_j = props.organise) === null || _j === void 0 ? void 0 : _j.additionalQuery,
2380
+ groupBy: (_k = props.organise) === null || _k === void 0 ? void 0 : _k.groupBy,
2342
2381
  type: resolvedType,
2343
2382
  };
2344
2383
  var safeReplacer = function () {
@@ -2364,10 +2403,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2364
2403
  props.collectionId,
2365
2404
  props.model,
2366
2405
  props.localURLEndpoint,
2367
- (_87 = props.organise) === null || _87 === void 0 ? void 0 : _87.extendedTabs,
2368
- (_88 = props.organise) === null || _88 === void 0 ? void 0 : _88.viewId,
2369
- (_89 = props.organise) === null || _89 === void 0 ? void 0 : _89.additionalQuery,
2370
- (_90 = props.organise) === null || _90 === void 0 ? void 0 : _90.groupBy,
2406
+ (_89 = props.organise) === null || _89 === void 0 ? void 0 : _89.extendedTabs,
2407
+ listViewId,
2408
+ (_90 = props.organise) === null || _90 === void 0 ? void 0 : _90.additionalQuery,
2409
+ (_91 = props.organise) === null || _91 === void 0 ? void 0 : _91.groupBy,
2371
2410
  resolvedType,
2372
2411
  ]);
2373
2412
  /**
@@ -2519,7 +2558,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2519
2558
  };
2520
2559
  }, 100);
2521
2560
  return function () { return clearTimeout(timeoutId); };
2522
- }, [(_91 = props.organise) === null || _91 === void 0 ? void 0 : _91.showReadFloatingNav, resolvedType, props.id, loading]);
2561
+ }, [(_92 = props.organise) === null || _92 === void 0 ? void 0 : _92.showReadFloatingNav, resolvedType, props.id, loading]);
2523
2562
  (0, react_1.useEffect)(function () {
2524
2563
  if (resolvedType !== "read")
2525
2564
  return;
@@ -5595,7 +5634,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
5595
5634
  // update an inline cell edit makes, gated on the same update right
5596
5635
  var columnTypeActions = {
5597
5636
  canUpdate: canUpdateRecord,
5598
- onButtonClick: (_92 = props.organise) === null || _92 === void 0 ? void 0 : _92.onButtonClick,
5637
+ onButtonClick: (_93 = props.organise) === null || _93 === void 0 ? void 0 : _93.onButtonClick,
5599
5638
  onUpdateCell: function (rowId, columnId, value) { return __awaiter(void 0, void 0, void 0, function () {
5600
5639
  var _a;
5601
5640
  return __generator(this, function (_b) {
@@ -5612,7 +5651,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
5612
5651
  }
5613
5652
  });
5614
5653
  }); },
5615
- onTimeTrackingAction: ((_93 = props.organise) === null || _93 === void 0 ? void 0 : _93.onTimeTrackingAction) && canUpdateRecord
5654
+ onTimeTrackingAction: ((_94 = props.organise) === null || _94 === void 0 ? void 0 : _94.onTimeTrackingAction) && canUpdateRecord
5616
5655
  ? function (rowId, columnId, action) {
5617
5656
  return handleTimeTrackingAction(rowId, columnId, action);
5618
5657
  }
@@ -7826,8 +7865,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
7826
7865
  : rows;
7827
7866
  };
7828
7867
  /* eslint-disable */
7829
- var newTableRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(tableData); }, [tableData, (_94 = props.bareSettings) === null || _94 === void 0 ? void 0 : _94.bareNewDTW]);
7830
- var newTableSpaceRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(spaceTableData); }, [spaceTableData, (_95 = props.bareSettings) === null || _95 === void 0 ? void 0 : _95.bareNewDTW]);
7868
+ var newTableRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(tableData); }, [tableData, (_95 = props.bareSettings) === null || _95 === void 0 ? void 0 : _95.bareNewDTW]);
7869
+ var newTableSpaceRows = (0, react_1.useMemo)(function () { return handleKeepCustomRowActions(spaceTableData); }, [spaceTableData, (_96 = props.bareSettings) === null || _96 === void 0 ? void 0 : _96.bareNewDTW]);
7831
7870
  /* eslint-enable */
7832
7871
  // INFO: the pencil beside a record's title opens the same form the Update
7833
7872
  // column's pencil did, for whoever may update; the bubble beside it opens
@@ -8542,39 +8581,71 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
8542
8581
  // recursion terminates at one level. Everything else about it — the schema,
8543
8582
  // the endpoints, the roles — is this instance's own props, so a consumer
8544
8583
  // configures the table once and the panel inherits it.
8584
+ var handleMarkDrawerFormEdited = function () {
8585
+ if (drawerFormRef.current)
8586
+ drawerFormEditedRef.current = true;
8587
+ };
8588
+ // INFO: a picker changes a value with a click and no input event; clicking into
8589
+ // a text field or an empty part of the form changes nothing
8590
+ var handleMarkDrawerFormChoice = function (event) {
8591
+ var _a;
8592
+ var target = event.target;
8593
+ if ((_a = target.closest) === null || _a === void 0 ? void 0 : _a.call(target, 'button, [role="option"], [role="menuitem"], li'))
8594
+ handleMarkDrawerFormEdited();
8595
+ };
8545
8596
  var renderReadDrawer = function () {
8546
8597
  var _a, _b, _c, _d;
8547
- if (!isDrawerRecord)
8598
+ if (!canHostDrawer)
8548
8599
  return null;
8600
+ var isForm = drawerFormRef.current;
8601
+ var handleCloseDrawer = function () {
8602
+ var _a, _b;
8603
+ setDrawerDiscardModal(false);
8604
+ (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "list", "");
8605
+ };
8549
8606
  var _e = (_b = (_a = props.viewSettings) === null || _a === void 0 ? void 0 : _a.readDrawer) !== null && _b !== void 0 ? _b : {}, anchor = _e.anchor, maxWidth = _e.maxWidth, maxHeight = _e.maxHeight, desc = _e.desc, disableExpand = _e.disableExpand, title = _e.title;
8550
- return (react_1.default.createElement(drawer_1.Drawer, { darkMode: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.darkMode, darkModeBg: (_d = props.organise) === null || _d === void 0 ? void 0 : _d.darkModeBg, testId: isDrawerForm ? "dt-form-drawer" : "dt-read-drawer", open: isDrawerHost, onClose: function () { var _a, _b; return (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "list", ""); }, anchor: anchor !== null && anchor !== void 0 ? anchor : "responsive", maxWidth: maxWidth !== null && maxWidth !== void 0 ? maxWidth : "3xl",
8607
+ return (react_1.default.createElement(drawer_1.Drawer, { darkMode: (_c = props.organise) === null || _c === void 0 ? void 0 : _c.darkMode, darkModeBg: (_d = props.organise) === null || _d === void 0 ? void 0 : _d.darkModeBg, testId: isForm ? "dt-form-drawer" : "dt-read-drawer", open: isDrawerHost, onClose: handleCloseDrawer, unmountOnClose: true, anchor: anchor !== null && anchor !== void 0 ? anchor : "responsive", maxWidth: maxWidth !== null && maxWidth !== void 0 ? maxWidth : "3xl",
8551
8608
  // INFO: a phone keyboard takes half the screen, which leaves a form in a
8552
- // three-quarter sheet almost no room for the field being typed in
8553
- maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : (isDrawerForm ? "100" : "75"),
8554
- // INFO: nothing typed into a form has been saved yet, so only its close
8555
- // button leaves it — not a stray tap outside or a stray Escape
8556
- disableDismiss: isDrawerForm, title: title !== null && title !== void 0 ? title : (typeof props.title === "string" && props.title
8609
+ // three-quarter sheet almost no room for the field being typed in. It
8610
+ // stops short of the top so there is still something to tap to close it.
8611
+ maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : (isForm ? "90" : "75"),
8612
+ // INFO: nothing typed into a form has been saved yet, so a tap outside or
8613
+ // Escape asks first once it has been edited
8614
+ onDismiss: function () {
8615
+ if (isForm && drawerFormEditedRef.current)
8616
+ setDrawerDiscardModal(true);
8617
+ else
8618
+ handleCloseDrawer();
8619
+ }, title: title !== null && title !== void 0 ? title : (typeof props.title === "string" && props.title
8557
8620
  ? props.title
8558
- : "Details"), desc: desc, expandable: !disableExpand, onExpand: function () { return setDrawerPageView(true); }, content: react_1.default.createElement(exports.DataTemplate, __assign({}, props, { id: drawerReadIdRef.current, type: isDrawerForm ? "update" : "read",
8559
- // INFO: strips the flag so the nested instance renders the record
8560
- // rather than hosting another drawer
8561
- viewSettings: undefined,
8562
- // INFO: the panel header already names the record, and a
8563
- // list/detail breadcrumb is meaningless while the list is still on
8564
- // screen behind it
8565
- title: "", description: "", organise: __assign(__assign({}, props.organise), { breadcrumbType: "hidden" }), bareSettings: __assign(__assign(__assign({
8566
- // INFO: DetailList's stacked rows waste a panel this narrow —
8567
- // compact puts label and value on one row. Overridable.
8568
- bareCompactMode: !isDrawerForm }, props.bareSettings), {
8569
- // INFO: the nested instance draws the form rather than hosting
8570
- // another panel
8571
- bareFormDrawer: false }), (isDrawerHost
8572
- ? {}
8573
- : {
8574
- barePollingInterval: undefined,
8575
- bareSocketName: undefined,
8576
- })) })) }));
8577
- };
8621
+ : "Details"), desc: desc, expandable: !disableExpand, onExpand: function () { return setDrawerPageView(true); }, content: react_1.default.createElement("div", { onInputCapture: handleMarkDrawerFormEdited, onChangeCapture: handleMarkDrawerFormEdited, onClickCapture: handleMarkDrawerFormChoice },
8622
+ react_1.default.createElement(exports.DataTemplate, __assign({ key: drawerSessionRef.current }, props, { id: drawerReadIdRef.current, type: isForm ? "update" : "read",
8623
+ // INFO: strips the flag so the nested instance renders the record
8624
+ // rather than hosting another drawer
8625
+ viewSettings: undefined,
8626
+ // INFO: the panel header already names the record, and a
8627
+ // list/detail breadcrumb is meaningless while the list is still on
8628
+ // screen behind it
8629
+ title: "", description: "", organise: __assign(__assign({}, props.organise), { breadcrumbType: "hidden" }), bareSettings: __assign(__assign(__assign({
8630
+ // INFO: DetailList's stacked rows waste a panel this narrow —
8631
+ // compact puts label and value on one row. Overridable.
8632
+ bareCompactMode: !isForm }, props.bareSettings), {
8633
+ // INFO: the nested instance draws the form rather than hosting
8634
+ // another panel
8635
+ bareFormDrawer: false }), (isDrawerHost
8636
+ ? {}
8637
+ : {
8638
+ barePollingInterval: undefined,
8639
+ bareSocketName: undefined,
8640
+ })) }))) }));
8641
+ };
8642
+ var renderDrawerDiscardModal = function () { return (react_1.default.createElement(modal_1.Modal, { open: drawerDiscardModal, onClose: function () { return setDrawerDiscardModal(false); }, title: "Discard changes?", renderContent: function () { return (react_1.default.createElement("div", { className: "flex flex-row justify-end pt-5 space-x-2" },
8643
+ react_1.default.createElement(button_1.Button, { id: "dtw-form-keep", text: "Keep Editing", size: "small", type: "light", onClick: function () { return setDrawerDiscardModal(false); } }),
8644
+ react_1.default.createElement(button_1.Button, { id: "dtw-form-discard", text: "Discard", size: "small", type: "danger", onClick: function () {
8645
+ var _a, _b;
8646
+ setDrawerDiscardModal(false);
8647
+ (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "list", "");
8648
+ } }))); } })); };
8578
8649
  var renderContent = function () {
8579
8650
  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;
8580
8651
  var isBottom = ((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareUpdateActionBottom) ? true : false;
@@ -9160,7 +9231,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
9160
9231
  ((_38 = props.bareSettings) === null || _38 === void 0 ? void 0 : _38.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" },
9161
9232
  react_1.default.createElement("span", { className: "h-1.5 w-1.5 rounded-full bg-orange-400" }),
9162
9233
  "OFFLINE")))),
9163
- props.description && (react_1.default.createElement("span", { className: "text-sm text-gray-500 ".concat(isMobileToolbar_1 ? "hidden md:inline" : "") }, props.description)))),
9234
+ props.description && (react_1.default.createElement("span", { className: "text-sm text-gray-500 ".concat(isMobileToolbar_1 ? "truncate md:whitespace-normal" : "") }, props.description)))),
9164
9235
  react_1.default.createElement("div", { className: ((_39 = props.bareSettings) === null || _39 === void 0 ? void 0 : _39.bareCompactMode)
9165
9236
  ? "hidden sm:block grow"
9166
9237
  : "grow" }),
@@ -11832,14 +11903,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11832
11903
  };
11833
11904
  return (react_1.default.createElement(context_1.ColumnTypeContext.Provider, { value: columnTypeActions },
11834
11905
  renderNotification("root"),
11835
- ((_97 = (_96 = props.renderSettings) === null || _96 === void 0 ? void 0 : _96.renderLoadingUI) === null || _97 === void 0 ? void 0 : _97.call(_96)) && loading ? ((_98 = props.renderSettings) === null || _98 === void 0 ? void 0 : _98.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_99 = props.organise) === null || _99 === void 0 ? void 0 : _99.darkMode, darkModeBg: (_100 = props.organise) === null || _100 === void 0 ? void 0 : _100.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
11906
+ ((_98 = (_97 = props.renderSettings) === null || _97 === void 0 ? void 0 : _97.renderLoadingUI) === null || _98 === void 0 ? void 0 : _98.call(_97)) && loading ? ((_99 = props.renderSettings) === null || _99 === void 0 ? void 0 : _99.renderLoadingUI()) : (react_1.default.createElement(modal_1.Modal, { darkMode: (_100 = props.organise) === null || _100 === void 0 ? void 0 : _100.darkMode, darkModeBg: (_101 = props.organise) === null || _101 === void 0 ? void 0 : _101.darkModeBg, maxWidth: selectedObjectStructureId || excelModal ? "2xl" : undefined, open: modalVisible, title: renderModalTitle(), renderContent: renderModalContent, onClose: function () {
11836
11907
  var _a, _b;
11837
11908
  if (loading)
11838
11909
  return;
11839
11910
  handlePopUpModal(false);
11840
11911
  setExportCSVEmail((_b = (_a = props.devSettings.currentUser) === null || _a === void 0 ? void 0 : _a.userEmail) !== null && _b !== void 0 ? _b : "");
11841
11912
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) })),
11842
- react_1.default.createElement(modal_1.Modal, { darkMode: (_101 = props.organise) === null || _101 === void 0 ? void 0 : _101.darkMode, darkModeBg: (_102 = props.organise) === null || _102 === void 0 ? void 0 : _102.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
11913
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_102 = props.organise) === null || _102 === void 0 ? void 0 : _102.darkMode, darkModeBg: (_103 = props.organise) === null || _103 === void 0 ? void 0 : _103.darkModeBg, maxWidth: "2xl", open: referenceCreationModal.id ? true : false, renderContent: function () {
11843
11914
  return (react_1.default.createElement(referenceModal_1.ReferenceModal, { referenceModelSchema: referenceModelSchema, referenceDataStructure: referenceCreationModal, devSettings: props.devSettings, handleCreateRefId: function (dataId) {
11844
11915
  if (dataId) {
11845
11916
  var currentValue = selectedData[referenceCreationModal.id];
@@ -11855,19 +11926,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11855
11926
  }, onClose: function () {
11856
11927
  setReferenceCreationModal({ id: "", name: "", type: "string" });
11857
11928
  } }),
11858
- react_1.default.createElement(modal_1.Modal, { darkMode: (_103 = props.organise) === null || _103 === void 0 ? void 0 : _103.darkMode, darkModeBg: (_104 = props.organise) === null || _104 === void 0 ? void 0 : _104.darkModeBg, maxWidth: "2xl", open: Object.keys(referenceDeleteTableData).length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
11929
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_104 = props.organise) === null || _104 === void 0 ? void 0 : _104.darkMode, darkModeBg: (_105 = props.organise) === null || _105 === void 0 ? void 0 : _105.darkModeBg, maxWidth: "2xl", open: Object.keys(referenceDeleteTableData).length > 0, renderContent: renderReferenceDeleteTable, onClose: function () {
11859
11930
  setReferenceDeleteTableData({});
11860
11931
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
11861
- react_1.default.createElement(modal_1.Modal, { darkMode: (_105 = props.organise) === null || _105 === void 0 ? void 0 : _105.darkMode, darkModeBg: (_106 = props.organise) === null || _106 === void 0 ? void 0 : _106.darkModeBg, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
11932
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_106 = props.organise) === null || _106 === void 0 ? void 0 : _106.darkMode, darkModeBg: (_107 = props.organise) === null || _107 === void 0 ? void 0 : _107.darkModeBg, open: deleteModal, renderContent: renderDeleteModalContent, onClose: function () {
11862
11933
  setDeletePasscodeInput("");
11863
11934
  setDeleteModal(!deleteModal);
11864
11935
  setDeleteFeedId("");
11865
11936
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
11866
- react_1.default.createElement(modal_1.Modal, { darkMode: (_107 = props.organise) === null || _107 === void 0 ? void 0 : _107.darkMode, darkModeBg: (_108 = props.organise) === null || _108 === void 0 ? void 0 : _108.darkModeBg, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
11937
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_108 = props.organise) === null || _108 === void 0 ? void 0 : _108.darkMode, darkModeBg: (_109 = props.organise) === null || _109 === void 0 ? void 0 : _109.darkModeBg, open: batchUpdateModal, renderContent: renderBatchUpdateModalContent, onClose: function () {
11867
11938
  setBatchUpdateData({ columnId: "", columnData: {} });
11868
11939
  setBatchUpdateModal(false);
11869
11940
  }, notification: react_1.default.createElement(react_1.default.Fragment, null, renderNotification("modal")) }),
11870
- react_1.default.createElement(modal_1.Modal, { darkMode: (_109 = props.organise) === null || _109 === void 0 ? void 0 : _109.darkMode, darkModeBg: (_110 = props.organise) === null || _110 === void 0 ? void 0 : _110.darkModeBg, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
11941
+ react_1.default.createElement(modal_1.Modal, { darkMode: (_110 = props.organise) === null || _110 === void 0 ? void 0 : _110.darkMode, darkModeBg: (_111 = props.organise) === null || _111 === void 0 ? void 0 : _111.darkModeBg, title: "Edit Auth Method", open: selectedAuthMethod ? true : false, renderContent: function () {
11871
11942
  var _a, _b;
11872
11943
  if (props.space)
11873
11944
  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 }));
@@ -11877,18 +11948,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
11877
11948
  } }),
11878
11949
  renderContent(),
11879
11950
  renderReadDrawer(),
11951
+ canHostDrawer && renderDrawerDiscardModal(),
11880
11952
  isActivityLog &&
11881
11953
  typeof document !== "undefined" &&
11882
11954
  (0, react_dom_1.createPortal)(
11883
11955
  // INFO: z-50 lifts it over a Modal the table may sit in (z-40)
11884
11956
  react_1.default.createElement("div", { className: "relative z-50" },
11885
- react_1.default.createElement(drawer_1.Drawer, { darkMode: (_111 = props.organise) === null || _111 === void 0 ? void 0 : _111.darkMode, darkModeBg: (_112 = props.organise) === null || _112 === void 0 ? void 0 : _112.darkModeBg, testId: "dt-activity-drawer", open: activityModal,
11957
+ react_1.default.createElement(drawer_1.Drawer, { darkMode: (_112 = props.organise) === null || _112 === void 0 ? void 0 : _112.darkMode, darkModeBg: (_113 = props.organise) === null || _113 === void 0 ? void 0 : _113.darkModeBg, testId: "dt-activity-drawer", open: activityModal,
11886
11958
  // INFO: the record stays set while the drawer slides out — clearing it
11887
11959
  // would remount the hidden panel collection-wide and fetch again. The
11888
11960
  // toolbar's collection-wide button clears it when it opens.
11889
11961
  onClose: function () { return setActivityModal(false); }, anchor: "responsive", maxWidth: "2xl", maxHeight: "75", title: "Activity Log", content: react_1.default.createElement(activityModal_1.ActivityModal, { title: props.title && typeof props.title === "string"
11890
11962
  ? props.title
11891
- : "this collection", devSettings: props.devSettings, collectionId: props.collectionId, dataId: resolvedType === "read" ? ((_113 = props.id) !== null && _113 !== void 0 ? _113 : "") : activityId, activityLog: (_114 = props.edit) === null || _114 === void 0 ? void 0 : _114.activityLog, model: structure }) })), document.body),
11963
+ : "this collection", devSettings: props.devSettings, collectionId: props.collectionId, dataId: resolvedType === "read" ? ((_114 = props.id) !== null && _114 !== void 0 ? _114 : "") : activityId, activityLog: (_115 = props.edit) === null || _115 === void 0 ? void 0 : _115.activityLog, model: structure }) })), document.body),
11892
11964
  renderScrollSentinel()));
11893
11965
  });
11894
11966
  //# sourceMappingURL=index.js.map